ramips: fix 8M WT3020 image creation
[librecmc/librecmc.git] / scripts / metadata.pm
index 1891c0a6ee88353dd7225707c8e0ba62a1efa360..b3f34f79e9fef9300ed5783b25923b64525a9a5c 100644 (file)
@@ -84,15 +84,18 @@ sub parse_target_metadata($) {
                        $profile = {
                                id => $1,
                                name => $1,
+                               priority => 999,
                                packages => []
                        };
                        push @{$target->{profiles}}, $profile;
                };
                /^Target-Profile-Name:\s*(.+)\s*$/ and $profile->{name} = $1;
+               /^Target-Profile-Priority:\s*(\d+)\s*$/ and do {
+                       $profile->{priority} = $1;
+                       $target->{sort} = 1;
+               };
                /^Target-Profile-Packages:\s*(.*)\s*$/ and $profile->{packages} = [ split(/\s+/, $1) ];
                /^Target-Profile-Description:\s*(.*)\s*/ and $profile->{desc} = get_multiline(*FILE);
-               /^Target-Profile-Config:/ and $profile->{config} = get_multiline(*FILE, "\t");
-               /^Target-Profile-Kconfig:/ and $profile->{kconfig} = 1;
        }
        close FILE;
        foreach my $target (@target) {
@@ -107,6 +110,11 @@ sub parse_target_metadata($) {
                                packages => []
                        }
                ];
+
+               $target->{sort} and @{$target->{profiles}} = sort {
+                       $a->{priority} <=> $b->{priority} or
+                       $a->{name} cmp $b->{name};
+               } @{$target->{profiles}};
        }
        return @target;
 }