summaryrefslogtreecommitdiff
path: root/apt-pkg/policy.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-04-01 17:18:31 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2010-04-01 17:18:31 +0200
commit46361a17f0cb6f4f7c46705c5af71b6680cf5b1d (patch)
treee7466e094406d5d195823840cb2d43a371f67bea /apt-pkg/policy.cc
parent3b1fffc35f3eb277d92f38c687c270edd1d8550d (diff)
parent436d7eab92bb8f9cc6498acfbf2055e717be6fd0 (diff)
merged from lp:~donkult/apt/sid
Diffstat (limited to 'apt-pkg/policy.cc')
-rw-r--r--apt-pkg/policy.cc41
1 files changed, 22 insertions, 19 deletions
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc
index b12a50d0a..9b24c2ef1 100644
--- a/apt-pkg/policy.cc
+++ b/apt-pkg/policy.cc
@@ -201,35 +201,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 /*{{{*/