summaryrefslogtreecommitdiff
path: root/apt-pkg/policy.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-05-31 10:34:56 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-05-31 10:34:56 +0200
commit3b310a644d82abeb76b5028a9ee7b8d1b96fc629 (patch)
tree4f700ae465eb6c065dfba405741c1ab800e06f11 /apt-pkg/policy.cc
parentc996a75cabffa5d3e5bc610d9f1097c2edae606f (diff)
parent4fdb612374655361c8923a4611db6a0d10054317 (diff)
merged from the debian branch
Diffstat (limited to 'apt-pkg/policy.cc')
-rw-r--r--apt-pkg/policy.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc
index 94c7fd4af..2cc2e5e39 100644
--- a/apt-pkg/policy.cc
+++ b/apt-pkg/policy.cc
@@ -216,10 +216,22 @@ void pkgPolicy::CreatePin(pkgVersionMatch::MatchType Type,string Name,
P->Data = Data;
return;
}
+
+ // Allow pinning by wildcards
+ // TODO: Maybe we should always prefer specific pins over non-
+ // specific ones.
+ if (Name[0] == '/' || Name.find_first_of("*[?") != string::npos)
+ {
+ pkgVersionMatch match(Data, Type);
+ for (pkgCache::GrpIterator G = Cache->GrpBegin(); G.end() != true; ++G)
+ if (match.ExpressionMatches(Name, G.Name()))
+ CreatePin(Type, G.Name(), Data, Priority);
+ return;
+ }
// Get a spot to put the pin
pkgCache::GrpIterator Grp = Cache->FindGrp(Name);
- for (pkgCache::PkgIterator Pkg = Grp.FindPkg("any");
+ for (pkgCache::PkgIterator Pkg = Grp.PackageList();
Pkg.end() != true; Pkg = Grp.NextPkg(Pkg))
{
Pin *P = 0;