Skip to content

Commit

Permalink
[generate_device_recipe] Allow specifying both bundles and packages f…
Browse files Browse the repository at this point in the history
…or rootfs targets

Signed-off-by: Eugenio Paolantonio (g7) <[email protected]>
  • Loading branch information
g7 committed Sep 11, 2024
1 parent f99192c commit 4383d33
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions generate_device_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,35 +158,37 @@ def generate_recipe_for_product(contents, product, arch, edition, variant, apile
with open(os.path.join(BUILDER_GENERATED_DIRECTORY, "product.yaml"), "w") as f:
f.write(TEMPLATE % template_config)

if config["type"] == "rootfs" and config.get("bundles", []):
for bundle in config["bundles"]:
write_end = False
if bundle["arch"] in ("any", arch) and bundle.get("apilevel", 28) in ("any", int(apilevel)):
if bundle.get("only_stable", False):
f.write(TEMPLATE_ONLY_STABLE)
write_end = True
elif bundle.get("only_nightly", False):
f.write(TEMPLATE_ONLY_NIGHTLY)
write_end = True

f.write(
TEMPLATE_BUNDLE % {
"name" : bundle["name"],
"architecture" : arch,
"packages" : " ".join(bundle["packages"]),
"apilevel" : int(apilevel),
}
)

if write_end:
f.write(TEMPLATE_END)
elif config["type"] == "rootfs" and config.get("packages", []):
f.write(
TEMPLATE_IMAGE_ADAPTATION % {
"architecture" : arch,
"packages" : " ".join(config["packages"])
}
)
if config["type"] == "rootfs":
if config.get("bundles", []):
for bundle in config["bundles"]:
write_end = False
if bundle["arch"] in ("any", arch) and bundle.get("apilevel", 28) in ("any", int(apilevel)):
if bundle.get("only_stable", False):
f.write(TEMPLATE_ONLY_STABLE)
write_end = True
elif bundle.get("only_nightly", False):
f.write(TEMPLATE_ONLY_NIGHTLY)
write_end = True

f.write(
TEMPLATE_BUNDLE % {
"name" : bundle["name"],
"architecture" : arch,
"packages" : " ".join(bundle["packages"]),
"apilevel" : int(apilevel),
}
)

if write_end:
f.write(TEMPLATE_END)

if config.get("packages", []):
f.write(
TEMPLATE_IMAGE_ADAPTATION % {
"architecture" : arch,
"packages" : " ".join(config["packages"])
}
)
elif config["type"] == "image":
f.write(
TEMPLATE_IMAGE_ADAPTATION % {
Expand Down

0 comments on commit 4383d33

Please sign in to comment.