Creata funzione di comodo per creazione dei checksum.

This commit is contained in:
Emiliano Vavassori 2022-04-09 01:30:47 +02:00
parent e84f275f42
commit a3380cecc4
1 changed files with 14 additions and 7 deletions

View File

@ -292,14 +292,17 @@ class Build(object):
for arch in self.arch:
for item in [ self.appimagefilename[arch], self.zsyncfilename[arch] ]:
# For any built arch, find out if a file exist.
if not os.path.exists(f"{item}.md5"):
# Build checksum
checksum = subprocess.run(shlex.split(f"md5sum {item}"), capture_output=True, text=True, encoding='utf-8')
if checksum.stdout:
with open(f"{item}.md5", 'w+') as f:
f.write(checksum.stdout)
self.__create_checksum__(item)
def __create_checksum__(self, file):
"""Internal function to create checksum file."""
if not os.path.exists(f"{file}.md5"):
checksum = subprocess.run(shlex.split(f"md5sum {file}"), capture_output=True, text=True, encoding='utf-8')
if checksum.stdout:
with open(f"{file}.md5", 'w+') as c:
c.write(checksum.stdout)
def publish(self):
"""Moves built versions to definitive storage."""
if all(self.built.values()):
@ -324,6 +327,10 @@ class Build(object):
# Creating versions for short version and query text
versions = [ self.short_version, self.branch_version ]
for arch in Build.ARCHSTD:
# If already built, do not do anything.
if self.built[arch]:
continue
os.chdir(self.full_path)
# if the appimage for the reported arch is not found, skip to next
# arch
@ -341,7 +348,7 @@ class Build(object):
os.unlink(appimagefilename[arch])
os.symlink(self.appimagefilename[arch], appimagefilename[arch])
# Create the checksum for the AppImage
subprocess.run(shlex.split(f"md5sum {appimagefilename[arch]} > {appimagefilename[arch]}.md5"))
self.__create_checksum__(appimagefilename[arch])
# Do not continue if no zsync file is provided.
if not self.updatable:
continue