diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2010-03-18 23:54:12 +0100 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2010-03-18 23:54:12 +0100 |
commit | c67dc114eafe034b8223ce3df6474f7c25f150a8 (patch) | |
tree | 756f6af6a63a57a38b87d44f31cb000d7d6e49d9 /apt-pkg/policy.cc | |
parent | e426a5ff1cd02797b29f5781be4d6fc8bdf44610 (diff) | |
parent | 8d4c859d0d20687a8ffcf9e1d60466d061c2e24d (diff) |
merge MultiArch-ABI. We don't support MultiArch yet (as most other tools),
but we support the usage of the new ABI so libapt users
can start to prepare for MultiArch (Closes: #536029)
Diffstat (limited to 'apt-pkg/policy.cc')
-rw-r--r-- | apt-pkg/policy.cc | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index f9901bc9a..0b8c1a81b 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -187,35 +187,38 @@ pkgCache::VerIterator pkgPolicy::GetCandidateVer(pkgCache::PkgIterator Pkg) void pkgPolicy::CreatePin(pkgVersionMatch::MatchType Type,string Name, string Data,signed short Priority) { - Pin *P = 0; - if (Name.empty() == true) - P = &*Defaults.insert(Defaults.end(),PkgPin()); - else { - // Get a spot to put the pin - pkgCache::PkgIterator Pkg = Cache->FindPkg(Name); - if (Pkg.end() == true) + Pin *P = &*Defaults.insert(Defaults.end(),PkgPin()); + P->Type = Type; + P->Priority = Priority; + P->Data = Data; + return; + } + + // Get a spot to put the pin + pkgCache::GrpIterator Grp = Cache->FindGrp(Name); + for (pkgCache::PkgIterator Pkg = Grp.FindPkg("any"); + Pkg.end() != true; Pkg = Grp.NextPkg(Pkg)) + { + Pin *P = 0; + if (Pkg.end() == false) + P = Pins + Pkg->ID; + else { // Check the unmatched table - for (vector<PkgPin>::iterator I = Unmatched.begin(); + for (vector<PkgPin>::iterator I = Unmatched.begin(); I != Unmatched.end() && P == 0; I++) if (I->Pkg == Name) P = &*I; - + if (P == 0) - P = &*Unmatched.insert(Unmatched.end(),PkgPin()); + P = &*Unmatched.insert(Unmatched.end(),PkgPin()); } - else - { - P = Pins + Pkg->ID; - } + P->Type = Type; + P->Priority = Priority; + P->Data = Data; } - - // Set.. - P->Type = Type; - P->Priority = Priority; - P->Data = Data; } /*}}}*/ // Policy::GetMatch - Get the matching version for a package pin /*{{{*/ |