latest symlinks for boot and live images

This commit is contained in:
Louis Abel 2022-08-05 15:00:04 -07:00
parent bffff511f3
commit 77ba94cca1
Signed by: label
GPG Key ID: B37E62D143879B36

View File

@ -566,13 +566,13 @@ class IsoBuild:
c.write(checksum) c.write(checksum)
c.close() c.close()
#linksum = Shared.get_checksum(linkbootpath, self.checksum, self.log) linksum = Shared.get_checksum(linkbootpath, self.checksum, self.log)
#if not linksum: if not linksum:
# self.log.error(Color.FAIL + linkbootpath + ' not found! Did we actually make the symlink?') self.log.error(Color.FAIL + linkbootpath + ' not found! Did we actually make the symlink?')
# return return
#with open(linkbootpath + '.CHECKSUM', "w+") as l: with open(linkbootpath + '.CHECKSUM', "w+") as l:
# l.write(linksum) l.write(linksum)
# l.close() l.close()
def _copy_nondisc_to_repo(self, force_unpack, arch, repo): def _copy_nondisc_to_repo(self, force_unpack, arch, repo):
""" """
@ -1932,6 +1932,13 @@ class LiveBuild:
arch, arch,
self.date self.date
) )
isolink = '{}-{}-{}-{}-{}.iso'.format(
self.shortname,
self.major_version,
image,
arch,
'latest'
)
live_res_dir = '/var/lib/mock/{}-{}-{}/result'.format( live_res_dir = '/var/lib/mock/{}-{}-{}/result'.format(
self.shortname.lower(), self.shortname.lower(),
self.major_version, self.major_version,
@ -1969,8 +1976,17 @@ class LiveBuild:
self.log.info(Color.INFO + 'Copying image to work directory') self.log.info(Color.INFO + 'Copying image to work directory')
source_path = os.path.join(live_res_dir, isoname) source_path = os.path.join(live_res_dir, isoname)
dest_path = os.path.join(live_dir_arch, isoname) dest_path = os.path.join(live_dir_arch, isoname)
link_path = os.path.join(live_dir_arch, isolink)
os.makedirs(live_dir_arch, exist_ok=True) os.makedirs(live_dir_arch, exist_ok=True)
shutil.copy2(source_path, dest_path) try:
shutil.copy2(source_path, dest_path)
if os.path.exists(link_path):
os.remove(link_path)
os.symlink(isoname, link_path)
except:
self.log.error(Color.FAIL + 'We could not copy the image or create a symlink.')
return
self.log.info(Color.INFO + 'Generating checksum') self.log.info(Color.INFO + 'Generating checksum')
checksum = Shared.get_checksum(dest_path, self.checksum, self.log) checksum = Shared.get_checksum(dest_path, self.checksum, self.log)
if not checksum: if not checksum: