Added some code to peer into a data structure in Maemian/Schedule.pm. Also added the
[maemian] / nokia-lintian / unpack / unpack-srcpkg-l2
1 #!/usr/bin/perl
2 # unpack-srcpkg-l2 -- lintian unpack script (source packages level 2)
3 #
4 # syntax: unpack-srcpkg-l2 <base-dir>
5
6 # Copyright (C) 1998 Christian Schwarz and Richard Braakman
7 #
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.
12 #
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.
17 #
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,
22 # MA 02110-1301, USA.
23
24 use strict;
25 use vars qw($verbose);
26 use FileHandle;
27
28 use lib "$ENV{'LINTIAN_ROOT'}/lib";
29 use Pipeline;
30
31 ($#ARGV == 0) or fail("syntax: unpack-srcpkg-l2 <base-dir>");
32 my $base_dir = shift;
33
34 print "N: Unpacking source package in directory $base_dir ...\n" if $verbose;
35 chdir($base_dir);
36
37 # We can't use spawn yet because older versions of dpkg-source print things
38 # out even with -q.  This can be fixed to use spawn once that newer version of
39 # dpkg is in oldstable.
40 my $pid = fork;
41 if (not defined $pid) {
42     fail("cannot fork: $!");
43 } elsif ($pid == 0) {
44     open(STDOUT, '>', '/dev/null');
45     exec('dpkg-source', '-q', '-x', 'dsc', 'unpacked');
46 } else {
47     waitpid($pid, 0);
48     unless ($? == 0) {
49         fail("cannot run dpkg-source: $!");
50     }
51 }
52
53 # fix permissions
54 spawn('chmod', '-R', 'u+rwX,o+rX,o-w', 'unpacked') == 0 or fail();
55
56 exit 0;
57
58 # -------------------------------
59
60 sub fail {
61   if ($_[0]) {
62     print STDERR "internal error: $_[0]\n";
63   } elsif ($!) {
64     print STDERR "internal error: $!\n";
65   } else {
66     print STDERR "internal error.\n";
67   }
68   exit 1;
69 }
70
71 # Local Variables:
72 # indent-tabs-mode: nil
73 # cperl-indent-level: 4
74 # End:
75 # vim: syntax=perl sw=4 sts=4 ts=4 et shiftround