[SCM] Debian package checker branch, master, updated. 2.5.0-5-gefece4a
The following commit has been merged in the master branch:
commit 36f3a5d91793338dc63d736fcb450a40e06e2221
Author: Niels Thykier <niels@thykier.net>
Date: Sat May 14 19:37:26 2011 +0200
Sample patch to unpack using libdpkg-perl instead dpkg-source
diff --git a/collection/unpacked b/collection/unpacked
index 1cceb5a..a98a65c 100755
--- a/collection/unpacked
+++ b/collection/unpacked
@@ -48,18 +48,25 @@ if ($type =~ m/^remove-/) {
if ($type eq 'source') {
# Ignore STDOUT of the child process because older versions of
# dpkg-source print things out even with -q.
- my $opts = { out => '/dev/null', err => 'unpacked-errors' };
- unless (spawn($opts, ['dpkg-source', '-q', '-x', 'dsc', 'unpacked'])) {
- open(ERRORS, '<', 'unpacked-errors')
- or fail("cannot open unpacked-errors: $!");
- print STDERR while <ERRORS>;
- close ERRORS;
- fail('dpkg-source -x failed with status ', $opts->{harness}->result);
+ if (0) {
+ my $opts = { out => '/dev/null', err => 'unpacked-errors' };
+ unless (spawn($opts, ['dpkg-source', '-q', '-x', 'dsc', 'unpacked'])) {
+ open(ERRORS, '<', 'unpacked-errors')
+ or fail("cannot open unpacked-errors: $!");
+ print STDERR while <ERRORS>;
+ close ERRORS;
+ fail('dpkg-source -x failed with status ', $opts->{harness}->result);
+ }
+
+
+ } else {
+ print STDERR "N: Using libdpkg-perl.\n";
+ libdpkg_unpack_dsc ('dsc', 'unpacked');
}
# fix permissions
spawn({ fail => 'error' },
- ['chmod', '-R', 'u+rwX,o+rX,o-w', 'unpacked']);
+ ['chmod', '-R', 'u+rwX,o+rX,o-w', 'unpacked']);
} else {
mkdir('unpacked', 0777) or fail("mkdir unpacked: $!");
@@ -85,3 +92,16 @@ if ($type eq 'source') {
['chmod', '-R', 'u+rwX,go-w', 'unpacked']);
}
+sub libdpkg_unpack_dsc {
+ my ($dsc, $target) = @_;
+ require Dpkg::Source::Package;
+ open(STDOUT, '>', '/dev/null') or fail "Redirecting stdout failed: $!";
+ # Create the object that does everything
+ my $srcpkg = Dpkg::Source::Package->new(filename => $dsc);
+
+ $srcpkg->check_checksums();
+
+ # Unpack the source package (delegated to Dpkg::Source::Package::*)
+ $srcpkg->extract($target);
+ return 1;
+}
--
Debian package checker
Reply to: