summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir@cohens.org.il>2009-04-25 01:07:49 +0300
committerTzafrir Cohen <tzafrir@cohens.org.il>2009-04-25 01:07:49 +0300
commitb6308fc73216a42e88c2a440e47f7ef66f649b0b (patch)
treeb3a4b5a4b92a2c3bb9cf2803e34d801e485ecd12
parent485e7216440ef4bed14785b9434e8763f307c735 (diff)
fix reversed logic for XML
The Asterisk build system has two different sources of configuration: * Information in modules * Information from external XML files (for CFLAGS and sound files) For modules having the name set menuselect.makeopts disables the module from building. For data from XML - it enables using it. This change applies the reversed logic where it is ought to be applied: when writing menuselect.makedeps . This should allow dummy-select to be used with all versions of Asterisk.
-rwxr-xr-xmenuselect/menuselect31
1 files changed, 16 insertions, 15 deletions
diff --git a/menuselect/menuselect b/menuselect/menuselect
index 24fcecd..1f6d0e8 100755
--- a/menuselect/menuselect
+++ b/menuselect/menuselect
@@ -199,6 +199,7 @@ sub parse_menuselect_xml_file($) {
Dir => $category,
Module => $1,
DisplayName => $2,
+ Defaultenabled => ['no'],
Avail => 1,
};
@@ -219,7 +220,12 @@ sub parse_menuselect_xml_file($) {
if (! exists $member->{$key}) {
$member->{$key} = [];
}
- push @{$member->{$key}}, ($val);
+ # Using "unshift' rather than 'push'.
+ # For a singleton value this makes the action an
+ # override, as only the first value counts.
+ # For a list value, however, it means a reversed
+ # order.
+ unshift @{$member->{$key}}, ($val);
}
}
@@ -435,16 +441,6 @@ sub check_module($) {
if ($ModInfo{$mod}{Avail} == 0) {
return 0;
}
- # XML inputs have a reversed logic: no 'defaultenabled' means 'no'
- # And we need to actually print enabled ones, rather than disabled
- # ones.
- if ($ModInfo{$mod}{Type} eq 'XML') {
- my $res = ((not exists $ModInfo{$mod}{Defaultenabled}) ||
- ($ModInfo{$mod}{Defaultenabled}[0] ne 'yes') );
- $ModInfo{$mod}{Checked} = $res;
- return $res;
- }
- # no dependencies to check:
if (! exists $ModInfo{$mod}{Depend}) {
$ModInfo{$mod}{Checked} = 1;
return 1;
@@ -483,8 +479,10 @@ sub resolve_deps() {
}
}
-# generate menuselect.makeopts. Please let me know if some parts are
-# still missing.
+# generate menuselect.makeopts.
+# The values in this file obey to different semantics:
+# 1. For modules, a module will be built unles listed here
+# 2. For XML values (sounds, CFLAGS) it will be enabled if listed here
sub gen_makeopts() {
open MAKEDEPS, ">$MakeoptsFile" or
die "Failed to open opts file $MakeoptsFile for writing. Aborting: $!\n";
@@ -492,8 +490,11 @@ sub gen_makeopts() {
my %Subdirs;
foreach my $mod (sort keys %ModInfo) {
next unless ($ModInfo{$mod}{Type} =~ /^(module|XML)$/);
- next if ($ModInfo{$mod}{Dir} eq 'CFLAGS');
- next if ($ModInfo{$mod}{Checked});
+ if ($ModInfo{$mod}{Type} eq 'XML') {
+ next unless ($ModInfo{$mod}{Checked});
+ } else {
+ next if ($ModInfo{$mod}{Checked});
+ }
my $dir = $ModInfo{$mod}{Dir};
if (! exists $Subdirs{$dir}) {
$Subdirs{$dir} = [];