Cambiata la logica di verifica della versione. Ogni versione nominale viene buildata due volte, una con nome generico e una con specifico con versione completa.
This commit is contained in:
parent
8c298e85de
commit
da8adc785f
@ -23,6 +23,8 @@ class Build(object):
|
|||||||
self.download_path = '/var/tmp/downloads'
|
self.download_path = '/var/tmp/downloads'
|
||||||
self.appversion = ''
|
self.appversion = ''
|
||||||
self.appimagefilename = {}
|
self.appimagefilename = {}
|
||||||
|
self.genappversion = ''
|
||||||
|
self.genappimagefilename = {}
|
||||||
|
|
||||||
# Getting versions and so on
|
# Getting versions and so on
|
||||||
v = versions.BuildVersion(self.query)
|
v = versions.BuildVersion(self.query)
|
||||||
@ -45,12 +47,12 @@ class Build(object):
|
|||||||
self.helppart = '.help' if self.offline_help else ''
|
self.helppart = '.help' if self.offline_help else ''
|
||||||
|
|
||||||
# If the build was called by queried name, build from latest release available but build with the most generic name
|
# If the build was called by queried name, build from latest release available but build with the most generic name
|
||||||
if self.queried_name:
|
myver = str.join('.', self.version.split('.')[0:2])
|
||||||
myver = str.join('.', self.version.split('.')[0:2])
|
self.genappversion = myver + self.languagepart + self.helppart
|
||||||
self.appversion = myver + self.languagepart + self.helppart
|
self.genappimagefilename[u'x86'] = self.appname + '-' + self.genappversion + self.languagepart + self.helppart + '-x86.AppImage'
|
||||||
else:
|
self.genappimagefilename[u'x86_64'] = self.appname + '-' + self.genappversion + self.languagepart + self.helppart + '-x86_64.AppImage'
|
||||||
self.appversion = self.version + self.languagepart + self.helppart
|
|
||||||
|
|
||||||
|
self.appversion = self.version + self.languagepart + self.helppart
|
||||||
self.appimagefilename[u'x86'] = self.appname + '-' + self.version + self.languagepart + self.helppart + '-x86.AppImage'
|
self.appimagefilename[u'x86'] = self.appname + '-' + self.version + self.languagepart + self.helppart + '-x86.AppImage'
|
||||||
self.appimagefilename[u'x86_64'] = self.appname + '-' + self.version + self.languagepart + self.helppart + '-x86_64.AppImage'
|
self.appimagefilename[u'x86_64'] = self.appname + '-' + self.version + self.languagepart + self.helppart + '-x86_64.AppImage'
|
||||||
|
|
||||||
@ -73,6 +75,16 @@ class Build(object):
|
|||||||
self.updatable = False
|
self.updatable = False
|
||||||
|
|
||||||
for arch in self.arch:
|
for arch in self.arch:
|
||||||
|
# For generalized builds, we need to check if there are .ver file
|
||||||
|
# and it contains the specific version found.
|
||||||
|
res = subprocess.check_output("find {path} -name {appimage}'".format(
|
||||||
|
path = self.storage_path,
|
||||||
|
appimage = self.genappimagefilename[arch] + '.ver'
|
||||||
|
), shell=True).decode('utf-8').strip('\n')
|
||||||
|
for file in res:
|
||||||
|
if self.version in open(file, 'r').read():
|
||||||
|
self.built = True
|
||||||
|
|
||||||
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]
|
appimage = self.appimagefilename[arch]
|
||||||
@ -151,9 +163,11 @@ class Build(object):
|
|||||||
os.chmod('appimagetool', 0o755)
|
os.chmod('appimagetool', 0o755)
|
||||||
|
|
||||||
# Build the requested version.
|
# Build the requested version.
|
||||||
|
if self.queried_name:
|
||||||
|
self.__unpackbuild__(arch, True)
|
||||||
self.__unpackbuild__(arch)
|
self.__unpackbuild__(arch)
|
||||||
|
|
||||||
def __unpackbuild__(self, arch):
|
def __unpackbuild__(self, arch, generalize = False):
|
||||||
# We start by filtering out tarballs from the list
|
# We start by filtering out tarballs from the list
|
||||||
buildtarballs = [ self.tarballs[arch][0] ]
|
buildtarballs = [ self.tarballs[arch][0] ]
|
||||||
|
|
||||||
@ -211,15 +225,28 @@ class Build(object):
|
|||||||
os.chmod(dest, 0o755)
|
os.chmod(dest, 0o755)
|
||||||
|
|
||||||
# Building app
|
# Building app
|
||||||
if self.updatable and self.queried_name:
|
if self.updatable:
|
||||||
# Updatable make sense only for generic images for fresh, still,
|
# Updatable make sense only for generic images for fresh, still,
|
||||||
# daily. If a request was for a specific version, I'd not build an
|
# daily. If a request was for a specific version, I'd not build an
|
||||||
# updatable version.
|
# updatable version.
|
||||||
# zsync name was generated already
|
# zsync name was generated already
|
||||||
subprocess.run("VERSION={version} ./appimagetool -u 'zsync|{zsync}' -v ./{appname}.AppDir/".format(version = self.appversion, zsync = self.appimagefilename[arch] + '.zsync', appname = self.appname), shell=True)
|
|
||||||
|
# If asked to do a generalized build:
|
||||||
|
if generalize:
|
||||||
|
subprocess.run("VERSION={version} ./appimagetool -u 'zsync|{zsync}' -v ./{appname}.AppDir/".format(version = self.genappversion, zsync = self.genappimagefilename[arch] + '.zsync', appname = self.appname), shell=True)
|
||||||
|
# Build version file management
|
||||||
|
with open(self.appimagefilename[arch] + '.ver', 'w') as v:
|
||||||
|
v.write(self.version)
|
||||||
|
else:
|
||||||
|
subprocess.run("VERSION={version} ./appimagetool -u 'zsync|{zsync}' -v ./{appname}.AppDir/".format(version = self.appversion, zsync = self.appimagefilename[arch] + '.zsync', appname = self.appname), shell=True)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
subprocess.run("VERSION={version} ./appimagetool -v ./{appname}.AppDir/".format(version = self.appversion, appname = self.appname), shell=True)
|
if generalize:
|
||||||
|
subprocess.run("VERSION={version} ./appimagetool -v ./{appname}.AppDir/".format(version = self.genappversion, appname = self.appname), shell=True)
|
||||||
|
with open(self.appimagefilename[arch] + '.ver', 'w') as v:
|
||||||
|
v.write(self.version)
|
||||||
|
else:
|
||||||
|
subprocess.run("VERSION={version} ./appimagetool -v ./{appname}.AppDir/".format(version = self.appversion, appname = self.appname), shell=True)
|
||||||
|
|
||||||
print("Built AppImage version {version}".format(version = self.appversion))
|
print("Built AppImage version {version}".format(version = self.appversion))
|
||||||
|
|
||||||
@ -246,7 +273,7 @@ class Build(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
os.chdir(self.appnamedir)
|
os.chdir(self.appnamedir)
|
||||||
subprocess.run("find . -iname '*.AppImage*' -exec cp {} %s \;" % self.storage_path, shell=True)
|
subprocess.run("find . -iname '*.AppImage*' -exec cp -f {} %s \;" % self.storage_path, shell=True)
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
"""Destructor"""
|
"""Destructor"""
|
||||||
|
Reference in New Issue
Block a user