[LEDE-DEV] [PATCH] scripts: case insensitive sort device names

Karl Palsson karlp at etactica.com
Wed Oct 12 06:51:23 PDT 2016


When selecting devices from the Target Devices menu, the brand choices
of naming makes it confusing to find particular devices by name, as the
sorting is case sensitve.  AirTight came after ALFA, and devolo and
jjPlus both came after Zyxel.

This does _not_ apply to the Target Profile list, as that includes
"Default - all profiles" inside the profile list.

Signed-off-by: Karl Palsson <karlp at etactica.com>
---
 scripts/target-metadata.pl | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/target-metadata.pl b/scripts/target-metadata.pl
index 3422572d1639..7f7dc6d4ee77 100755
--- a/scripts/target-metadata.pl
+++ b/scripts/target-metadata.pl
@@ -276,8 +276,12 @@ menu "Target Devices"
 
 EOF
 	foreach my $target (@target) {
-		my $profiles = $target->{profiles};
-		foreach my $profile (@{$target->{profiles}}) {
+		my @profiles = sort {
+			my $x = $a->{name};
+			my $y = $b->{name};
+			"\L$x" cmp "\L$y";
+		} @{$target->{profiles}};
+		foreach my $profile (@profiles) {
 			next unless $profile->{id} =~ /^DEVICE_/;
 			print <<EOF;
 menuconfig TARGET_DEVICE_$target->{conf}_$profile->{id}
-- 
2.4.11




More information about the Lede-dev mailing list