1
0

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

View File

@ -47,7 +47,7 @@ class Build(object):
print("Got %s." % archive)
def build(self, outdir):
def build(self):
"""Building all the versions."""
# We have 4 builds to do:
# * standard languages, no help
@ -56,11 +56,11 @@ class Build(object):
# * all languages + offline help
# Preparation tasks
appnamedir = os.path.join(self.__builddir__, self.__appname__)
appimagedir = os.path.join(self.__builddir__, self.__appname__, self.__appname__ + '.AppDir')
os.makedirs(appimagedir, exist_ok = True)
self.appnamedir = os.path.join(self.__builddir__, self.__appname__)
self.appimagedir = os.path.join(self.__builddir__, self.__appname__, self.__appname__ + '.AppDir')
os.makedirs(self.appimagedir, exist_ok = True)
# And then cd to the appname folder.
os.chdir(appnamedir)
os.chdir(self.appnamedir)
# Download appimagetool from github
appimagetoolurl = "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-{arch}.AppImage".format(arch = self.__arch__)
urllib.request.urlretrieve(appimagetoolurl, 'appimagetool')
@ -102,7 +102,7 @@ class Build(object):
for archive in buildtarballs:
subprocess.run("tar xzf ../%s" % archive, shell=True)
os.chdir(appimagedir)
os.chdir(self.appimagedir)
# At this point, let's decompress the deb packages
subprocess.run("find .. -iname '*.deb' -exec dpkg -x {} . \;", shell=True)
# Changing desktop file
@ -113,11 +113,11 @@ class Build(object):
# 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')
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.chdir(bindir)
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
apprunurl = "https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-{arch}".format(arch = self.__arch__)
@ -132,16 +132,28 @@ class Build(object):
# Building app
subprocess.run("VERSION={version} ./appimagetool -v ./{appname}.AppDir/".format(version = appversion, appname = self.__appname__), shell=True)
# Copying built image to final directory
subprocess.run("find . -iname '*.AppImage' -exec cp {} %s \;" % outdir, shell = True)
print("Built AppImage version {version}".format(version = appversion))
# Cleanup phase, before new run.
os.chdir(appnamedir)
for deb in glob.glob(appnamedir + '/*.deb'):
os.chdir(self.appnamedir)
for deb in glob.glob(self.appnamedir + '/*.deb'):
os.remove(deb)
shutil.rmtree(appimagedir)
os.makedirs(appimagedir)
shutil.rmtree(self.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):
"""Destructor"""
@ -161,5 +173,6 @@ if __name__ == '__main__':
b = Build(sys.argv[1], sys.argv[2], sys.argv[3])
b.download()
b.build(sys.argv[4])
b.build()
b.checksums()
del b