diff options
author | Niels Thykier <niels@thykier.net> | 2017-07-07 10:43:25 +0000 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2017-07-07 11:24:18 +0000 |
commit | 1d94471647f372c55bfed8e33f9e6d33c30ab85c (patch) | |
tree | cb27db04689b2198588ccb0f0940cc2f9e564b56 | |
parent | b7ca7f5adf4efbef7693d62e0e029bb18d30040d (diff) | |
download | debhelper-1d94471647f372c55bfed8e33f9e6d33c30ab85c.tar.gz |
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 <niels@thykier.net>
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' => \'<INSERT-HERE>', #'# Hi emacs. + # Magic value for debhelper tools to request "current version" + 'DH_BUILTIN_VERSION' => \'<DH_LIB_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 <niels@thykier.net> Wed, 05 Jul 2017 15:51:48 +0000 @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B<dh> I<sequence> [B<--with> I<addon>[B<,>I<addon> ...]] [B<--list>] [S<I<debhelper options>>] 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<dh_auto_build> [S<I<build system options>>] [S<I<debhelper options>>] [S<B<--> I<params>>] 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<dh_auto_clean> [S<I<build system options>>] [S<I<debhelper options>>] [S<B<--> I<params>>] 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<dh_auto_configure> [S<I<build system options>>] [S<I<debhelper options>>] [S<B<--> I<params>>] 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<dh_auto_install> [S<I<build system options>>] [S<I<debhelper options>>] [S<B<--> I<params>>] 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<dh_auto_test> [S<I<build system options>>] [S<I<debhelper options>>] [S<B<--> I<params>>] 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<dh_bugfiles> [B<-A>] [S<I<debhelper options>>] 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<dh_builddeb> [S<I<debhelper options>>] [B<--destdir=>I<directory>] [B<--filename=>I<name>] [S<B<--> I<params>>] @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B<dh_clean> [S<I<debhelper options>>] [B<-k>] [B<-d>] [B<-X>I<item>] [S<I<path> ...>] 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<dh_compress> [S<I<debhelper options>>] [B<-X>I<item>] [B<-A>] [S<I<file> ...>] 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<dh_fixperms> [S<I<debhelper options>>] [B<-X>I<item>] @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B<dh_gconf> [S<I<debhelper options>>] [B<--priority=>I<priority>] 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<dh_gencontrol> [S<I<debhelper options>>] [S<B<--> I<params>>] @@ -11,6 +11,8 @@ use warnings; use File::Find; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B<dh_icons> [S<I<debhelper options>>] [B<-n>] @@ -11,6 +11,8 @@ use warnings; use File::Find; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B<dh_install> [B<-X>I<item>] [B<--autodest>] [B<--sourcedir=>I<dir>] [S<I<debhelper options>>] [S<I<file|dir> ... I<destdir>>] 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<dh_installchangelogs> [S<I<debhelper options>>] [B<-k>] [B<-X>I<item>] [I<upstream>] 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<dh_installcron> [S<B<debhelper options>>] [B<--name=>I<name>] 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<dh_installdeb> [S<I<debhelper options>>] 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<dh_installdebconf> [S<I<debhelper options>>] [B<-n>] [S<B<--> I<params>>] 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<dh_installdirs> [S<I<debhelper options>>] [B<-A>] [S<I<dir> ...>] 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<dh_installdocs> [S<I<debhelper options>>] [B<-A>] [B<-X>I<item>] [S<I<file> ...>] 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<dh_installemacsen> [S<I<debhelper options>>] [B<-n>] [B<--priority=>I<n>] [B<--flavor=>I<foo>] 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<dh_installexamples> [S<I<debhelper options>>] [B<-A>] [B<-X>I<item>] [S<I<file> ...>] 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<dh_installgsettings> [S<I<debhelper options>>] [B<--priority=<number>>] 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<dh_installifupdown> [S<I<debhelper options>>] [B<--name=>I<name>] 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<dh_installinfo> [S<I<debhelper options>>] [B<-A>] [S<I<file> ...>] 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<dh_installinit> [S<I<debhelper options>>] [B<--name=>I<name>] [B<-n>] [B<-R>] [B<-r>] [B<-d>] [S<B<--> I<params>>] 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<dh_installlogcheck> [S<I<debhelper options>>] 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<dh_installlogrotate> [S<I<debhelper options>>] [B<--name=>I<name>] 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<dh_installman> [S<I<debhelper options>>] [S<I<manpage> ...>] 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<dh_installmanpages> [S<I<debhelper options>>] [S<I<file> ...>] 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<dh_installmenu> [S<B<debhelper options>>] [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<dh_installmime> [S<I<debhelper options>>] 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<dh_installmodules> [S<I<debhelper options>>] [B<-n>] [B<--name=>I<name>] 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<dh_installpam> [S<I<debhelper options>>] [B<--name=>I<name>] 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<dh_installppp> [S<I<debhelper options>>] [B<--name=>I<name>] 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<dh_installudev> [S<I<debhelper options>>] [B<-n>] [B<--name=>I<name>] [B<--priority=>I<priority>] 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<dh_installwm> [S<I<debhelper options>>] [B<-n>] [B<--priority=>I<n>] [S<I<wm> ...>] 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<dh_installxfonts> [S<I<debhelper options>>] @@ -11,6 +11,8 @@ use warnings; use File::Find; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B<dh_link> [S<I<debhelper options>>] [B<-A>] [B<-X>I<item>] [S<I<source destination> ...>] @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B<dh_lintian> [S<I<debhelper options>>] 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<dh_listpackages> [S<I<debhelper options>>] 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<dh_makeshlibs> [S<I<debhelper options>>] [B<-m>I<major>] [B<-V>I<[dependencies]>] [B<-n>] [B<-X>I<item>] [S<B<--> I<params>>] @@ -11,6 +11,8 @@ use warnings; use Cwd; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B<dh_md5sums> [S<I<debhelper options>>] [B<-x>] [B<-X>I<item>] [B<--include-conffiles>] @@ -11,6 +11,8 @@ use warnings; use File::Find; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B<dh_missing> [B<-X>I<item>] [B<--sourcedir=>I<dir>] [S<I<debhelper options>>] 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<dh_movefiles> [S<I<debhelper options>>] [B<--sourcedir=>I<dir>] [B<-X>I<item>] [S<I<file> ...>] @@ -12,6 +12,8 @@ use Config; use File::Find; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B<dh_perl> [S<I<debhelper options>>] [B<-d>] [S<I<library dirs> ...>] @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B<dh_prep> [S<I<debhelper options>>] [B<-X>I<item>] 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<dh_shlibdeps> [S<I<debhelper options>>] [B<-L>I<package>] [B<-l>I<directory>] [B<-X>I<item>] [S<B<--> I<params>>] @@ -11,6 +11,8 @@ use warnings; use File::Find; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B<dh_strip> [S<I<debhelper options>>] [B<-X>I<item>] [B<--dbg-package=>I<package>] [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<dh_systemd_enable> [S<I<debhelper options>>] [B<--no-enable>] [B<--name=>I<name>] [S<I<unit file> ...>] 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<dh_systemd_start> [S<I<debhelper options>>] [B<--restart-after-upgrade>] [B<--no-stop-on-upgrade>] [S<I<unit file> ...>] @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B<dh_testdir> [S<I<debhelper options>>] [S<I<file> ...>] diff --git a/dh_testroot b/dh_testroot index 557207ee..ed324e8c 100755 --- a/dh_testroot +++ b/dh_testroot @@ -19,6 +19,9 @@ L<fakeroot(1)> use strict; use warnings; use Debian::Debhelper::Dh_Lib; + +our $VERSION = DH_BUILTIN_VERSION; + inhibit_log(); if ($< != 0) { @@ -10,6 +10,8 @@ use strict; use warnings; use Debian::Debhelper::Dh_Lib; +our $VERSION = DH_BUILTIN_VERSION; + =head1 SYNOPSIS B<dh_ucf> [S<I<debhelper options>>] [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<dh_update_autotools_config> [S<I<debhelper options>>] 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<dh_usrlocal> [S<I<debhelper options>>] [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: ------------------- |