Corretta logica di build con il discorso updatable: solo se richiesta versione generica o daily.
This commit is contained in:
parent
2410098953
commit
425adb5545
@ -12,6 +12,7 @@ class Build(object):
|
||||
def __init__(self, query, arch):
|
||||
"""Build all versions that can be found in the indicated repo."""
|
||||
self.query = query
|
||||
self.queried_name = False if '.' in self.query else True
|
||||
self.arch = arch
|
||||
self.url = {}
|
||||
self.language = 'basic'
|
||||
@ -21,6 +22,7 @@ class Build(object):
|
||||
self.storage_path = '/srv/http/appimage.sys42.eu'
|
||||
self.download_path = '/var/tmp/downloads'
|
||||
self.appimagefilename = {}
|
||||
self.zsyncfilename = {}
|
||||
|
||||
# Getting versions and so on
|
||||
v = versions.BuildVersion(self.query)
|
||||
@ -40,8 +42,14 @@ class Build(object):
|
||||
else:
|
||||
self.languagepart += self.language
|
||||
|
||||
self.appimagefilename[u'x86'] = self.appname + '-' + self.version + self.languagepart + ('.help' if self.offline_help else '') + '-x86.AppImage'
|
||||
self.appimagefilename[u'x86_64'] = self.appname + '-' + v.version + self.languagepart + ('.help' if self.offline_help else '') + '-x86_64.AppImage'
|
||||
self.helppart = '.help' if self.offline_help else ''
|
||||
|
||||
self.appimagefilename[u'x86'] = self.appname + '-' + self.version + self.languagepart + self.helppart + '-x86.AppImage'
|
||||
self.appimagefilename[u'x86_64'] = self.appname + '-' + v.version + self.languagepart + self.helppart + '-x86_64.AppImage'
|
||||
|
||||
version = str.join('.', self.version.split('.')[0-2])
|
||||
self.zsyncfilename[u'x86'] = self.appname + '-' + version + self.languagepart + self.helppart + '-x86.AppImage.zsync'
|
||||
self.zsyncfilename[u'x86_64'] = self.appname + '-' + version + self.languagepart + self.helppart + '-x86_64.AppImage.zsync'
|
||||
|
||||
|
||||
def check(self, storage_path):
|
||||
@ -56,10 +64,15 @@ class Build(object):
|
||||
print("Upgradable and portable options were required together. Building only portable.")
|
||||
self.updatable = False
|
||||
|
||||
if self.updatable and not self.queried_name:
|
||||
# If the queried version was a numbered version, doesn't make sense
|
||||
# to build an updatable version.
|
||||
self.updatable = False
|
||||
|
||||
for arch in self.arch:
|
||||
res = subprocess.check_output("find {path} -name '{appimage}'".format(
|
||||
path = self.storage_path,
|
||||
appimage = self.appimagefilename[arch] + ('.zsync' if self.updatable else '')
|
||||
appimage = self.appimagefilename[arch]
|
||||
), shell=True).decode('utf-8').strip('\n')
|
||||
if len(res) > 1:
|
||||
self.built = True
|
||||
@ -166,9 +179,11 @@ class Build(object):
|
||||
subprocess.run("tar xzf {folder}/{archive}".format(folder = self.download_path, archive = archive), shell=True)
|
||||
|
||||
os.chdir(self.appnamedir)
|
||||
|
||||
os.makedirs(self.appimagedir, exist_ok = True)
|
||||
# At this point, let's decompress the deb packages
|
||||
subprocess.run("find .. -iname '*.deb' -exec dpkg -x {} . \;", shell=True, cwd=self.appimagedir)
|
||||
|
||||
if self.portable:
|
||||
shortversion = str.join('.', self.version.split('.')[:3])
|
||||
subprocess.run("find . -type f -iname 'bootstraprc' -exec sed -i 's|^UserInstallation=.*|UserInstallation=\$SYSUSERCONFIG/libreoffice/%s|g' {} \+" % shortversion, shell=True, cwd=self.appimagedir)
|
||||
@ -198,11 +213,12 @@ class Build(object):
|
||||
appversion += '.help'
|
||||
|
||||
# Building app
|
||||
if self.updatable:
|
||||
# for the daily build, updatable builds work if the latest one
|
||||
# provide updates.
|
||||
zsync = self.appimagefilename[arch] + '.zsync'
|
||||
subprocess.run("VERSION={version} ./appimagetool -u 'zsync|{zsync}' -v ./{appname}.AppDir/".format(version = appversion, zsync = zsync, appname = self.appname), shell=True)
|
||||
if self.updatable and self.queried_name:
|
||||
# Updatable make sense only for generic images for fresh, still,
|
||||
# daily. If a request was for a specific version, I'd not build an
|
||||
# updatable version.
|
||||
# zsync name was generated already
|
||||
subprocess.run("VERSION={version} ./appimagetool -u 'zsync|{zsync}' -v ./{appname}.AppDir/".format(version = appversion, zsync = self.zsyncfilename[arch], appname = self.appname), shell=True)
|
||||
|
||||
else:
|
||||
subprocess.run("VERSION={version} ./appimagetool -v ./{appname}.AppDir/".format(version = appversion, appname = self.appname), shell=True)
|
||||
|
Reference in New Issue
Block a user