aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-03-15 11:08:05 +0000
committerFelix Fietkau <nbd@openwrt.org>2015-03-15 11:08:05 +0000
commit2888f54b6df1ea2d90f477e99dd2caa6ff3821b0 (patch)
treeb5ecb974102fe082c12a1286a765d414eb355ab2 /scripts
parentf7a7b550d3eb9e3ddf993143fe5531c54206e5a5 (diff)
downloadupstream-2888f54b6df1ea2d90f477e99dd2caa6ff3821b0.tar.gz
upstream-2888f54b6df1ea2d90f477e99dd2caa6ff3821b0.tar.bz2
upstream-2888f54b6df1ea2d90f477e99dd2caa6ff3821b0.zip
scripts/feeds: add support for installing targets
Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@44781 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/feeds57
1 files changed, 57 insertions, 0 deletions
diff --git a/scripts/feeds b/scripts/feeds
index a1795e1639..62edb66820 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -366,6 +366,30 @@ sub do_install_package($$) {
return 0;
}
+sub do_install_target($) {
+ my $target = shift;
+ my $path = $target->{makefile};
+
+ if ($path) {
+ $path =~ s/\/Makefile$//;
+ my $name = $path;
+ $name =~ s/.*\///;
+ my $dest = "./target/linux/$name";
+
+ -e $dest and do {
+ warn "Path $dest already exists";
+ return 1;
+ };
+
+ system("ln -sf ../../$path ./target/linux/");
+ } else {
+ warn "Package is not valid\n";
+ return 1;
+ }
+
+ return 0;
+}
+
sub lookup_package($$) {
my $feed = shift;
my $package = shift;
@@ -378,6 +402,18 @@ sub lookup_package($$) {
return;
}
+sub lookup_target($$) {
+ my $feed = shift;
+ my $target = shift;
+
+ foreach my $feed ($feed, @feeds) {
+ next unless $feed->[1];
+ next unless $feed_cache{$feed->[1]};
+ $feed_cache{$feed->[1]}->[2]->{$target} and return $feed;
+ }
+ return;
+}
+
sub is_core_package($) {
my $package = shift;
foreach my $file ("tmp/info/.packageinfo-$package", glob("tmp/info/.packageinfo-*_$package")) {
@@ -387,12 +423,33 @@ sub is_core_package($) {
return 0;
}
+sub install_target {
+ my $feed = shift;
+ my $name = shift;
+
+ $feed = $feed_cache{$feed->[1]}->[2];
+ $feed or return 0;
+
+ my $target = $feed->{$name};
+ $target or return 0;
+
+ warn "Installing target '$name'\n";
+ return do_install_target($target);
+}
+
sub install_package {
my $feed = shift;
my $name = shift;
my $force = shift;
my $ret = 0;
+ $feed = lookup_target($feed, $name);
+ $feed and do {
+ $installed_targets{$name} and return 0;
+ install_target($feed, $name);
+ return 0;
+ };
+
$feed = lookup_package($feed, $name);
$feed or do {
$installed{$name} and return 0;