aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2015-02-09 12:09:23 +0000
committerJohn Crispin <john@openwrt.org>2015-02-09 12:09:23 +0000
commit2e2c04777b7ca4da9cc476685f1d4636bcdc4c0e (patch)
tree69826fd647f0afff0dedd84e8282d0a261238dc7 /scripts
parent28353b3fc5e4cedcb9200b43cd738ac38e00eb96 (diff)
downloadupstream-2e2c04777b7ca4da9cc476685f1d4636bcdc4c0e.tar.gz
upstream-2e2c04777b7ca4da9cc476685f1d4636bcdc4c0e.tar.bz2
upstream-2e2c04777b7ca4da9cc476685f1d4636bcdc4c0e.zip
build: allow openwrt.git packages to be replaced by feeds
Currently, replacing a package available in openwrt.git requires modifications in openwrt.git, or requires duplicating the package in a feed but with a different name, which causes all kind of problems related to dependencies (all packages selecting it would have to be modified accordingly to select the new package). With this change, if a package with the same name is present both in feeds/ and package/ folders, the one in feeds/ can override the one in package/, both in the menuconfig and during the build, by passing the "-f" option to "./scripts/feeds install" This mechanism is particularly useful for vendor tree, or in general for application which needs to replace one particular package which exists within openwrt.git by a custom/newer version. Signed-off-by: Mathieu Olivari <mathieu@qca.qualcomm.com> SVN-Revision: 44334
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/feeds30
1 files changed, 22 insertions, 8 deletions
diff --git a/scripts/feeds b/scripts/feeds
index 31ad544994..4b98d3e7e4 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -358,6 +358,7 @@ sub is_core_package($) {
sub install_package {
my $feed = shift;
my $name = shift;
+ my $force = shift;
my $ret = 0;
$feed = lookup_package($feed, $name);
@@ -382,14 +383,26 @@ sub install_package {
my $type = $feed->[0];
$src or $src = $name;
+ # If it's a core package and we don't want to override, just return
+ !$force and is_core_package($src) and return 0;
+
# previously installed packages set the runtime package
- # newly installed packages set the source package
- $installed{$src} and return 0;
+ # newly installed packages set the source package to 1
+ $installed{$src} and $installed{$src} == 1 and return 0;
+
+ # we'll trigger the override only with the 3 conditions below:
+ # - override is allowed by command line (-f)
+ # - a package with the same src exists in the core packages list
+ # - the package previously installed is not from a feed
+ my $override = 1 if ($force and is_core_package($src) and !$installed{$name}->{feed});
# check previously installed packages
- $installed{$name} and return 0;
+ $installed{$name} and !$override and return 0;
$installed{$src} = 1;
- warn "Installing package '$src'\n";
+
+ defined($override) and $override == 1
+ and warn "Overriding package '$src'\n"
+ or warn "Installing package '$src'\n";
$install_method{$type} or do {
warn "Unknown installation method: '$type'\n";
@@ -409,7 +422,7 @@ sub install_package {
$dep =~ s/^.+://;
$dep =~ s/\/.+$//;
next unless $dep;
- install_package($feed, $dep) == 0 or $ret = 1;
+ install_package($feed, $dep, 0) == 0 or $ret = 1;
}
}
@@ -436,7 +449,7 @@ sub install {
my $feed;
my $ret = 0;
- getopts('ap:d:h', \%opts);
+ getopts('ap:d:fh', \%opts);
if ($opts{h}) {
usage();
@@ -462,7 +475,7 @@ sub install {
my $p = $feed_package->{$name};
next if $p->{vdepends};
if( $p->{name} ) {
- install_package($feed, $p->{name}) == 0 or $ret = 1;
+ install_package($feed, $p->{name}, exists($opts{f})) == 0 or $ret = 1;
get_feed($f->[1]);
}
}
@@ -470,7 +483,7 @@ sub install {
}
} else {
while ($name = shift @ARGV) {
- install_package($feed, $name) == 0 or $ret = 1;
+ install_package($feed, $name, exists($opts{f})) == 0 or $ret = 1;
}
}
@@ -638,6 +651,7 @@ Commands:
-a : Install all packages from all feeds or from the specified feed using the -p option.
-p <feedname>: Prefer this feed when installing packages.
-d <y|m|n>: Set default for newly installed packages.
+ -f : Install will be forced even if the package exists in core OpenWrt (override)
search [options] <substring>: Search for a package
Options: