diff mbox series

[OpenWrt-Devel,1/3] scripts: target-metadata don't add PROFILES twice

Message ID 20200401061748.2022142-2-mail@aparcar.org
State New
Headers show
Series ImageBuilder: Show alternative names | expand

Commit Message

Paul Spooren April 1, 2020, 6:17 a.m. UTC
Since 4ee3cf2b5a profiles with alternative vendor names may appear
multiple times in `tmp/.targetinfo` or `.targetinfo` (for
ImageBuilders).

The `target-metadata.pl` script adds these profiles then twice to
`PROFILE_NAMES` and the ImageBuilder show the profile twices when
running `make info`.

This patch uses Perls `uniq` function to add the profiles only once to
`.profiles.mk`.

Signed-off-by: Paul Spooren <mail@aparcar.org>
---
 scripts/target-metadata.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/scripts/target-metadata.pl b/scripts/target-metadata.pl
index ee0ab5a718..fd8f4096a7 100755
--- a/scripts/target-metadata.pl
+++ b/scripts/target-metadata.pl
@@ -4,6 +4,7 @@  use lib "$FindBin::Bin";
 use strict;
 use metadata;
 use Getopt::Long;
+use List::MoreUtils qw(uniq);
 
 sub target_config_features(@) {
 	my $ret;
@@ -426,7 +427,7 @@  sub gen_profile_mk() {
 	my @targets = parse_target_metadata($file);
 	foreach my $cur (@targets) {
 		next unless $cur->{id} eq $target;
-		print "PROFILE_NAMES = ".join(" ", map { $_->{id} } @{$cur->{profiles}})."\n";
+		print "PROFILE_NAMES = ".join(" ", uniq map { $_->{id} } @{$cur->{profiles}})."\n";
 		foreach my $profile (@{$cur->{profiles}}) {
 			print $profile->{id}.'_NAME:='.$profile->{name}."\n";
 			print $profile->{id}.'_HAS_IMAGE_METADATA:='.$profile->{has_image_metadata}."\n";