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

Re: Distribution installer that defaults to Debian?



-=| Joel Roth, Wed, Dec 22, 2010 at 12:31:56AM -1000 |=-
> On Tue, Dec 21, 2010 at 11:22:52AM +0200, Damyan Ivanov wrote:
> > Another way is to query apt's local database perhaps via 
> > AptPkg::PkgRecords.
> 
> Thanks for the pointer. I'm playing with that right now.
> 
>     use feature ':5.10';
>     use AptPkg::Cache;
>     my $apt = AptPkg::Cache->new();
>     my $record = $apt->packages; # AptPkg::PkgRecords object
>     my $h = $record->lookup($package_name);
>     say "$package_name $h->{VerStr}"
> 
> 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.

Attachment: signature.asc
Description: Digital signature


Reply to: