X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/8d9850a1854fb081d4ae571c25322ececd77145a..1fc825bf7be1e9842a0560261d684264c565589e:/apt-pkg/versionmatch.cc diff --git a/apt-pkg/versionmatch.cc b/apt-pkg/versionmatch.cc index d4ae21d56..4a426809c 100644 --- a/apt-pkg/versionmatch.cc +++ b/apt-pkg/versionmatch.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: versionmatch.cc,v 1.4 2001/05/22 06:20:06 jgg Exp $ +// $Id: versionmatch.cc,v 1.9 2003/05/19 17:58:26 doogie Exp $ /* ###################################################################### Version Matching @@ -11,9 +11,6 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#ifdef __GNUG__ -#pragma implementation "apt-pkg/versionmatch.h" -#endif #include #include @@ -28,6 +25,10 @@ /* Break up the data string according to the selected type */ pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type) : Type(Type) { + MatchAll = false; + VerPrefixMatch = false; + RelVerPrefixMatch = false; + if (Type == None || Data.length() < 1) return; @@ -48,7 +49,10 @@ pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type) : Type(Type) { // All empty = match all if (Data == "*") + { + MatchAll = true; return; + } // Are we a simple specification? string::const_iterator I = Data.begin(); @@ -61,7 +65,7 @@ pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type) : Type(Type) else RelArchive = Data; - if (RelVerStr.end()[-1] == '*') + if (RelVerStr.length() > 0 && RelVerStr.end()[-1] == '*') { RelVerPrefixMatch = true; RelVerStr = string(RelVerStr.begin(),RelVerStr.end()-1); @@ -163,6 +167,9 @@ bool pkgVersionMatch::FileMatch(pkgCache::PkgFileIterator File) { if (Type == Release) { + if (MatchAll == true) + return true; + /* cout << RelVerStr << ',' << RelOrigin << ',' << RelArchive << ',' << RelLabel << endl; cout << File.Version() << ',' << File.Origin() << ',' << File.Archive() << ',' << File.Label() << endl;*/ @@ -198,11 +205,13 @@ bool pkgVersionMatch::FileMatch(pkgCache::PkgFileIterator File) if (Type == Origin) { - if (OrSite.empty() == false) - if (File->Site == 0 || - OrSite != File.Site()) + if (OrSite.empty() == false) { + if (File->Site == 0 || OrSite != File.Site()) return false; - return true; + } else // so we are talking about file:// or status file + if (strcmp(File.Site(),"") == 0 && File->Archive != 0) // skip the status file + return false; + return (OrSite == File.Site()); /* both strings match */ } return false;