summaryrefslogtreecommitdiff
path: root/apt-pkg/policy.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-07-29 15:45:06 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-07-29 15:45:06 +0200
commit194fac6be95e698d8eec86ddf19ebc1e7ca6d5c7 (patch)
treeee446fd8a9ae1a184395ed339c71331437f51717 /apt-pkg/policy.cc
parent64dda04bd949ab73ca77732fcc5149cc7c2a5557 (diff)
parentfc15861a405a0b0483bb8989e6a43215a86dba55 (diff)
merged from debian-sid
Diffstat (limited to 'apt-pkg/policy.cc')
-rw-r--r--apt-pkg/policy.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc
index bd213e0ce..c5028d822 100644
--- a/apt-pkg/policy.cc
+++ b/apt-pkg/policy.cc
@@ -56,8 +56,22 @@ pkgPolicy::pkgPolicy(pkgCache *Owner) : Pins(0), PFPriority(0), Cache(Owner)
// The config file has a master override.
string DefRel = _config->Find("APT::Default-Release");
if (DefRel.empty() == false)
- CreatePin(pkgVersionMatch::Release,"",DefRel,990);
-
+ {
+ bool found = false;
+ // FIXME: make ExpressionMatches static to use it here easily
+ pkgVersionMatch vm("", pkgVersionMatch::None);
+ for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F != Cache->FileEnd(); ++F)
+ {
+ if ((F->Archive != 0 && vm.ExpressionMatches(DefRel, F.Archive()) == true) ||
+ (F->Codename != 0 && vm.ExpressionMatches(DefRel, F.Codename()) == true) ||
+ (F->Version != 0 && vm.ExpressionMatches(DefRel, F.Version()) == true))
+ found = true;
+ }
+ if (found == false)
+ _error->Error(_("The value '%s' is invalid for APT::Default-Release as such a release is not available in the sources"), DefRel.c_str());
+ else
+ CreatePin(pkgVersionMatch::Release,"",DefRel,990);
+ }
InitDefaults();
}
/*}}}*/