|
|
@@ -126,15 +126,12 @@ sub upn ($) {
|
|
|
#
|
|
|
# deduce external variables from description
|
|
|
#
|
|
|
-sub find_options ($) {
|
|
|
- my($descr) = @_;
|
|
|
- my(%evar);
|
|
|
-
|
|
|
- %evar = map {
|
|
|
- $1 => '%{'.$1.'}'
|
|
|
- } $descr =~ /--define\s*'(\S+)\s*\%\{\1\}'/;
|
|
|
-
|
|
|
- return \%evar;
|
|
|
+sub find_options ($$) {
|
|
|
+ my($spec, $descr) = @_;
|
|
|
+ my $evar = {};
|
|
|
+ $descr =~ s/--define\s*'(\S+)\s*\%\{\1\}'/$evar->{$1} = '%{'.$1.'}', ''/sge; # before openpkg-20021230
|
|
|
+ $spec =~ s/^%option\s*(\S+)\s+\S+/$evar->{$1} = '%{'.$1.'}', ''/mge; # after openpkg-20021230
|
|
|
+ return $evar;
|
|
|
}
|
|
|
|
|
|
#
|
|
|
@@ -292,12 +289,13 @@ sub spec2data ($) {
|
|
|
my($s) = @_;
|
|
|
my(%map);
|
|
|
my($a,$o);
|
|
|
+ my $spec = $s;
|
|
|
|
|
|
# remove comments
|
|
|
$s =~ s/^\s*#.*?\n//mg;
|
|
|
|
|
|
# map commands
|
|
|
- $s =~ s/^%(ifdef|ifndef|if|define|else|endif|\{)/#$1/mg;
|
|
|
+ $s =~ s/^%(ifdef|ifndef|if|option|define|else|endif|\{)/#$1/mg;
|
|
|
|
|
|
# split sections
|
|
|
foreach (split(/^(?=%\w+\s*\n)/m, $s)) {
|
|
|
@@ -308,7 +306,7 @@ sub spec2data ($) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $o = find_options($map{'description'});
|
|
|
+ $o = find_options($spec, $map{'description'});
|
|
|
$a = package2data($map{'*'}, $o);
|
|
|
if (exists $map{'description'}) {
|
|
|
$a->{'Description'} = { '' => [ $map{'description'} ] };
|