diff options
author | Felix Fietkau <nbd@nbd.name> | 2016-05-10 14:43:46 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-05-11 19:03:35 +0200 |
commit | 1189af85fd35f46fa5239b5de6113d3665b9d9cf (patch) | |
tree | caec812f4367e314cf84b1eb62e3598ae81d51c0 /scripts | |
parent | 87550a0e8784805ade2058c3f320add972062941 (diff) | |
download | mtk-20170518-1189af85fd35f46fa5239b5de6113d3665b9d9cf.zip mtk-20170518-1189af85fd35f46fa5239b5de6113d3665b9d9cf.tar.gz mtk-20170518-1189af85fd35f46fa5239b5de6113d3665b9d9cf.tar.bz2 |
metadata.pl: add support for forcing sorting of profiles
Used to mix device profiles (specified in the image makefile) with
regular target profiles.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/metadata.pl | 4 | ||||
-rw-r--r-- | scripts/metadata.pm | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/scripts/metadata.pl b/scripts/metadata.pl index 410fa9f..f5afb1e 100755 --- a/scripts/metadata.pl +++ b/scripts/metadata.pl @@ -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; diff --git a/scripts/metadata.pm b/scripts/metadata.pm index 1891c0a..3b75621 100644 --- a/scripts/metadata.pm +++ b/scripts/metadata.pm @@ -84,11 +84,16 @@ 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-Name:\s*(.+)\s*$/ and do { + $target->{sort} = 1; + $profile->{name} = $1; + }; + /^Target-Profile-Priority:\s*(\d+)\s*$/ and $profile->{priority} = $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"); |