[openwrt/openwrt] scripts/feeds: fix preference of package install

LEDE Commits lede-commits at lists.infradead.org
Thu Dec 10 04:25:29 EST 2020


aparcar pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/a3e5b24d430a752caebf513aaacce707204b5def

commit a3e5b24d430a752caebf513aaacce707204b5def
Author: Karel Kočí <karel.koci at nic.cz>
AuthorDate: Tue Dec 10 13:04:19 2019 +0100

    scripts/feeds: fix preference of package install
    
    The previous behavior prefered same feed for dependent packages as
    initial package. This caused inconsitency in installation of packages.
    The difference was if two feeds provide same package (different version)
    there was different result if you executed install for that specific
    version compared to install for package depending on it from different
    feed.
    
    This ensures that preferred feed is propagated without change and
    selected feed is used only really for package it was selected for.
    
    Signed-off-by: Karel Kočí <karel.koci at nic.cz>
---
 scripts/feeds | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/scripts/feeds b/scripts/feeds
index e402200194..122f8568cb 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -517,19 +517,19 @@ sub install_src {
 	my $force = shift;
 	my $ret = 0;
 
-	$feed = lookup_src($feed, $name);
-	unless ($feed) {
+	my $select_feed = lookup_src($feed, $name);
+	unless ($select_feed) {
 		$installed{$name} and return 0;
 		$feed_src->{$name} or warn "WARNING: No feed for source package '$name' found\n";
 		return 0;
 	}
 
 	# switch to the metadata for the selected feed
-	get_feed($feed->[1]);
+	get_feed($select_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})) {
+	if (exists($select_feed->[3]{force})) {
 		$force = 1;
 	}
 
@@ -557,12 +557,12 @@ sub install_src {
 	}
 
 	if ($override) {
-		warn "Overriding core package '$name' with version from $feed->[1]\n";
+		warn "Overriding core package '$name' with version from $select_feed->[1]\n";
 	} else {
-		warn "Installing package '$name' from $feed->[1]\n";
+		warn "Installing package '$name' from $select_feed->[1]\n";
 	}
 
-	do_install_src($feed, $src) == 0 or do {
+	do_install_src($select_feed, $src) == 0 or do {
 		warn "failed.\n";
 		return 1;
 	};
@@ -597,15 +597,15 @@ sub install_package {
 	my $name = shift;
 	my $force = shift;
 
-	$feed = lookup_package($feed, $name);
-	unless ($feed) {
+	my $select_feed = lookup_package($feed, $name);
+	unless ($select_feed) {
 		$installed_pkg{$name} and return 0;
 		$feed_vpackage->{$name} or warn "WARNING: No feed for package '$name' found\n";
 		return 0;
 	}
 
 	# switch to the metadata for the selected feed
-	get_feed($feed->[1]);
+	get_feed($select_feed->[1]);
 	my $pkg = $feed_vpackage->{$name} or return 1;
 	return install_src($feed, $pkg->[0]{src}{name}, $force);
 }
@@ -615,14 +615,12 @@ sub install_target_or_package {
 	my $name = shift;
 	my $force = shift;
 
-	my $this_feed_target = lookup_target($feed, $name);
-	$this_feed_target and do {
-		return install_target($this_feed_target, $name);
+	lookup_target($feed, $name) and do {
+		return install_target($feed, $name);
 	};
 
-	my $this_feed_src = lookup_src($feed, $name);
-	$this_feed_src and do {
-		return install_src($this_feed_src, $name, $force);
+	lookup_src($feed, $name) and do {
+		return install_src($feed, $name, $force);
 	};
 
 	return install_package($feed, $name, $force);



More information about the lede-commits mailing list