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

@DPATCH@
diff -urNad bug.153966.452564~/common/rpackage.cc bug.153966.452564/common/rpackage.cc
--- bug.153966.452564~/common/rpackage.cc	2010-04-14 00:16:09.000000000 +0200
+++ bug.153966.452564/common/rpackage.cc	2010-04-14 00:20:52.000000000 +0200
@@ -896,7 +896,7 @@
 {
    char uri[512];
    //FIXME: get the supportedOrigins from pkgStatus
-   if(origin() == "Debian") {
+   if(origin() == "Ubuntu") {
       string prefix;
       string srcpkg = srcPackage();
 
@@ -917,7 +917,7 @@
       if(verstr.find(':')!=verstr.npos)
          verstr=string(verstr, verstr.find(':')+1);
 
-      snprintf(uri,512,"http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog",
+      snprintf(uri,512,"http://changelogs.ubuntu.com/changelogs/pool/%s/%s/%s/%s_%s/changelog",
                                src_section.c_str(),
                                prefix.c_str(),
                                srcpkg.c_str(),
@@ -956,9 +956,23 @@
       struct stat filestatus;
       stat(filename.c_str(), &filestatus );
       if (filestatus.st_size == 0) {
-         out << "This change is not coming from a source that supports changelogs.\n" << endl;
-         out << "Failed to fetch the changelog for " << name() << endl;
-         out << "URI was: " << uri << endl;
+      // FIXME: Use supportedOrigins
+         if(origin() == "Ubuntu") {
+            string verstr;
+            if(availableVersion() != NULL) 
+               verstr = availableVersion();
+            
+            if(verstr.find(':')!=verstr.npos)
+               verstr=string(verstr, verstr.find(':')+1);
+            out << "The list of changes is not available yet.\n" << endl;
+            out << "Please use https://launchpad.net/ubuntu/+source/"<< srcPackage() << 
+                "/" << verstr << "/+changelog" << endl;
+            out << "until the changes become available or try again later." << endl;
+         } else {
+            out << "This change is not coming from a source that supports changelogs.\n" << endl;
+            out << "Failed to fetch the changelog for " << name() << endl;
+            out << "URI was: " << uri << endl;
+         }
       }
    };
    out.close();
diff -urNad bug.153966.452564~/common/rpackagestatus.cc bug.153966.452564/common/rpackagestatus.cc
--- bug.153966.452564~/common/rpackagestatus.cc	2010-04-13 23:31:39.000000000 +0200
+++ bug.153966.452564/common/rpackagestatus.cc	2010-04-14 00:18:59.000000000 +0200
@@ -69,7 +69,7 @@
       markUnsupported = true;
 
       // read supported labels
-      labels = _config->Find("Synaptic::supported-label", "Debian Debian-Security");
+      labels = _config->Find("Synaptic::supported-label", "Ubuntu");
       stringstream sst1(labels);
       while(!sst1.eof()) {
 	 sst1 >> s;
@@ -77,7 +77,7 @@
       }
 
       // read supported origins
-      origin = _config->Find("Synaptic::supported-origins", "Debian");
+      origin = _config->Find("Synaptic::supported-origins", "Ubuntu");
       stringstream sst2(origin);
       while(!sst2.eof()) {
 	 sst2 >> s;
@@ -85,7 +85,7 @@
       }
       
       // read supported components
-      components = _config->Find("Synaptic::supported-components", "main updates/main");
+      components = _config->Find("Synaptic::supported-components", "main updates/main restricted");
       stringstream sst3(components);
       while(!sst3.eof()) {
 	 sst3 >> s;
