summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmdline/apt-get.cc8
-rwxr-xr-xtest/integration/test-apt-get-source5
2 files changed, 9 insertions, 4 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index da04561c0..581466326 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -198,7 +198,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
pkgSrcRecords &SrcRecs,string &Src,
CacheFile &CacheFile)
{
- string VerTag;
+ string VerTag, UserRequestedVerTag;
string RelTag = _config->Find("APT::Default-Release");
string TmpSrc = Name;
pkgDepCache *Cache = CacheFile.GetDepCache();
@@ -209,7 +209,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
if (TmpSrc[found] == '/')
RelTag = TmpSrc.substr(found+1);
else
- VerTag = TmpSrc.substr(found+1);
+ VerTag = UserRequestedVerTag = TmpSrc.substr(found+1);
TmpSrc = TmpSrc.substr(0,found);
}
@@ -331,7 +331,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
const string Ver = Parse->Version();
// See if we need to look for a specific release tag
- if (RelTag != "")
+ if (RelTag != "" && UserRequestedVerTag == "")
{
const string Rel = GetReleaseForSourceRecord(SrcList, Parse);
@@ -360,7 +360,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
if (VerTag.empty() == false && (VerTag == Ver))
break;
}
- if (Version != "" && RelTag != "")
+ if (UserRequestedVerTag == "" && Version != "" && RelTag != "")
ioprintf(c1out, "Selected version '%s' (%s) for %s\n",
Version.c_str(), RelTag.c_str(), Src.c_str());
diff --git a/test/integration/test-apt-get-source b/test/integration/test-apt-get-source
index b98ebbada..c8db4edbe 100755
--- a/test/integration/test-apt-get-source
+++ b/test/integration/test-apt-get-source
@@ -65,3 +65,8 @@ testequal "$HEADER
E: Ignore unavailable version '9.9-not-there' of package 'foo'
E: Unable to find a source package for foo" aptget source -q --print-uris foo=9.9-not-there
+# version and release
+testequal "$HEADER
+Need to get 0 B of source archives.
+'file://${APTARCHIVE}/foo_0.0.1.dsc' foo_0.0.1.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
+'file://${APTARCHIVE}/foo_0.0.1.tar.gz' foo_0.0.1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris -t unstable foo=0.0.1