]> err.no Git - dpkg/commitdiff
Switch perl programs to use the new Dpkg module and its variables.
authorGuillem Jover <guillem@debian.org>
Sun, 22 Jul 2007 00:31:25 +0000 (00:31 +0000)
committerGuillem Jover <guillem@debian.org>
Sun, 22 Jul 2007 00:31:25 +0000 (00:31 +0000)
18 files changed:
ChangeLog
debian/changelog
scripts/cleanup-info.pl
scripts/controllib.pl
scripts/dpkg-architecture.pl
scripts/dpkg-checkbuilddeps.pl
scripts/dpkg-distaddfile.pl
scripts/dpkg-divert.pl
scripts/dpkg-genchanges.pl
scripts/dpkg-gencontrol.pl
scripts/dpkg-parsechangelog.pl
scripts/dpkg-scanpackages.pl
scripts/dpkg-scansources.pl
scripts/dpkg-shlibdeps.pl
scripts/dpkg-source.pl
scripts/dpkg-statoverride.pl
scripts/install-info.pl
scripts/update-alternatives.pl

index f78c72e845a7e5fc0fad5c4f1bc5e22709e91d74..e79bda5733035e65967f2fe800b375284c959f2a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2007-07-22  Guillem Jover  <guillem@debian.org>
+
+       * scripts/cleanup-info.pl: Use new Dpkg module, and remove variable
+       declarations already done in the module.
+       * scripts/controllib.pl: Likewise.
+       * scripts/dpkg-architecture.pl: Likewise.
+       * scripts/dpkg-checkbuilddeps.pl: Likewise.
+       * scripts/dpkg-distaddfile.pl: Likewise.
+       * scripts/dpkg-divert.pl: Likewise.
+       * scripts/dpkg-genchanges.pl: Likewise.
+       * scripts/dpkg-gencontrol.pl: Likewise.
+       * scripts/dpkg-parsechangelog.pl: Likewise.
+       * scripts/dpkg-scanpackages.pl: Likewise.
+       * scripts/dpkg-scansources.pl: Likewise.
+       * scripts/dpkg-shlibdeps.pl: Likewise.
+       * scripts/dpkg-source.pl: Likewise.
+       * scripts/dpkg-statoverride.pl: Likewise.
+       * scripts/install-info.pl: Likewise.
+       * scripts/update-alternatives.pl: Likewise.
+
+       * scripts/controllib.pl (init_substvars): Remove comment about
+       $version needing to be a global variable set elsewhere.
+
+       * scripts/dpkg-scanpackages.pl: Remove $0 mangling.
+       (version, usage): Use $progname instead of $0.
+       * scripts/dpkg-statoverride.pl: Likewise.
+       * scripts/install-info.pl: Likewise.
+       * scripts/dpkg-divert.pl: Likewise.
+       (quit, badusage): Use $progname instead of $0.
+       * scripts/update-alternatives.pl: Likewise.
+       * scripts/dpkg-scansources.pl ($Me): Remove declaration.
+       (xwarndie_mess, version, usage): Use $progname instead of $Me.
+
 2007-07-21  Guillem Jover  <guillem@debian.org>
 
        * m4/perl.m4 (DPKG_PROG_PERL): Add support for user overridable
index 735ffe014a32510fbdf187f32c3e9005fe5a2bdd..8a44db8a3bfe43efcd8b6c9a2dcee6f68d280853 100644 (file)
@@ -15,7 +15,7 @@ dpkg (1.14.6) UNRELEASED; urgency=low
     - Split option descriptions so that it gets easier to distinguish.
     - Unify author and copyright information formatting.
   * Move variables automatically modified at build time to a new style perl
-    module.
+    module and make all programs use the new module..
 
   [ Updated scripts translations ]
   * French (Frédéric Bothamy, Christian Perrier).
index 7324d197b1869a2042ba4134ef1800f4cbd97213..5fcbdc8b79a54eff4ef4649c87988698dc3b0732 100755 (executable)
 use strict;
 use warnings;
 
-my $dpkglibdir = "."; # This line modified by Makefile
+use Dpkg;
+
 push(@INC,$dpkglibdir);
 require 'dpkg-gettext.pl';
 textdomain("dpkg");
 
 ($0) = $0 =~ m:.*/(.+):;
 
-my $version = '1.1.6'; # This line modified by Makefile
 sub version {
     printf _g("Debian %s version %s.\n"), $0, $version;
 
index 9cf0382688ebab8d69c9debfd8f76c912ba09251..96731cab5475fa853b3dcd99578ff32f32e1037c 100755 (executable)
@@ -5,9 +5,7 @@ use warnings;
 
 use English;
 use POSIX qw(:errno_h);
-
-our $dpkglibdir;
-our $pkgdatadir;
+use Dpkg;
 
 push(@INC,$dpkglibdir);
 require 'dpkg-gettext.pl';
@@ -36,10 +34,6 @@ our @src_dep_fields = qw(Build-Depends Build-Depends-Indep
 our $warnable_error = 1;
 our $quiet_warnings = 0;
 
-our $version;
-our $progname = $0;
-$progname = $& if $progname =~ m,[^/]+$,;
-
 
 sub getfowner
 {
@@ -551,8 +545,6 @@ sub init_substvars
     $substvar{'source:Upstream-Version'} = $fi{"L Version"};
     $substvar{'source:Upstream-Version'} =~ s/-[^-]*$//;
 
-    # FIXME: this needs all progs using controllib to set $version as 'our'.
-    # We expect the calling program to set $version.
     $substvar{"dpkg:Version"} = $version;
     $substvar{"dpkg:Upstream-Version"} = $version;
     $substvar{"dpkg:Upstream-Version"} =~ s/-[^-]+$//;
index 9b89a2f75980cb8036164f7fe81d9e2cf090693f..c199e0bafa65e0471b64304a01fb7318830098d2 100755 (executable)
 use strict;
 use warnings;
 
-our $progname;
-our $version = "1.0.0"; # This line modified by Makefile
-our $dpkglibdir = "."; # This line modified by Makefile
-our $pkgdatadir = ".."; # This line modified by Makefile
+use Dpkg;
 
 push(@INC,$dpkglibdir);
 require 'controllib.pl';
index 79cd2d9c2dde2e81ce938712f1c00d8efe88813f..881631685053670b94a701a5c488b24959f2553d 100755 (executable)
@@ -4,13 +4,9 @@
 use strict;
 use warnings;
 
-our $progname;
-our $dpkglibdir = "."; # This line modified by Makefile
-our $pkgdatadir = ".."; # This line modified by Makefile
-
 use Getopt::Long;
+use Dpkg;
 
-my $admindir = "/var/lib/dpkg";
 push(@INC,$dpkglibdir);
 require 'controllib.pl';
 
index 5002cb461da1a88e69659d8f80886369f5bdfb5f..155550118ba08b2e5d1397d7145d008a28cac259 100755 (executable)
@@ -3,12 +3,9 @@
 use strict;
 use warnings;
 
-our $progname;
-our $version = '1.3.0'; # This line modified by Makefile
-our $dpkglibdir = "."; # This line modified by Makefile
-
 use POSIX;
 use POSIX qw(:errno_h :signal_h);
+use Dpkg;
 
 push(@INC,$dpkglibdir);
 require 'controllib.pl';
index 9e6661526f0b496cfef57df6f57e5d805451408d..784847172849dd97c07f1a301a864c26677fa1ad 100755 (executable)
@@ -3,10 +3,7 @@
 use strict;
 use warnings;
 
-my $version = '1.0.11'; # This line modified by Makefile
-my $admindir = "/var/lib/dpkg"; # This line modified by Makefile
-my $dpkglibdir = "../utils"; # This line modified by Makefile
-($0) = $0 =~ m:.*/(.+):;
+use Dpkg;
 
 push (@INC, $dpkglibdir);
 require 'dpkg-gettext.pl';
@@ -16,7 +13,7 @@ my $enoent = `$dpkglibdir/enoent` || die sprintf(_g("Cannot get ENOENT value fro
 sub ENOENT { $enoent; }
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $0, $version;
+    printf _g("Debian %s version %s.\n"), $progname, $version;
 
     printf _g("
 Copyright (C) 1995 Ian Jackson.
@@ -53,7 +50,7 @@ Options:
 When adding, default is --local and --divert <original>.distrib.
 When removing, --package or --local and --divert must match if specified.
 Package preinst/postrm scripts should always specify --package and --divert.
-"), $0);
+"), $progname);
 }
 
 my $testmode = 0;
@@ -296,13 +293,13 @@ sub infon
 
 sub quit
 {
-    printf STDERR "%s: %s\n", $0, "@_";
+    printf STDERR "%s: %s\n", $progname, "@_";
     exit(2);
 }
 
 sub badusage
 {
-    printf STDERR "%s: %s\n\n", $0, "@_";
+    printf STDERR "%s: %s\n\n", $progname, "@_";
     &usage;
     exit(2);
 }
index 54abf1bbe07910500931060ff37f706077b9a17e..51c90a6debfc112145cbbdd1773f1b4bad0ee1a8 100755 (executable)
@@ -3,13 +3,9 @@
 use strict;
 use warnings;
 
-our $progname;
-our $version = '1.3.0'; # This line modified by Makefile
-our $dpkglibdir = "."; # This line modified by Makefile
-our $pkgdatadir = ".."; # This line modified by Makefile
-
 use POSIX;
 use POSIX qw(:errno_h :signal_h);
+use Dpkg;
 
 push(@INC,$dpkglibdir);
 require 'controllib.pl';
index 56ac9af5b9c01935ed6fdb73731a8ba99e8762dd..6f7ec1a59090a5242b1384096a54606de4b560b8 100755 (executable)
@@ -3,17 +3,13 @@
 use strict;
 use warnings;
 
-our $version = '1.3.0'; # This line modified by Makefile
-our $dpkglibdir = "."; # This line modified by Makefile
-our $pkgdatadir = ".."; # This line modified by Makefile
-
 use POSIX;
 use POSIX qw(:errno_h);
+use Dpkg;
 
 push(@INC,$dpkglibdir);
 require 'controllib.pl';
 
-our $progname;
 our %substvar;
 our (%f, %fi);
 our %fieldimps;
index 4a7df3cedc060e1088c79a07b064eb36b2114049..2ef223b5aefdd49fbc1d33a922c109c0464d9009 100755 (executable)
@@ -3,12 +3,9 @@
 use strict;
 use warnings;
 
-our $progname;
-our $version = '1.3.0'; # This line modified by Makefile
-our $dpkglibdir = "/usr/lib/dpkg"; # This line modified by Makefile
-
 use POSIX;
 use POSIX qw(:errno_h);
+use Dpkg;
 
 push(@INC,$dpkglibdir);
 require 'controllib.pl';
index a6d83d83add94c8ed143c5b9b7cefad1d1b34fe2..2581391ec220baade799324dba81e1346b3bbe0b 100755 (executable)
@@ -5,11 +5,7 @@ use strict;
 
 use IO::Handle;
 use IO::File;
-
-my $version= '1.2.6'; # This line modified by Makefile
-my $dpkglibdir= "."; # This line modified by Makefile
-
-($0) = $0 =~ m:.*/(.+):;
+use Dpkg;
 
 push(@INC,$dpkglibdir);
 require 'controllib.pl';
@@ -48,7 +44,7 @@ my %options = (help            => sub { &usage; exit 0; },
 my $result = GetOptions(\%options,'help|h|?','version','udeb|u!','arch|a=s','multiversion|m!');
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $0, $version;
+    printf _g("Debian %s version %s.\n"), $progname, $version;
     exit;
 }
 
@@ -62,7 +58,7 @@ Options:
   -m, --multiversion       allow multiple versions of a single package.
   -h, --help               show this help message.
       --version            show the version.
-"), $0;
+"), $progname;
 }
 
 sub load_override
index a3857a2255faadbe49583c46dd49ca41954ce0b2..4eade815ba40bf51e0278e62d7511dee905caf1c 100755 (executable)
@@ -29,7 +29,8 @@
 use strict;
 use warnings;
 
-my $dpkglibdir= "."; # This line modified by Makefile
+use Dpkg;
+
 push(@INC,$dpkglibdir);
 require 'dpkg-gettext.pl';
 textdomain("dpkg-dev");
@@ -37,8 +38,6 @@ textdomain("dpkg-dev");
 use Getopt::Long ();
 
 my $Exit = 0;
-(my $Me = $0) =~ s-.*/--;
-my $version= '1.6.2.1'; # This line modified by Makefile
 
 # %Override is a hash of lists.  The subs following describe what's in
 # the lists.
@@ -76,7 +75,7 @@ sub debug {
 }
 
 sub xwarndie_mess {
-    my @mess = ("$Me: ", @_);
+    my @mess = ("$progname: ", @_);
     $mess[$#mess] =~ s/:$/: $!\n/;     # XXX loses if it's really /:\n/
     return @mess;
 }
@@ -95,7 +94,7 @@ sub xwarn_noerror {
 }
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $Me, $version;
+    printf _g("Debian %s version %s.\n"), $progname, $version;
     exit;
 }
 
@@ -113,7 +112,7 @@ Options:
       --version            show the version.
 
 See the man page for the full documentation.
-"), $Me;
+"), $progname;
 
     exit;
 }
index 67f45d5abf7f52887930c3dbe9d2e9dfa19f3525..198d72671ec10dbe02d68f33717ee20d8ab3eb2f 100755 (executable)
@@ -6,13 +6,9 @@
 use strict;
 use warnings;
 
-our $progname;
-our $version = "1.4.1.19"; # This line modified by Makefile
-our $dpkglibdir = "/usr/lib/dpkg";
-my $admindir = "/var/lib/dpkg";
-
 use English;
 use POSIX qw(:errno_h :signal_h);
+use Dpkg;
 
 my $shlibsoverride= '/etc/dpkg/shlibs.override';
 my $shlibsdefault= '/etc/dpkg/shlibs.default';
index 97a5426209d83483c062e1046b898fc7d40665fa..4c92e3b1e38a4ecafba6f89e66e14a16693b9912 100755 (executable)
@@ -3,10 +3,7 @@
 use strict;
 use warnings;
 
-our $progname;
-our $version = "1.3.0"; # This line modified by Makefile
-our $dpkglibdir = "."; # This line modified by Makefile
-our $pkgdatadir = ".."; # This line modified by Makefile
+use Dpkg;
 
 my @filesinarchive;
 my %dirincluded;
index 5ee877e92f312c63468309ba0fb63236c366cf7c..e75eceff2ccd5687dbb6d37201d41e2bc0f99f8a 100755 (executable)
@@ -5,13 +5,8 @@ use warnings;
 
 use POSIX;
 use POSIX qw(:errno_h :signal_h);
+use Dpkg;
 
-my $admindir = "/var/lib/dpkg"; # This line modified by Makefile
-my $version = '1.3.0'; # This line modified by Makefile
-
-($0) = $0 =~ m:.*/(.+):;
-
-my $dpkglibdir= "."; # This line modified by Makefile
 push (@INC, $dpkglibdir);
 require 'dpkg-gettext.pl';
 textdomain("dpkg");
@@ -26,7 +21,7 @@ my %group;
 my %mode;
 
 sub version {
-       printf _g("Debian %s version %s.\n"), $0, $version;
+       printf _g("Debian %s version %s.\n"), $progname, $version;
 
        printf _g("
 Copyright (C) 2000 Wichert Akkerman.");
@@ -54,7 +49,7 @@ Options:
   --quiet                  quiet operation, minimal output.
   --help                   show this help message.
   --version                show the version.
-"), $0;
+"), $progname;
 }
 
 sub CheckModeConflict {
index a0c9571a5ea5d382d6f918377a7f8b822c4fe168..35f30d32c43a7192d2497164cbf5ba2e8ce63b8c 100755 (executable)
@@ -1,20 +1,17 @@
 #!/usr/bin/perl --
 
 use Text::Wrap;
+use Dpkg;
 
-my $dpkglibdir = "."; # This line modified by Makefile
 push (@INC, $dpkglibdir);
 require 'dpkg-gettext.pl';
 textdomain("dpkg");
 
-($0) = $0 =~ m:.*/(.+):;
-
 # fixme: sort entries
 # fixme: send to FSF ?
 
-$version= '0.93.42.2'; # This line modified by Makefile
 sub version {
-    printf _g("Debian %s version %s.\n"), $0, $version;
+    printf _g("Debian %s version %s.\n"), $progname, $version;
 
     printf _g("
 Copyright (C) 1994,1995 Ian Jackson.");
@@ -48,7 +45,7 @@ Options:
   --quiet                  do not show output messages.
   --help                   show this help message.
   --version                show the version.
-"), $0;
+"), $progname;
 }
 
 $dirfile = '/usr/share/info/dir';
index 0cd589c14142dad724f73841b4d8d32d353a46f1..1f879a0ce4919412f42395991d541c77e8c1adcb 100755 (executable)
@@ -3,15 +3,12 @@
 use strict;
 use warnings;
 
-my $admindir = "/var/lib/dpkg"; # This line modified by Makefile
-my $dpkglibdir = "../utils"; # This line modified by Makefile
-my $version = '0.93.80'; # This line modified by Makefile
+use Dpkg;
+
 push (@INC, $dpkglibdir);
 require 'dpkg-gettext.pl';
 textdomain("dpkg");
 
-($0) = $0 =~ m:.*/(.+):;
-
 # Global variables:
 
 my $altdir = '/etc/alternatives';
@@ -61,7 +58,7 @@ my $enoent = `$dpkglibdir/enoent` || die sprintf(_g("Cannot get ENOENT value fro
 sub ENOENT { $enoent; }
 
 sub version {
-    printf _g("Debian %s version %s.\n"), $0, $version;
+    printf _g("Debian %s version %s.\n"), $progname, $version;
 
     printf _g("
 Copyright (C) 1995 Ian Jackson.
@@ -108,18 +105,18 @@ Options:
   --quiet                  quiet operation, minimal output.
   --help                   show this help message.
   --version                show the version.
-"), $0, $altdir;
+"), $progname, $altdir;
 }
 
 sub quit
 {
-    printf STDERR "%s: %s\n", $0, "@_";
+    printf STDERR "%s: %s\n", $progname, "@_";
     exit(2);
 }
 
 sub badusage
 {
-    printf STDERR "%s: %s\n\n", $0, "@_";
+    printf STDERR "%s: %s\n\n", $progname, "@_";
     &usage;
     exit(2);
 }