All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCHv2 01/12] support/scripts: add check-dotconfig.py
@ 2020-04-21 17:26 Romain Naour
  2020-04-21 17:26 ` [Buildroot] [PATCHv2 02/12] gitlab-ci: check generated config files Romain Naour
                   ` (11 more replies)
  0 siblings, 12 replies; 22+ messages in thread
From: Romain Naour @ 2020-04-21 17:26 UTC (permalink / raw)
  To: buildroot

For the same reason as for 50b747f212be2c9c0f7cf10c674ed488d042715c,
we need to check if the generated configuration file (.config)
contains all symbols present in the defconfig file.

If not there is an issue with the defconfig.

This script will be used in .gitlab-ci.yml.

Inspired by is_toolchain_usable() function from genrandconfig:
https://git.busybox.net/buildroot/tree/utils/genrandconfig?h=2020.02#n164

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Yann E. MORIN <yann.morin.1998@free.fr>
---
v2: update with the improved patch suggested by Yann.
    http://lists.busybox.net/pipermail/buildroot/2020-April/280679.html
---
 support/scripts/check-dotconfig.py | 44 ++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100755 support/scripts/check-dotconfig.py

diff --git a/support/scripts/check-dotconfig.py b/support/scripts/check-dotconfig.py
new file mode 100755
index 0000000000..81c83a8481
--- /dev/null
+++ b/support/scripts/check-dotconfig.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python3
+
+# This scripts check that all lines present in the defconfig are
+# still present in the .config
+
+import sys
+
+
+def main():
+    if not (len(sys.argv) == 3):
+        print("Error: incorrect number of arguments")
+        print("""Usage: check-dotconfig <configfile> <defconfig>""")
+        sys.exit(1)
+
+    configfile = sys.argv[1]
+    defconfig = sys.argv[2]
+
+    # strip() to get rid of trailing \n
+    with open(configfile) as configf:
+        configlines = [l.strip() for l in configf.readlines()]
+
+    defconfiglines = []
+    with open(defconfig) as defconfigf:
+        for line in defconfigf.readlines():
+            # strip() to get rid of trailing \n
+            line = line.strip()
+            if line.startswith("BR2_"):
+                defconfiglines.append(line)
+            elif line.startswith('# BR2_') and line.endswith(' is not set'):
+                defconfiglines.append(line)
+
+    # Check that all the defconfig lines are still present
+    missing = [defconfigline.strip() for defconfigline in defconfiglines
+               if defconfigline not in configlines]
+
+    if len(missing):
+        print("WARN: defconfig {} can't be used:".format(defconfig))
+        for m in missing:
+            print("      Missing: {}".format(m))
+    sys.exit(1 if len(missing) else 0)
+
+
+if __name__ == "__main__":
+    main()
-- 
2.25.3

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2020-05-07 21:11 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21 17:26 [Buildroot] [PATCHv2 01/12] support/scripts: add check-dotconfig.py Romain Naour
2020-04-21 17:26 ` [Buildroot] [PATCHv2 02/12] gitlab-ci: check generated config files Romain Naour
2020-04-21 19:44   ` Thomas Petazzoni
2020-04-21 19:52   ` Yann E. MORIN
2020-04-21 17:26 ` [Buildroot] [PATCHv2 03/12] configs/amarula_a64_relic_defconfig: remove BR2_PACKAGE_HOST_ANDROID_TOOLS_FASTBOOT Romain Naour
2020-04-21 19:43   ` Thomas Petazzoni
2020-04-21 19:48     ` Romain Naour
2020-04-21 17:26 ` [Buildroot] [PATCHv2 04/12] configs: fix typo BR2_TARGET_ROOTFS_EXT2_4 Romain Naour
2020-04-21 19:29   ` Fabio Estevam
2020-04-21 17:26 ` [Buildroot] [PATCHv2 05/12] configs:minnowboard_max-graphical_defconfig: re-enable GLX support Romain Naour
2020-05-07 21:11   ` Peter Korsgaard
2020-04-21 17:26 ` [Buildroot] [PATCHv2 06/12] configs/nanopi_r1_defconfig: remove BR2_TARGET_UBOOT_BOARD_DEFCONFIG Romain Naour
2020-04-21 17:26 ` [Buildroot] [PATCHv2 07/12] configs: remove BR2_PACKAGE_QT5BASE_LICENSE_APPROVED Romain Naour
2020-04-21 19:54   ` Yann E. MORIN
2020-04-21 17:26 ` [Buildroot] [PATCHv2 08/12] configs/engicam_imx6qdl_icore_qt5_defconfig: needs udev to select glmark2 Romain Naour
2020-04-21 19:28   ` Fabio Estevam
2020-04-21 17:26 ` [Buildroot] [PATCHv2 09/12] configs/olimex_a20_olinuxino_lime{, 2}_defconfig: use a glibc toolchain Romain Naour
2020-04-21 17:26 ` [Buildroot] [PATCHv2 10/12] configs/qemu_ppc_virtex_ml507_defconfig: select BR2_POWERPC_SOFT_FLOAT Romain Naour
2020-04-21 17:26 ` [Buildroot] [PATCHv2 11/12] configs/qemu_riscv*: remove BR2_TARGET_OPENSBI_USE_PLAT Romain Naour
2020-04-21 17:26 ` [Buildroot] [PATCHv2 12/12] gitlab-ci: check all defconfigs on every push Romain Naour
2020-04-21 20:23   ` Yann E. MORIN
2020-04-21 20:09 ` [Buildroot] [PATCHv2 01/12] support/scripts: add check-dotconfig.py Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.