summaryrefslogtreecommitdiff
path: root/apt-pkg/policy.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2011-05-16 15:57:52 +0200
committerMichael Vogt <mvo@debian.org>2011-05-16 15:57:52 +0200
commitd44b706c2d5964daaaf55e6eb97845827958f6e3 (patch)
treeb77f6e72c34c2444ec28e2d47430211d802efb4b /apt-pkg/policy.cc
parent9c192d2811c12dcaf607024eb7f0677b011194e6 (diff)
parentd77b985a309c379d4978525172a72b728fecd15e (diff)
merged from lp:~donkult/apt/sid
Diffstat (limited to 'apt-pkg/policy.cc')
-rw-r--r--apt-pkg/policy.cc17
1 files changed, 7 insertions, 10 deletions
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc
index 3d6ec1cdc..2cc2e5e39 100644
--- a/apt-pkg/policy.cc
+++ b/apt-pkg/policy.cc
@@ -220,21 +220,18 @@ void pkgPolicy::CreatePin(pkgVersionMatch::MatchType Type,string Name,
// 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);
- }
- }
+ 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;