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):
|
def __init__(self, query, arch):
|
||||||
"""Build all versions that can be found in the indicated repo."""
|
"""Build all versions that can be found in the indicated repo."""
|
||||||
self.query = query
|
self.query = query
|
||||||
|
self.queried_name = False if '.' in self.query else True
|
||||||
self.arch = arch
|
self.arch = arch
|
||||||
self.url = {}
|
self.url = {}
|
||||||
self.language = 'basic'
|
self.language = 'basic'
|
||||||
@ -21,6 +22,7 @@ class Build(object):
|
|||||||
self.storage_path = '/srv/http/appimage.sys42.eu'
|
self.storage_path = '/srv/http/appimage.sys42.eu'
|
||||||
self.download_path = '/var/tmp/downloads'
|
self.download_path = '/var/tmp/downloads'
|
||||||
self.appimagefilename = {}
|
self.appimagefilename = {}
|
||||||
|
self.zsyncfilename = {}
|
||||||
|
|
||||||
# Getting versions and so on
|
# Getting versions and so on
|
||||||
v = versions.BuildVersion(self.query)
|
v = versions.BuildVersion(self.query)
|
||||||
@ -40,8 +42,14 @@ class Build(object):
|
|||||||
else:
|
else:
|
||||||
self.languagepart += self.language
|
self.languagepart += self.language
|
||||||
|
|
||||||
self.appimagefilename[u'x86'] = self.appname + '-' + self.version + self.languagepart + ('.help' if self.offline_help else '') + '-x86.AppImage'
|
self.helppart = '.help' if self.offline_help else ''
|
||||||
self.appimagefilename[u'x86_64'] = self.appname + '-' + v.version + self.languagepart + ('.help' if self.offline_help else '') + '-x86_64.AppImage'
|
|
||||||
|
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):
|
def check(self, storage_path):
|
||||||
@ -56,10 +64,15 @@ class Build(object):
|
|||||||
print("Upgradable and portable options were required together. Building only portable.")
|
print("Upgradable and portable options were required together. Building only portable.")
|
||||||
self.updatable = False
|
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:
|
for arch in self.arch:
|
||||||
res = subprocess.check_output("find {path} -name '{appimage}'".format(
|
res = subprocess.check_output("find {path} -name '{appimage}'".format(
|
||||||
path = self.storage_path,
|
path = self.storage_path,
|
||||||
appimage = self.appimagefilename[arch] + ('.zsync' if self.updatable else '')
|
appimage = self.appimagefilename[arch]
|
||||||
), shell=True).decode('utf-8').strip('\n')
|
), shell=True).decode('utf-8').strip('\n')
|
||||||
if len(res) > 1:
|
if len(res) > 1:
|
||||||
self.built = True
|
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)
|
subprocess.run("tar xzf {folder}/{archive}".format(folder = self.download_path, archive = archive), shell=True)
|
||||||
|
|
||||||
os.chdir(self.appnamedir)
|
os.chdir(self.appnamedir)
|
||||||
|
|
||||||
os.makedirs(self.appimagedir, exist_ok = True)
|
os.makedirs(self.appimagedir, exist_ok = True)
|
||||||
# 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, cwd=self.appimagedir)
|
subprocess.run("find .. -iname '*.deb' -exec dpkg -x {} . \;", shell=True, cwd=self.appimagedir)
|
||||||
|
|
||||||
if self.portable:
|
if self.portable:
|
||||||
shortversion = str.join('.', self.version.split('.')[:3])
|
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)
|
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'
|
appversion += '.help'
|
||||||
|
|
||||||
# Building app
|
# Building app
|
||||||
if self.updatable:
|
if self.updatable and self.queried_name:
|
||||||
# for the daily build, updatable builds work if the latest one
|
# Updatable make sense only for generic images for fresh, still,
|
||||||
# provide updates.
|
# daily. If a request was for a specific version, I'd not build an
|
||||||
zsync = self.appimagefilename[arch] + '.zsync'
|
# updatable version.
|
||||||
subprocess.run("VERSION={version} ./appimagetool -u 'zsync|{zsync}' -v ./{appname}.AppDir/".format(version = appversion, zsync = zsync, appname = self.appname), shell=True)
|
# 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:
|
else:
|
||||||
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)
|
||||||
|
Reference in New Issue
Block a user