aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2008-09-27 22:57:58 +0000
committerFelix Fietkau <nbd@openwrt.org>2008-09-27 22:57:58 +0000
commit033d2f6ca6102a6cb593e5fe6b1cc03681654f7c (patch)
tree7a9642ddcff4e9578a579d98372b21e3964be61a
parentc514c50057b16f155bfca7b2bd6f4b3c31b8aad4 (diff)
downloadupstream-033d2f6ca6102a6cb593e5fe6b1cc03681654f7c.tar.gz
upstream-033d2f6ca6102a6cb593e5fe6b1cc03681654f7c.tar.bz2
upstream-033d2f6ca6102a6cb593e5fe6b1cc03681654f7c.zip
scripts/feeds: allow multiple alternative urls for a single feed. this will be useful for maintaining release branch forks of /packages
SVN-Revision: 12746
-rwxr-xr-xscripts/feeds17
1 files changed, 12 insertions, 5 deletions
diff --git a/scripts/feeds b/scripts/feeds
index 099468a8f7..ab765b1ea3 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -31,18 +31,19 @@ sub parse_config() {
s/#.+$//;
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;
- $line[2] =~ /\s/ and $valid = 0;
+ @src = split /\s+/, $line[2];
$valid or die "Syntax error in feeds.list, line: $line\n";
$name{$line[1]} and die "Duplicate feed name '$line[1]', line: $line\n";
$name{$line[1]} = 1;
- push @feeds, [@line];
+ push @feeds, [$line[0], $line[1], \@src];
}
close FEEDS;
}
@@ -192,7 +193,7 @@ sub list {
}
if ($opts{s}) {
foreach my $feed (@feeds) {
- printf "\%-32s\tURL: %s\n", $feed->[1], $feed->[2];
+ printf "\%-32s\tURL: %s\n", $feed->[1], join(", ", @{$feed->[2]});
}
return 0;
}
@@ -419,8 +420,14 @@ sub update_feed($$$$)
return 1;
};
$perform_update and do {
- warn "Updating feed '$name' from '$src' ...\n";
- &{$update_method{$type}}($name, $src) == 0 or do {
+ my $failed = 1;
+ foreach my $feedsrc (@$src) {
+ warn "Updating feed '$name' from '$feedsrc' ...\n";
+ next unless &{$update_method{$type}}($name, $feedsrc) == 0;
+ $failed = 0;
+ last;
+ }
+ $failed and do {
warn "failed.\n";
return 1;
};