uqmi: add mtu config option possibility
[openwrt/staging/dedeckeh.git] / scripts / feeds
index f49cdb3e457d5256108e84c4bb52d1069a57a1dd..a4dfd9e260a8fe713405b288cd4d596dc775ea1f 100755 (executable)
@@ -41,33 +41,49 @@ my $feed_src = {};
 my $feed_target = {};
 my $feed_vpackage = {};
 
-sub parse_config() {
+sub parse_file($$);
+
+sub parse_file($$) {
+       my ($fname, $name) = @_;
        my $line = 0;
-       my %name;
+       my $fh;
 
-       open FEEDS, "feeds.conf" or
-               open FEEDS, "feeds.conf.default" or
-               die "Unable to open feeds configuration";
-       while (<FEEDS>) {
+       open $fh, $fname or return undef;
+       while (<$fh>) {
                chomp;
                s/#.+$//;
+               $line++;
                next unless /\S/;
                my @line = split /\s+/, $_, 3;
                my @src;
-               $line++;
 
                my $valid = 1;
                $line[0] =~ /^src-[\w-]+$/ or $valid = 0;
                $line[1] =~ /^\w+$/ or $valid = 0;
-               @src = split /\s+/, $line[2];
-               $valid or die "Syntax error in feeds.conf, line: $line\n";
+               @src = split /\s+/, ($line[2] or '');
+               @src = ('') if @src == 0;
+               $valid or die "Syntax error in $fname, line: $line\n";
+
+               $name->{$line[1]} and die "Duplicate feed name '$line[1]' in '$fname' line: $line\n";
+               $name->{$line[1]} = 1;
 
-               $name{$line[1]} and die "Duplicate feed name '$line[1]', line: $line\n";
-               $name{$line[1]} = 1;
+               if ($line[0] eq "src-include") {
+                       parse_file($line[2], $name) or
+                           die "Unable to open included file '$line[2]'";
+                       next;
+               }
 
                push @feeds, [$line[0], $line[1], \@src];
        }
-       close FEEDS;
+       close $fh;
+       return 1;
+}
+
+sub parse_config() {
+       my %name;
+       parse_file("feeds.conf", \%name) or
+           parse_file("feeds.conf.default", \%name)  or
+           die "Unable to open feeds configuration";
 }
 
 sub update_location($$)
@@ -105,8 +121,8 @@ sub update_index($)
        -d "./feeds/$name.tmp/info" or mkdir "./feeds/$name.tmp/info" or return 1;
 
        system("$mk -s prepare-mk OPENWRT_BUILD= TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\"");
-       system("$mk -s -f include/scan.mk IS_TTY=1 SCAN_TARGET=\"packageinfo\" SCAN_DIR=\"feeds/$name\" SCAN_NAME=\"package\" SCAN_DEPS=\"$ENV{TOPDIR}/include/package*.mk\" SCAN_DEPTH=5 SCAN_EXTRA=\"\" TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\"");
-       system("$mk -s -f include/scan.mk IS_TTY=1 SCAN_TARGET=\"targetinfo\" SCAN_DIR=\"feeds/$name\" SCAN_NAME=\"target\" SCAN_DEPS=\"profiles/*.mk $ENV{TOPDIR}/include/target.mk\" SCAN_DEPTH=5 SCAN_EXTRA=\"\" SCAN_MAKEOPTS=\"TARGET_BUILD=1\" TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\"");
+       system("$mk -s -f include/scan.mk IS_TTY=1 SCAN_TARGET=\"packageinfo\" SCAN_DIR=\"feeds/$name\" SCAN_NAME=\"package\" SCAN_DEPTH=5 SCAN_EXTRA=\"\" TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\"");
+       system("$mk -s -f include/scan.mk IS_TTY=1 SCAN_TARGET=\"targetinfo\" SCAN_DIR=\"feeds/$name\" SCAN_NAME=\"target\" SCAN_DEPTH=5 SCAN_EXTRA=\"\" SCAN_MAKEOPTS=\"TARGET_BUILD=1\" TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\"");
        system("ln -sf $name.tmp/.packageinfo ./feeds/$name.index");
        system("ln -sf $name.tmp/.targetinfo ./feeds/$name.targetindex");
 
@@ -127,12 +143,17 @@ my %update_method = (
                'init'          => "ln -s '%s' '%s'",
                'update'        => "",
                'revision'      => "echo -n 'local'"},
+       'src-dummy' => {
+               'init'          => "true '%s' && mkdir '%s'",
+               'update'        => "",
+               'revision'      => "echo -n 'dummy'"},
        'src-git' => {
                'init'          => "git clone --depth 1 '%s' '%s'",
                'init_branch'   => "git clone --depth 1 --branch '%s' '%s' '%s'",
                'init_commit'   => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
                'update'        => "git pull --ff",
                'update_force'  => "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)",
+               'post_update'   => "git submodule update --init --recursive",
                'controldir'    => ".git",
                'revision'      => "git rev-parse --short HEAD | tr -d '\n'"},
        'src-git-full' => {
@@ -141,6 +162,7 @@ my %update_method = (
                'init_commit'   => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
                'update'        => "git pull --ff",
                'update_force'  => "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)",
+               'post_update'   => "git submodule update --init --recursive",
                'controldir'    => ".git",
                'revision'      => "git rev-parse --short HEAD | tr -d '\n'"},
        'src-gitsvn' => {
@@ -197,6 +219,10 @@ sub update_feed_via($$$$$) {
                }
                system("cd '$safepath'; $update_cmd") == 0 or return 1;
        }
+       if ($m->{'post_update'}) {
+               my $cmd = $m->{'post_update'};
+               system("cd '$safepath'; $cmd") == 0 or return 1;
+       }
 
        return 0;
 }
@@ -813,11 +839,12 @@ sub feed_config() {
                my $installed = (-f "feeds/$feed->[1].index");
 
                printf "\tconfig FEED_%s\n", $feed->[1];
-               printf "\t\tbool \"Enable feed %s\"\n", $feed->[1];
+               printf "\t\ttristate \"Enable feed %s\"\n", $feed->[1];
                printf "\t\tdepends on PER_FEED_REPO\n";
                printf "\t\tdefault y\n" if $installed;
                printf "\t\thelp\n";
-               printf "\t\t Enable the \\\"%s\\\" feed at %s.\n", $feed->[1], $feed->[2][0];
+               printf "\t\t Enable the \\\"%s\\\" feed in opkg distfeeds.conf.\n", $feed->[1];
+               printf "\t\t Say M to add the feed commented out.\n";
                printf "\n";
        }