#! /bin/sh /usr/share/dpatch/dpatch-run
## 04_changelog.dpatch by  <egon@localhost.localdomain>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

Index: aptitude-0.8.12-1ubuntu1/src/apt_options.cc
===================================================================
--- aptitude-0.8.12-1ubuntu1.orig/src/apt_options.cc
+++ aptitude-0.8.12-1ubuntu1/src/apt_options.cc
@@ -302,7 +302,7 @@
 		 "should only need to change this if the changelogs move "
 		 "to a different URL."),
 	      "APT::Changelogs::Server",
-	      "http://metadata.ftp-master.debian.org/changelogs"),
+	      "http://changelogs.ubuntu.com/changelogs"),
   option_item(N_("Display a preview of what will be done before doing it"),
 	      N_("If this option is enabled, then when you ask "
 		 "aptitude to perform an install run, it will "
Index: aptitude-0.8.12-1ubuntu1/src/cmdline/cmdline_changelog.cc
===================================================================
--- aptitude-0.8.12-1ubuntu1.orig/src/cmdline/cmdline_changelog.cc
+++ aptitude-0.8.12-1ubuntu1/src/cmdline/cmdline_changelog.cc
@@ -292,7 +292,7 @@
 
   if(access("/usr/bin/sensible-pager", X_OK)!=0)
     {
-      _error->Warning(_("Can't execute sensible-pager, is this a working Debian system?"));
+      _error->Warning(_("Can't execute sensible-pager, is this a working Ubuntu system?"));
 
       pager=getenv("PAGER");
 
Index: aptitude-0.8.12-1ubuntu1/src/generic/apt/pkg_changelog.cc
===================================================================
--- aptitude-0.8.12-1ubuntu1.orig/src/generic/apt/pkg_changelog.cc
+++ aptitude-0.8.12-1ubuntu1/src/generic/apt/pkg_changelog.cc
@@ -584,14 +584,14 @@
 
 		  // WATCH: apt/cmdline/apt-get.cc(DownloadChangelog)
 		  string server = aptcfg->Find("APT::Changelogs::Server",
-					       "http://metadata.ftp-master.debian.org/changelogs");
-		  string path = cw::util::ssprintf("%s/%s/%s/%s_%s",
+                                           "http://changelogs.ubuntu.com/changelogs");
+		  string path = cw::util::ssprintf("pool/%s/%s/%s/%s_%s",
 						   realsection.c_str(),
 						   prefix.c_str(),
 						   source_package.c_str(),
 						   source_package.c_str(),
 						   realver.c_str());
-		  uri = cw::util::ssprintf("%s/%s_changelog",
+		  uri = cw::util::ssprintf("%s/%s/changelog",
 					   server.c_str(),
 					   path.c_str());
 		}
@@ -690,9 +690,7 @@
     {
       if (!vf.File().end() &&
 	  vf.File().Origin() &&
-	  (string("Debian") == vf.File().Origin() ||
-	   string("Debian Ports") == vf.File().Origin() ||
-	   string("Debian Backports") == vf.File().Origin()))
+	  (string("Ubuntu") == vf.File().Origin()))
 	{
 	  return true;
 	}
Index: aptitude-0.8.12-1ubuntu1/src/view_changelog.cc
===================================================================
--- aptitude-0.8.12-1ubuntu1.orig/src/view_changelog.cc
+++ aptitude-0.8.12-1ubuntu1/src/view_changelog.cc
@@ -275,7 +275,7 @@
   string menulabel =
     ssprintf(_("Changelog of %s"), pkgname.c_str());
   string tablabel = ssprintf(_("%s changes"), pkgname.c_str());
-  string desclabel = _("View the list of changes made to this Debian package.");
+  string desclabel = _("View the list of changes made to this Ubuntu package.");
 
   cw::util::ref_ptr<aptitude::apt::changelog> changelog(aptitude::apt::parse_changelog(filename));
   cw::fragment *f = changelog.valid() ? render_changelog(changelog, curverstr) : NULL;
Index: aptitude-0.8.12-1ubuntu1/src/generic/apt/download_queue.cc
===================================================================
--- aptitude-0.8.12-1ubuntu1.orig/src/generic/apt/download_queue.cc
+++ aptitude-0.8.12-1ubuntu1/src/generic/apt/download_queue.cc
@@ -875,7 +875,8 @@
 
 	if (req.get_uri().find("/changelogs/") != std::string::npos)
 	  {
-	    std::string uri_filename = req.get_uri().substr(req.get_uri().find_last_of("/") + 1);
+            auto last_slash = req.get_uri().find_last_of("/");
+	    std::string uri_filename = req.get_uri().substr(req.get_uri().find_last_of("/", last_slash - 1) + 1);
 
 	    std::regex underscore_regex("[^_]+");
 	    auto elem_begin = std::sregex_iterator(uri_filename.begin(), uri_filename.end(), underscore_regex);
