diff mbox

[LEDE-DEV,2/5] scripts/package-metadata.pl: split variants into -y and -m lists

Message ID 1476553202-5272-3-git-send-email-jo@mein.io
State Superseded
Headers show

Commit Message

Jo-Philipp Wich Oct. 15, 2016, 5:39 p.m. UTC
When emitting .packagedeps, build separate srcpkg/variants lists for build
variants in <*> and <m> states - this is needed to restrict opkg package
installation to only <*> variants in a later change.

Right now the package install code considers the entire variants list
which will include both <*> and <m> selected packages, ultimatively leading
to file clashes upon opkg install when multiple conflicting candidates are
passed to the opkg command line.

This issue happens for example if package "ip" is set to <m> and package
"ip-full" to <*> -  the install command will eventually fail with:

     * check_conflicts_for: The following packages conflict with ip:
     * check_conflicts_for: 	ip-full *
     * opkg_install_cmd: Cannot install package ip.

For backwards compatibility with subdir.mk continue to emit */variants
lists as unions of the previous */variants-y and */variants-m lists.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
---
 scripts/package-metadata.pl | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl
index 0e42414..9b6dced 100755
--- a/scripts/package-metadata.pl
+++ b/scripts/package-metadata.pl
@@ -401,6 +401,7 @@  sub gen_package_mk() {
 	my %dep;
 	my %done;
 	my $line;
+	my @variants;
 
 	parse_package_metadata($ARGV[0]) or exit 1;
 	foreach my $name (sort {uc($a) cmp uc($b)} keys %package) {
@@ -418,7 +419,8 @@  sub gen_package_mk() {
 				if (!defined($done{$pkg->{src}}) or $pkg->{variant_default}) {
 					print "\$(curdir)/$pkg->{subdir}$pkg->{src}/default-variant := $pkg->{variant}\n";
 				}
-				print "\$(curdir)/$pkg->{subdir}$pkg->{src}/variants += \$(if $config,$pkg->{variant})\n"
+				print "\$(curdir)/$pkg->{subdir}$pkg->{src}/variants-$config += $pkg->{variant}\n";
+				push @variants, "$pkg->{subdir}$pkg->{src}";
 			}
 			$pkg->{prereq} and print "prereq-$config += $pkg->{subdir}$pkg->{src}\n";
 		}
@@ -540,6 +542,10 @@  sub gen_package_mk() {
 		}
 	}
 
+	foreach my $srcpkg (@variants) {
+		print "\$(curdir)/$srcpkg/variants := \$(\$(curdir)/$srcpkg/variants-y) \$(\$(curdir)/$srcpkg/variants-m)\n";
+	}
+
 	if ($line ne "") {
 		print "\n$line";
 	}