summaryrefslogtreecommitdiff
path: root/apt-pkg/policy.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2020-02-16 11:40:07 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2020-02-16 11:46:29 +0100
commit2c1f718bb2b0d64a14ab53d323704f034b69c13a (patch)
tree2cb149ecae99caef1764a15ee852c21480beee36 /apt-pkg/policy.cc
parent7e64f5c74f0c5d26bcddbcb07e9d87dfca6907eb (diff)
policy: Add SetPriority() methods
These allow overriding priorities, however, pins set by SetPriority for package files will be overriden by calls to InitDefaults().
Diffstat (limited to 'apt-pkg/policy.cc')
-rw-r--r--apt-pkg/policy.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc
index b9bdfd20f..5f9ece85f 100644
--- a/apt-pkg/policy.cc
+++ b/apt-pkg/policy.cc
@@ -285,6 +285,21 @@ APT_PURE signed short pkgPolicy::GetPriority(pkgCache::PkgFileIterator const &Fi
return PFPriority[File->ID];
}
/*}}}*/
+// SetPriority - Directly set priority /*{{{*/
+// ---------------------------------------------------------------------
+void pkgPolicy::SetPriority(pkgCache::VerIterator const &Ver, signed short Priority)
+{
+ Pin pin;
+ pin.Data = "pkgPolicy::SetPriority";
+ pin.Priority = Priority;
+ VerPins[Ver->ID] = pin;
+}
+void pkgPolicy::SetPriority(pkgCache::PkgFileIterator const &File, signed short Priority)
+{
+ PFPriority[File->ID] = Priority;
+}
+
+ /*}}}*/
// ReadPinDir - Load the pin files from this dir into a Policy /*{{{*/
// ---------------------------------------------------------------------
/* This will load each pin file in the given dir into a Policy. If the