1
0

Supporto a daily e prerelease.

This commit is contained in:
Emiliano Vavassori 2022-03-22 01:24:55 +01:00
parent d1a2b50461
commit 66bcd2b39c
2 changed files with 40 additions and 16 deletions

View File

@ -28,24 +28,26 @@ class Build(object):
# Creating a tempfile
self.builddir = tempfile.mkdtemp()
self.tarballs = {}
self.appname = 'LibreOffice' if not self.query == 'daily' else 'LibreOfficeDev'
self.appname = 'LibreOffice' if not self.query == 'daily' and not self.query == 'prerelease' else 'LibreOfficeDev'
self.version = v.version
self.url = v.basedirurl
self.built = False
# Building expected AppImageName
languagepart = "."
self.languagepart = "."
if ',' in self.language:
languagepart += self.language.replace(',', '-')
self.languagepart += self.language.replace(',', '-')
else:
languagepart += self.language
self.languagepart += self.language
self.appimagefilename[u'x86'] = self.appname + '-' + self.version + languagepart + ('.help' if self.offline_help else '') + '-x86.AppImage'
self.appimagefilename[u'x86_64'] = self.appname + '-' + v.version + languagepart + ('.help' if self.offline_help else '') + '-x86_64.AppImage'
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'
def check(self, storage_path):
"""Checking if the requested AppImage has been already built."""
self.storage_path += ('/daily' if self.query == 'daily' else '')
self.storage_path += ('/prerelease' if self.query == 'prerelease' else '')
self.storage_path = storage_path + ('/portable' if self.portable else '')
# Incompatibilities - if portable and updatable are asked together,
# only portable will be built.
@ -196,8 +198,13 @@ class Build(object):
# Building app
if self.updatable:
# for the daily build, updatable builds work if the latest one
# provide updates.
if self.query == 'daily':
zsync = self.appname + self.version.split('-')[0] + self.languagepart + ('.help' if self.offline_help else '') + '-' + arch + '.AppImage.zsync'
else:
zsync = self.appimagefilename[arch] + '.zsync'
subprocess.run("VERSION={version} ./appimagetool -u 'zsync|{zsync}' -v ./{appname}.AppDir/".format(version = appversion, zsync = self.appimagefilename[arch] + '.zsync', appname = self.appname), shell=True)
subprocess.run("VERSION={version} ./appimagetool -u 'zsync|{zsync}' -v ./{appname}.AppDir/".format(version = appversion, zsync = zsync, appname = self.appname), shell=True)
else:
subprocess.run("VERSION={version} ./appimagetool -v ./{appname}.AppDir/".format(version = appversion, appname = self.appname), shell=True)

View File

@ -8,7 +8,8 @@ from packaging.version import parse as parse_version
class BuildVersion(object):
ARCHIVE = "https://downloadarchive.documentfoundation.org/libreoffice/old/"
RELEASE = "https://download.documentfoundation.org/libreoffice/stable/"
DAILY = "https://dev-builds.libreoffice.org/daily/master/Linux-rpm_deb-x86_64@tb87-TDF/current/"
DAILY = "https://dev-builds.libreoffice.org/daily/master/Linux-rpm_deb-x86_64@tb87-TDF/"
PRERELEASE = "https://dev-builds.libreoffice.org/pre-releases/deb/x86_64/"
def __init__(self, query):
self.query = query
@ -45,17 +46,33 @@ class BuildVersion(object):
basedirurl = {}
version = ''
if branch == 'daily':
basedirurl = { 'x86_64': BuildVersion.DAILY, 'x86': '-' }
version = etree.HTML(urllib.request.urlopen(BuildVersion.DAILY).read()).xpath('//td/a')[1].text.split('_')[1]
# The daily builds can be mostly distinguished by the day of build
# (official version is constant.
# The last built version is the next-to-last version [-2] on the page.
fulldailypath = etree.HTML(urllib.request.urlopen(BuildVersion.DAILY).read()).xpath('//td/a')[-2].text
dailyversion = fulldailypath.split('_')[0].replace('-', '')
version
newurl = str.join('/', [ BuildVersion.DAILY, fulldailypath, '' ])
basedirurl = { u'x86_64': newurl, u'x86': '-' }
version = etree.HTML(urllib.request.urlopen(newurl).read()).xpath('//td/a')[1].text.split('_')[1]
return { 'version': version + '-' + dailyversion, 'basedirurl': basedirurl }
if branch == 'prerelease':
version = etree.HTML(urllib.request.urlopen(BuildVersion.PRERELEASE).read()).xpath('//td/a')[1].text.split('_')[1]
basedirurl = { u'x86': '-', u'x86_64': BuildVersion.PRERELEASE }
return { 'version': version, 'basedirurl': basedirurl }
# Stable releases.
versions = etree.HTML(urllib.request.urlopen(BuildVersion.RELEASE).read()).xpath('//td/a')
index = 1
if branch == 'still':
index = 2
index = -2
elif branch == 'fresh':
index = 3
index = -1
version = self.__getlatestrel(versions[index].text.strip('/'))
return { 'version': version, 'basedirurl': self.__getbaseurl(version) }
@ -67,10 +84,10 @@ class BuildVersion(object):
# x86 binaries are not anymore offered after 6.3.0.
if parse_version(version) < parse_version('6.3.0'):
basedirurl['x86'] = url + 'x86/'
basedirurl[u'x86'] = url + 'x86/'
else:
basedirurl['x86'] = '-'
basedirurl[u'x86'] = '-'
basedirurl['x86_64'] = url + 'x86_64/'
basedirurl[u'x86_64'] = url + 'x86_64/'
return basedirurl