diff options
author | Julian Andres Klode <jak@debian.org> | 2015-08-10 11:00:37 +0200 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2015-08-10 11:00:37 +0200 |
commit | 9fb02ab02528ea45747318af26fae8a732cd2840 (patch) | |
tree | 34e39ba7a3016542ea0684482f453712b242c3db /apt-pkg/policy.cc | |
parent | ebda4f51f6707e5a6550f92d9407eab855039060 (diff) |
pkgPolicy: Introduce storage and helpers for per-version pins
Per-version pins should lead to more predictable results with
/etc/apt/preferences uses like pinning one version with -1.
Diffstat (limited to 'apt-pkg/policy.cc')
-rw-r--r-- | apt-pkg/policy.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index 6da6ed606..5d7ab0e6b 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -50,9 +50,12 @@ pkgPolicy::pkgPolicy(pkgCache *Owner) : Pins(0), PFPriority(0), Cache(Owner) return; PFPriority = new signed short[Owner->Head().PackageFileCount]; Pins = new Pin[Owner->Head().PackageCount]; + VerPins = new Pin[Owner->Head().VersionCount]; for (unsigned long I = 0; I != Owner->Head().PackageCount; I++) Pins[I].Type = pkgVersionMatch::None; + for (unsigned long I = 0; I != Owner->Head().VersionCount; I++) + VerPins[I].Type = pkgVersionMatch::None; // The config file has a master override. string DefRel = _config->Find("APT::Default-Release"); @@ -318,6 +321,12 @@ APT_PURE signed short pkgPolicy::GetPriority(pkgCache::PkgIterator const &Pkg) return Pins[Pkg->ID].Priority; return 0; } +APT_PURE signed short pkgPolicy::GetPriority(pkgCache::VerIterator const &Ver) +{ + if (VerPins[Ver->ID].Type != pkgVersionMatch::None) + return VerPins[Ver->ID].Priority; + return 0; +} APT_PURE signed short pkgPolicy::GetPriority(pkgCache::PkgFileIterator const &File) { return PFPriority[File->ID]; @@ -440,4 +449,4 @@ bool ReadPinFile(pkgPolicy &Plcy,string File) } /*}}}*/ -pkgPolicy::~pkgPolicy() {delete [] PFPriority; delete [] Pins;} +pkgPolicy::~pkgPolicy() {delete [] PFPriority; delete [] Pins; delete [] VerPins; } |