3 # Copyright (C) 2006 OpenWrt.org
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
21 my $deps = ($pkg->{vdepends
} or $pkg->{depends
});
23 return 0 unless defined $deps;
24 foreach my $dep (@
{$deps}) {
25 return 1 if $dep eq $name;
26 return 1 if ($package{$dep} and (find_dep
($package{$dep},$name) == 1));
36 return 0 if ($a->{submenu
} ne $b->{submenu
});
37 if (find_dep
($a, $b->{name
}) == 1) {
39 } elsif (find_dep
($b, $a->{name
}) == 1) {
44 # print STDERR "depends($a->{name}, $b->{name}) == $ret\n";
49 sub print_category
($) {
54 return unless $category{$cat};
56 print "menu \"$cat\"\n\n";
57 my %spkg = %{$category{$cat}};
59 foreach my $spkg (sort {uc($a) cmp uc($b)} keys %spkg) {
60 foreach my $pkg (@
{$spkg{$spkg}}) {
61 my $menu = $pkg->{submenu
};
63 $menu_dep{$menu} or $menu_dep{$menu} = $pkg->{submenudep
};
67 $menus{$menu} or $menus{$menu} = [];
68 push @
{$menus{$menu}}, $pkg;
72 ($a eq 'undef' ?
1 : 0) or
73 ($b eq 'undef' ?
-1 : 0) or
77 foreach my $menu (@menus) {
80 ($a->{name
} cmp $b->{name
})
82 if ($menu ne 'undef') {
83 $menu_dep{$menu} and print "if $menu_dep{$menu}\n";
84 print "menu \"$menu\"\n";
86 foreach my $pkg (@pkgs) {
87 my $title = $pkg->{name
};
88 my $c = (72 - length($pkg->{name
}) - length($pkg->{title
}));
90 $title .= ("." x
$c). " ". $pkg->{title
};
92 print "\tconfig DEFAULT_".$pkg->{name
}."\n";
95 $pkg->{menu
} and print "menu";
96 print "config PACKAGE_".$pkg->{name
}."\n";
97 print "\t\ttristate \"$title\"\n";
98 print "\t\tdefault y if DEFAULT_".$pkg->{name
}."\n";
99 foreach my $default (split /\s*,\s*/, $pkg->{default}) {
100 print "\t\tdefault $default\n";
102 foreach my $depend (@
{$pkg->{depends
}}) {
104 $depend =~ s/^([@\+]+)//;
108 if ($vdep = $package{$depend}->{vdepends
}) {
109 $depend = join("||", map { "PACKAGE_".$_ } @
$vdep);
111 $flags =~ /@/ or $depend = "PACKAGE_$depend";
112 $flags =~ /\+/ and $m = "select";
114 print "\t\t$m $depend\n";
117 print $pkg->{description
};
120 $pkg->{config
} and print $pkg->{config
}."\n";
122 if ($menu ne 'undef') {
124 $menu_dep{$menu} and print "endif\n";
129 undef $category{$cat};
135 $line =~ /^Source-Makefile: \s*(.+\/([^\
/]+)\/Makefile
)\s
*$/ and do {
140 $line =~ /^Package: \s*(.+)\s*$/ and do {
143 $pkg->{makefile
} = $makefile;
145 $pkg->{default} = "m if ALL";
148 $line =~ /^Version: \s*(.+)\s*$/ and $pkg->{version
} = $1;
149 $line =~ /^Title: \s*(.+)\s*$/ and $pkg->{title
} = $1;
150 $line =~ /^Menu: \s*(.+)\s*$/ and $pkg->{menu
} = $1;
151 $line =~ /^Submenu: \s*(.+)\s*$/ and $pkg->{submenu
} = $1;
152 $line =~ /^Submenu-Depends: \s*(.+)\s*$/ and $pkg->{submenudep
} = $1;
153 $line =~ /^Default: \s*(.+)\s*$/ and $pkg->{default} = $1;
154 $line =~ /^Provides: \s*(.+)\s*$/ and do {
155 my @vpkg = split /\s+/, $1;
156 foreach my $vpkg (@vpkg) {
157 $package{$vpkg} or $package{$vpkg} = { vdepends
=> [] };
158 push @
{$package{$vpkg}->{vdepends
}}, $pkg->{name
};
161 $line =~ /^Depends: \s*(.+)\s*$/ and do {
162 my @dep = split /\s+/, $1;
163 $pkg->{depends
} = \
@dep;
165 $line =~ /^Category: \s*(.+)\s*$/ and do {
166 $pkg->{category
} = $1;
167 defined $category{$1} or $category{$1} = {};
168 defined $category{$1}->{$src} or $category{$1}->{$src} = [];
169 push @
{$category{$1}->{$src}}, $pkg;
171 $line =~ /^Description: \s*(.*)\s*$/ and do {
172 my $desc = "\t\t$1\n\n";
175 last if $line =~ /^@@/;
176 $desc .= "\t\t$line";
178 $pkg->{description
} = $desc;
180 $line =~ /^Config: \s*(.*)\s*$/ and do {
184 last if $line =~ /^@@/;
187 $pkg->{config
} = $conf;
191 print_category
'Base system';
192 foreach my $cat (keys %category) {
This page took 0.067083 seconds and 5 git commands to generate.