aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-08-28 15:21:35 +0200
committerJohn Crispin <john@phrozen.org>2019-08-28 16:10:41 +0200
commit775b70f8d5dfe9830aaf3b79fc8fb38c8148ee1f (patch)
tree7d3723d99f972c5213383d8d851e23f321a5e595
parent6e45ba4699eb8424951648cfeddc0a8633f8891e (diff)
downloadupstream-775b70f8d5dfe9830aaf3b79fc8fb38c8148ee1f.tar.gz
upstream-775b70f8d5dfe9830aaf3b79fc8fb38c8148ee1f.tar.bz2
upstream-775b70f8d5dfe9830aaf3b79fc8fb38c8148ee1f.zip
scripts/feeds: allow adding parameters to feeds
this allows adding "--" prefixed parameters inside feeds.conf between the target and name. The first parameter is --force which has the same effect as using -f when installing any of the packages. This allows creating feeds that will override base packages by default. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rwxr-xr-xscripts/feeds48
1 files changed, 30 insertions, 18 deletions
diff --git a/scripts/feeds b/scripts/feeds
index a4dfd9e260..e36e044a11 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -44,7 +44,7 @@ my $feed_vpackage = {};
sub parse_file($$);
sub parse_file($$) {
- my ($fname, $name) = @_;
+ my ($fname, $existing) = @_;
my $line = 0;
my $fh;
@@ -54,26 +54,33 @@ sub parse_file($$) {
s/#.+$//;
$line++;
next unless /\S/;
- my @line = split /\s+/, $_, 3;
- my @src;
-
- my $valid = 1;
- $line[0] =~ /^src-[\w-]+$/ or $valid = 0;
- $line[1] =~ /^\w+$/ or $valid = 0;
- @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;
-
- if ($line[0] eq "src-include") {
- parse_file($line[2], $name) or
- die "Unable to open included file '$line[2]'";
+
+ my ($type, $flags, $name, $urls) = m!^src-(\w+)((?:\s+--\w+(?:=\S+)?)*)\s+(\w+)(?:\s+(\S.*))?$!;
+ unless ($type && $name) {
+ die "Syntax error in $fname, line $line\n";
+ }
+
+ if ($existing->{$name}++) {
+ die "Duplicate feed name '$name' in '$fname' line: $line\n";
+ }
+
+ my @src = defined($urls) ? split /\s+/, $urls : ();
+ push @src, '' if @src == 0;
+
+ my %flags;
+ if (defined $flags) {
+ while ($flags =~ m!\s+--(\w+)(?:=(\S+))?!g) {
+ $flags{$1} = defined($2) ? $2 : 1;
+ }
+ }
+
+ if ($type eq "include") {
+ parse_file($urls, $name) or
+ die "Unable to open included file '$urls'";
next;
}
- push @feeds, [$line[0], $line[1], \@src];
+ push @feeds, ["src-$type", $name, \@src, \%flags];
}
close $fh;
return 1;
@@ -521,6 +528,11 @@ sub install_src {
get_feed($feed->[1]);
my $src = $feed_src->{$name} or return 1;
+ # enable force flag if feed src line was declared with --force
+ if (exists($feed->[3]{force})) {
+ $force = 1;
+ }
+
# If it's a core package and we don't want to override, just return
my $override = 0;
if (is_core_src($name)) {