]> git.saurik.com Git - apt.git/blobdiff - apt-private/private-source.cc
drop some needlessly public declarations in libapt-private
[apt.git] / apt-private / private-source.cc
index c7e5e425720512cf3985b27d884d10f7bac3af6d..21c69e19c0b8f8bca53e5ae2afc2513be0ad70bf 100644 (file)
@@ -245,8 +245,8 @@ static pkgSrcRecords::Parser *FindSrc(const char *Name,
         // choose a good candidate and proceed with that.
         // Maybe we will find a source later on with the right VerTag
         // or RelTag
-        pkgCache::VerIterator Ver = Cache->GetCandidateVer(Pkg);
-        if (Ver.end() == false) 
+        pkgCache::VerIterator const Ver = Cache->GetCandidateVersion(Pkg);
+        if (Ver.end() == false)
         {
            if (strcmp(Ver.SourcePkgName(),Ver.ParentPkg().Name()) != 0)
               Src = Ver.SourcePkgName();
@@ -288,6 +288,7 @@ static pkgSrcRecords::Parser *FindSrc(const char *Name,
                  while ((Parse = SrcRecs.Find(Src.c_str(), MatchSrcOnly)) != 0) 
                  {
                     const std::string Ver = Parse->Version();
+                    bool CorrectRelTag = false;
 
                     // See if we need to look for a specific release tag
                     if (RelTag != "" && UserRequestedVerTag == "")
@@ -297,13 +298,10 @@ static pkgSrcRecords::Parser *FindSrc(const char *Name,
                        {
                           if ((Rls->Archive != 0 && RelTag == Rls.Archive()) ||
                                 (Rls->Codename != 0 && RelTag == Rls.Codename()))
-                          {
-                             Last = Parse;
-                             Offset = Parse->Offset();
-                             Version = Ver;
-                          }
+                             CorrectRelTag = true;
                        }
-                    }
+                    } else
+                       CorrectRelTag = true;
 
                     // Ignore all versions which doesn't fit
                     if (VerTag.empty() == false &&
@@ -311,7 +309,7 @@ static pkgSrcRecords::Parser *FindSrc(const char *Name,
                        continue;
 
                     // Newer version or an exact match? Save the hit
-                    if (Last == 0 || Cache->VS().CmpVersion(Version,Ver) < 0) {
+                    if (CorrectRelTag && (Last == 0 || Cache->VS().CmpVersion(Version,Ver) < 0)) {
                        Last = Parse;
                        Offset = Parse->Offset();
                        Version = Ver;