[OpenWrt-Devel] [PATCH] metadata: express conflicts in a single line

Mathias Kresin dev at kresin.me
Thu Jul 12 13:33:37 EDT 2018


Due to the use of dependencies to express conflicts, a package which
conflicts with multiple other packages (variants) is indented one level
for each conflict:

< > pkg-variant-a
< >   pkg-variant-b (conflicts pkg-variant-a)
< >     pkg-variant-c (conflicts pkg-variant-a && pkg-variant-b)

Express conflicts in a single line by using the logical AND operator to
fix the visual glitch.

Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 scripts/package-metadata.pl | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl
index 53bb45a..3e5d8f7 100755
--- a/scripts/package-metadata.pl
+++ b/scripts/package-metadata.pl
@@ -243,12 +243,20 @@ sub mconf_conflicts {
 	my $pkgname = shift;
 	my $depends = shift;
 	my $res = "";
+	my @conflics;
 
 	foreach my $depend (@$depends) {
 		next unless $package{$depend};
-		$res .= "\t\tdepends on m || (PACKAGE_$depend != y)\n";
+		push @conflics, "PACKAGE_$depend != y";
 	}
-	return $res;
+
+	if (!@conflics) {
+		return $res;
+	}
+
+	$res = join(" && ", at conflics);
+
+	return "\t\tdepends on m || ($res)\n";
 }
 
 sub print_package_config_category($) {
-- 
2.7.4


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list