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($$)
'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'",
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";
}