mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-29 23:54:26 +00:00
scripts/feeds: install targets to target/linux/feeds and support overriding
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
0bdf8d1206
commit
ebc36ebb23
@ -434,14 +434,16 @@ sub do_install_target($) {
|
|||||||
$path =~ s/\/Makefile$//;
|
$path =~ s/\/Makefile$//;
|
||||||
my $name = $path;
|
my $name = $path;
|
||||||
$name =~ s/.*\///;
|
$name =~ s/.*\///;
|
||||||
my $dest = "./target/linux/$name";
|
my $dest = "./target/linux/feeds/$name";
|
||||||
|
|
||||||
|
-d "./target/linux/feeds" or mkdir "./target/linux/feeds";
|
||||||
|
|
||||||
-e $dest and do {
|
-e $dest and do {
|
||||||
warn "Path $dest already exists";
|
warn "Path $dest already exists";
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
system("ln -sf ../../$path ./target/linux/");
|
system("ln -sf ../../../$path ./target/linux/feeds/");
|
||||||
} else {
|
} else {
|
||||||
warn "Target is not valid\n";
|
warn "Target is not valid\n";
|
||||||
return 1;
|
return 1;
|
||||||
@ -498,18 +500,34 @@ sub is_core_src($) {
|
|||||||
sub install_target {
|
sub install_target {
|
||||||
my $feed = shift;
|
my $feed = shift;
|
||||||
my $name = shift;
|
my $name = shift;
|
||||||
|
my $force = shift;
|
||||||
|
|
||||||
$feed = lookup_target($feed, $name);
|
$feed = lookup_target($feed, $name);
|
||||||
|
my $feed_name = $feed->[1];
|
||||||
|
|
||||||
$installed_targets{$name} and return 0;
|
-e "target/linux/feeds/$name" and return 0;
|
||||||
|
|
||||||
$feed = $feed_cache{$feed->[1]}->[2];
|
# enable force flag if feed src line was declared with --force
|
||||||
|
if (exists($feed->[3]{force})) {
|
||||||
|
$force = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$feed = $feed_cache{$feed_name}->[2];
|
||||||
$feed or return 0;
|
$feed or return 0;
|
||||||
|
|
||||||
my $target = $feed->{$name};
|
my $target = $feed->{$name};
|
||||||
$target or return 0;
|
$target or return 0;
|
||||||
|
|
||||||
warn "Installing target '$name'\n";
|
if (-e "target/linux/$name") {
|
||||||
|
if ($force) {
|
||||||
|
warn "Overriding target '$name' with version from '$feed_name'\n";
|
||||||
|
} else {
|
||||||
|
warn "WARNING: Not overriding core target '$name'; use -f to force\n";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
warn "Installing target '$name'\n";
|
||||||
|
}
|
||||||
return do_install_target($target);
|
return do_install_target($target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,7 +638,7 @@ sub install_target_or_package {
|
|||||||
my $force = shift;
|
my $force = shift;
|
||||||
|
|
||||||
lookup_target($feed, $name) and do {
|
lookup_target($feed, $name) and do {
|
||||||
return install_target($feed, $name);
|
return install_target($feed, $name, $force);
|
||||||
};
|
};
|
||||||
|
|
||||||
lookup_src($feed, $name) and do {
|
lookup_src($feed, $name) and do {
|
||||||
@ -736,7 +754,7 @@ sub uninstall {
|
|||||||
}
|
}
|
||||||
get_installed();
|
get_installed();
|
||||||
while ($name = shift @ARGV) {
|
while ($name = shift @ARGV) {
|
||||||
my $target = "target/linux/$name";
|
my $target = "target/linux/feeds/$name";
|
||||||
-l "$target" and do {
|
-l "$target" and do {
|
||||||
uninstall_target($target);
|
uninstall_target($target);
|
||||||
$uninstall = 1;
|
$uninstall = 1;
|
||||||
@ -903,7 +921,7 @@ my %commands = (
|
|||||||
'uninstall' => \&uninstall,
|
'uninstall' => \&uninstall,
|
||||||
'feed_config' => \&feed_config,
|
'feed_config' => \&feed_config,
|
||||||
'clean' => sub {
|
'clean' => sub {
|
||||||
system("rm -rf ./feeds ./package/feeds");
|
system("rm -rf ./feeds ./package/feeds ./target/linux/feeds");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user