Creata funzione di comodo per creazione dei checksum.
This commit is contained in:
parent
e84f275f42
commit
a3380cecc4
@ -292,14 +292,17 @@ class Build(object):
|
|||||||
for arch in self.arch:
|
for arch in self.arch:
|
||||||
for item in [ self.appimagefilename[arch], self.zsyncfilename[arch] ]:
|
for item in [ self.appimagefilename[arch], self.zsyncfilename[arch] ]:
|
||||||
# For any built arch, find out if a file exist.
|
# For any built arch, find out if a file exist.
|
||||||
if not os.path.exists(f"{item}.md5"):
|
self.__create_checksum__(item)
|
||||||
# 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)
|
|
||||||
|
|
||||||
|
|
||||||
|
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):
|
def publish(self):
|
||||||
"""Moves built versions to definitive storage."""
|
"""Moves built versions to definitive storage."""
|
||||||
if all(self.built.values()):
|
if all(self.built.values()):
|
||||||
@ -324,6 +327,10 @@ class Build(object):
|
|||||||
# Creating versions for short version and query text
|
# Creating versions for short version and query text
|
||||||
versions = [ self.short_version, self.branch_version ]
|
versions = [ self.short_version, self.branch_version ]
|
||||||
for arch in Build.ARCHSTD:
|
for arch in Build.ARCHSTD:
|
||||||
|
# If already built, do not do anything.
|
||||||
|
if self.built[arch]:
|
||||||
|
continue
|
||||||
|
|
||||||
os.chdir(self.full_path)
|
os.chdir(self.full_path)
|
||||||
# if the appimage for the reported arch is not found, skip to next
|
# if the appimage for the reported arch is not found, skip to next
|
||||||
# arch
|
# arch
|
||||||
@ -341,7 +348,7 @@ class Build(object):
|
|||||||
os.unlink(appimagefilename[arch])
|
os.unlink(appimagefilename[arch])
|
||||||
os.symlink(self.appimagefilename[arch], appimagefilename[arch])
|
os.symlink(self.appimagefilename[arch], appimagefilename[arch])
|
||||||
# Create the checksum for the AppImage
|
# 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.
|
# Do not continue if no zsync file is provided.
|
||||||
if not self.updatable:
|
if not self.updatable:
|
||||||
continue
|
continue
|
||||||
|
Reference in New Issue
Block a user