add in checksum for latest image (RLBT#0000148)

This commit is contained in:
Louis Abel 2022-07-19 02:01:05 -07:00
parent 60f97b1c67
commit 65a4ec93c3
Signed by: label
GPG Key ID: B37E62D143879B36
1 changed files with 21 additions and 0 deletions

View File

@ -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')