From 65a4ec93c323353742ab99f9c9a8f76b3a1b2440 Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Tue, 19 Jul 2022 02:01:05 -0700 Subject: [PATCH] add in checksum for latest image (RLBT#0000148) --- iso/empanadas/empanadas/util/iso_utils.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/iso/empanadas/empanadas/util/iso_utils.py b/iso/empanadas/empanadas/util/iso_utils.py index a098791..6db7ce8 100644 --- a/iso/empanadas/empanadas/util/iso_utils.py +++ b/iso/empanadas/empanadas/util/iso_utils.py @@ -1358,6 +1358,7 @@ class IsoBuild: source_path = latest_artifacts[arch] drop_name = source_path.split('/')[-1] + checksum_name = drop_name + '.CHECKSUM' full_drop = '{}/{}'.format( image_arch_dir, drop_name @@ -1407,6 +1408,15 @@ class IsoBuild: arch, formattype ) + latest_path = latest_name.split('/')[-1] + latest_checksum = '{}/{}-{}-{}.latest.{}.{}.CHECKSUM'.format( + image_arch_dir, + self.shortname, + self.major_version, + imagename, + arch, + formattype + ) # For some reason python doesn't have a "yeah just change this # link" part of the function if os.path.exists(latest_name): @@ -1414,6 +1424,17 @@ class IsoBuild: os.symlink(drop_name, latest_name) + self.log.info('Creating checksum for latest symlinked image...') + shutil.copy2(checksum_drop, latest_checksum) + with open(latest_checksum, 'r') as link: + checkdata = link.read() + + checkdata = checkdata.replace(drop_name, latest_path) + + with open(latest_checksum, 'w+') as link: + link.write(checkdata) + link.close() + self.log.info(Color.INFO + 'Image download phase completed')