summaryrefslogtreecommitdiff
path: root/apt-pkg/policy.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-07-28 09:19:45 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-07-28 09:19:45 +0200
commit0b7d641cf12761c3dcc5edb4031adfc9709963e4 (patch)
tree5d12281c5f482e6f85636f57ef86a2dc92e8713c /apt-pkg/policy.cc
parent7d79339f811aeebacb3f841bac6075fdfbadd03f (diff)
parented6ba81db1b2832089ea443cf0030ab3f15fda97 (diff)
* merged latest fixes from debian-sid
* apt-pkg/contrib/sha1.cc: - fix illegally casts of on-stack buffer to a type requiring more alignment than it has resulting in segfaults on sparc (Closes: #634696) * apt-pkg/contrib/cdromutl.cc: - fix escape problem when looking for the mounted devices * apt-pkg/contrib/strutl.{h,cc}, test/libapt/strutil_test.cc: - add new DeEscapeString() similar to DeQuoteString but unescape character escapes like \0XX and \xXX (plus added test) * refresh po/* * cmdline/apt-get.cc: - fix missing download progress in apt-get download - do not require unused partial dirs in 'source' (Closes: #633510) - buildconflicts effect all architectures - implement MultiarchCross for build-dep and source (Closes: #632221) * cmdline/apt-key: - use a tmpfile instead of /etc/apt/secring.gpg (Closes: #632596) * debian/apt.postinst: - remove /etc/apt/secring.gpg if it is an empty file * doc/apt-cache.8.xml: - apply madison typofix from John Feuerstein, thanks! (Closes: #633455) * apt-pkg/policy.cc: - emit an error on unknown APT::Default-Release value (Closes: #407511) * apt-pkg/aptconfiguration.cc: - ensure that native architecture is if not specified otherwise the first architecture in the Architectures vector * apt-pkg/deb/deblistparser.cc: - Strip only :any and :native if MultiArch should be stripped as it is save to ignore them in non-MultiArch contexts but if the dependency is a specific architecture (and not the native) do not strip
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 be96d4c84..2c22fe0da 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();
}
/*}}}*/