Added some code to peer into a data structure in Maemian/Schedule.pm. Also added the
[maemian] / nokia-lintian / collection / menu-files
1 #!/usr/bin/perl -w
2 # menu-files -- lintian collector script
3
4 # Copyright (C) 1998 Richard Braakman
5
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, you can find it on the World Wide
18 # Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
19 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
20 # MA 02110-1301, USA.
21
22 use strict;
23
24 ($#ARGV == 1) or fail("syntax: menu-files <pkg> <type>");
25 my $pkg = shift;
26 my $type = shift;
27
28 -f "fields/package" or fail("menu-files invoked in wrong directory");
29
30 use lib "$ENV{'LINTIAN_ROOT'}/lib";
31 use Pipeline;
32
33 if (-e "menu") {
34     spawn('rm', '-rf', 'menu') == 0
35         or fail("cannot rm old menu directory");
36 }
37
38 mkdir("menu", 0777) or fail("cannot mkdir menu: $!");
39
40 if (-d "unpacked/usr/lib/menu") {    
41     spawn('cp', '-a', 'unpacked/usr/lib/menu', 'menu/lib') == 0
42         or fail("cannot copy unpacked/usr/lib/menu/ directory");
43 } else {
44     # no menu directory
45     mkdir("menu/lib", 0777) or fail("cannot mkdir menu/lib: $!");
46 }
47
48 if (-d "unpacked/usr/share/menu") {    
49     spawn('cp', '-a', 'unpacked/usr/share/menu', 'menu/share') == 0
50         or fail("cannot copy unpacked/usr/share/menu directory");
51 } else {
52     # no menu directory
53     mkdir("menu/share", 0777) or fail("cannot mkdir menu/share: $!");
54 }
55
56
57 exit 0;
58
59 # -----------------------------------
60
61 sub fail {
62     if ($_[0]) {
63         print STDERR "internal error: $_[0]\n";
64     } elsif ($!) {
65         print STDERR "internal error: $!\n";
66     } else {
67         print STDERR "internal error.\n";
68     }
69     exit 1;
70 }