tag 382826 patch thanks The attached patch makes apt-get strip the binary-only NMU suffix from the binary package version to construct the source package version.
I've tested that it allows me to use "apt-get source" on packages that have had binary-only NMUs. If I should regenerate it against a different version, please let me2 know. -- Matt
diff -ru ../apt-0.7.6/apt-pkg/deb/debversion.cc ./apt-pkg/deb/debversion.cc --- ../apt-0.7.6/apt-pkg/deb/debversion.cc 2007-07-24 05:33:28.000000000 -0700 +++ ./apt-pkg/deb/debversion.cc 2007-08-19 22:38:58.000000000 -0700 @@ -266,3 +266,19 @@ return string(Ver,Last); } /*}}}*/ +// debVS::SourceVersion - Return the source version string /*{{{*/ +// --------------------------------------------------------------------- +/* This strips all the binary-only NMU specific information from the version + number */ +string debVersioningSystem::SourceVersion(const char *Ver) +{ + // Chop off the trailing +b<number> + const char *I; + unsigned Last = strlen(Ver); + for (I = Ver + Last - 1; I > Ver + 2 && isdigit(*I); I--); + if (I >= Ver + 2 && *I == 'b' && *(I - 1) == '+') + Last = I - Ver - 1; + + return string(Ver,Last); +} + /*}}}*/ diff -ru ../apt-0.7.6/apt-pkg/deb/debversion.h ./apt-pkg/deb/debversion.h --- ../apt-0.7.6/apt-pkg/deb/debversion.h 2007-07-24 05:33:28.000000000 -0700 +++ ./apt-pkg/deb/debversion.h 2007-08-19 22:46:38.000000000 -0700 @@ -33,6 +33,7 @@ return DoCmpVersion(A,Aend,B,Bend); } virtual string UpstreamVersion(const char *A); + virtual string SourceVersion(const char *A); debVersioningSystem(); }; diff -ru ../apt-0.7.6/apt-pkg/version.h ./apt-pkg/version.h --- ../apt-0.7.6/apt-pkg/version.h 2007-07-24 05:33:28.000000000 -0700 +++ ./apt-pkg/version.h 2007-08-19 22:45:22.000000000 -0700 @@ -44,6 +44,7 @@ virtual int DoCmpReleaseVer(const char *A,const char *Aend, const char *B,const char *Bend) = 0; virtual string UpstreamVersion(const char *A) = 0; + virtual string SourceVersion(const char *A) = 0; // See if the given VS is compatible with this one.. virtual bool TestCompatibility(pkgVersioningSystem const &Against) diff -ru ../apt-0.7.6/cmdline/apt-get.cc ./cmdline/apt-get.cc --- ../apt-0.7.6/cmdline/apt-get.cc 2007-08-01 15:48:14.000000000 -0700 +++ ./cmdline/apt-get.cc 2007-08-19 23:01:09.000000000 -0700 @@ -1242,7 +1242,7 @@ //std::cout << VF.File().Archive() << std::endl; if(VF.File().Archive() && (VF.File().Archive() == DefRel)) { - VerTag = Ver.VerStr(); + VerTag = Cache.VS().SourceVersion(Ver.VerStr()); break; } }