summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2009-08-12 14:52:43 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2009-08-12 14:52:43 +0200
commitebf6c42d9db4766c315ea15f25c4a7a9a799660b (patch)
tree8a88466c665b75ccfa016a20c388f9a5025b2ff3 /cmdline
parent619596fcd20e3fda2ab352103cfeb9437015dfbc (diff)
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)
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-get.cc22
1 files changed, 15 insertions, 7 deletions
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();