From e25d6ed7dd04a72aa785a1f96fe83be0da56c5b1 Mon Sep 17 00:00:00 2001 From: Luis Eduardo Bonatti Date: Thu, 29 Aug 2024 12:07:22 -0300 Subject: [PATCH] Fix metadata tag and location During the creation of prepatched iso the updated metadata was copied only to upgrade folder, this commit fix it by copying to patches as well. It also fix a tag location to be on root level. Test Plan: PASS: Build prepatched image. PASS: Check SHA is the same between patches/upgrade metadata.xml. PASS: Check prepatched_iso tag is on root level. Story: 2010676 Task: 50936 Change-Id: I3b7c1f614877c48497d23bbcddc4ea4bb23b3352 Signed-off-by: Luis Eduardo Bonatti --- build-tools/create-prepatched-iso | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build-tools/create-prepatched-iso b/build-tools/create-prepatched-iso index 924f13c2..a215a1af 100755 --- a/build-tools/create-prepatched-iso +++ b/build-tools/create-prepatched-iso @@ -226,7 +226,7 @@ def add_tag_xml(parent, name, text): tag = ET.SubElement(parent, name) tag.text = text -def add_ostree_info(metadata, iso_path): +def update_metadata_info(metadata, iso_path): """Adds ostree repository info to a metadata file This function get the ostree data from inside the iso and update @@ -245,15 +245,15 @@ def add_ostree_info(metadata, iso_path): add_tag_xml(ostree, "number_of_commits", "1") + # Update prepatched iso field + add_tag_xml(root, "prepatched_iso", "Y") + base_element = ET.SubElement(ostree, "base") # For now we add empty values here as the software # expect this fields to be in the XML add_tag_xml(base_element, "commit", "") add_tag_xml(base_element, "checksum", "") - # Add Y to prepatched-iso tag - add_tag_xml(base_element, "prepatched_iso", "Y") - # Get ostree commit try: cmd = f"ostree --repo={iso_path}/ostree_repo rev-parse starlingx" @@ -449,9 +449,9 @@ def main(): # Copy only the patch metadata with the biggest patch version to ISO patch_num = int(patch["sw_version"].split(".")[-1]) if latest_patch_number == patch_num: - shutil.copy(patch["metadata"], f"{iso_folder}/patches") # Metadata inside upgrades requires ostree information - add_ostree_info(patch["metadata"], iso_folder) + update_metadata_info(patch["metadata"], iso_folder) + shutil.copy(patch["metadata"], f"{iso_folder}/patches") shutil.copy(patch["metadata"], f"{iso_folder}/upgrades") # Update ostree summary