Terminata costruzione di tutte le build. Previsto checksum. AppImage sono ferme lì.

This commit is contained in:
Emiliano Vavassori 2022-03-20 01:04:47 +01:00
parent e87d4085fb
commit 249527c78c
1 changed files with 28 additions and 15 deletions

View File

@ -47,7 +47,7 @@ class Build(object):
print("Got %s." % archive) print("Got %s." % archive)
def build(self, outdir): def build(self):
"""Building all the versions.""" """Building all the versions."""
# We have 4 builds to do: # We have 4 builds to do:
# * standard languages, no help # * standard languages, no help
@ -56,11 +56,11 @@ class Build(object):
# * all languages + offline help # * all languages + offline help
# Preparation tasks # Preparation tasks
appnamedir = os.path.join(self.__builddir__, self.__appname__) self.appnamedir = os.path.join(self.__builddir__, self.__appname__)
appimagedir = os.path.join(self.__builddir__, self.__appname__, self.__appname__ + '.AppDir') self.appimagedir = os.path.join(self.__builddir__, self.__appname__, self.__appname__ + '.AppDir')
os.makedirs(appimagedir, exist_ok = True) os.makedirs(self.appimagedir, exist_ok = True)
# And then cd to the appname folder. # And then cd to the appname folder.
os.chdir(appnamedir) os.chdir(self.appnamedir)
# Download appimagetool from github # Download appimagetool from github
appimagetoolurl = "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-{arch}.AppImage".format(arch = self.__arch__) appimagetoolurl = "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-{arch}.AppImage".format(arch = self.__arch__)
urllib.request.urlretrieve(appimagetoolurl, 'appimagetool') urllib.request.urlretrieve(appimagetoolurl, 'appimagetool')
@ -102,7 +102,7 @@ class Build(object):
for archive in buildtarballs: for archive in buildtarballs:
subprocess.run("tar xzf ../%s" % archive, shell=True) subprocess.run("tar xzf ../%s" % archive, shell=True)
os.chdir(appimagedir) os.chdir(self.appimagedir)
# At this point, let's decompress the deb packages # At this point, let's decompress the deb packages
subprocess.run("find .. -iname '*.deb' -exec dpkg -x {} . \;", shell=True) subprocess.run("find .. -iname '*.deb' -exec dpkg -x {} . \;", shell=True)
# Changing desktop file # Changing desktop file
@ -113,11 +113,11 @@ class Build(object):
# Find the name of the binary called in the desktop file. # Find the name of the binary called in the desktop file.
binaryname = subprocess.check_output("awk 'BEGIN { FS = \"=\" } /^Exec/ { print $2; exit }' startcenter.desktop | awk '{ print $1 }'", shell=True).decode('utf-8').strip('\n') binaryname = subprocess.check_output("awk 'BEGIN { FS = \"=\" } /^Exec/ { print $2; exit }' startcenter.desktop | awk '{ print $1 }'", shell=True).decode('utf-8').strip('\n')
bindir=os.path.join(self.__builddir__, self.__appname__, self.__appname__ + '.AppDir', 'usr', 'bin') bindir=os.path.join(self.appimagedir, 'usr', 'bin')
os.makedirs(bindir, exist_ok = True) os.makedirs(bindir, exist_ok = True)
os.chdir(bindir) os.chdir(bindir)
subprocess.run("find ../../opt -name soffice -path '*programm*' -exec ln -s {} %s \;" % binaryname, shell=True) subprocess.run("find ../../opt -name soffice -path '*programm*' -exec ln -s {} %s \;" % binaryname, shell=True)
os.chdir(appimagedir) os.chdir(self.appimagedir)
# Download AppRun from github # Download AppRun from github
apprunurl = "https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-{arch}".format(arch = self.__arch__) apprunurl = "https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-{arch}".format(arch = self.__arch__)
@ -132,16 +132,28 @@ class Build(object):
# Building app # Building app
subprocess.run("VERSION={version} ./appimagetool -v ./{appname}.AppDir/".format(version = appversion, appname = self.__appname__), shell=True) subprocess.run("VERSION={version} ./appimagetool -v ./{appname}.AppDir/".format(version = appversion, appname = self.__appname__), shell=True)
# Copying built image to final directory print("Built AppImage version {version}".format(version = appversion))
subprocess.run("find . -iname '*.AppImage' -exec cp {} %s \;" % outdir, shell = True)
# Cleanup phase, before new run. # Cleanup phase, before new run.
os.chdir(appnamedir) os.chdir(self.appnamedir)
for deb in glob.glob(appnamedir + '/*.deb'): for deb in glob.glob(self.appnamedir + '/*.deb'):
os.remove(deb) os.remove(deb)
shutil.rmtree(appimagedir) shutil.rmtree(self.appimagedir)
os.makedirs(appimagedir) os.makedirs(self.appimagedir)
def checksums(self):
"""Create checksums of the built versions."""
os.chdir(self.appnamedir)
for appimage in glob.glob('*.AppImage'):
# See if a checksum already exist
if not os.path.exists(appimage + '.md5'):
subprocess.run("md5sum {appimage} > {appimage}.md5".format(appimage = appimage), shell=True)
def move(self, outdir):
"""Moves built versions to definitive storage."""
os.chdir(self.appnamedir)
subprocess.run("find . -iname '*.AppImage*' -exec cp {} %s \;" % outdir, shell=True)
def __del__(self): def __del__(self):
"""Destructor""" """Destructor"""
@ -161,5 +173,6 @@ if __name__ == '__main__':
b = Build(sys.argv[1], sys.argv[2], sys.argv[3]) b = Build(sys.argv[1], sys.argv[2], sys.argv[3])
b.download() b.download()
b.build(sys.argv[4]) b.build()
b.checksums()
del b del b