+2007-10-11 Guillem Jover <guillem@debian.org>
+
+ * scripts/controllib.pl ($warnable_error, $quiet_warnings): Remove
+ variable declarations.
+ (failure, syserr, error, internerr, warning, warnerror)
+ (subprocerr): Remove functions.
+ (unknown, usageerr): Move functions to ...
+ * scripts/Dpkg/ErrorHandling.pm: ... here.
+ (usageerr): Call usage from main::.
+ (@EXPORT_OK): Add usageerr and unknown.
+
+ * scripts/822-date.pl: Use Dpkg::ErrorHandling.
+ * scripts/changelog/debian.pl: Likewise.
+ * scripts/controllib.pl: Likewise.
+ * scripts/dpkg-architecture.pl: Likewise.
+ * scripts/dpkg-buildpackage.pl: Likewise.
+ * scripts/dpkg-checkbuilddeps.pl: Likewise.
+ * scripts/dpkg-distaddfile.pl: Likewise.
+ * scripts/dpkg-genchanges.pl: Likewise.
+ * scripts/dpkg-gencontrol.pl: Likewise.
+ * scripts/dpkg-gensymbols.pl: Likewise.
+ * scripts/dpkg-parsechangelog.pl: Likewise.
+ * scripts/dpkg-shlibdeps.pl: Likewise.
+ * scripts/dpkg-source.pl: Likewise.
+
+ * scripts/dpkg-buildpackage.pl ($warnable_error): Import from
+ Dpkg::ErrorHandling instead of declaring as our.
+ * scripts/dpkg-source.pl ($warnable_error, $quiet_warnings): Likewise.
+
+ * scripts/822-date.pl: Do not require controllib.pl anymore.
+ * scripts/dpkg-parsechangelog.pl: Likewise.
+ * scripts/dpkg-shlibdeps.pl: Likewise.
+
2007-10-10 Guillem Jover <guillem@debian.org>
* scripts/Dpkg/ErrorHandling.pm: Use Dpkg.
[ Guillem Jover ]
* Use shipped perl modules when calling perl programs at build time.
+ * Switch perl programs to use the new Dpkg/ErrorHandling module.
[ Updated dpkg translations ]
* Polish (Robert Luberda).
use Dpkg;
use Dpkg::Gettext;
+use Dpkg::ErrorHandling qw(warning);
textdomain("dpkg-dev");
-push(@INC, $dpkglibdir);
-require 'controllib.pl';
-
@ARGV && die _g("Usage: 822-date")."\n";
warning(_g("This program is deprecated. Please use 'date -R' instead."));
use Dpkg::Gettext;
use base qw(Exporter);
-our @EXPORT_OK = qw( failure syserr error internerr warning
- warnerror subprocerr );
+our @EXPORT_OK = qw(warning warnerror error failure unknown syserr internerr
+ subprocerr usageerr $warnable_error $quiet_warnings);
our $warnable_error = 1;
our $quiet_warnings = 0;
}
}
+sub unknown {
+ my $field = $_;
+ warning(sprintf(_g("unknown information field '%s' in input data in %s"),
+ $field, $_[0]));
+}
+
sub subprocerr {
my ($p) = @_;
require POSIX;
}
}
+sub usageerr
+{
+ printf(STDERR "%s: %s\n\n", $progname, "@_");
+ # XXX: access to main namespace
+ main::usage();
+ exit(2);
+}
1;
use Dpkg;
use Dpkg::Gettext;
+use Dpkg::ErrorHandling qw(error internerr usageerr);
push(@INC,$dpkglibdir);
require 'controllib.pl';
use POSIX qw(:errno_h);
use Dpkg;
use Dpkg::Gettext;
+use Dpkg::ErrorHandling qw(warning error failure internerr syserr subprocerr);
textdomain("dpkg-dev");
our @src_dep_fields = qw(Build-Depends Build-Depends-Indep
Build-Conflicts Build-Conflicts-Indep);
-our $warnable_error = 1;
-our $quiet_warnings = 0;
-
sub getfowner
{
return $index;
}
-sub unknown {
- my $field = $_;
- warning(sprintf(_g("unknown information field '%s' in input data in %s"),
- $field, $_[0]));
-}
-
sub syntax {
&error(sprintf(_g("syntax error in %s at line %d: %s"), $whatmsg, $., $_[0]));
}
-sub failure { die sprintf(_g("%s: failure: %s"), $progname, $_[0])."\n"; }
-sub syserr { die sprintf(_g("%s: failure: %s: %s"), $progname, $_[0], $!)."\n"; }
-sub error { die sprintf(_g("%s: error: %s"), $progname, $_[0])."\n"; }
-sub internerr { die sprintf(_g("%s: internal error: %s"), $progname, $_[0])."\n"; }
-
-sub warning
-{
- if (!$quiet_warnings) {
- warn sprintf(_g("%s: warning: %s"), $progname, $_[0])."\n";
- }
-}
-
-sub usageerr
-{
- printf(STDERR "%s: %s\n\n", $progname, "@_");
- &usage;
- exit(2);
-}
-
-sub warnerror
-{
- if ($warnable_error) {
- warning(@_);
- } else {
- error(@_);
- }
-}
-
-sub subprocerr {
- my ($p) = @_;
- require POSIX;
- if (POSIX::WIFEXITED($?)) {
- die sprintf(_g("%s: failure: %s gave error exit status %s"),
- $progname, $p, POSIX::WEXITSTATUS($?))."\n";
- } elsif (POSIX::WIFSIGNALED($?)) {
- die sprintf(_g("%s: failure: %s died from signal %s"),
- $progname, $p, POSIX::WTERMSIG($?))."\n";
- } else {
- die sprintf(_g("%s: failure: %s failed with unknown exit code %d"),
- $progname, $p, $?)."\n";
- }
-}
-
1;
use Dpkg;
use Dpkg::Gettext;
+use Dpkg::ErrorHandling qw(warning syserr usageerr);
push(@INC,$dpkglibdir);
require 'controllib.pl';
use Dpkg;
use Dpkg::Gettext;
+use Dpkg::ErrorHandling qw(warning error failure syserr subprocerr usageerr
+ $warnable_error);
use Dpkg::BuildOptions;
push (@INC, $dpkglibdir);
require 'controllib.pl';
-our $warnable_error;
-
textdomain("dpkg-dev");
sub showversion {
use Getopt::Long;
use Dpkg;
use Dpkg::Gettext;
+use Dpkg::ErrorHandling qw(error);
push(@INC,$dpkglibdir);
require 'controllib.pl';
use POSIX qw(:errno_h :signal_h);
use Dpkg;
use Dpkg::Gettext;
+use Dpkg::ErrorHandling qw(error syserr usageerr);
push(@INC,$dpkglibdir);
require 'controllib.pl';
use POSIX qw(:errno_h :signal_h);
use Dpkg;
use Dpkg::Gettext;
+use Dpkg::ErrorHandling qw(warning error failure unknown internerr syserr
+ subprocerr usageerr);
push(@INC,$dpkglibdir);
require 'controllib.pl';
use POSIX qw(:errno_h);
use Dpkg;
use Dpkg::Gettext;
+use Dpkg::ErrorHandling qw(warning error failure unknown internerr syserr
+ subprocerr usageerr);
push(@INC,$dpkglibdir);
require 'controllib.pl';
use Dpkg::Shlibs::Objdump;
use Dpkg::Shlibs::SymbolFile;
use Dpkg::Gettext;
+use Dpkg::ErrorHandling qw(warning error syserr usageerr);
textdomain("dpkg-dev");
use POSIX qw(:errno_h);
use Dpkg;
use Dpkg::Gettext;
-
-push(@INC,$dpkglibdir);
-require 'controllib.pl';
+use Dpkg::ErrorHandling qw(warning error syserr subprocerr usageerr);
textdomain("dpkg-dev");
use POSIX qw(:errno_h :signal_h);
use Dpkg;
use Dpkg::Gettext;
+use Dpkg::ErrorHandling qw(warning error failure syserr usageerr);
use Dpkg::Path qw(relative_to_pkg_root);
use Dpkg::Version qw(vercmp);
use Dpkg::Shlibs qw(find_library);
my @depfields= qw(Suggests Recommends Depends Pre-Depends);
my $i=0; my %depstrength = map { $_ => $i++ } @depfields;
-push(@INC, $dpkglibdir);
-require 'controllib.pl';
textdomain("dpkg-dev");
my $shlibsoverride= '/etc/dpkg/shlibs.override';
use Dpkg;
use Dpkg::Gettext;
+use Dpkg::ErrorHandling qw(warning warnerror error failure unknown
+ internerr syserr subprocerr usageerr
+ $warnable_error $quiet_warnings);
my @filesinarchive;
my %dirincluded;
our (%f, %fi);
our $sourcepackage;
-our $warnable_error;
-our $quiet_warnings;
our %substvar;
our @src_dep_fields;