From 1d94471647f372c55bfed8e33f9e6d33c30ab85c Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Fri, 7 Jul 2017 10:43:25 +0000 Subject: Dh_Lib: Embed tool versions into auto-generated snippets Use $main::VERSION to determine the version of the tool and embed that into auto-generated snippets (e.g. via autoscript). This enables lintian to extract the tool + version and display it on: https://lintian.debian.org/tags/debhelper-autoscript-in-maintainer-scripts.html Signed-off-by: Niels Thykier --- Debian/Debhelper/Dh_Lib.pm | 33 ++++++++++++++++++++++++++++----- debian/changelog | 3 +++ dh | 2 ++ dh_auto_build | 3 +++ dh_auto_clean | 2 ++ dh_auto_configure | 3 +++ dh_auto_install | 2 ++ dh_auto_test | 2 ++ dh_bugfiles | 2 ++ dh_builddeb | 2 ++ dh_clean | 2 ++ dh_compress | 2 ++ dh_fixperms | 2 ++ dh_gconf | 2 ++ dh_gencontrol | 2 ++ dh_icons | 2 ++ dh_install | 2 ++ dh_installcatalogs | 2 ++ dh_installchangelogs | 2 ++ dh_installcron | 2 ++ dh_installdeb | 2 ++ dh_installdebconf | 2 ++ dh_installdirs | 2 ++ dh_installdocs | 2 ++ dh_installemacsen | 2 ++ dh_installexamples | 2 ++ dh_installgsettings | 2 ++ dh_installifupdown | 2 ++ dh_installinfo | 2 ++ dh_installinit | 2 ++ dh_installlogcheck | 2 ++ dh_installlogrotate | 2 ++ dh_installman | 2 ++ dh_installmanpages | 2 ++ dh_installmenu | 2 ++ dh_installmime | 2 ++ dh_installmodules | 2 ++ dh_installpam | 2 ++ dh_installppp | 2 ++ dh_installudev | 2 ++ dh_installwm | 2 ++ dh_installxfonts | 2 ++ dh_link | 2 ++ dh_lintian | 2 ++ dh_listpackages | 2 ++ dh_makeshlibs | 2 ++ dh_md5sums | 2 ++ dh_missing | 2 ++ dh_movefiles | 2 ++ dh_perl | 2 ++ dh_prep | 2 ++ dh_shlibdeps | 2 ++ dh_strip | 2 ++ dh_systemd_enable | 2 ++ dh_systemd_start | 2 ++ dh_testdir | 2 ++ dh_testroot | 3 +++ dh_ucf | 2 ++ dh_update_autotools_config | 2 ++ dh_usrlocal | 2 ++ doc/PROGRAMMING | 9 ++++++--- 61 files changed, 156 insertions(+), 8 deletions(-) diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm index 1b97f3d9..6ef9c371 100644 --- a/Debian/Debhelper/Dh_Lib.pm +++ b/Debian/Debhelper/Dh_Lib.pm @@ -21,6 +21,8 @@ use constant { 'MAX_COMPAT_LEVEL' => 11, # Magic value for xargs 'XARGS_INSERT_PARAMS_HERE' => \'', #'# Hi emacs. + # Magic value for debhelper tools to request "current version" + 'DH_BUILTIN_VERSION' => \'', #'# Hi emacs. }; my %NAMED_COMPAT_LEVELS = ( @@ -60,13 +62,14 @@ use vars qw(@EXPORT %dh); &rm_files &make_symlink_raw_target &on_items_in_parallel XARGS_INSERT_PARAMS_HERE &glob_expand_error_handler_reject &glob_expand_error_handler_warn_and_discard &glob_expand - &glob_expand_error_handler_silently_ignore + &glob_expand_error_handler_silently_ignore DH_BUILTIN_VERSION ); # The Makefile changes this if debhelper is installed in a PREFIX. my $prefix="/usr"; my $MAX_PROCS = get_buildoption("parallel") || 1; +my $DH_TOOL_VERSION; sub init { my %params=@_; @@ -758,6 +761,24 @@ sub pkgfilename { } } +sub _tool_version { + return $DH_TOOL_VERSION if defined($DH_TOOL_VERSION); + if (defined($main::VERSION)) { + $DH_TOOL_VERSION = $main::VERSION; + } + if (defined($DH_TOOL_VERSION) and $DH_TOOL_VERSION eq DH_BUILTIN_VERSION) { + my $version = "UNRELEASED-${\MAX_COMPAT_LEVEL}"; + eval { + require Debian::Debhelper::Dh_Version; + $version = $Debian::Debhelper::Dh_Version::version; + }; + $DH_TOOL_VERSION = $version; + } else { + $DH_TOOL_VERSION //= 'UNDECLARED'; + } + return $DH_TOOL_VERSION; +} + # Automatically add a shell script snippet to a debian script. # Only works if the script has #DEBHELPER# in it. # @@ -773,6 +794,7 @@ sub autoscript { my $filename=shift; my $sed=shift || ""; + my $tool_version = _tool_version(); # This is the file we will modify. my $outfile="debian/".pkgext($package)."$script.debhelper"; @@ -794,14 +816,14 @@ sub autoscript { if (-e $outfile && ($script eq 'postrm' || $script eq 'prerm') && !compat(5)) { # Add fragments to top so they run in reverse order when removing. - complex_doit("echo \"# Automatically added by ".basename($0)."\"> $outfile.new"); + complex_doit("echo \"# Automatically added by ".basename($0)."/${tool_version}\"> $outfile.new"); autoscript_sed($sed, $infile, "$outfile.new"); complex_doit("echo '# End automatically added section' >> $outfile.new"); complex_doit("cat $outfile >> $outfile.new"); rename_path("${outfile}.new", $outfile); } else { - complex_doit("echo \"# Automatically added by ".basename($0)."\">> $outfile"); + complex_doit("echo \"# Automatically added by ".basename($0)."/${tool_version}\">> $outfile"); autoscript_sed($sed, $infile, $outfile); complex_doit("echo '# End automatically added section' >> $outfile"); } @@ -832,7 +854,7 @@ sub autoscript_sed { sub autotrigger { my ($package, $trigger_type, $trigger_target) = @_; - my ($triggers_file, $ifd); + my ($triggers_file, $ifd, $tool_version); if (not exists($VALID_TRIGGER_TYPES{$trigger_type})) { require Carp; @@ -840,6 +862,7 @@ sub autoscript_sed { } return if $dh{NO_ACT}; + $tool_version = _tool_version(); $triggers_file = generated_file($package, 'triggers'); if ( -f $triggers_file ) { open($ifd, '<', $triggers_file) @@ -856,7 +879,7 @@ sub autoscript_sed { }x; print {$ofd} $line; } - print {$ofd} '# Triggers added by ' . basename($0) . "\n"; + print {$ofd} '# Triggers added by ' . basename($0) . "/${tool_version}\n"; print {$ofd} "${trigger_type} ${trigger_target}\n"; close($ofd) or error("closing ${triggers_file}.new failed: $!"); close($ifd); diff --git a/debian/changelog b/debian/changelog index ee9c3f30..5abbf644 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,9 @@ debhelper (10.6.3) UNRELEASED; urgency=medium "dpkg-parsechangelog | grep". * debhelper.pod: Use substitution to ensure examples always use the recommended compatibility level. + * Dh_Lib.pm: Embed tool versions into autoscripts so lintian can + extract and display them. Tools that want to rely on this + feature should set "$main::VERSION" to the version of the tool. -- Niels Thykier Wed, 05 Jul 2017 15:51:48 +0000 diff --git a/dh b/dh index 4200af28..e6d81cd6 100755 --- a/dh +++ b/dh @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B I [B<--with> I[B<,>I ...]] [B<--list>] [S>] diff --git a/dh_auto_build b/dh_auto_build index bc932df2..c189a216 100755 --- a/dh_auto_build +++ b/dh_auto_build @@ -8,8 +8,11 @@ dh_auto_build - automatically builds a package use strict; use warnings; +use Debian::Debhelper::Dh_Lib; use Debian::Debhelper::Dh_Buildsystems; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [S>] [S I>] diff --git a/dh_auto_clean b/dh_auto_clean index 0f4ce092..e71448ee 100755 --- a/dh_auto_clean +++ b/dh_auto_clean @@ -11,6 +11,8 @@ use warnings; use Debian::Debhelper::Dh_Lib; use Debian::Debhelper::Dh_Buildsystems; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [S>] [S I>] diff --git a/dh_auto_configure b/dh_auto_configure index 8a2c23d2..4bd1b368 100755 --- a/dh_auto_configure +++ b/dh_auto_configure @@ -8,8 +8,11 @@ dh_auto_configure - automatically configure a package prior to building use strict; use warnings; +use Debian::Debhelper::Dh_Lib; use Debian::Debhelper::Dh_Buildsystems; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [S>] [S I>] diff --git a/dh_auto_install b/dh_auto_install index 5ca6a524..6b34eb19 100755 --- a/dh_auto_install +++ b/dh_auto_install @@ -13,6 +13,8 @@ use Debian::Debhelper::Dh_Buildsystems; use File::Spec; use Cwd; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [S>] [S I>] diff --git a/dh_auto_test b/dh_auto_test index 547a469c..a64bb2dc 100755 --- a/dh_auto_test +++ b/dh_auto_test @@ -11,6 +11,8 @@ use warnings; use Debian::Debhelper::Dh_Lib; use Debian::Debhelper::Dh_Buildsystems; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [S>] [S I>] diff --git a/dh_bugfiles b/dh_bugfiles index 32722777..62b9ac9f 100755 --- a/dh_bugfiles +++ b/dh_bugfiles @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [B<-A>] [S>] diff --git a/dh_builddeb b/dh_builddeb index 533006db..90dd4725 100755 --- a/dh_builddeb +++ b/dh_builddeb @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<--destdir=>I] [B<--filename=>I] [S I>] diff --git a/dh_clean b/dh_clean index 7a058a71..11a00df0 100755 --- a/dh_clean +++ b/dh_clean @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-k>] [B<-d>] [B<-X>I] [S ...>] diff --git a/dh_compress b/dh_compress index 127178d3..b5b1fb36 100755 --- a/dh_compress +++ b/dh_compress @@ -12,6 +12,8 @@ use Cwd qw(getcwd abs_path); use File::Spec::Functions qw(abs2rel); use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-X>I] [B<-A>] [S ...>] diff --git a/dh_fixperms b/dh_fixperms index 20813e1f..6f7017aa 100755 --- a/dh_fixperms +++ b/dh_fixperms @@ -11,6 +11,8 @@ use warnings; use Config; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-X>I] diff --git a/dh_gconf b/dh_gconf index 4e4968ca..ba8f51ab 100755 --- a/dh_gconf +++ b/dh_gconf @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<--priority=>I] diff --git a/dh_gencontrol b/dh_gencontrol index 8238a417..aae4b222 100755 --- a/dh_gencontrol +++ b/dh_gencontrol @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [S I>] diff --git a/dh_icons b/dh_icons index acbbd4ce..b7e84532 100755 --- a/dh_icons +++ b/dh_icons @@ -11,6 +11,8 @@ use warnings; use File::Find; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-n>] diff --git a/dh_install b/dh_install index 2b41deea..3cf24185 100755 --- a/dh_install +++ b/dh_install @@ -11,6 +11,8 @@ use warnings; use File::Find; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [B<-X>I] [B<--autodest>] [B<--sourcedir=>I] [S>] [S ... I>] diff --git a/dh_installcatalogs b/dh_installcatalogs index dc1fad93..f15a6878 100755 --- a/dh_installcatalogs +++ b/dh_installcatalogs @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + my $sgmlbasever = "1.28"; =head1 SYNOPSIS diff --git a/dh_installchangelogs b/dh_installchangelogs index bc20ec06..18b9bc0a 100755 --- a/dh_installchangelogs +++ b/dh_installchangelogs @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-k>] [B<-X>I] [I] diff --git a/dh_installcron b/dh_installcron index 9bc3d7a1..abfdefe2 100755 --- a/dh_installcron +++ b/dh_installcron @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<--name=>I] diff --git a/dh_installdeb b/dh_installdeb index fc81147d..60b1fbb8 100755 --- a/dh_installdeb +++ b/dh_installdeb @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] diff --git a/dh_installdebconf b/dh_installdebconf index ba2e9bc8..a8cf0409 100755 --- a/dh_installdebconf +++ b/dh_installdebconf @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-n>] [S I>] diff --git a/dh_installdirs b/dh_installdirs index 222968ce..7254df16 100755 --- a/dh_installdirs +++ b/dh_installdirs @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-A>] [S ...>] diff --git a/dh_installdocs b/dh_installdocs index 4b9cdcb4..bb2616c1 100755 --- a/dh_installdocs +++ b/dh_installdocs @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-A>] [B<-X>I] [S ...>] diff --git a/dh_installemacsen b/dh_installemacsen index 96e77100..fcae6dfe 100755 --- a/dh_installemacsen +++ b/dh_installemacsen @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-n>] [B<--priority=>I] [B<--flavor=>I] diff --git a/dh_installexamples b/dh_installexamples index bb02d915..530e03de 100755 --- a/dh_installexamples +++ b/dh_installexamples @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-A>] [B<-X>I] [S ...>] diff --git a/dh_installgsettings b/dh_installgsettings index 05c0b339..db0d1032 100755 --- a/dh_installgsettings +++ b/dh_installgsettings @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<--priority=>] diff --git a/dh_installifupdown b/dh_installifupdown index 7114a26b..bd0aaf44 100755 --- a/dh_installifupdown +++ b/dh_installifupdown @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<--name=>I] diff --git a/dh_installinfo b/dh_installinfo index 33137ed3..dbef7de6 100755 --- a/dh_installinfo +++ b/dh_installinfo @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-A>] [S ...>] diff --git a/dh_installinit b/dh_installinit index a10ea1a2..02282e0d 100755 --- a/dh_installinit +++ b/dh_installinit @@ -11,6 +11,8 @@ use warnings; use Debian::Debhelper::Dh_Lib; use File::Find; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<--name=>I] [B<-n>] [B<-R>] [B<-r>] [B<-d>] [S I>] diff --git a/dh_installlogcheck b/dh_installlogcheck index 646b7ef4..9b8473e8 100755 --- a/dh_installlogcheck +++ b/dh_installlogcheck @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] diff --git a/dh_installlogrotate b/dh_installlogrotate index 0c43d8fd..ca561bd5 100755 --- a/dh_installlogrotate +++ b/dh_installlogrotate @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<--name=>I] diff --git a/dh_installman b/dh_installman index ead17526..72606604 100755 --- a/dh_installman +++ b/dh_installman @@ -11,6 +11,8 @@ use warnings; use File::Find; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [S ...>] diff --git a/dh_installmanpages b/dh_installmanpages index b7bbe8d5..22c669ef 100755 --- a/dh_installmanpages +++ b/dh_installmanpages @@ -11,6 +11,8 @@ use warnings; use File::Find; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [S ...>] diff --git a/dh_installmenu b/dh_installmenu index a534782c..b4464a27 100755 --- a/dh_installmenu +++ b/dh_installmenu @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-n>] diff --git a/dh_installmime b/dh_installmime index a1fd2adf..eb447869 100755 --- a/dh_installmime +++ b/dh_installmime @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] diff --git a/dh_installmodules b/dh_installmodules index bb48553a..e24f6ea2 100755 --- a/dh_installmodules +++ b/dh_installmodules @@ -11,6 +11,8 @@ use warnings; use Debian::Debhelper::Dh_Lib; use File::Find; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-n>] [B<--name=>I] diff --git a/dh_installpam b/dh_installpam index 2cdcb2a5..256f7ab8 100755 --- a/dh_installpam +++ b/dh_installpam @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<--name=>I] diff --git a/dh_installppp b/dh_installppp index 21d99a72..9eb09051 100755 --- a/dh_installppp +++ b/dh_installppp @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<--name=>I] diff --git a/dh_installudev b/dh_installudev index 3e0ddde7..01d0f9d9 100755 --- a/dh_installudev +++ b/dh_installudev @@ -11,6 +11,8 @@ use warnings; use Debian::Debhelper::Dh_Lib; use File::Find; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-n>] [B<--name=>I] [B<--priority=>I] diff --git a/dh_installwm b/dh_installwm index 1bd49dad..4290b757 100755 --- a/dh_installwm +++ b/dh_installwm @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-n>] [B<--priority=>I] [S ...>] diff --git a/dh_installxfonts b/dh_installxfonts index e7f2b715..cc05aa56 100755 --- a/dh_installxfonts +++ b/dh_installxfonts @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] diff --git a/dh_link b/dh_link index 1da51d1c..7e2fe3ba 100755 --- a/dh_link +++ b/dh_link @@ -11,6 +11,8 @@ use warnings; use File::Find; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-A>] [B<-X>I] [S ...>] diff --git a/dh_lintian b/dh_lintian index 2c6608d8..fb3bdbf3 100755 --- a/dh_lintian +++ b/dh_lintian @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] diff --git a/dh_listpackages b/dh_listpackages index 3fb4f150..170f16b8 100755 --- a/dh_listpackages +++ b/dh_listpackages @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] diff --git a/dh_makeshlibs b/dh_makeshlibs index c2d50bd7..7f7bf59c 100755 --- a/dh_makeshlibs +++ b/dh_makeshlibs @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-m>I] [B<-V>I<[dependencies]>] [B<-n>] [B<-X>I] [S I>] diff --git a/dh_md5sums b/dh_md5sums index 887e2134..b3a3a741 100755 --- a/dh_md5sums +++ b/dh_md5sums @@ -11,6 +11,8 @@ use warnings; use Cwd; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-x>] [B<-X>I] [B<--include-conffiles>] diff --git a/dh_missing b/dh_missing index c78bf6d7..f882fb8e 100755 --- a/dh_missing +++ b/dh_missing @@ -11,6 +11,8 @@ use warnings; use File::Find; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [B<-X>I] [B<--sourcedir=>I] [S>] diff --git a/dh_movefiles b/dh_movefiles index 1014c084..7c5c8ffd 100755 --- a/dh_movefiles +++ b/dh_movefiles @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<--sourcedir=>I] [B<-X>I] [S ...>] diff --git a/dh_perl b/dh_perl index 8a70c99e..b536099d 100755 --- a/dh_perl +++ b/dh_perl @@ -12,6 +12,8 @@ use Config; use File::Find; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-d>] [S ...>] diff --git a/dh_prep b/dh_prep index 57410d54..518b6eb7 100755 --- a/dh_prep +++ b/dh_prep @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-X>I] diff --git a/dh_shlibdeps b/dh_shlibdeps index 82f7d1ea..0e847c66 100755 --- a/dh_shlibdeps +++ b/dh_shlibdeps @@ -11,6 +11,8 @@ use warnings; use Cwd; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-L>I] [B<-l>I] [B<-X>I] [S I>] diff --git a/dh_strip b/dh_strip index c2741c50..bcc8e090 100755 --- a/dh_strip +++ b/dh_strip @@ -11,6 +11,8 @@ use warnings; use File::Find; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-X>I] [B<--dbg-package=>I] [B<--keep-debug>] diff --git a/dh_systemd_enable b/dh_systemd_enable index b89c9518..9a256b0c 100755 --- a/dh_systemd_enable +++ b/dh_systemd_enable @@ -11,6 +11,8 @@ use warnings; use Debian::Debhelper::Dh_Lib; use File::Find; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<--no-enable>] [B<--name=>I] [S ...>] diff --git a/dh_systemd_start b/dh_systemd_start index 46c14a7d..740a3117 100755 --- a/dh_systemd_start +++ b/dh_systemd_start @@ -12,6 +12,8 @@ use Debian::Debhelper::Dh_Lib; use File::Find; use Cwd qw(getcwd abs_path); +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<--restart-after-upgrade>] [B<--no-stop-on-upgrade>] [S ...>] diff --git a/dh_testdir b/dh_testdir index 4c8715d3..4fb5a9cf 100755 --- a/dh_testdir +++ b/dh_testdir @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [S ...>] diff --git a/dh_testroot b/dh_testroot index 557207ee..ed324e8c 100755 --- a/dh_testroot +++ b/dh_testroot @@ -19,6 +19,9 @@ L use strict; use warnings; use Debian::Debhelper::Dh_Lib; + +our $VERSION = DH_BUILTIN_VERSION; + inhibit_log(); if ($< != 0) { diff --git a/dh_ucf b/dh_ucf index 638ca1a0..4f940dc1 100755 --- a/dh_ucf +++ b/dh_ucf @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-n>] diff --git a/dh_update_autotools_config b/dh_update_autotools_config index 1c14ba8f..d9ce75a1 100755 --- a/dh_update_autotools_config +++ b/dh_update_autotools_config @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] diff --git a/dh_usrlocal b/dh_usrlocal index a5527880..86f2bd99 100755 --- a/dh_usrlocal +++ b/dh_usrlocal @@ -12,6 +12,8 @@ use Debian::Debhelper::Dh_Lib; use File::Find; use File::stat; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B [S>] [B<-n>] diff --git a/doc/PROGRAMMING b/doc/PROGRAMMING index c5627b35..0cbe21a7 100644 --- a/doc/PROGRAMMING +++ b/doc/PROGRAMMING @@ -62,11 +62,14 @@ with the rest of debhelper if it does, so this is highly encouraged. Use Dh_Lib like this: -use Debian::Debhelper::Dh_Lib +use Debian::Debhelper::Dh_Lib; +our $VERSION = '1.0'; init(); -The init() function causes Dh_lib to parse the command line and do some other -initialization tasks. +The init() function causes Dh_lib to parse the command line and do +some other initialization tasks. If present, $main::VERSION will be +used to determine the version of the tool (e.g. embedded into +autoscript snippets). Argument processing: ------------------- -- cgit v1.2.3