Added some code to peer into a data structure in Maemian/Schedule.pm. Also added the
[maemian] / nokia-lintian / collection / source-control-file
1 #!/usr/bin/perl -w
2 # source-control-file -- lintian collector script
3
4 # Copyright (C) 2004 Frank Lichtenheld
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 use warnings;
24
25 ($#ARGV == 1) or fail("syntax: source-control-file <pkg> <type>");
26 my $pkg = shift;
27 my $type = shift;
28
29 -f "debfiles/control" or fail("control invoked in wrong directory");
30
31 use lib "$ENV{'LINTIAN_ROOT'}/lib";
32 use Util;
33
34 my @control_data = read_dpkg_control("debfiles/control");
35 shift @control_data; # we don't need the source information
36
37 mkdir "control", 0777  or fail( "can't create dir control: $!" );
38
39 foreach (@control_data) {
40     my $pkg_name = $_->{'package'};
41     fail("no package line found in control file of $pkg $type")
42         if !$pkg_name;
43     mkdir "control/$pkg_name", 0777
44         or fail( "can't create dir control/$pkg_name: $!" );
45     for my $field (keys %$_) {
46         my $field_file = "control/$pkg_name/$field";
47         open (F, '>', "$field_file")
48             or fail("cannot open file $field_file for writing: $!");
49         print F $_->{$field},"\n";
50         close F;
51     }
52 }