summaryrefslogtreecommitdiff
path: root/src/generic/apt/pkg_changelog.cc
diff options
context:
space:
mode:
authorDaniel Hartwig <mandyke@gmail.com>2012-06-28 17:33:01 +0800
committerDaniel Hartwig <mandyke@gmail.com>2012-06-28 17:33:01 +0800
commitfaedc8178b90b77e030344dfc368e3fa3d88f050 (patch)
treea0eb7cd923421fc40644fda6ed01892fefd8b594 /src/generic/apt/pkg_changelog.cc
parentfcda1a118830b468929ef27a25a95d9e72939a8e (diff)
downloadaptitude-faedc8178b90b77e030344dfc368e3fa3d88f050.tar.gz
Merge changelog URI construction from apt-get
* src/generic/apt/pkg_changelog.cc: - use up-to-date changelog uri construction from apt-get using APT::Changelogs::Server * src/apt_options.cc: - drop disused Aptitude::Changelog-URL-Template * src/cmdline/cmdline_changelog.cc: - remove extraneous guess-work with source packages, which happened to also download the wrong changelog sometimes (Closes: #631464) - changelog download works with no deb-src lines, so we don't need to instruct the user to add any (Closes: #587775, #537393)
Diffstat (limited to 'src/generic/apt/pkg_changelog.cc')
-rw-r--r--src/generic/apt/pkg_changelog.cc51
1 files changed, 16 insertions, 35 deletions
diff --git a/src/generic/apt/pkg_changelog.cc b/src/generic/apt/pkg_changelog.cc
index 9b1caf33..d425a260 100644
--- a/src/generic/apt/pkg_changelog.cc
+++ b/src/generic/apt/pkg_changelog.cc
@@ -39,6 +39,8 @@
#include <sigc++/bind.h>
#include <apt-pkg/sourcelist.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
#include <cwidget/generic/util/ssprintf.h>
@@ -86,12 +88,12 @@ namespace aptitude
boost::shared_ptr<changelog_info>
changelog_info::create(const std::string &source_package,
const std::string &source_version,
- const std::string &section,
+ const std::string &path,
const std::string &display_name)
{
return boost::make_shared<changelog_info>(source_package,
source_version,
- section,
+ path,
display_name);
}
@@ -117,14 +119,18 @@ namespace aptitude
const string source_version =
rec.SourceVer().empty() ? ver.VerStr() : rec.SourceVer();
+ string path;
+ path = flNotFile(rec.FileName());
+ path += source_package + "_" + StripEpoch(source_version);
+
LOG_TRACE(Loggers::getAptitudeChangelog(),
"For " << ver.ParentPkg().Name()
<< " " << ver.VerStr() << ", getting the changelog of the source package "
- << source_package << " " << source_version);
+ << source_package << " " << source_version << " from " << path);
return boost::make_shared<changelog_info>(source_package,
source_version,
- ver.Section(),
+ path,
ver.ParentPkg().Name());
}
@@ -385,8 +391,8 @@ namespace aptitude
<< req.get_info()->get_source_package()
<< ", source_version = "
<< req.get_info()->get_source_version()
- << ", section = "
- << req.get_info()->get_section()
+ << ", path = "
+ << req.get_info()->get_path()
<< ", display_name = "
<< req.get_info()->get_display_name()
<< ", download = 0x"
@@ -436,7 +442,7 @@ namespace aptitude
const string source_package(info.get_source_package());
const string source_version(info.get_source_version());
- const string section(info.get_section());
+ const string path(info.get_path());
const string name(info.get_display_name());
const string short_description = cw::util::ssprintf(_("Changelog of %s"), name.c_str());
@@ -520,34 +526,9 @@ namespace aptitude
}
}
- string realsection;
-
- if(section.find('/') != section.npos)
- realsection.assign(section, 0, section.find('/'));
- else
- realsection.assign("main");
-
- string prefix;
-
- if(source_package.size() > 3 &&
- source_package[0] == 'l' && source_package[1] == 'i' && source_package[2] == 'b')
- prefix = std::string("lib") + source_package[3];
- else
- prefix = source_package[0];
-
- string realver;
-
- if(source_version.find(':') != source_version.npos)
- realver.assign(source_version, source_version.find(':') + 1, source_version.npos);
- else
- realver = source_version;
-
- string uri = cw::util::ssprintf("http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog",
- realsection.c_str(),
- prefix.c_str(),
- source_package.c_str(),
- source_package.c_str(),
- realver.c_str());
+ string server = _config->Find("APT::Changelogs::Server",
+ "http://packages.debian.org/changelogs");
+ string uri = cw::util::ssprintf("%s/%s/changelog", server.c_str(), path.c_str());
LOG_TRACE(logger,
"Adding " << uri
<< " as a URI for the changelog of " << source_package << " " << source_version);