Просмотр исходного кода

Dpkg: Deprecate lowercase exported by default variables

Rename, uppercase and do not export new variables by default, to avoid
cluttering the caller namespace, and to give them consistent names. We'll
keep the old variables for a while, to not break uses from external
modules.

Addresses Variables::ProhibitPackageVars.
Guillem Jover лет назад: 13
Родитель
Сommit
fb5285f569

+ 2 - 0
debian/changelog

@@ -88,6 +88,8 @@ dpkg (1.17.0) UNRELEASED; urgency=low
   * Print correct path to vendor directory on error message in dpkg-vendor.
   * Do not hardcode the dpkg system configuration directory in perl scripts,
     respect build time setting.
+  * Deprecate Dpkg lowercase and exported by default variables, replaced by
+    new unified uppercase non-exported by default ones.
 
   [ Updated manpages translations ]
   * Fix incorrect translation of "fortify" in French manpage for dpkg-buildflags

+ 16 - 8
scripts/Dpkg.pm

@@ -16,20 +16,28 @@ package Dpkg;
 use strict;
 use warnings;
 
-our $VERSION = '1.00';
+our $VERSION = '1.01';
 
 use base qw(Exporter);
-our @EXPORT_OK = qw($CONFDIR);
+our @EXPORT_OK = qw($PROGNAME $PROGVERSION $CONFDIR $ADMINDIR $LIBDIR $DATADIR);
 our @EXPORT = qw($version $progname $admindir $dpkglibdir $pkgdatadir);
 
-our ($progname) = $0 =~ m{(?:.*/)?([^/]*)};
+our ($PROGNAME) = $0 =~ m{(?:.*/)?([^/]*)};
 
 # The following lines are automatically fixed at install time
-our $version = '1.17.x';
+our $PROGVERSION = '1.17.x';
 our $CONFDIR = '/etc/dpkg';
-our $admindir = '/var/lib/dpkg';
-our $dpkglibdir = '.';
-our $pkgdatadir = '..';
-$pkgdatadir = $ENV{DPKG_DATADIR} if defined $ENV{DPKG_DATADIR};
+our $ADMINDIR = '/var/lib/dpkg';
+our $LIBDIR = '.';
+our $DATADIR = '..';
+$DATADIR = $ENV{DPKG_DATADIR} if defined $ENV{DPKG_DATADIR};
+
+# XXX: Backwards compatibility, to be removed on VERSION 2.00.
+## no critic (Variables::ProhibitPackageVars)
+our $version = $PROGVERSION;
+our $admindir = $ADMINDIR;
+our $dpkglibdir = $LIBDIR;
+our $pkgdatadir = $DATADIR;
+## use critic
 
 1;

+ 5 - 5
scripts/Dpkg/Arch.pm

@@ -31,7 +31,7 @@ our @EXPORT_OK = qw(get_raw_build_arch get_raw_host_arch
                     gnutriplet_to_multiarch debarch_to_multiarch);
 
 use POSIX qw(:errno_h);
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::BuildEnv;
@@ -146,7 +146,7 @@ sub read_cputable
     local $_;
     local $/ = "\n";
 
-    open my $cputable_fh, '<', "$pkgdatadir/cputable"
+    open my $cputable_fh, '<', "$Dpkg::DATADIR/cputable"
 	or syserr(_g('cannot open %s'), 'cputable');
     while (<$cputable_fh>) {
 	if (m/^(?!\#)(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/) {
@@ -170,7 +170,7 @@ sub read_ostable
     local $_;
     local $/ = "\n";
 
-    open my $ostable_fh, '<', "$pkgdatadir/ostable"
+    open my $ostable_fh, '<', "$Dpkg::DATADIR/ostable"
 	or syserr(_g('cannot open %s'), 'ostable');
     while (<$ostable_fh>) {
 	if (m/^(?!\#)(\S+)\s+(\S+)\s+(\S+)/) {
@@ -196,7 +196,7 @@ sub abitable_load()
     # it does not exist, as that will only mean the other tables do not have
     # an entry needing to be overridden. This way we do not require a newer
     # dpkg by libdpkg-perl.
-    if (open my $abitable_fh, '<', "$pkgdatadir/abitable") {
+    if (open my $abitable_fh, '<', "$Dpkg::DATADIR/abitable") {
         while (<$abitable_fh>) {
             if (m/^(?!\#)(\S+)\s+(\S+)/) {
                 $abibits{$1} = $2;
@@ -220,7 +220,7 @@ sub read_triplettable()
     local $_;
     local $/ = "\n";
 
-    open my $triplettable_fh, '<', "$pkgdatadir/triplettable"
+    open my $triplettable_fh, '<', "$Dpkg::DATADIR/triplettable"
 	or syserr(_g('cannot open %s'), 'triplettable');
     while (<$triplettable_fh>) {
 	if (m/^(?!\#)(\S+)\s+(\S+)/) {

+ 2 - 2
scripts/Dpkg/Changelog/Parse.pm

@@ -36,7 +36,7 @@ use warnings;
 
 our $VERSION = '1.00';
 
-use Dpkg; # for $dpkglibdir
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Control::Changelog;
@@ -75,7 +75,7 @@ it's passed as the parameter that follows.
 sub changelog_parse {
     my (%options) = @_;
     my @parserpath = ('/usr/local/lib/dpkg/parsechangelog',
-                      "$dpkglibdir/parsechangelog",
+                      "$Dpkg::LIBDIR/parsechangelog",
                       '/usr/lib/dpkg/parsechangelog');
     my $format = 'debian';
     my $changelogfile = 'debian/changelog';

+ 1 - 1
scripts/Dpkg/Control.pm

@@ -93,7 +93,7 @@ Corresponds to a vendor file in $Dpkg::CONFDIR/origins/.
 
 =item CTRL_FILE_STATUS
 
-Corresponds to an entry in dpkg's status file (/var/lib/dpkg/status).
+Corresponds to an entry in dpkg's status file ($Dpkg::ADMINDIR/status).
 
 =item CTRL_CHANGELOG
 

+ 1 - 1
scripts/Dpkg/Control/Types.pm

@@ -47,7 +47,7 @@ use constant {
     CTRL_PKG_DEB => 32,      # DEBIAN/control in binary packages
     CTRL_FILE_CHANGES => 64, # .changes file
     CTRL_FILE_VENDOR => 128, # File in $Dpkg::CONFDIR/origins
-    CTRL_FILE_STATUS => 256, # /var/lib/dpkg/status
+    CTRL_FILE_STATUS => 256, # $Dpkg::ADMINDIR/status
     CTRL_CHANGELOG => 512,   # Output of dpkg-parsechangelog
 };
 

+ 3 - 3
scripts/Dpkg/ErrorHandling.pm

@@ -18,7 +18,7 @@ use warnings;
 
 our $VERSION = '0.01';
 
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 
 use base qw(Exporter);
@@ -46,7 +46,7 @@ sub report(@)
     my ($type, $msg) = (shift, shift);
 
     $msg = sprintf($msg, @_) if (@_);
-    return "$progname: $type: $msg\n";
+    return "$Dpkg::PROGNAME: $type: $msg\n";
 }
 
 sub info($;@)
@@ -102,7 +102,7 @@ sub usageerr(@)
     my ($msg) = (shift);
 
     $msg = sprintf($msg, @_) if (@_);
-    warn "$progname: $msg\n\n";
+    warn "$Dpkg::PROGNAME: $msg\n\n";
     # XXX: access to main namespace
     main::usage();
     exit(2);

+ 2 - 2
scripts/Dpkg/Source/Package/V1.pm

@@ -22,7 +22,7 @@ our $VERSION = '0.01';
 
 use base 'Dpkg::Source::Package';
 
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Compression;
@@ -387,7 +387,7 @@ sub do_build {
 
     if ($ur) {
         printf(STDERR _g('%s: unrepresentable changes to source') . "\n",
-               $progname);
+               $Dpkg::PROGNAME);
         exit(1);
     }
 }

+ 3 - 3
scripts/Dpkg/Substvars.pm

@@ -21,7 +21,7 @@ use warnings;
 
 our $VERSION = '1.02';
 
-use Dpkg qw($version);
+use Dpkg qw();
 use Dpkg::Arch qw(get_host_arch);
 use Dpkg::ErrorHandling;
 use Dpkg::Gettext;
@@ -70,8 +70,8 @@ sub new {
             'Newline' => "\n",
             'Space' => ' ',
             'Tab' => "\t",
-            'dpkg:Version' => $version,
-            'dpkg:Upstream-Version' => $version,
+            'dpkg:Version' => $Dpkg::PROGVERSION,
+            'dpkg:Upstream-Version' => $Dpkg::PROGVERSION,
             },
         used => {},
 	msg_prefix => '',

+ 4 - 4
scripts/Makefile.am

@@ -116,10 +116,10 @@ man3_MANS =
 do_perl_subst = $(AM_V_GEN) \
 		sed -e "s:^\#![[:space:]]*/usr/bin/perl:\#!$(PERL):" \
 		    -e "s:\$$CONFDIR[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$CONFDIR='$(pkgconfdir)':" \
-		    -e "s:\$$dpkglibdir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$dpkglibdir='$(pkglibdir)':" \
-		    -e "s:\$$pkgdatadir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$pkgdatadir='$(pkgdatadir)':" \
-		    -e "s:\$$admindir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$admindir='$(admindir)':" \
-		    -e "s:\$$version[[:space:]]*=[[:space:]]*['\"][^'\"]*[\"']:\$$version='$(PACKAGE_VERSION)':"
+		    -e "s:\$$ADMINDIR[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$ADMINDIR='$(admindir)':" \
+		    -e "s:\$$LIBDIR[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$LIBDIR='$(pkglibdir)':" \
+		    -e "s:\$$DATADIR[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$DATADIR='$(pkgdatadir)':" \
+		    -e "s:\$$PROGVERSION[[:space:]]*=[[:space:]]*['\"][^'\"]*[\"']:\$$PROGVERSION='$(PACKAGE_VERSION)':"
 
 do_shell_subst = $(AM_V_GEN) \
 		 sed -e "s:^version[[:space:]]*=[[:space:]]*['\"][^'\"]*[\"']:version=\"$(PACKAGE_VERSION)\":"

+ 4 - 4
scripts/changelog/debian.pl

@@ -24,17 +24,17 @@ use warnings;
 
 use Getopt::Long qw(:config posix_default bundling no_ignorecase);
 
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Changelog::Debian;
 
 textdomain('dpkg-dev');
 
-$progname = "parsechangelog/$progname";
+$Dpkg::PROGNAME = "parsechangelog/$Dpkg::PROGNAME";
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $progname, $version;
+    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
     printf _g('
 This is free software; see the GNU General Public License version 2 or
@@ -68,7 +68,7 @@ Options:
                                 counted from the top (or the tail if
                                 <number> is lower than 0)
     --all                       include all changes
-"), $progname;
+"), $Dpkg::PROGNAME;
 }
 
 my ( $since, $until, $from, $to, $all, $count, $offset, $file, $label );

+ 3 - 3
scripts/dpkg-architecture.pl

@@ -22,7 +22,7 @@
 use strict;
 use warnings;
 
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Arch qw(get_raw_build_arch get_raw_host_arch get_gcc_host_gnu_type
@@ -34,7 +34,7 @@ use Dpkg::Arch qw(get_raw_build_arch get_raw_host_arch get_gcc_host_gnu_type
 textdomain('dpkg-dev');
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $progname, $version;
+    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
     printf _g('
 This is free software; see the GNU General Public License version 2 or
@@ -62,7 +62,7 @@ sub usage {
   -c <command>       set environment and run the command in it.
   -?, --help         show this help message.
       --version      show the version.
-'), $progname;
+'), $Dpkg::PROGNAME;
 }
 
 sub list_arches()

+ 3 - 3
scripts/dpkg-buildflags.pl

@@ -21,7 +21,7 @@
 use strict;
 use warnings;
 
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling qw(:DEFAULT report);
 use Dpkg::BuildFlags;
@@ -30,7 +30,7 @@ use Dpkg::Vendor qw(get_current_vendor);
 textdomain('dpkg-dev');
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $progname, $version;
+    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
     printf _g('
 This is free software; see the GNU General Public License version 2 or
@@ -58,7 +58,7 @@ sub usage {
                      and their origin.
   --help             show this help message.
   --version          show the version.
-'), $progname;
+'), $Dpkg::PROGNAME;
 }
 
 my ($param, $action);

+ 5 - 5
scripts/dpkg-buildpackage.pl

@@ -27,7 +27,7 @@ use Cwd;
 use File::Basename;
 use POSIX qw(:sys_wait_h);
 
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::BuildOptions;
@@ -40,7 +40,7 @@ use Dpkg::IPC;
 textdomain('dpkg-dev');
 
 sub showversion {
-    printf _g("Debian %s version %s.\n"), $progname, $version;
+    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
     print _g('
 This is free software; see the GNU General Public License version 2 or
@@ -105,7 +105,7 @@ sub usage {
   -I[<pattern>]  filter out files when building tarballs.
       --source-option=<opt>
                  pass option <opt> to dpkg-source.
-'), $progname;
+'), $Dpkg::PROGNAME;
 }
 
 my @debian_rules = ('debian/rules');
@@ -507,7 +507,7 @@ chdir($dir) or syserr("chdir $dir");
 if (not $signreleased) {
     warning(_g('not signing UNRELEASED build; use --force-sign to override'));
 }
-print "$progname: $srcmsg\n";
+print "$Dpkg::PROGNAME: $srcmsg\n";
 if ($signerrors) {
     warning($signerrors);
     exit 1;
@@ -519,7 +519,7 @@ sub mustsetvar {
     error(_g('unable to determine %s'), $text)
 	unless defined($var);
 
-    print "$progname: $text $var\n";
+    print "$Dpkg::PROGNAME: $text $var\n";
     return $var;
 }
 

+ 6 - 5
scripts/dpkg-checkbuilddeps.pl

@@ -24,7 +24,7 @@ use warnings;
 
 use Getopt::Long qw(:config posix_default bundling no_ignorecase);
 
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Arch qw(get_host_arch);
@@ -35,7 +35,7 @@ textdomain('dpkg-dev');
 
 sub version()
 {
-	printf(_g("Debian %s version %s.\n"), $progname, $version);
+	printf(_g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION);
 	exit(0);
 }
 
@@ -57,13 +57,14 @@ sub usage {
       --version  show the version.')
 	. "\n\n" . _g(
 '<control-file> is the control file to process (default: debian/control).')
-	. "\n", $progname;
+	. "\n", $Dpkg::PROGNAME;
 }
 
 my $ignore_bd_arch = 0;
 my $ignore_bd_indep = 0;
 my ($bd_value, $bc_value);
 my $host_arch = get_host_arch();
+my $admindir = $Dpkg::ADMINDIR;
 if (!GetOptions('A' => \$ignore_bd_arch,
                 'B' => \$ignore_bd_indep,
                 'help|?' => sub { usage(); exit(0); },
@@ -108,11 +109,11 @@ if ($bc_value) {
 }
 
 if (@unmet) {
-	printf STDERR _g('%s: Unmet build dependencies: '), $progname;
+	printf STDERR _g('%s: Unmet build dependencies: '), $Dpkg::PROGNAME;
 	print STDERR join(' ', map { $_->output() } @unmet), "\n";
 }
 if (@conflicts) {
-	printf STDERR _g('%s: Build conflicts: '), $progname;
+	printf STDERR _g('%s: Build conflicts: '), $Dpkg::PROGNAME;
 	print STDERR join(' ', map { $_->output() } @conflicts), "\n";
 }
 exit 1 if @unmet || @conflicts;

+ 3 - 3
scripts/dpkg-distaddfile.pl

@@ -22,7 +22,7 @@ use strict;
 use warnings;
 
 use POSIX qw(:errno_h :fcntl_h);
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::File;
@@ -33,7 +33,7 @@ my $fileslistfile = 'debian/files';
 
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $progname, $version;
+    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
     printf _g('
 This is free software; see the GNU General Public License version 2 or
@@ -49,7 +49,7 @@ Options:
   -f<files-list-file>      write files here instead of debian/files.
   -?, --help               show this help message.
       --version            show the version.
-'), $progname;
+'), $Dpkg::PROGNAME;
 }
 
 while (@ARGV && $ARGV[0] =~ m/^-/) {

+ 6 - 6
scripts/dpkg-genchanges.pl

@@ -24,7 +24,7 @@ use warnings;
 
 use Encode;
 use POSIX qw(:errno_h);
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::File;
 use Dpkg::Checksums;
@@ -97,7 +97,7 @@ sub binary_opt() { return (($include == BIN) ? '-b' :
 }
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $progname, $version;
+    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
     printf _g('
 This is free software; see the GNU General Public License version 2 or
@@ -133,7 +133,7 @@ sub usage {
   -U<field>                remove a field.
   -?, --help               show this help message.
       --version            show the version.
-"), $progname;
+"), $Dpkg::PROGNAME;
 }
 
 
@@ -145,11 +145,11 @@ while (@ARGV) {
     } elsif (m/^-B$/) {
 	is_sourceonly && usageerr(_g('cannot combine %s and %s'), $_, '-S');
 	$include = ARCH_DEP;
-	printf STDERR _g('%s: arch-specific upload - not including arch-independent packages') . "\n", $progname;
+	printf STDERR _g('%s: arch-specific upload - not including arch-independent packages') . "\n", $Dpkg::PROGNAME;
     } elsif (m/^-A$/) {
 	is_sourceonly && usageerr(_g('cannot combine %s and %s'), $_, '-S');
 	$include = ARCH_INDEP;
-	printf STDERR _g('%s: arch-indep upload - not including arch-specific packages') . "\n", $progname;
+	printf STDERR _g('%s: arch-indep upload - not including arch-specific packages') . "\n", $Dpkg::PROGNAME;
     } elsif (m/^-S$/) {
 	is_binaryonly && usageerr(_g('cannot combine %s and %s'), binary_opt, '-S');
 	$include = SOURCE;
@@ -443,7 +443,7 @@ if (!is_binaryonly) {
     $origsrcmsg= _g('binary-only upload - not including any source code');
 }
 
-print(STDERR "$progname: $origsrcmsg\n") ||
+print(STDERR "$Dpkg::PROGNAME: $origsrcmsg\n") ||
     syserr(_g('write original source message')) unless $quiet;
 
 $fields->{'Format'} = $substvars->get('Format');

+ 3 - 3
scripts/dpkg-gencontrol.pl

@@ -23,7 +23,7 @@ use strict;
 use warnings;
 
 use POSIX qw(:errno_h :fcntl_h);
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::File;
@@ -59,7 +59,7 @@ my $substvars_loaded = 0;
 
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $progname, $version;
+    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
     printf _g('
 This is free software; see the GNU General Public License version 2 or
@@ -88,7 +88,7 @@ sub usage {
   -T<substvars-file>       read variables here, not debian/substvars.
   -?, --help               show this help message.
       --version            show the version.
-'), $progname;
+'), $Dpkg::PROGNAME;
 }
 
 while (@ARGV) {

+ 3 - 3
scripts/dpkg-gensymbols.pl

@@ -21,7 +21,7 @@
 use strict;
 use warnings;
 
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Arch qw(get_host_arch);
 use Dpkg::Package;
 use Dpkg::Shlibs qw(@librarypaths);
@@ -50,7 +50,7 @@ my $debug = 0;
 my $host_arch = get_host_arch();
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $progname, $version;
+    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
     printf _g('
 This is free software; see the GNU General Public License version 2 or
@@ -88,7 +88,7 @@ sub usage {
   -d                       display debug information during work.
   -?, --help               show this help message.
       --version            show the version.
-'), $progname;
+'), $Dpkg::PROGNAME;
 }
 
 my @files;

+ 3 - 3
scripts/dpkg-mergechangelogs.pl

@@ -19,7 +19,7 @@
 use warnings;
 use strict;
 
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Changelog::Debian;
 use Dpkg::ErrorHandling;
 use Dpkg::Gettext;
@@ -51,7 +51,7 @@ BEGIN {
 }
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $progname, $version;
+    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
     printf "\n" . _g(
 'This is free software; see the GNU General Public License version 2 or
@@ -68,7 +68,7 @@ Options:
                            after the last '~' in the version.
   -?, --help               show this help message.
       --version            show the version.
-"), $progname);
+"), $Dpkg::PROGNAME);
 }
 
 my $merge_prereleases;

+ 3 - 3
scripts/dpkg-name.pl

@@ -24,7 +24,7 @@ use strict;
 use File::Basename;
 use File::Path;
 
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Control;
@@ -43,12 +43,12 @@ my %options = (
 
 sub version()
 {
-    printf(_g("Debian %s version %s.\n"), $progname, $version);
+    printf(_g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION);
 }
 
 sub usage()
 {
-    printf(_g("Usage: %s [<option>...] <file>...\n"), $progname);
+    printf(_g("Usage: %s [<option>...] <file>...\n"), $Dpkg::PROGNAME);
 
     print(_g("
 Options:

+ 3 - 3
scripts/dpkg-parsechangelog.pl

@@ -22,7 +22,7 @@
 use strict;
 use warnings;
 
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Changelog::Parse;
@@ -33,7 +33,7 @@ my %options;
 my $fieldname;
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $progname, $version;
+    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
     printf _g('
 This is free software; see the GNU General Public License version 2 or
@@ -71,7 +71,7 @@ sub usage {
       -o<number>                counted from the top (or the tail if
                                 <number> is lower than 0)
     --all                       include all changes
-"), $progname;
+"), $Dpkg::PROGNAME;
 }
 
 while (@ARGV) {

+ 3 - 3
scripts/dpkg-scanpackages.pl

@@ -24,7 +24,7 @@ use IO::Handle;
 use IO::File;
 use Getopt::Long qw(:config posix_default bundling no_ignorecase);
 
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Control;
@@ -58,7 +58,7 @@ my $result = GetOptions(\%options,
                         'medium|M=s');
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $progname, $version;
+    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
     exit;
 }
 
@@ -75,7 +75,7 @@ Options:
   -M, --medium <medium>    add X-Medium field for dselect multicd access method
   -?, --help               show this help message.
       --version            show the version.
-"), $progname;
+"), $Dpkg::PROGNAME;
 }
 
 sub load_override

+ 3 - 3
scripts/dpkg-scansources.pl

@@ -22,7 +22,7 @@ use warnings;
 
 use Getopt::Long qw(:config posix_default bundling no_ignorecase);
 
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Control;
@@ -75,7 +75,7 @@ sub debug {
 }
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $progname, $version;
+    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
     exit;
 }
 
@@ -95,7 +95,7 @@ Options:
       --version            show the version.
 
 See the man page for the full documentation.
-"), $progname;
+"), $Dpkg::PROGNAME;
 
     exit;
 }

+ 4 - 3
scripts/dpkg-shlibdeps.pl

@@ -28,7 +28,7 @@ use POSIX qw(:errno_h);
 use Cwd qw(realpath);
 use File::Basename qw(dirname);
 
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Path qw(relative_to_pkg_root guess_pkg_root_dir
@@ -55,6 +55,7 @@ my $i = 0; my %depstrength = map { $_ => $i++ } @depfields;
 
 textdomain('dpkg-dev');
 
+my $admindir = $Dpkg::ADMINDIR;
 my $shlibsoverride = "$Dpkg::CONFDIR/shlibs.override";
 my $shlibsdefault = "$Dpkg::CONFDIR/shlibs.default";
 my $shlibslocal = 'debian/shlibs.local';
@@ -539,7 +540,7 @@ if (!$stdout) {
 ##
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $progname, $version;
+    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
     printf _g('
 This is free software; see the GNU General Public License version 2 or
@@ -574,7 +575,7 @@ sub usage {
     . "\n\n" . _g(
 'Dependency fields recognized are:
   %s
-'), $progname, join('/', @depfields);
+'), $Dpkg::PROGNAME, join('/', @depfields);
 }
 
 sub get_min_version_from_deps {

+ 3 - 3
scripts/dpkg-source.pl

@@ -28,7 +28,7 @@
 use strict;
 use warnings;
 
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Arch qw(debarch_eq debarch_is debarch_is_wildcard);
@@ -464,7 +464,7 @@ sub setopmode {
 }
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $progname, $version;
+    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
     print _g('
 This is free software; see the GNU General Public License version 2 or
@@ -514,7 +514,7 @@ sub usage {
     . "\n\n" . _g(
 'More options are available but they depend on the source package format.
 See dpkg-source(1) for more info.') . "\n",
-    $progname,
+    $Dpkg::PROGNAME,
     $Dpkg::Source::Package::diff_ignore_default_regexp,
     join(' ', map { "-I$_" } @Dpkg::Source::Package::tar_ignore_default_pattern),
     compression_get_default(),

+ 3 - 3
scripts/dpkg-vendor.pl

@@ -21,7 +21,7 @@
 use strict;
 use warnings;
 
-use Dpkg;
+use Dpkg qw();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Vendor qw(get_vendor_dir get_vendor_info get_current_vendor);
@@ -29,7 +29,7 @@ use Dpkg::Vendor qw(get_vendor_dir get_vendor_info get_current_vendor);
 textdomain('dpkg-dev');
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $progname, $version;
+    printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
 
     printf _g('
 This is free software; see the GNU General Public License version 2 or
@@ -50,7 +50,7 @@ sub usage {
   --query <field>         print the content of the vendor-specific field.
   --help                  show this help message.
   --version               show the version.
-'), $progname;
+'), $Dpkg::PROGNAME;
 }
 
 my ($vendor, $param, $action);

+ 2 - 2
scripts/t/750_Dpkg_Substvars.t

@@ -18,7 +18,7 @@ use Test::More tests => 32;
 use strict;
 use warnings;
 
-use Dpkg qw($version);
+use Dpkg qw();
 use Dpkg::Arch qw(get_host_arch);
 
 use_ok('Dpkg::Substvars');
@@ -48,7 +48,7 @@ is($s->get('var3'), undef, 'var3 deleted');
 is($s->get('Newline'), "\n", 'newline');
 is($s->get('Space'), ' ', 'space');
 is($s->get('Tab'), "\t", 'tab');
-is($s->get('dpkg:Version'), $version, 'dpkg version 1');
+is($s->get('dpkg:Version'), $Dpkg::PROGVERSION, 'dpkg version 1');
 
 # special variables
 is($s->get('Arch'), undef, 'no arch');