[SCM] Debian package checker branch, master, updated. 2.2.6-51-gda155b5
The following commit has been merged in the master branch:
commit 6e3405187d321d3c55dbcf7d84a01225954a359e
Author: Raphael Geissert <atomo64@gmail.com>
Date: Sun Mar 1 15:12:47 2009 -0600
Parallelize unpacking scripts
Run, as possible, parts of the unpacking scripts in parallel.
diff --git a/unpack/unpack-binpkg-l1 b/unpack/unpack-binpkg-l1
index d555c76..a423ef2 100755
--- a/unpack/unpack-binpkg-l1
+++ b/unpack/unpack-binpkg-l1
@@ -33,11 +33,13 @@ my $file = shift;
# import perl libraries
use lib "$ENV{'LINTIAN_ROOT'}/lib";
use Util;
-use Lintian::Command qw(spawn);
+use Lintian::Command qw(spawn reap);
# stat $file
(my @stat = stat $file) or fail("$file: cannot stat: $!");
+my (@jobs, $job);
+
# create directory in lab
print "N: Creating directory $base_dir ...\n" if $verbose;
mkdir("$base_dir", 0777) or fail("mkdir $base_dir: $!");
@@ -53,15 +55,21 @@ spawn({ fail => 'error', out => "$base_dir/control.tar" },
['ar', 'p', $file, 'control.tar.gz'],
'|', ['gzip', '-dc']);
+$job = { fail =>'error' };
+push @jobs, $job;
# extract the tarball's contents
-spawn({ fail =>'error' },
- ["tar", "xf", "$base_dir/control.tar", "-C", "$base_dir/control"]);
+spawn($job,
+ ["tar", "xf", "$base_dir/control.tar", "-C", "$base_dir/control", '&']);
+$job = { fail =>'error', out => "$base_dir/control-index" };
+push @jobs, $job;
# create index of control.tar.gz
-spawn({ fail => 'error', out => "$base_dir/control-index" },
+spawn($job,
["tar", "tvf", "$base_dir/control.tar"],
- '|', ["sort", "-k", "6"]);
+ '|', ["sort", "-k", "6"], '&');
+reap(@jobs);
+undef @jobs;
# clean up control.tar
unlink("$base_dir/control.tar") or fail();
@@ -69,21 +77,25 @@ unlink("$base_dir/control.tar") or fail();
spawn({ fail => 'error' },
["chmod", "-R", "u+rX,o-w", "$base_dir/control"]);
+$job = { fail => 'error', out => "$base_dir/index" };
+push @jobs, $job;
# (replaces dpkg-deb -c)
# create index file for package
-spawn({ fail => 'error', out => "$base_dir/index" },
+spawn($job,
["dpkg-deb", "--fsys-tarfile", $file ],
'|', ["tar", "tfv", "-"],
'|', ["sed", "-e", "s/^h/-/"],
- '|', ["sort", "-k", "6"]);
+ '|', ["sort", "-k", "6"], '&');
+$job = { fail => 'error', out => "$base_dir/index-owner-id" };
+push @jobs, $job;
# (replaces dpkg-deb -c)
# create index file for package with owner IDs instead of names
-spawn({ fail => 'error', out => "$base_dir/index-owner-id" },
+spawn($job,
["dpkg-deb", "--fsys-tarfile", $file],
'|', ["tar", "--numeric-owner", "-tvf", "-"],
'|', ["sed", "-e", "s/^h/-/"],
- '|', ["sort", "-k", "6"]);
+ '|', ["sort", "-k", "6"], '&');
# get package control information
my $data = (read_dpkg_control("$base_dir/control/control"))[0];
@@ -102,4 +114,7 @@ $data->{'source'} =~ s/\s*\(.*\)\s*$//;
symlink("../../source/$data->{'source'}","$base_dir/source")
or fail("symlink: $!");
+reap(@jobs);
+undef @jobs;
+
exit 0;
diff --git a/unpack/unpack-srcpkg-l1 b/unpack/unpack-srcpkg-l1
index cd8b97d..ed2e397 100755
--- a/unpack/unpack-srcpkg-l1
+++ b/unpack/unpack-srcpkg-l1
@@ -37,11 +37,13 @@ use lib "$ENV{'LINTIAN_ROOT'}/lib";
use Util;
use File::Spec;
-use Lintian::Command qw(spawn);
+use Lintian::Command qw(spawn reap);
# stat $file
(my @stat = stat $file) or fail("$file: cannot stat: $!");
+my (@jobs, $job);
+
# get package control information
my $data = get_dsc_info($file);
@@ -87,7 +89,8 @@ if (!$tarball) {
# Collect a list of the files in the source package. tar currently doesn't
# automatically recognize LZMA, so we need to add the option where it's
# needed. Change hard link status (h) to regular files and remove a leading
-# ./ prefix on filenames while we're reading the tar output.
+# ./ prefix on filenames while we're reading the tar output. We intentionally
+# don't parallelize this job because we need to use the output below.
my @tar_options = ('-tvf');
if ($tarball =~ /\.lzma\z/) {
unshift(@tar_options, '--lzma');
@@ -154,9 +157,8 @@ if ($prefix) {
# Now that we have the file names we want, write them out sorted to the index
# file.
-spawn({ fail => 'error', out => "$base_dir/index" },
- sub { print @index },
- '|', ['sort', '-k', '6']);
+my $job = { fail => 'error', out => "$base_dir/index" };
+spawn($job, sub { print @index }, '|', ['sort', '-k', '6'], '&');
# Create symbolic links to binary packages
mkdir("$base_dir/binary", 0777) or fail("mkdir $base_dir/binary: $!");
@@ -165,6 +167,9 @@ for my $bin (split(/,\s+/o,$data->{'binary'})) {
or fail("cannot symlink binary package $bin: $!");
}
+# Wait for all jobs to finish.
+reap($job);
+
exit 0;
# Local Variables:
--
Debian package checker
Reply to: