diff options
author | Michael Vogt <mvo@debian.org> | 2013-12-04 16:27:05 +0100 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2013-12-04 16:29:33 +0100 |
commit | 42517437947654de48102c1f9e32353c8a043af2 (patch) | |
tree | 25a2aa14dc7c3c6c4a1a76ded63d15af1f6f8e66 /cmdline/apt-get.cc | |
parent | c6b83f9c68aafa3f2bd1b695a6beb724d7520bc5 (diff) |
refactor FindSrc()
Diffstat (limited to 'cmdline/apt-get.cc')
-rw-r--r-- | cmdline/apt-get.cc | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 15742c8e5..79e9d7fcb 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -304,7 +304,6 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, pkgSrcRecords::Parser *Last = 0; unsigned long Offset = 0; string Version; - string FoundRel; pkgSourceList *SrcList = CacheFile.GetSourceList(); /* Iterate over all of the hits, which includes the resulting @@ -316,21 +315,21 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, while ((Parse = SrcRecs.Find(Src.c_str(), MatchSrcOnly)) != 0) { const string Ver = Parse->Version(); - const string Rel = GetReleaseForSourceRecord(SrcList, Parse); - if (RelTag != "" && Rel == RelTag) + // See if we need to look for a specific release tag + if (RelTag != "") { - ioprintf(c1out, "Selectied version '%s' (%s) for %s\n", - Ver.c_str(), RelTag.c_str(), Src.c_str()); - Last = Parse; - Offset = Parse->Offset(); - Version = Ver; - FoundRel = RelTag; - break; - } + const string Rel = GetReleaseForSourceRecord(SrcList, Parse); - if (RelTag.empty() == false && (RelTag == FoundRel)) - break; + if (Rel == RelTag) + { + ioprintf(c1out, "Selectied version '%s' (%s) for %s\n", + Ver.c_str(), RelTag.c_str(), Src.c_str()); + Last = Parse; + Offset = Parse->Offset(); + break; + } + } // Ignore all versions which doesn't fit if (VerTag.empty() == false && @@ -344,14 +343,14 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, Version = Ver; } - // was the version check above an exact match? If so, we don't need to look further + // was the version check above an exact match? + // If so, we don't need to look further if (VerTag.empty() == false && (VerTag == Ver)) - { break; - } } if (Last != 0 || VerTag.empty() == true) break; + _error->Error(_("Ignore unavailable version '%s' of package '%s'"), VerTag.c_str(), TmpSrc.c_str()); return 0; } |