From cf52665a8dabf36641757ebe5f0d5fe1786b7546 Mon Sep 17 00:00:00 2001 From: Haibo Lin Date: Fri, 19 Jul 2019 17:23:20 +0800 Subject: [PATCH] Use createrepo_checksum option instead of hardcoded sha256 JIRA: COMPOSE-3392 Signed-off-by: Haibo Lin --- pungi/metadata.py | 13 +++++++------ pungi/phases/createiso.py | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pungi/metadata.py b/pungi/metadata.py index 6d40d1d4..923d4b05 100644 --- a/pungi/metadata.py +++ b/pungi/metadata.py @@ -259,8 +259,9 @@ def write_tree_info(compose, arch, variant, timestamp=None, bi=None): ti.variants.add(var) repomd_path = os.path.join(var.paths.repository, "repodata", "repomd.xml") + createrepo_checksum = compose.conf["createrepo_checksum"] if os.path.isfile(repomd_path): - ti.checksums.add(repomd_path, "sha256", root_dir=os_tree) + ti.checksums.add(repomd_path, createrepo_checksum, root_dir=os_tree) for i in variant.get_variants(types=["addon"], arch=arch): addon = productmd.treeinfo.Variant(ti) @@ -276,7 +277,7 @@ def write_tree_info(compose, arch, variant, timestamp=None, bi=None): repomd_path = os.path.join(addon.paths.repository, "repodata", "repomd.xml") if os.path.isfile(repomd_path): - ti.checksums.add(repomd_path, "sha256", root_dir=os_tree) + ti.checksums.add(repomd_path, createrepo_checksum, root_dir=os_tree) class LoraxProduct(productmd.treeinfo.Release): def _validate_short(self): @@ -310,12 +311,12 @@ def write_tree_info(compose, arch, variant, timestamp=None, bi=None): # stage2 - mainimage if bi_ti.stage2.mainimage: ti.stage2.mainimage = bi_ti.stage2.mainimage - ti.checksums.add(ti.stage2.mainimage, "sha256", root_dir=os_tree) + ti.checksums.add(ti.stage2.mainimage, createrepo_checksum, root_dir=os_tree) # stage2 - instimage if bi_ti.stage2.instimage: ti.stage2.instimage = bi_ti.stage2.instimage - ti.checksums.add(ti.stage2.instimage, "sha256", root_dir=os_tree) + ti.checksums.add(ti.stage2.instimage, createrepo_checksum, root_dir=os_tree) # images for platform in bi_ti.images.images: @@ -327,7 +328,7 @@ def write_tree_info(compose, arch, variant, timestamp=None, bi=None): # We can't add that. continue ti.images.images[platform][image] = path - ti.checksums.add(path, "sha256", root_dir=os_tree) + ti.checksums.add(path, createrepo_checksum, root_dir=os_tree) # add product.img to images-$arch product_img = os.path.join(os_tree, "images", "product.img") @@ -335,7 +336,7 @@ def write_tree_info(compose, arch, variant, timestamp=None, bi=None): if os.path.isfile(product_img): for platform in ti.images.images: ti.images.images[platform]["product.img"] = product_img_relpath - ti.checksums.add(product_img_relpath, "sha256", root_dir=os_tree) + ti.checksums.add(product_img_relpath, createrepo_checksum, root_dir=os_tree) path = os.path.join(compose.paths.compose.os_tree(arch=arch, variant=variant), ".treeinfo") compose.log_info("Writing treeinfo: %s" % path) diff --git a/pungi/phases/createiso.py b/pungi/phases/createiso.py index 5599dc8f..2108a45c 100644 --- a/pungi/phases/createiso.py +++ b/pungi/phases/createiso.py @@ -426,7 +426,7 @@ def prepare_iso(compose, arch, variant, disc_num=1, disc_count=None, split_iso_d ) run(cmd) # add repodata/repomd.xml back to checksums - ti.checksums.add("repodata/repomd.xml", "sha256", root_dir=iso_dir) + ti.checksums.add("repodata/repomd.xml", createrepo_checksum, root_dir=iso_dir) new_ti_path = os.path.join(iso_dir, ".treeinfo") ti.dump(new_ti_path)