[debhelper-devel] [debhelper] 01/01: Dh_Lib: Embed tool versions into auto-generated snippets

Niels Thykier nthykier at moszumanska.debian.org
Fri Jul 7 11:26:16 UTC 2017


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository debhelper.

commit 1d94471647f372c55bfed8e33f9e6d33c30ab85c
Author: Niels Thykier <niels at thykier.net>
Date:   Fri Jul 7 10:43:25 2017 +0000

    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 at thykier.net>
---
 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 1b97f3d..6ef9c37 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 ee9c3f3..5abbf64 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 at thykier.net>  Wed, 05 Jul 2017 15:51:48 +0000
 
diff --git a/dh b/dh
index 4200af2..e6d81cd 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<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 bc932df..c189a21 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 0f4ce09..e71448e 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 8a2c23d..4bd1b36 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 5ca6a52..6b34eb1 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 547a469..a64bb2d 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 3272277..62b9ac9 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 533006d..90dd472 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>>]
diff --git a/dh_clean b/dh_clean
index 7a058a7..11a00df 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<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 127178d..b5b1fb3 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 20813e1..6f7017a 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>]
diff --git a/dh_gconf b/dh_gconf
index 4e4968c..ba8f51a 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<dh_gconf> [S<I<debhelper options>>] [B<--priority=>I<priority>]
diff --git a/dh_gencontrol b/dh_gencontrol
index 8238a41..aae4b22 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>>]
diff --git a/dh_icons b/dh_icons
index acbbd4c..b7e8453 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<dh_icons> [S<I<debhelper options>>] [B<-n>]
diff --git a/dh_install b/dh_install
index 2b41dee..3cf2418 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<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 dc1fad9..f15a687 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 bc20ec0..18b9bc0 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 9bc3d7a..abfdefe 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 fc81147..60b1fbb 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 ba2e9bc..a8cf040 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 222968c..7254df1 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 4b9cdcb..bb2616c 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 96e7710..fcae6df 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 bb02d91..530e03d 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 05c0b33..db0d103 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 7114a26..bd0aaf4 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 33137ed..dbef7de 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 a10ea1a..02282e0 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 646b7ef..9b8473e 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 0c43d8f..ca561bd 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 ead1752..7260660 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 b7bbe8d..22c669e 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 a534782..b4464a2 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 a1fd2ad..eb44786 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 bb48553..e24f6ea 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 2cdcb2a..256f7ab 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 21d99a7..9eb0905 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 3e0ddde..01d0f9d 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 1bd49da..4290b75 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 e7f2b71..cc05aa5 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>>]
diff --git a/dh_link b/dh_link
index 1da51d1..7e2fe3b 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<dh_link> [S<I<debhelper options>>] [B<-A>] [B<-X>I<item>] [S<I<source destination> ...>]
diff --git a/dh_lintian b/dh_lintian
index 2c6608d..fb3bdbf 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<dh_lintian> [S<I<debhelper options>>]
diff --git a/dh_listpackages b/dh_listpackages
index 3fb4f15..170f16b 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 c2d50bd..7f7bf59 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>>]
diff --git a/dh_md5sums b/dh_md5sums
index 887e213..b3a3a74 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<dh_md5sums> [S<I<debhelper options>>] [B<-x>] [B<-X>I<item>] [B<--include-conffiles>]
diff --git a/dh_missing b/dh_missing
index c78bf6d..f882fb8 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<dh_missing> [B<-X>I<item>] [B<--sourcedir=>I<dir>] [S<I<debhelper options>>]
diff --git a/dh_movefiles b/dh_movefiles
index 1014c08..7c5c8ff 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> ...>]
diff --git a/dh_perl b/dh_perl
index 8a70c99..b536099 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<dh_perl> [S<I<debhelper options>>] [B<-d>] [S<I<library dirs> ...>]
diff --git a/dh_prep b/dh_prep
index 57410d5..518b6eb 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<dh_prep> [S<I<debhelper options>>] [B<-X>I<item>]
diff --git a/dh_shlibdeps b/dh_shlibdeps
index 82f7d1e..0e847c6 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>>]
diff --git a/dh_strip b/dh_strip
index c2741c5..bcc8e09 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<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 b89c951..9a256b0 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 46c14a7..740a311 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> ...>]
diff --git a/dh_testdir b/dh_testdir
index 4c8715d..4fb5a9c 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<dh_testdir> [S<I<debhelper options>>] [S<I<file> ...>]
diff --git a/dh_testroot b/dh_testroot
index 557207e..ed324e8 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) {
diff --git a/dh_ucf b/dh_ucf
index 638ca1a..4f940dc 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<dh_ucf> [S<I<debhelper options>>] [B<-n>]
diff --git a/dh_update_autotools_config b/dh_update_autotools_config
index 1c14ba8..d9ce75a 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 a552788..86f2bd9 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 c5627b3..0cbe21a 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:
 -------------------

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list