From ba91b1518a1208fecc1ca076fd9cfbd28344b5b3 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 30 Aug 2010 11:39:43 +0200 Subject: * apt-pkg/versionmatch.cc: - let the pin origin actually work as advertised in the manpage which means "" are optional and pinning a local archive does work - even if it is a non-flat archive (Closes: #594435) --- apt-pkg/versionmatch.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/versionmatch.cc b/apt-pkg/versionmatch.cc index 093180f9b..17a54bc4c 100644 --- a/apt-pkg/versionmatch.cc +++ b/apt-pkg/versionmatch.cc @@ -118,7 +118,10 @@ pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type) : Type(Type) if (Type == Origin) { - OrSite = Data; + if (Data[0] == '"' && Data.end()[-1] == '"') + OrSite = Data.substr(1, Data.length() - 2); + else + OrSite = Data; return; } } @@ -259,10 +262,10 @@ bool pkgVersionMatch::FileMatch(pkgCache::PkgFileIterator File) if (Type == Origin) { if (OrSite.empty() == false) { - if (File->Site == 0 || !ExpressionMatches(OrSite, File.Site())) + if (File->Site == 0) return false; } else // so we are talking about file:// or status file - if (strcmp(File.Site(),"") == 0 && File->Archive != 0) // skip the status file + if (strcmp(File.Site(),"") == 0 && File->Archive != 0 && strcmp(File.Archive(),"now") == 0) // skip the status file return false; return (ExpressionMatches(OrSite, File.Site())); /* both strings match */ } -- cgit v1.2.3