brcm2708-gpu-fw: update to latest version
[openwrt/openwrt.git] / scripts / kconfig.pl
index 7073e3b1ae426fedcf86d3034f713b1e320fa734..6a6bbd27472b929005e22f42498057603c8ae457 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env perl
 # 
 #!/usr/bin/env perl
 # 
-# Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
+# Copyright (C) 2006 Felix Fietkau <nbd@nbd.name>
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -29,7 +29,7 @@ sub load_config($$) {
        my $mod_plus = shift;
        my %config;
 
        my $mod_plus = shift;
        my %config;
 
-       open FILE, "$file" or die "can't open file";
+       open FILE, "$file" or die "can't open file '$file'";
        while (<FILE>) {
                chomp;
                /^$PREFIX(.+?)=(.+)/ and do {
        while (<FILE>) {
                chomp;
                /^$PREFIX(.+?)=(.+)/ and do {
@@ -73,20 +73,25 @@ sub config_add($$$) {
                my %cfg = %$_;
                
                foreach my $config (keys %cfg) {
                my %cfg = %$_;
                
                foreach my $config (keys %cfg) {
-                       next if $mod_plus and $config{$config} and $config{$config} eq "y";
+                       if ($mod_plus and $config{$config}) {
+                               next if $config{$config} eq "y";
+                               next if $cfg{$config} eq '#undef';
+                       }
                        $config{$config} = $cfg{$config};
                }
        }
        return \%config;
 }
 
                        $config{$config} = $cfg{$config};
                }
        }
        return \%config;
 }
 
-sub config_diff($$) {
+sub config_diff($$$) {
        my $cfg1 = shift;
        my $cfg2 = shift;
        my $cfg1 = shift;
        my $cfg2 = shift;
+       my $new_only = shift;
        my %config;
        
        foreach my $config (keys %$cfg2) {
                if (!defined($cfg1->{$config}) or $cfg1->{$config} ne $cfg2->{$config}) {
        my %config;
        
        foreach my $config (keys %$cfg2) {
                if (!defined($cfg1->{$config}) or $cfg1->{$config} ne $cfg2->{$config}) {
+                       next if $new_only and !defined($cfg1->{$config}) and $cfg2->{$config} eq '#undef';
                        $config{$config} = $cfg2->{$config};
                }
        }
                        $config{$config} = $cfg2->{$config};
                }
        }
@@ -146,7 +151,11 @@ sub parse_expr {
        } elsif ($arg eq '>') {
                my $arg1 = parse_expr($pos);
                my $arg2 = parse_expr($pos);
        } elsif ($arg eq '>') {
                my $arg1 = parse_expr($pos);
                my $arg2 = parse_expr($pos);
-               return config_diff($arg1, $arg2);
+               return config_diff($arg1, $arg2, 0);
+       } elsif ($arg eq '>+') {
+               my $arg1 = parse_expr($pos);
+               my $arg2 = parse_expr($pos);
+               return config_diff($arg1, $arg2, 1);
        } elsif ($arg eq '-') {
                my $arg1 = parse_expr($pos);
                my $arg2 = parse_expr($pos);
        } elsif ($arg eq '-') {
                my $arg1 = parse_expr($pos);
                my $arg2 = parse_expr($pos);