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 <r.shcherbakov@inango-systems.com>
This commit is contained in:
parent
0bf1ac5b8a
commit
098a0f1159
@ -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")
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user