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

Re: RFC: dh-make-perl: two fixes



-=| Peter Pentchev, Sat, Apr 25, 2009 at 02:25:16AM +0300 |=-
> 
> Here are two patches that fix little issues that I've come across
> in the past couple of days while running dh-make-perl on a couple
> of CPAN modules.

Thanks for this, I was feeling lonely hacking on dh-make-perl :)

> The first change: do not put "libfoo-perl (>= 0.000-1)" for
> modules that actually *do* have a dependency on version 0.000 in
> their META.yml / Makefile.PL / whatever file! :)  For an example of
> this behavior, try
> 
>   dh-make-perl --cpan Software::License --pkg-perl
> 
> ...and look at Build-Depends-Indep.
> 
> diff -urN -urN -x tags -x .svn ./lib/Debian/Dependency.pm 
> /fs/linux/home/roam/deb/pkg-perl/pkg-perl/trunk/dh-make-perl/lib/Debian/Dependency.pm
> --- ./lib/Debian/Dependency.pm	2009-04-25 01:47:28.000000000 +0300
> +++ /fs/linux/home/roam/deb/pkg-perl/pkg-perl/trunk/dh-make-perl/lib/Debian/Dependency.pm	2009-04-24 18:44:52.000000000 +0300
> @@ -84,7 +84,7 @@
>      my $self = shift;
>  
>      return (
> -          $self->ver
> +          $self->ver && $self->ver !~ /^0+(\.0+)?$/
>          ? $self->pkg . ' (' . $self->rel . ' ' . $self->ver . ')'
>          : $self->pkg
>      );

This better be fixed in the part that extracts the version so that 
$self->ver is not set if the version is dummy. The patch above works 
around the bad parsing. The end result is the same, but a dummy 
version in META.yml better be represented internally as a plain, 
version-less dependency.

> The second change: when pruning the dependencies aggregated from
> distinct sources, fix the replacement of an older version with
> a newer one.  This shows up in the somewhat rare case when there
> are two different ways a package depends on another one, and
> the two dependencies specify different versions - a rare case, but
> exactly the one that prune() was meant to handle :)  For an example
> of this behavior, look at the Test::Kwalitee CPAN module which has
> a "require 5.6.2" directive; Debian::Dependencies->prune() then has
> to update a 5.6.0-12 dependency to 5.6.2 and comes up with a bare
> "Build-Depends-Indep: 5.6.2" in the control file.  Try it:
> 
>   dh-make-perl --cpan Test::Kwalitee --pkg-perl
> 
> ...and look at Build-Depends-Indep.
> 
> Both patches are below.  If nobody objects, I will commit them in
> a day or three.
> 
> Thanks for reading this far ;)
> 
> G'luck,
> Peter
> 
> diff -urN -urN -x tags -x .svn ./lib/Debian/Dependencies.pm 
> /fs/linux/home/roam/deb/pkg-perl/pkg-perl/trunk/dh-make-perl/lib/Debian/Dependencies.pm
> --- ./lib/Debian/Dependencies.pm	2009-04-25 01:47:28.000000000 +0300
> +++ /fs/linux/home/roam/deb/pkg-perl/pkg-perl/trunk/dh-make-perl/lib/Debian/Dependencies.pm	2009-04-24 19:09:33.000000000 +0300
> @@ -124,7 +124,7 @@
>          if ( exists $deps{$p} ) {
>              my $cur_ver = $deps{$p}->ver;
>  
> -            $deps{$p} = $v
> +            $deps{$p} = Debian::Dependency->new($p, $v)
>                  if defined($v) and not defined($cur_ver)
>                      or $AptPkg::Config::_config->system->versioning->compare(
>                          $cur_ver, $v ) < 0;
> 

This patch is perfectly OK. Please commit.

Bonus points if you add a test to t/Dependencies.t that verifies the 
fix :)


-- 
dam

Attachment: signature.asc
Description: Digital signature


Reply to: