9 sub print_category($) {
12 return unless $category{$cat};
14 print "menu \"$cat\"\n\n";
15 my %spkg = %{$category{$cat}};
16 foreach my $spkg (sort {uc($a) cmp uc($b)} keys %spkg) {
17 foreach my $pkg (@{$spkg{$spkg}}) {
18 my $title = $pkg->{name};
19 my $c = (72 - length($pkg->{name}) - length($pkg->{title}));
21 $title .= ("." x $c). " ". $pkg->{title};
24 $pkg->{menu} and print "menu";
25 print "config PACKAGE_".$pkg->{name}."\n";
26 print "\t\ttristate \"$title\"\n";
27 foreach my $default (split /\s*,\s*/, $pkg->{default}) {
28 print "\t\tdefault $default\n";
30 foreach my $depend (@{$pkg->{depends}}) {
32 $depend =~ s/^([@\+])//;
34 $flags =~ /@/ or $depend = "PACKAGE_$depend";
35 $flags =~ /\+/ and $m = "select";
36 print "\t\t$m $depend\n";
39 print $pkg->{description};
42 $pkg->{config} and print $pkg->{config}."\n";
47 undef $category{$cat};
53 $line =~ /^Source-Makefile: \s*(.+\/([^\/]+)\/Makefile)\s*$/ and do {
58 $line =~ /^Package: \s*(.+)\s*$/ and do {
61 $pkg->{makefile} = $makefile;
63 $pkg->{default} = "m if ALL";
65 $line =~ /^Version: \s*(.+)\s*$/ and $pkg->{version} = $1;
66 $line =~ /^Title: \s*(.+)\s*$/ and $pkg->{title} = $1;
67 $line =~ /^Menu: \s*(.+)\s*$/ and $pkg->{menu} = $1;
68 $line =~ /^Default: \s*(.+)\s*$/ and $pkg->{default} = $1;
69 $line =~ /^Depends: \s*(.+)\s*$/ and do {
70 my @dep = split /\s+/, $1;
71 $pkg->{depends} = \@dep;
73 $line =~ /^Category: \s*(.+)\s*$/ and do {
74 $pkg->{category} = $1;
75 defined $category{$1} or $category{$1} = {};
76 defined $category{$1}->{$src} or $category{$1}->{$src} = [];
77 push @{$category{$1}->{$src}}, $pkg;
79 $line =~ /^Description: \s*(.*)\s*$/ and do {
80 my $desc = "\t\t$1\n\n";
83 last if $line =~ /^@@/;
86 $pkg->{description} = $desc;
88 $line =~ /^Config: \s*(.*)\s*$/ and do {
92 last if $line =~ /^@@/;
95 $pkg->{config} = $conf;
99 print_category 'Base system';
100 foreach my $cat (keys %category) {