Bug#388255: Patch to fix this

2017-01-09 Thread Michael Vogt
On Sat, Jan 07, 2017 at 05:30:51PM +0100, Roderich Schupp wrote:
> Hi,
Hi,

> the attached patch ignores the bin-nmu suffix in the package version when
> computing getChangelogURI().
> It needs a compiler implementing C++11, though.
[..]

Thanks for the patch! It looks great. My only small concern is the
c++11 dependency. It needs gcc 4.9 AIUI which means that it won't work
on oldstable. Probably ok, I doubt people backport this far back.

Thanks,
 Michael



Bug#388255: Patch to fix this

2017-01-07 Thread Roderich Schupp
Hi,

the attached patch ignores the bin-nmu suffix in the package version when
computing getChangelogURI().
It needs a compiler implementing C++11, though.

Cheers, Roderich
diff --git a/common/rpackage.cc b/common/rpackage.cc
index 56184984..3a1cdcb3 100644
--- a/common/rpackage.cc
+++ b/common/rpackage.cc
@@ -44,6 +44,7 @@
 #include 
 #include 
 #include 
+#include 
 
 
 #include 
@@ -974,11 +975,13 @@ string RPackage::getChangelogURI()
  prefix=std::string("lib")+srcpkg[3];
 
   string verstr;
+  std::regex epoch ("^\\d+:");
+  std::regex bin_nmu ("\\+b\\d+$");
   if(availableVersion() != NULL) 
  verstr = availableVersion();
   
-  if(verstr.find(':')!=verstr.npos)
- verstr=string(verstr, verstr.find(':')+1);
+  verstr = std::regex_replace(verstr, epoch, "");
+  verstr = std::regex_replace(verstr, bin_nmu, "");
 
   snprintf(uri,512,"http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog";,
src_section.c_str(),