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
};
93 $pkg->{menu
} and print "menu";
94 print "config PACKAGE_".$pkg->{name
}."\n";
95 print "\t\ttristate \"$title\"\n";
96 foreach my $default (split /\s*,\s*/, $pkg->{default}) {
97 print "\t\tdefault $default\n";
99 foreach my $depend (@
{$pkg->{depends
}}) {
101 $depend =~ s/^([@\+]+)//;
105 if ($vdep = $package{$depend}->{vdepends
}) {
106 $depend = join("||", map { "PACKAGE_".$_ } @
$vdep);
108 $flags =~ /@/ or $depend = "PACKAGE_$depend";
109 $flags =~ /\+/ and $m = "select";
111 print "\t\t$m $depend\n";
114 print $pkg->{description
};
117 $pkg->{config
} and print $pkg->{config
}."\n";
119 if ($menu ne 'undef') {
121 $menu_dep{$menu} and print "endif\n";
126 undef $category{$cat};
132 $line =~ /^Source-Makefile: \s*(.+\/([^\
/]+)\/Makefile
)\s
*$/ and do {
137 $line =~ /^Package: \s*(.+)\s*$/ and do {
140 $pkg->{makefile
} = $makefile;
142 $pkg->{default} = "m if ALL";
145 $line =~ /^Version: \s*(.+)\s*$/ and $pkg->{version
} = $1;
146 $line =~ /^Title: \s*(.+)\s*$/ and $pkg->{title
} = $1;
147 $line =~ /^Menu: \s*(.+)\s*$/ and $pkg->{menu
} = $1;
148 $line =~ /^Submenu: \s*(.+)\s*$/ and $pkg->{submenu
} = $1;
149 $line =~ /^Submenu-Depends: \s*(.+)\s*$/ and $pkg->{submenudep
} = $1;
150 $line =~ /^Default: \s*(.+)\s*$/ and $pkg->{default} = $1;
151 $line =~ /^Provides: \s*(.+)\s*$/ and do {
152 my @vpkg = split /\s+/, $1;
153 foreach my $vpkg (@vpkg) {
154 $package{$vpkg} or $package{$vpkg} = { vdepends
=> [] };
155 push @
{$package{$vpkg}->{vdepends
}}, $pkg->{name
};
158 $line =~ /^Depends: \s*(.+)\s*$/ and do {
159 my @dep = split /\s+/, $1;
160 $pkg->{depends
} = \
@dep;
162 $line =~ /^Category: \s*(.+)\s*$/ and do {
163 $pkg->{category
} = $1;
164 defined $category{$1} or $category{$1} = {};
165 defined $category{$1}->{$src} or $category{$1}->{$src} = [];
166 push @
{$category{$1}->{$src}}, $pkg;
168 $line =~ /^Description: \s*(.*)\s*$/ and do {
169 my $desc = "\t\t$1\n\n";
172 last if $line =~ /^@@/;
173 $desc .= "\t\t$line";
175 $pkg->{description
} = $desc;
177 $line =~ /^Config: \s*(.*)\s*$/ and do {
181 last if $line =~ /^@@/;
184 $pkg->{config
} = $conf;
188 print_category
'Base system';
189 foreach my $cat (keys %category) {
This page took 0.068016 seconds and 5 git commands to generate.