From: Felix Fietkau Date: Tue, 10 May 2016 12:43:46 +0000 (+0200) Subject: metadata.pl: add support for forcing sorting of profiles X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=1189af85fd35f46fa5239b5de6113d3665b9d9cf;p=openwrt%2Fstaging%2Fstintel.git 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 --- diff --git a/include/target.mk b/include/target.mk index 817901f0b9..f4342bdbb5 100644 --- a/include/target.mk +++ b/include/target.mk @@ -59,6 +59,7 @@ extra_packages = $(if $(filter wpad-mini wpad nas,$(1)),iwinfo) define ProfileDefault NAME:= + PRIORITY:= PACKAGES:= endef @@ -70,6 +71,7 @@ define Profile dumpinfo : $(call shexport,Profile/$(1)/Description) DUMPINFO += \ echo "Target-Profile: $(1)"; \ + $(if $(PRIORITY), echo "Target-Profile-Priority: $(PRIORITY)"; ) \ echo "Target-Profile-Name: $(NAME)"; \ echo "Target-Profile-Packages: $(PACKAGES) $(call extra_packages,$(DEFAULT_PACKAGES) $(PACKAGES))"; \ if [ -f ./config/profile-$(1) ]; then \ diff --git a/scripts/metadata.pl b/scripts/metadata.pl index 410fa9fe24..f5afb1e47b 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 < $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");