summaryrefslogtreecommitdiff
path: root/apt-pkg/policy.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2011-04-15 12:52:45 +0200
committerJulian Andres Klode <jak@debian.org>2011-04-15 12:52:45 +0200
commit1a4c9766e0b31795b5d9869c6a98c1bba8380faa (patch)
treeb4413151fc9f7e3464f5a9626e79e5c0f86659a3 /apt-pkg/policy.cc
parent90cf90b254e5dbe8194dc93fa8f57f891b3ea518 (diff)
* apt-pkg/policy.cc:
- Allow pinning by glob() expressions, and regular expressions surrounded by slashes (the "/" character).
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 94c7fd4af..3d6ec1cdc 100644
--- a/apt-pkg/policy.cc
+++ b/apt-pkg/policy.cc
@@ -216,6 +216,21 @@ 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.find("*") != string::npos || Name.find("[") != string::npos
+ || Name.find("?") != string::npos || Name[0] == '/') {
+ pkgVersionMatch match(Data, Type);
+ for (pkgCache::PkgIterator P = Cache->PkgBegin();
+ P != Cache->PkgEnd(); P++) {
+ if (match.ExpressionMatches(Name, P.Name())) {
+ CreatePin(Type, P.Name(), Data, Priority);
+ }
+ }
+ return;
+ }
// Get a spot to put the pin
pkgCache::GrpIterator Grp = Cache->FindGrp(Name);