[SCM] Debian package checker branch, master, updated. 2.0.0-29-gac85d00
The following commit has been merged in the master branch:
commit 8f2cb8be58b0509fa82fe42905f2fc264a47f991
Author: Frank Lichtenheld <djpig@debian.org>
Date: Fri Oct 17 00:37:48 2008 +0200
collection/{file-info,md5sums}: Replace usages of pipeline_open
These are the only places where we actually use the pipe_* options
and reap().
diff --git a/collection/file-info b/collection/file-info
index df58bc4..4ca3718 100755
--- a/collection/file-info
+++ b/collection/file-info
@@ -21,6 +21,11 @@
use strict;
+use FileHandle;
+use lib "$ENV{'LINTIAN_ROOT'}/lib";
+use Util;
+use Lintian::Command qw(spawn reap);
+
($#ARGV == 1) or fail("syntax: file-info <pkg> <type>");
my $pkg = shift;
my $type = shift;
@@ -31,13 +36,12 @@ unlink("file-info");
chdir("unpacked")
or fail("cannot chdir to unpacked directory: $!");
-use FileHandle;
-use lib "$ENV{'LINTIAN_ROOT'}/lib";
-use Pipeline;
my $XARGS=FileHandle->new;
-pipeline_open($XARGS, (sub { exec 'xargs', '-0r', 'file' }), "../file-info")
- or fail("cannot fork: $!");
+my %opts = ( pipe_in => FileHandle->new,
+ out => '../file-info',
+ fail => 'error' );
+spawn(\%opts, ['xargs', '-0r', 'file']);
open(INDEX, '<', "../index")
or fail("cannot open index file: $!");
while (<INDEX>) {
@@ -47,23 +51,9 @@ while (<INDEX>) {
s/ -> .*//;
s/(\G|[^\\](?:\\\\)*)\\(\d{3})/"$1" . chr(oct $2)/ge;
s/\\\\/\\/;
- printf $XARGS "%s\0", $_;
+ printf {$opts{pipe_in}} "%s\0", $_;
}
close(INDEX);
-close($XARGS) or fail("xargs for file exited with code $?");
-
-exit 0;
-
-# -----------------------------------
-
-sub fail {
- if ($_[0]) {
- print STDERR "internal error: $_[0]\n";
- } elsif ($!) {
- print STDERR "internal error: $!\n";
- } else {
- print STDERR "internal error.\n";
- }
- exit 1;
-}
+close $opts{pipe_in};
+reap(\%opts);
diff --git a/collection/md5sums b/collection/md5sums
index 7174bf2..f4e9339 100755
--- a/collection/md5sums
+++ b/collection/md5sums
@@ -21,6 +21,11 @@
use strict;
+use FileHandle;
+use lib "$ENV{'LINTIAN_ROOT'}/lib";
+use Lintian::Command qw(spawn reap);
+use Util;
+
($#ARGV == 1) or fail("syntax: md5sums <pkg> <type>");
my $pkg = shift;
my $type = shift;
@@ -31,13 +36,10 @@ unlink("md5sums");
chdir("unpacked")
or fail("cannot chdir to unpacked directory: $!");
-use FileHandle;
-use lib "$ENV{'LINTIAN_ROOT'}/lib";
-use Pipeline;
-
-my $XARGS=FileHandle->new;
-pipeline_open($XARGS, (sub { exec 'xargs', '-0r', 'md5sum' }), "../md5sums")
- or fail("cannot fork: $!");
+my %opts = ( pipe_in => FileHandle->new,
+ out => '../md5sums',
+ fail => 'error' );
+spawn(\%opts, ['xargs', '-0r', 'md5sum'] );
open(INDEX, '<', "../index")
or fail("cannot open index file: $!");
while (<INDEX>) {
@@ -47,23 +49,10 @@ while (<INDEX>) {
s/ link to .*//;
s/\\(\d+)/chr(oct($1))/eg;
s/\\\\/\\/g;
- printf $XARGS "%s\0", $_;
+ printf {$opts{pipe_in}} "%s\0", $_;
}
close(INDEX);
-close($XARGS) or fail("xargs for md5sum exited with code $?");
-
-exit 0;
+close $opts{pipe_in};
+reap(\%opts);
-# -----------------------------------
-
-sub fail {
- if ($_[0]) {
- print STDERR "internal error: $_[0]\n";
- } elsif ($!) {
- print STDERR "internal error: $!\n";
- } else {
- print STDERR "internal error.\n";
- }
- exit 1;
-}
--
Debian package checker
Reply to: