Browse Source

Dpkg::ErrorHandling: Replace failure calls with error or syserr

There's no point in a different failure vs error or syserr function, so
let's remove it.
Guillem Jover 17 years ago
parent
commit
7e1f9c695e

+ 13 - 0
ChangeLog

@@ -1,3 +1,16 @@
+2008-12-08  Guillem Jover  <guillem@debian.org>
+
+	* scripts/Dpkg/ErrorHandling.pm (@EXPORT): Remove 'failure'.
+	(failure): Remove function.
+	(syserr): Rename 'failure' string to 'error'.
+	(subprocerr): Use error instead of failure.
+	* scripts/Dpkg/Checksums.pm (extractchecksum): Likewise.
+	* scripts/Dpkg/Source/Functions.pm (erasedir): Likewise.
+	* scripts/changelog/debian.pl: Likewise.
+	* scripts/dpkg-gencontrol.pl: Likewise.
+	* scripts/dpkg-shlibdeps.pl: Likewise.
+	* scripts/dpkg-buildpackage.pl: Use syserr instead of failure.
+
 2008-12-08  Guillem Jover  <guillem@debian.org>
 2008-12-08  Guillem Jover  <guillem@debian.org>
 
 
 	* scripts/Dpkg/ErrorHandling.pm (@EXPORT_OK): Move info, warning,
 	* scripts/Dpkg/ErrorHandling.pm (@EXPORT_OK): Move info, warning,

+ 1 - 1
scripts/Dpkg/Checksums.pm

@@ -22,7 +22,7 @@ our %check_regex = ( md5 => qr/[0-9a-f]{32}/,
 sub extractchecksum {
 sub extractchecksum {
     my ($alg, $checksum) = @_;
     my ($alg, $checksum) = @_;
     ($checksum =~ /^($check_regex{$alg})(\s|$)/m)
     ($checksum =~ /^($check_regex{$alg})(\s|$)/m)
-	|| failure(_g("checksum program gave bogus output `%s'"), $checksum);
+	|| error(_g("checksum program gave bogus output `%s'"), $checksum);
     return $1;
     return $1;
 }
 }
 
 

+ 5 - 10
scripts/Dpkg/ErrorHandling.pm

@@ -4,7 +4,7 @@ use Dpkg;
 use Dpkg::Gettext;
 use Dpkg::Gettext;
 
 
 use base qw(Exporter);
 use base qw(Exporter);
-our @EXPORT = qw(info warning warnerror error errormsg failure
+our @EXPORT = qw(info warning warnerror error errormsg
                  syserr internerr subprocerr usageerr syntaxerr);
                  syserr internerr subprocerr usageerr syntaxerr);
 our @EXPORT_OK = qw(report unknown $warnable_error $quiet_warnings);
 our @EXPORT_OK = qw(report unknown $warnable_error $quiet_warnings);
 
 
@@ -38,15 +38,10 @@ sub warnerror(@)
     }
     }
 }
 }
 
 
-sub failure($;@)
-{
-    die report(_g("failure"), @_);
-}
-
 sub syserr($;@)
 sub syserr($;@)
 {
 {
     my $msg = shift;
     my $msg = shift;
-    die report(_g("failure"), "$msg: $!", @_);
+    die report(_g("error"), "$msg: $!", @_);
 }
 }
 
 
 sub error($;@)
 sub error($;@)
@@ -81,11 +76,11 @@ sub subprocerr(@)
     require POSIX;
     require POSIX;
 
 
     if (POSIX::WIFEXITED($?)) {
     if (POSIX::WIFEXITED($?)) {
-	failure(_g("%s gave error exit status %s"), $p, POSIX::WEXITSTATUS($?));
+	error(_g("%s gave error exit status %s"), $p, POSIX::WEXITSTATUS($?));
     } elsif (POSIX::WIFSIGNALED($?)) {
     } elsif (POSIX::WIFSIGNALED($?)) {
-	failure(_g("%s died from signal %s"), $p, POSIX::WTERMSIG($?));
+	error(_g("%s died from signal %s"), $p, POSIX::WTERMSIG($?));
     } else {
     } else {
-	failure(_g("%s failed with unknown exit code %d"), $p, $?);
+	error(_g("%s failed with unknown exit code %d"), $p, $?);
     }
     }
 }
 }
 
 

+ 1 - 1
scripts/Dpkg/Source/Functions.pm

@@ -25,7 +25,7 @@ sub erasedir {
         return if $! == ENOENT;
         return if $! == ENOENT;
         syserr(_g("unable to check for removal of dir `%s'"), $dir);
         syserr(_g("unable to check for removal of dir `%s'"), $dir);
     }
     }
-    failure(_g("rm -rf failed to remove `%s'"), $dir);
+    error(_g("rm -rf failed to remove `%s'"), $dir);
 }
 }
 
 
 sub fixperms {
 sub fixperms {

+ 3 - 4
scripts/changelog/debian.pl

@@ -115,15 +115,14 @@ my $opts = { since => $since, until => $until,
 
 
 if ($file eq '-') {
 if ($file eq '-') {
     $changes->parse({ inhandle => \*STDIN, %$opts })
     $changes->parse({ inhandle => \*STDIN, %$opts })
-	or failure(_g('fatal error occured while parsing input'));
+	or error(_g('fatal error occured while parsing input'));
 } else {
 } else {
     $changes->parse({ infile => $file, %$opts })
     $changes->parse({ infile => $file, %$opts })
-	or failure(_g('fatal error occured while parsing %s'),
-		   $file );
+	or error(_g('fatal error occured while parsing %s'), $file);
 }
 }
 
 
 
 
 eval("print \$changes->${format}_str(\$opts)");
 eval("print \$changes->${format}_str(\$opts)");
 if ($@) {
 if ($@) {
-    failure("%s",$@);
+    error("%s", $@);
 }
 }

+ 2 - 2
scripts/dpkg-buildpackage.pl

@@ -360,12 +360,12 @@ unless ($noclean) {
     withecho(@rootcommand, @debian_rules, 'clean');
     withecho(@rootcommand, @debian_rules, 'clean');
 }
 }
 unless ($binaryonly) {
 unless ($binaryonly) {
-    chdir('..') or failure('chdir ..');
+    chdir('..') or syserr('chdir ..');
     my @opts = @passopts;
     my @opts = @passopts;
     if ($diffignore) { push @opts, $diffignore }
     if ($diffignore) { push @opts, $diffignore }
     push @opts, @tarignore;
     push @opts, @tarignore;
     withecho('dpkg-source', @opts, '-b', $dir);
     withecho('dpkg-source', @opts, '-b', $dir);
-    chdir($dir) or failure("chdir $dir");
+    chdir($dir) or syserr("chdir $dir");
 }
 }
 unless ($sourceonly) {
 unless ($sourceonly) {
     withecho(@debian_rules, 'build');
     withecho(@debian_rules, 'build');

+ 1 - 1
scripts/dpkg-gencontrol.pl

@@ -298,7 +298,7 @@ if (!defined($substvars->get('Installed-Size'))) {
     close(DU);
     close(DU);
     $? && subprocerr(_g("du in \`%s'"), $packagebuilddir);
     $? && subprocerr(_g("du in \`%s'"), $packagebuilddir);
     $duo =~ m/^(\d+)\s+\.$/ ||
     $duo =~ m/^(\d+)\s+\.$/ ||
-        failure(_g("du gave unexpected output \`%s'"), $duo);
+        error(_g("du gave unexpected output \`%s'"), $duo);
     $substvars->set('Installed-Size', $1);
     $substvars->set('Installed-Size', $1);
 }
 }
 if (defined($substvars->get('Extra-Size'))) {
 if (defined($substvars->get('Extra-Size'))) {

+ 3 - 3
scripts/dpkg-shlibdeps.pl

@@ -159,7 +159,7 @@ foreach my $file (keys %exec) {
 			 "that do not have any shlibs or symbols file.\nTo help dpkg-shlibdeps " .
 			 "that do not have any shlibs or symbols file.\nTo help dpkg-shlibdeps " .
 			 "find private libraries, you might need to set LD_LIBRARY_PATH.");
 			 "find private libraries, you might need to set LD_LIBRARY_PATH.");
 	    if (scalar(split_soname($soname))) {
 	    if (scalar(split_soname($soname))) {
-		failure($msg, $soname, $file, $obj->{format}, join(":", @{$obj->{RPATH}}));
+		error($msg, $soname, $file, $obj->{format}, join(":", @{$obj->{RPATH}}));
 	    } else {
 	    } else {
 		warning($msg, $soname, $file, $obj->{format}, join(":", @{$obj->{RPATH}}));
 		warning($msg, $soname, $file, $obj->{format}, join(":", @{$obj->{RPATH}}));
 	    }
 	    }
@@ -254,8 +254,8 @@ foreach my $file (keys %exec) {
 		    $ignore++ unless scalar(split_soname($soname));
 		    $ignore++ unless scalar(split_soname($soname));
 		    # 3/ when we have been asked to do so
 		    # 3/ when we have been asked to do so
 		    $ignore++ if $ignore_missing_info;
 		    $ignore++ if $ignore_missing_info;
-		    failure(_g("no dependency information found for %s " .
-		               "(used by %s)."), $lib, $file)
+		    error(_g("no dependency information found for %s " .
+		             "(used by %s)."), $lib, $file)
 		        unless $ignore;
 		        unless $ignore;
 		}
 		}
 	    }
 	    }