diff options
author | Julian Andres Klode <jak@debian.org> | 2011-04-15 12:52:45 +0200 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2011-04-15 12:52:45 +0200 |
commit | 1a4c9766e0b31795b5d9869c6a98c1bba8380faa (patch) | |
tree | b4413151fc9f7e3464f5a9626e79e5c0f86659a3 /apt-pkg | |
parent | 90cf90b254e5dbe8194dc93fa8f57f891b3ea518 (diff) |
* apt-pkg/policy.cc:
- Allow pinning by glob() expressions, and regular expressions
surrounded by slashes (the "/" character).
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/policy.cc | 15 |
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); |