tag 579112 + patch thanks On Sun, 25 Apr 2010 15:33:57 +0300, Niko Tyni wrote:
I'd still like to see this feature in debhelper, preferrably in <= 9, so I've looked at the code a bit: > > > On Fri, 25 Dec 2009 15:00:04 +0200, Niko Tyni wrote: > > > > I suppose extending dh_perl a bit could give a scalable way > > > > to require binNMUs for selected packages when the Perl > > > > upstream version changes. Just a new flag to substitute > > > > ${perl:Depends} with something like > > > > perl (>= 5.10.1-8), perl (<< 5.10.2~) > > > > would do AFAICS. In patch 0001-dh_perl-add-S-_s_ameperl-switch-in-v9.patch I've added a -S switch, that adds exactly these values to ${perl:Depends}, and can be used with d/compat=9 and override_dh_perl: dh_perl -S > > How about providing a new substvar? Something like ${perl:Same} or > > ${perl:Built} that would expand to a proper >=, << dependency like the > > one above. > > A new substvar would avoid adding command-line switches to dh_perl, > > which may be hidden in a 'dh' call. I've implemented this in 0002-dh_perl-add-perl-Current-and-perl-Next-substvars-in-.patch, again only in compat mode 9, to be used by adding ${perl:Current} and/or ${perl:Next} in d/control's Depends. (They could also be combined into one substvar.) > I like the separate switch approach flag better. The case is rare enough that > having an override_dh_perl target is not much of a burden IMO. 1.5 years later I agree :) Setting the substvars always seems like a waste of resources. > But that's Joey's call, assuming he's OK with having this in debhelper. Yup. Both patches are tested (and can probably be improved perl-wise, e.g. by using $Config{PERL_REVISION|PERL_VERSION|PERL_SUBVERSION} etc.). But they give the desired result. (Unrelated note: not only is the debhelper code nice to read, today I also detected doc/PROGRAMMING which is very helpful. Thanks, Joey.) Cheers, gregor -- .''`. Homepage: http://info.comodo.priv.at/ - OpenPGP key ID: 0x8649AA06 : :' : Debian GNU/Linux user, admin, & developer - http://www.debian.org/ `. `' Member of VIBE!AT & SPI, fellow of Free Software Foundation Europe `- NP: John Zorn: Sippur (Sparks)
From 43b2543a297aff1a15773fd77f46c7f2c7fc1d88 Mon Sep 17 00:00:00 2001 From: gregor herrmann <gre...@debian.org> Date: Thu, 8 Dec 2011 23:54:22 +0100 Subject: [PATCH 2/2] dh_perl: add perl:Current and perl::Next substvars in v9 Adds 2 new substitution variables, that expand to e.g. "perl (>= 5.14.2)" and "perl (<< 5.14.3~)" for packages that rely on the exact perl version. Closes: #579112 --- dh_perl | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/dh_perl b/dh_perl index bf2506c..9f1eec7 100755 --- a/dh_perl +++ b/dh_perl @@ -25,6 +25,10 @@ and will use this information to generate a dependency on B<perl> or B<perlapi>. The dependency will be substituted into your package's F<control> file wherever you place the token B<${perl:Depends}>. +Starting with compatibility level 9, B<${perl:Current}> and B<${perl:Next}> +are expanded to B<perl[-base] (E<gt>= $currentversion)> and B<perl[-base] (<< +$nextminorversion~)>. + B<dh_perl> also cleans up empty directories that MakeMaker can generate when installing Perl modules. @@ -116,11 +120,16 @@ foreach my $package (@{$dh{DOPACKAGES}}) { if ($deps) { my $version=""; + my $currentversion=""; + my $nextversion=""; if ($deps & XS_MODULE or $dh{V_FLAG_SET}) { ($version) = `dpkg -s $perl` =~ /^Version:\s*(\S+)/m unless $version; $version = ">= $version"; } + $currentversion = ">= $Config{version}"; + my ($v1, $v2, $v3) = split /\./, $Config{version}; + $nextversion = "<< " . (join ".", $v1, $v2, $v3 + 1) . "~"; # no need to depend on an un-versioned perl-base -- it's # essential @@ -131,6 +140,12 @@ foreach my $package (@{$dh{DOPACKAGES}}) { addsubstvar($package, "perl:Depends", "perlapi-" . ($Config{debian_abi} || $Config{version})) if $deps & XS_MODULE; + + # add perl:Current and perl:Next denoting the current and next possible minor version + addsubstvar($package, "perl:Current", $perl, $currentversion) + unless compat(8); + addsubstvar($package, "perl:Next", $perl, $nextversion) + unless compat(8); } # MakeMaker always makes lib and share dirs, but typically -- 1.7.7.3
From 1add2d16cd4dcb814ec917dbad0a0435ed0b6e73 Mon Sep 17 00:00:00 2001 From: gregor herrmann <gre...@debian.org> Date: Fri, 9 Dec 2011 00:55:55 +0100 Subject: [PATCH] dh_perl: add -S (_s_ameperl) switch in v9 The -S switch will add e.g. "perl (>= 5.14.2)" and "perl (<< 5.14.3~)" to the ${perl:Depends} variable for packages that need the exact perl version they are built against. Closes: #579112 --- dh_perl | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/dh_perl b/dh_perl index bf2506c..9977ad4 100755 --- a/dh_perl +++ b/dh_perl @@ -56,6 +56,12 @@ directories, you can make B<dh_perl> check those directories by passing their names on the command line. It will only check the F<vendorlib> and F<vendorarch> directories by default. +=item B<-S> + +Starting with compatibility level 9, B<${perl:Depends}> adds B<perl[-base] +(E<gt>= $currentversion)> and B<perl[-base] (<< $nextminorversion~)> to +Depends, if B<dh_perl> is invoked with B<-S> (mnemonic: _s_ame perl version). + =back =head1 CONFORMS TO @@ -66,7 +72,7 @@ Perl policy, version 1.20 =cut -init(); +init(options => { S => \$dh{S_FLAG} }); my $vendorlib = substr $Config{vendorlib}, 1; my $vendorarch = substr $Config{vendorarch}, 1; @@ -131,6 +137,14 @@ foreach my $package (@{$dh{DOPACKAGES}}) { addsubstvar($package, "perl:Depends", "perlapi-" . ($Config{debian_abi} || $Config{version})) if $deps & XS_MODULE; + + if (! compat(8) && $dh{S_FLAG}) { + my $currentversion = ">= $Config{version}"; + my ($v1, $v2, $v3) = split /\./, $Config{version}; + my $nextversion = "<< " . (join ".", $v1, $v2, $v3 + 1) . "~"; + addsubstvar($package, "perl:Depends", $perl, $currentversion); + addsubstvar($package, "perl:Depends", $perl, $nextversion); + } } # MakeMaker always makes lib and share dirs, but typically -- 1.7.7.3
signature.asc
Description: Digital signature