metadata.pl: add support for forcing sorting of profiles
[openwrt/staging/wigyori.git] / scripts / metadata.pl
index 410fa9fe24fa2bb8852be9ecf08685b05c144d15..f5afb1e47b49a60d696afc42705d706e1f39c7c7 100755 (executable)
@@ -282,6 +282,10 @@ EOF
 
        foreach my $target (@target) {
                my $profiles = $target->{profiles};
+               $target->{sort} and @$profiles = sort {
+                       $a->{priority} <=> $b->{priority} or
+                       $a->{name} cmp $b->{name};
+               } @$profiles;
 
                foreach my $profile (@$profiles) {
                        print <<EOF;