2 # unpack-binpkg-l2 -- lintian unpack script (binary packages level 2)
4 # syntax: unpack-binpkg-l <base-dir>
6 # Copyright (C) 1998 Christian Schwarz and Richard Braakman
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, you can find it on the World Wide
20 # Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
21 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
25 use vars qw($verbose);
27 ($#ARGV == 0) or fail("syntax: unpack-binpkg-l2 <base-dir>");
30 use lib "$ENV{'LINTIAN_ROOT'}/lib";
33 print "N: Unpacking binary packages in directory $base_dir ...\n" if $verbose;
34 mkdir("$base_dir/unpacked", 0777) or fail();
36 # avoid using dpkg-deb -x; this pipeline is far faster. I got a factor 2
37 # improvement on large debs, and factor 1.5 on small debs. I heard
38 # it's because dpkg-deb syncs while writing. -- Richard
40 pipeline((sub { exec 'dpkg-deb', '--fsys-tarfile', "$base_dir/deb" }),
41 (sub { exec 'tar', 'xf', '-', '-C', "$base_dir/unpacked" })) == 0
45 spawn('chmod', '-R', 'u+rwX,go-w', "$base_dir/unpacked") == 0 or fail();
49 # -------------------------------
53 print STDERR "internal error: $_[0]\n";
55 print STDERR "internal error: $!\n";
57 print STDERR "internal error.\n";