toolchain: switch to musl by default, except for mips64
[openwrt/staging/wigyori.git] / scripts / feeds
index 62edb668209c850b412b644ec426c6012a8bbc52..b6d2f45e7208e42a4abd9bda0b543981b176ec06 100755 (executable)
@@ -51,7 +51,7 @@ sub parse_config() {
                $line++;
 
                my $valid = 1;
-               $line[0] =~ /^src-\w+$/ or $valid = 0;
+               $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";
@@ -128,6 +128,13 @@ my %update_method = (
                'update'        => "git pull --ff",
                'controldir'    => ".git",
                'revision'      => "git show --abbrev-commit HEAD | head -n 1 | cut -d ' ' -f 2 | tr -d '\n'"},
+       'src-git-full' => {
+               'init'          => "git clone '%s' '%s'",
+               'init_branch'   => "git clone --branch '%s' '%s' '%s'",
+               'init_commit'   => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -",
+               'update'        => "git pull --ff",
+               'controldir'    => ".git",
+               'revision'      => "git show --abbrev-commit HEAD | head -n 1 | cut -d ' ' -f 2 | tr -d '\n'"},
        'src-gitsvn' => {
                'init'  => "git svn clone -r HEAD '%s' '%s'",
                'update'        => "git svn rebase",
@@ -383,7 +390,7 @@ sub do_install_target($) {
 
                system("ln -sf ../../$path ./target/linux/");
        } else {
-               warn "Package is not valid\n";
+               warn "Target is not valid\n";
                return 1;
        }
 
@@ -581,6 +588,17 @@ sub install {
        return $ret;
 }
 
+sub uninstall_target($) {
+       my $dir = shift;
+       my $name = $dir;
+       $name =~ s/.*\///g;
+
+       my $dest = readlink $dir;
+       return unless $dest =~ /..\/..\/feeds/;
+       warn "Uninstalling target '$name'\n";
+       unlink "$dir";
+}
+
 sub uninstall {
        my %opts;
        my $name;
@@ -595,6 +613,10 @@ sub uninstall {
 
        if ($opts{a}) {
                system("rm -rvf ./package/feeds");
+               foreach my $dir (glob "target/linux/*") {
+                       next unless -l $dir;
+                       uninstall_target($dir);
+               }
                $uninstall = 1;
        } else {
                if($#ARGV == -1) {
@@ -603,6 +625,13 @@ sub uninstall {
                }
                get_installed();
                while ($name = shift @ARGV) {
+                       my $target = "target/linux/$name";
+                       -l "$target" and do {
+                               uninstall_target($target);
+                               $uninstall = 1;
+                               next;
+                       };
+
                        my $pkg = $installed{$name};
                        $pkg or do {
                                warn "WARNING: $name not installed\n";
@@ -764,7 +793,7 @@ my %commands = (
        'uninstall' => \&uninstall,
        'feed_config' => \&feed_config,
        'clean' => sub {
-               system("rm -rf feeds");
+               system("rm -rf ./feeds ./package/feeds");
        }
 );