[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Distribution installer that defaults to Debian?



On Wed, Dec 22, 2010 at 03:39:43PM +0200, Damyan Ivanov wrote:
> > To integrate with cpan clients, it would help to have a reliable
> > way to get the corresponding upstream version. Here are some
> > samples:
> > 
> > Package        Debian version   Probable CPAN version
> > -----------------------------------------------------
> > padre          0.76.ds1-1       0.76
> > nama           1.064-6          1.064
> > libdancer-perl 1.2000+dfsg-1    1.2000
> > 
> > Any references? I could whip up a regex, of course...
> 
> This is a can of worms :)
> 
> The only certain thing is that you should drop everything after the 
> last dash. What remains is what is called "upstream version" of the 
> Debian package. Unfortunately, there is *no guarantee* that this will 
> match the version under which upstream has released their 
> distribution.
> 
> There are many reasons for the "upstream" part of a Debian package 
> version to differ from the actual version string used by upstream. 
> Some times, the upstream sources were repackaged and the resulting 
> tarball used as a substitute of the upstream source. These are most 
> commonly noted as "+dfsg" or ".dsX".
> 
> Some other time, upstream had changed the way they increment versions 
> in a way that is not compatible with dpkg's understanding of versions. 
> 
> For example Module::Build 0.36 is to be found in Debian as 
> libmodule-build-perl 0.360000. The main difference between versions 
> found on CPAN and Debian versions is that CPAN ones are compared as 
> fractional numbers. Debian versions are compared as a sequence of 
> (integer) numbers and non-digit text strings. So for dpkg 0.3401 is 
> larger than 0.36 (because 3401 is larger than 36), whereas for CPAN 
> the opposite is true. In order to cope with upstream releasing 0.36 
> after 0.3401, we "mangle" the upstream version, forcing the part after 
> the dot to be right-padded with zeroes and be at least 4 digits.
> 
> These manglings are described (as a Perl substitutions) in a file 
> named 'debian/watch' in the *source* debian package. These source 
> packages are not normally available on users' systems, but you can 
> fetch them via http://packages.qa.debian.org/$package -- in the left 
> pane, in the "versions" box, there are icons for downloading the .dsc 
> file of each availabel version. "dsc" stands for Debian source control 
> file and the link to it can be given to the 'dget' program which will 
> download the .dsc and the associated files that comprise the "source 
> package" and then unpack the source package into a folder so that you 
> can inspect the debian/watch file.
> 
> Armed with the knowledge of the version manglings, you can apply them 
> to the version required by the META and look for the corresponding 
> Debian package versions on the local system.
> 
> As you can see, quite a complicated task.

Wow! Well worms are quiet, great at digesting organic
matter, and produce nourishing, microbe-rich compost. :-)

What is interesting, is that with such a complicated
relationship between Debian and upstream version numbers,
Debian packages don't appear to contain a copy of the
unmangled upstream version number, which would have
been convenient.

The distribution itself will have the version number in META.yml
or in the $VERSION variable of an appropriate package, but that's
beyond the scope of what a simple utility is supposed to
explore.

-- 
Joel Roth


Reply to: