From 098a0f1159ae261d9924b2da21db2ea53e906377 Mon Sep 17 00:00:00 2001 From: Roman Shcherbakov Date: Mon, 4 Aug 2025 19:30:04 +0300 Subject: [PATCH] scripts: gen_config: new features to remove package and include profiles Add processing two new sections in gen_config.py: * include: add the possibility to include one profile into another; * packages_remove: add separate section to remove some packages. References: PCF-1849, FEAT-84 Signed-off-by: Roman Shcherbakov --- scripts/gen_config.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/gen_config.py b/scripts/gen_config.py index e5755ab358..3de714ec03 100755 --- a/scripts/gen_config.py +++ b/scripts/gen_config.py @@ -73,6 +73,11 @@ def load_yaml(fname: str, profile: dict): if not f.get("feed") or not f.get("packages"): die(f"Found bad additional_packages {f}") profile["additional_packages"].extend(new.get(n)) + elif n in {"include"}: + profile["include"].extend(new.get(n)) + elif n in {"packages_remove"}: + profile["packages_remove"].extend(new.get(n)) + return profile if not profile_file.is_file(): @@ -157,11 +162,16 @@ profile = { "feeds": {}, "packages": [], "profiles": [], + "include": [], + "packages_remove": [], } for p in sys.argv[1:]: profile = load_yaml(p, profile) +for p in profile.get("include", []): + profile = load_yaml(p, profile) + if getenv("GENCONFIG_VERBOSE"): print(yaml.dump(profile)) @@ -236,6 +246,10 @@ for ap in profile.get("additional_packages"): config_output += f"{profile.get('diffconfig', '')}" +for package in profile.get("packages_remove", []): + print(f"Remove package from .config: {package}") + config_output += f"# CONFIG_PACKAGE_{package} is not set\n" + Path(".config").write_text(config_output) print("Configuration written to .config")