From ebf6c42d9db4766c315ea15f25c4a7a9a799660b Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 12 Aug 2009 14:52:43 +0200 Subject: Add the pkg/release syntax to the source command in apt-get and also add the understanding for codenames instead of archives here [cmdline/apt-get.cc] - add pkg/archive and codename in source (Closes: #414105, #441178) --- cmdline/apt-get.cc | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 71566fd55..1582fff85 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1220,17 +1220,25 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, { // We want to pull the version off the package specification.. string VerTag; + string DefRel; string TmpSrc = Name; - string::size_type Slash = TmpSrc.rfind('='); + const size_t found = TmpSrc.find_last_of("/="); // honor default release - string DefRel = _config->Find("APT::Default-Release"); + if (found != string::npos && TmpSrc[found] == '/') + { + DefRel = TmpSrc.substr(found+1); + TmpSrc = TmpSrc.substr(0,found); + } + else + DefRel = _config->Find("APT::Default-Release"); + pkgCache::PkgIterator Pkg = Cache.FindPkg(TmpSrc); - if (Slash != string::npos) + if (found != string::npos && TmpSrc[found] == '=') { - VerTag = string(TmpSrc.begin() + Slash + 1,TmpSrc.end()); - TmpSrc = string(TmpSrc.begin(),TmpSrc.begin() + Slash); + VerTag = TmpSrc.substr(found+1); + TmpSrc = TmpSrc.substr(0,found); } else if(!Pkg.end() && DefRel.empty() == false) { @@ -1252,8 +1260,8 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, pkgCache::Flag::NotSource && Pkg.CurrentVer() != Ver) continue; - //std::cout << VF.File().Archive() << std::endl; - if(VF.File().Archive() && (VF.File().Archive() == DefRel)) + if((VF.File().Archive() != 0 && VF.File().Archive() == DefRel) || + (VF.File().Codename() != 0 && VF.File().Codename() == DefRel)) { pkgRecords::Parser &Parse = Recs.Lookup(VF); VerTag = Parse.SourceVer(); -- cgit v1.2.3