diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-11-18 11:14:49 +0100 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-11-18 11:14:49 +0100 |
commit | 9b66180fe75c8414b84f422d1f278f4cec1c32b7 (patch) | |
tree | 41a6a8a58ad78592ebd1451995b25168d22adcbc /cmdline/apt-get.cc | |
parent | 413ba44c86dcc7421494ff6bba2e2289941b5ad7 (diff) |
cmdline/apt-get.cc: simplify changelog uri generation
Diffstat (limited to 'cmdline/apt-get.cc')
-rw-r--r-- | cmdline/apt-get.cc | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 406adf644..01f850aa6 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -2771,7 +2771,6 @@ bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher, pkgCache::VerI string srcpkg; string prefix; string descr; - string src_section; string verstr; string server; string path; @@ -2781,28 +2780,16 @@ bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher, pkgCache::VerI pkgCache::PkgIterator Pkg = V.ParentPkg(); pkgRecords::Parser &rec=Recs.Lookup(V.FileList()); - // build uri + // we need the the source pkg, the source version and the pool prefix srcpkg = rec.SourcePkg().empty() ? Pkg.Name() : rec.SourcePkg(); - // FIXME: we actually need the source section here - src_section= Pkg.Section(); - if(src_section.find('/')!=src_section.npos) - src_section=string(src_section, 0, src_section.find('/')); - else - src_section="main"; - - prefix+=srcpkg[0]; - if(srcpkg.size()>3 && srcpkg[0]=='l' && srcpkg[1]=='i' && srcpkg[2]=='b') - prefix=std::string("lib")+srcpkg[3]; - - verstr = V.VerStr(); - if(verstr.find(':')!=verstr.npos) - verstr=string(verstr, verstr.find(':')+1); + verstr = StripEpoch(V.VerStr()); + prefix = flNotFile(rec.FileName()); // make the server configurable server = _config->Find("Apt::Changelogs::Server", "http://packages.debian.org/"); // ... but not the format string to avoid all possible attacks - strprintf(path, "/changelogs/pool/%s/%s/%s/%s_%s/changelog", src_section.c_str(), prefix.c_str(), srcpkg.c_str(), srcpkg.c_str(), verstr.c_str()); + strprintf(path, "/changelogs/%s/%s_%s/changelog", prefix.c_str(), srcpkg.c_str(), verstr.c_str()); // queue it string changelog_uri = server+path; strprintf(descr, _("Changelog for %s (%s)"), srcpkg.c_str(), changelog_uri.c_str()); |