bug within DhMakePerl::Utils
Iosif Fettich
ifettich at netsoft.ro
Thu Mar 19 19:49:49 UTC 2015
Hi Damyan,
sorry to bug you via e-mail, but as I'm not really aquainted with Ubuntu's
tools to deal with system maintenance, I hope to be of help even so.
I found an issue that IS a bug within
DhMakePerl::Utils::find_cpan_distribution, $VERSION = '0.71'.
To start with the end; a patch that works fine for me is
# diff Utils.pm Utils.pm.orig
35d34
< use Data::Dumper;
95,111d93
< print "Name: ", $name, "\n";
< print Dumper( CPAN::Shell->expand( 'Distribution',
< "/\\/$name-[^\\/]+\\.(tar|zip)/" ) );
<
< my $dist;
< my @dist = CPAN::Shell->expand( 'Distribution',
"/\\/$name-[^\\/]+\\.(tar|zip)/" );
<
< foreach (reverse @dist) {
< my $base_id = $_->base_id();
< $base_id =~ s/(.*)-.*/$1/; # remove version and extension
< #$base_id =~ s/-/::/g; # convert dashes to colons
< if ( $base_id eq $name ) {
< $dist = $_;
< last;
< }
< }
< $dist = shift @dist unless ($dist);
113c95,96
< return $dist;
---
> return CPAN::Shell->expand( 'Distribution',
> "/\\/$name-[^\\/]+\\.(tar|zip)/" );
That makes the new code for find_cpan_distribution to look like
---
sub find_cpan_distribution {
my( $name ) = @_;
$name =~ s/::/-/g;
my $dist;
my @dist = CPAN::Shell->expand( 'Distribution', "/\\/$name-[^\\/]+\\.(tar|zip)/" );
foreach (reverse @dist) {
my $base_id = $_->base_id();
$base_id =~ s/(.*)-.*/$1/; # remove version and extension
#$base_id =~ s/-/::/g; # convert dashes to colons
if ( $base_id eq $name ) {
$dist = $_;
last;
}
}
$dist = shift @dist unless ($dist);
return $dist;
}
---
I've stumbled over the issue trying to build some .deb packages on a clean
fresh Ubuntu 14.04 LTS install, using
$ cpan2deb AnyEvent-Filesys-Notify
I noticed that whereas the output from CPAN::Shell->expand(...) is
$VAR1 = bless( {
'ID' => 'M/MG/MGRIMES/AnyEvent-Filesys-Notify-1.15.tar.gz',
'RO' => {
'CPAN_USERID' => 'MGRIMES',
'CPAN_COMMENT' => undef
}
}, 'CPAN::Distribution' );
$VAR2 = bless( {
'ID' => 'M/MG/MGRIMES/AnyEvent-Filesys-Notify-1.16.tar.gz',
'RO' => {
'CPAN_COMMENT' => undef,
'CPAN_USERID' => 'MGRIMES'
}
}, 'CPAN::Distribution' );
and consists of a _list_, the returned result is always the first distribution
(AnyEvent-Filesys-Notify-1.15).
The cpan shell utility, on the other hand, always returns the higher version,
so you end up with AnyEvent-Filesys-Notify-1.16 if searching 'by hand' for
AnyEvent-Filesys-Notify in CPAN.
(And, of course, AnyEvent-Filesys-Notify-1.15 is buggy and doesn't pass
the tests, whereas AnyEvent-Filesys-Notify-1.16 is fine - that's what
triggered my attempt to tracking it down).
Hope that helps.
Many thanks,
Iosif Fettich
More information about the Ubuntu-devel-discuss
mailing list