build: add option to mark devices as BROKEN
authorAdrian Schmutzler <freifunk@adrianschmutzler.de>
Tue, 28 Jul 2020 18:47:34 +0000 (20:47 +0200)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Thu, 30 Jul 2020 19:49:07 +0000 (21:49 +0200)
By specifying "BROKEN := 1" or "BROKEN := y" for a device, it will be
hidden (and deselected) by default. By that, it provides a stronger
option to "disable" a device beyond just using DEFAULT := n.

To make these devices visible, just enable the BROKEN option in
developer settings as already implemented for targets and packages.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
config/Config-devel.in
include/image.mk
scripts/metadata.pm
scripts/target-metadata.pl

index 11741c70708d1da820ccce714e91eae8af6dd9d3..6447a79db2caa3367caf1d7530ef33928e526ba0 100644 (file)
@@ -9,7 +9,7 @@ menuconfig DEVEL
        default n
 
        config BROKEN
-               bool "Show broken platforms / packages" if DEVEL
+               bool "Show broken platforms / packages / devices" if DEVEL
                default n
 
        config BINARY_FOLDER
index 300f7a66195a30dffd5aa0718d69736578f49a8b..be934e94d34c754e7a866cb594ddc42217be99b6 100644 (file)
@@ -426,6 +426,7 @@ define Device/Init
 
   UBOOT_PATH :=  $(STAGING_DIR_IMAGE)/uboot-$(1)
 
+  BROKEN :=
   DEFAULT :=
 endef
 
@@ -638,6 +639,7 @@ Target-Profile-Name: $(DEVICE_DISPLAY)
 Target-Profile-Packages: $(DEVICE_PACKAGES)
 Target-Profile-hasImageMetadata: $(if $(foreach image,$(IMAGES),$(findstring append-metadata,$(IMAGE/$(image)))),1,0)
 Target-Profile-SupportedDevices: $(SUPPORTED_DEVICES)
+$(if $(BROKEN),Target-Profile-Broken: $(BROKEN))
 $(if $(DEFAULT),Target-Profile-Default: $(DEFAULT))
 Target-Profile-Description:
 $(DEVICE_DESCRIPTION)
index 1826a040a1165032f49a64f10de40ed0d75f97fe..f6dce39662d280942541303be5cd7de463a00ba0 100644 (file)
@@ -158,6 +158,10 @@ sub parse_target_metadata($) {
                };
                /^Target-Profile-Packages:\s*(.*)\s*$/ and $profile->{packages} = [ split(/\s+/, $1) ];
                /^Target-Profile-Description:\s*(.*)\s*/ and $profile->{desc} = get_multiline(*FILE);
+               /^Target-Profile-Broken:\s*(.+)\s*$/ and do {
+                       $profile->{broken} = 1;
+                       $profile->{default} = "n";
+               };
                /^Target-Profile-Default:\s*(.+)\s*$/ and $profile->{default} = $1;
        }
        close FILE;
index ee0ab5a71811a900a1b79152a3acd924724bf4cf..c58f09657323005adda3f897417b44be7d55c603 100755 (executable)
@@ -239,6 +239,7 @@ config TARGET_$target->{conf}_$profile->{id}
        bool "$profile->{name}"
        depends on TARGET_$target->{conf}
 EOF
+                       $profile->{broken} and print "\tdepends on BROKEN\n";
                        my @pkglist = merge_package_lists($target->{packages}, $profile->{packages});
                        foreach my $pkg (@pkglist) {
                                print "\tselect DEFAULT_$pkg\n";
@@ -298,6 +299,7 @@ menuconfig TARGET_DEVICE_$target->{conf}_$profile->{id}
        depends on TARGET_$target->{conf}
        default $profile->{default}
 EOF
+                       $profile->{broken} and print "\tdepends on BROKEN\n";
                        my @pkglist = merge_package_lists($target->{packages}, $profile->{packages});
                        foreach my $pkg (@pkglist) {
                                print "\tselect DEFAULT_$pkg if !TARGET_PER_DEVICE_ROOTFS\n";