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 print "\t\tdefault ".$pkg->{default}."\n";
28 foreach my $depend (@{$pkg->{depends}}) {
29 print "\t\tdepends PACKAGE_$depend\n";
31 foreach my $need (@{$pkg->{needs}}) {
32 print "\t\tselect PACKAGE_$need\n";
35 print $pkg->{description};
38 $pkg->{config} and print $pkg->{config}."\n";
43 undef $category{$cat};
49 $line =~ /^Source-Makefile: \s*(.+\/([^\/]+)\/Makefile)\s*$/ and do {
54 $line =~ /^Package: \s*(.+)\s*$/ and do {
57 $pkg->{makefile} = $makefile;
59 $pkg->{default} = "m if ALL";
61 $line =~ /^Version: \s*(.+)\s*$/ and $pkg->{version} = $1;
62 $line =~ /^Title: \s*(.+)\s*$/ and $pkg->{title} = $1;
63 $line =~ /^Menu: \s*(.+)\s*$/ and $pkg->{menu} = $1;
64 $line =~ /^Default: \s*(.+)\s*$/ and $pkg->{default} = $1;
65 $line =~ /^Depends: \s*(.+)\s*$/ and do {
66 my @dep = split /,\s*/, $1;
67 $pkg->{depends} = \@dep;
69 $line =~ /^Needs: \s*(.+)\s*$/ and do {
70 my @need = split /,\s*/, $1;
71 $pkg->{needs} = \@need;
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) {