From 651022622780ff0d6a235b9521fdc0d1d043522f Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Thu, 31 Mar 2022 00:24:21 +0200 Subject: [PATCH 01/10] Primo push con nuova versione del build. --- scripts/loaih-build | 15 ++++++++------- setup.py | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/scripts/loaih-build b/scripts/loaih-build index 5ff89a2..033d9dc 100644 --- a/scripts/loaih-build +++ b/scripts/loaih-build @@ -7,15 +7,16 @@ import loaih @click.command() @click.option('-a', '--arch', 'arch', type=click.Choice(['x86', 'x86_64', 'all'], case_sensitive=False), default='all', help="Build the AppImage for a specific architecture. If there is no specific options, the process will build for both architectures (if available). Default: all") +@click.option('-c/-C', '--check/--no-check', 'check', default=True, help="Check in the final storage if the queried version is existent. Default: check") +@click.option('-d', '--download-path', 'download_path', default = '/var/tmp/downloads', type=str, help="Path to the download folder. Default: /var/tmp/downloads") @click.option('-l', '--language', 'language', default = 'basic', type=str, help="Languages to be included. Options: basic, standard, full, a language string (e.g. 'it') or a list of languages comma separated (e.g.: 'en-US,en-GB,it'). Default: basic") @click.option('-o/-O', '--offline-help/--no-offline-help', 'offline', default = False, help="Include or not the offline help for the chosen languages. Default: no offline help") @click.option('-p/-P', '--portable/--no-portable', 'portable', default = False, help="Create a portable version of the AppImage or not. Default: no portable") +@click.option('-r', '--repo-path', 'repo_path', default = '/srv/http/appimage.sys42.eu', type=str, help="Path to the final storage of the AppImage. Default: /srv/http/appimage.sys42.eu") +@click.option('-s/-S', '--sign/--no-sign', 'sign', default=False, help="Wether to sign the build. Default: no-sign") @click.option('-u/-U', '--updatable/--no-updatable', 'updatable', default = True, help="Create an updatable version of the AppImage or not. Default: updatable") -@click.option('-d', '--download-path', 'download', default = '/var/tmp/downloads', type=str, help="Path to the download folder. Default: /var/tmp/downloads") -@click.option('-s', '--storage-path', 'storage', default = '/srv/http/appimage.sys42.eu', type=str, help="Path to the final storage of the AppImage. Default: /srv/http/appimage.sys42.eu") -@click.option('-c/-C', '--check/--no-check', 'check', default=True, help="Check in the final storage if the queried version is existent. Default: check") @click.argument('query') -def build(arch, language, offline, portable, updatable, download, storage, check, query): +def build(arch, language, offline, portable, updatable, download_path, repo_path, check, sign, query): # Parsing options arches = [] if arch.lower() == 'all': @@ -61,11 +62,11 @@ def build(arch, language, offline, portable, updatable, download, storage, check obj.updatable = updatable if check: - obj.check(storage) + obj.check(repo_path) else: - obj.storage_path = storage + obj.storage_path = repo_path - obj.download(download) + obj.download(download_path) obj.build() obj.checksums() obj.publish() diff --git a/setup.py b/setup.py index 032157f..4ee9309 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ from setuptools import setup,find_packages setup( name="loaih", - version="1.0.1", + version="1.1.0", description="LOAIH - LibreOffice AppImage Helpers, help build a LibreOffice AppImage", author="Emiliano Vavassori", author_email="syntaxerrormmm@libreoffice.org", From a68882888a2a16cec6c6cc3cec0be1c96c940f90 Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Thu, 31 Mar 2022 01:00:13 +0200 Subject: [PATCH 02/10] Correzione script di nuovo. --- scripts/loaih-build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/loaih-build b/scripts/loaih-build index 033d9dc..80b6295 100644 --- a/scripts/loaih-build +++ b/scripts/loaih-build @@ -21,7 +21,7 @@ def build(arch, language, offline, portable, updatable, download_path, repo_path arches = [] if arch.lower() == 'all': # We need to build it twice. - arches = [ u'x86', u'x86_64' ] + arches = [ 'x86', 'x86_64' ] else: arches = [ arch.lower().decode('utf-8') ] From 5ce7f5cc071694929eb23d30da8d5844fe7d9853 Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Thu, 31 Mar 2022 01:03:32 +0200 Subject: [PATCH 03/10] Rimozione forzatura stringa utf-8 da libreria. --- loaih/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/loaih/__init__.py b/loaih/__init__.py index 89f05d1..0d2c402 100644 --- a/loaih/__init__.py +++ b/loaih/__init__.py @@ -35,7 +35,7 @@ class Build(object): 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 = { u'x86': False, u'x86_64': False } + self.built = { 'x86': False, 'x86_64': False } # Preparing the default for the relative path on the storage for # different versions. @@ -73,12 +73,12 @@ class Build(object): # If the build was called by queried name, build from latest release available but build with the most generic name myver = str.join('.', self.version.split('.')[0:2]) self.genappversion = myver + self.languagepart + self.helppart - self.genappimagefilename[u'x86'] = self.appname + '-' + self.genappversion + '-x86.AppImage' - self.genappimagefilename[u'x86_64'] = self.appname + '-' + self.genappversion + '-x86_64.AppImage' + self.genappimagefilename['x86'] = self.appname + '-' + self.genappversion + '-x86.AppImage' + self.genappimagefilename['x86_64'] = self.appname + '-' + self.genappversion + '-x86_64.AppImage' self.appversion = self.version + self.languagepart + self.helppart - self.appimagefilename[u'x86'] = self.appname + '-' + self.appversion + '-x86.AppImage' - self.appimagefilename[u'x86_64'] = self.appname + '-' + self.appversion + '-x86_64.AppImage' + self.appimagefilename['x86'] = self.appname + '-' + self.appversion + '-x86.AppImage' + self.appimagefilename['x86_64'] = self.appname + '-' + self.appversion + '-x86_64.AppImage' for arch in self.arch: # For generalized builds, we need to check if there are .ver file From c88e10b2acf2383e00d5a6e38aafc4c7930e270b Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Thu, 31 Mar 2022 01:19:51 +0200 Subject: [PATCH 04/10] Refactoring di determinato codice, vediamo se potrebbe funzionare. --- loaih/__init__.py | 11 ++++----- scripts/loaih-build | 60 ++++++++++++--------------------------------- 2 files changed, 20 insertions(+), 51 deletions(-) diff --git a/loaih/__init__.py b/loaih/__init__.py index 0d2c402..ae3ecf8 100644 --- a/loaih/__init__.py +++ b/loaih/__init__.py @@ -8,6 +8,7 @@ import tempfile, os, sys, glob, subprocess, shutil, re class Build(object): LANGSTD = [ 'ar', 'de', 'en-GB', 'es', 'fr', 'it', 'ja', 'ko', 'pt', 'pt-BR', 'ru', 'zh-CN', 'zh-TW' ] LANGBASIC = [ 'en-GB' ] + ARCHSTD = [ u'x86', u'x86_64' ] def __init__(self, query, arch): """Build all versions that can be found in the indicated repo.""" @@ -35,7 +36,7 @@ class Build(object): 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 = { 'x86': False, 'x86_64': False } + self.built = { u'x86': False, u'x86_64': False } # Preparing the default for the relative path on the storage for # different versions. @@ -73,12 +74,10 @@ class Build(object): # If the build was called by queried name, build from latest release available but build with the most generic name myver = str.join('.', self.version.split('.')[0:2]) self.genappversion = myver + self.languagepart + self.helppart - self.genappimagefilename['x86'] = self.appname + '-' + self.genappversion + '-x86.AppImage' - self.genappimagefilename['x86_64'] = self.appname + '-' + self.genappversion + '-x86_64.AppImage' - self.appversion = self.version + self.languagepart + self.helppart - self.appimagefilename['x86'] = self.appname + '-' + self.appversion + '-x86.AppImage' - self.appimagefilename['x86_64'] = self.appname + '-' + self.appversion + '-x86_64.AppImage' + for arch in ARCHSTD: + self.genappimagefilename[arch] = self.appname + '-' + self.genappversion + f'-{arch}.AppImage' + self.appimagefilename[arch] = self.appname + '-' + self.appversion + f'-{arch}.AppImage' for arch in self.arch: # For generalized builds, we need to check if there are .ver file diff --git a/scripts/loaih-build b/scripts/loaih-build index 80b6295..3b704b4 100644 --- a/scripts/loaih-build +++ b/scripts/loaih-build @@ -2,7 +2,6 @@ # encoding: utf-8 import click -import yaml import loaih @click.command() @@ -21,56 +20,27 @@ def build(arch, language, offline, portable, updatable, download_path, repo_path arches = [] if arch.lower() == 'all': # We need to build it twice. - arches = [ 'x86', 'x86_64' ] + arches = [ u'x86', u'x86_64' ] else: - arches = [ arch.lower().decode('utf-8') ] + arches = [ arch.lower() ] - if query.endswith('.yml') or query.endswith('.yaml'): - # This is a buildfile. So we have to load the file and pass the build options ourselves. - config = {} - with open(query, 'r') as file: - config = yaml.safe_load(file) + obj = loaih.Build(query, arches) - # With the config file, we ignore all the command line options and set - # generic default. - for build in config['builds']: - # Loop a run for each build. - obj = loaih.Build(build['query'], arches) - - obj.language = build['language'] - obj.offline_help = build['offline_help'] - obj.portable = build['portable'] - obj.updatable = True - - if check: - obj.check(config['data']['storage']) - else: - obj.storage_path = config['data']['storage'] - - obj.download(config['data']['download']) - obj.build() - obj.checksums() - obj.publish() - del obj + obj.language = language + obj.offline_help = offline + obj.portable = portable + obj.updatable = updatable + if check: + obj.check(repo_path) else: - obj = loaih.Build(query, arches) + obj.storage_path = repo_path - obj.language = language - obj.offline_help = offline - obj.portable = portable - obj.updatable = updatable - - if check: - obj.check(repo_path) - else: - obj.storage_path = repo_path - - obj.download(download_path) - obj.build() - obj.checksums() - obj.publish() - del obj + obj.download(download_path) + obj.build() + obj.checksums() + obj.publish() + del obj if __name__ == '__main__': build() From 2c60de03cb91a7aa929ef502a7d739c809fd6bf3 Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Thu, 31 Mar 2022 01:28:06 +0200 Subject: [PATCH 05/10] Ancora correzioni allo script di dev. --- loaih/__init__.py | 2 +- scripts/loaih-build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/loaih/__init__.py b/loaih/__init__.py index ae3ecf8..12b9154 100644 --- a/loaih/__init__.py +++ b/loaih/__init__.py @@ -193,7 +193,7 @@ class Build(object): os.chmod('appimagetool', 0o755) # Build the requested version. - if self.queried_name and not self.portable: + if self.queried_name: self.__unpackbuild__(arch, True) self.__unpackbuild__(arch) diff --git a/scripts/loaih-build b/scripts/loaih-build index 3b704b4..8139578 100644 --- a/scripts/loaih-build +++ b/scripts/loaih-build @@ -12,7 +12,7 @@ import loaih @click.option('-o/-O', '--offline-help/--no-offline-help', 'offline', default = False, help="Include or not the offline help for the chosen languages. Default: no offline help") @click.option('-p/-P', '--portable/--no-portable', 'portable', default = False, help="Create a portable version of the AppImage or not. Default: no portable") @click.option('-r', '--repo-path', 'repo_path', default = '/srv/http/appimage.sys42.eu', type=str, help="Path to the final storage of the AppImage. Default: /srv/http/appimage.sys42.eu") -@click.option('-s/-S', '--sign/--no-sign', 'sign', default=False, help="Wether to sign the build. Default: no-sign") +@click.option('-s/-S', '--sign/--no-sign', 'sign', default=False, help="Whether to sign the build. Default: no-sign") @click.option('-u/-U', '--updatable/--no-updatable', 'updatable', default = True, help="Create an updatable version of the AppImage or not. Default: updatable") @click.argument('query') def build(arch, language, offline, portable, updatable, download_path, repo_path, check, sign, query): From 544d805b5018f3c12ef4bf551112ac636e43eae7 Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Thu, 31 Mar 2022 01:50:15 +0200 Subject: [PATCH 06/10] =?UTF-8?q?Commit=20con=20funzionalit=C3=A0=20di=20f?= =?UTF-8?q?irma=20complete.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- loaih/__init__.py | 59 +++++++++++++++++++++++++--------------- scripts/loaih-build | 66 +++++++++++++++++++++++++++++++++++---------- 2 files changed, 89 insertions(+), 36 deletions(-) diff --git a/loaih/__init__.py b/loaih/__init__.py index 12b9154..1c64989 100644 --- a/loaih/__init__.py +++ b/loaih/__init__.py @@ -20,11 +20,14 @@ class Build(object): self.offline_help = False self.portable = False self.updatable = True + self.sign = False self.storage_path = '/srv/http/appimage.sys42.eu' self.download_path = '/var/tmp/downloads' + + # Specific build version self.appversion = '' - self.appimagefilename = {} self.genappversion = '' + self.appimagefilename = {} self.genappimagefilename = {} # Getting versions and so on @@ -45,6 +48,26 @@ class Build(object): self.relative_path = [] self.full_path = '' + def version_strings(self): + """Build version strings based on the information received.""" + # Building expected AppImageName + self.languagepart = "." + if ',' in self.language: + self.languagepart += self.language.replace(',', '-') + else: + self.languagepart += self.language + + 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 + self.appversion = self.version + self.languagepart + self.helppart + myver = str.join('.', self.version.split('.')[0:2]) + self.genappversion = myver + self.languagepart + self.helppart + for arch in ARCHSTD: + self.appimagefilename[arch] = self.appname + '-' + self.appversion + f'-{arch}.AppImage' + self.genappimagefilename[arch] = self.appname + '-' + self.genappversion + f'-{arch}.AppImage' + + def check(self, storage_path): """Checking if the requested AppImage has been already built.""" # Mandate to the private function to calculate the full_path available @@ -62,22 +85,8 @@ class Build(object): # to build an updatable version. self.updatable = False - # Building expected AppImageName - self.languagepart = "." - if ',' in self.language: - self.languagepart += self.language.replace(',', '-') - else: - self.languagepart += self.language - - 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 - myver = str.join('.', self.version.split('.')[0:2]) - self.genappversion = myver + self.languagepart + self.helppart - self.appversion = self.version + self.languagepart + self.helppart - for arch in ARCHSTD: - self.genappimagefilename[arch] = self.appname + '-' + self.genappversion + f'-{arch}.AppImage' - self.appimagefilename[arch] = self.appname + '-' + self.appversion + f'-{arch}.AppImage' + # Call the build for queries + self.version_strings() for arch in self.arch: # For generalized builds, we need to check if there are .ver file @@ -193,7 +202,8 @@ class Build(object): os.chmod('appimagetool', 0o755) # Build the requested version. - if self.queried_name: + if self.queried_name and not self.portable: + # If it is portable, do not generate a generalized version self.__unpackbuild__(arch, True) self.__unpackbuild__(arch) @@ -274,22 +284,27 @@ class Build(object): # updatable version. # zsync name was generated already + # Dealing with extra options + buildopts = [] + if self.sign: + buildopts.append('--sign') + # 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) + subprocess.run("VERSION={version} ./appimagetool {buildopts} -u 'zsync|{zsync}' -v ./{appname}.AppDir/".format(version = self.genappversion, buildopts = str.join(' ', buildopts), zsync = self.genappimagefilename[arch] + '.zsync', appname = self.appname), shell=True) # Build version file management with open(self.genappimagefilename[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) + subprocess.run("VERSION={version} ./appimagetool {buildopts} -u 'zsync|{zsync}' -v ./{appname}.AppDir/".format(version = self.appversion, buildopts = str.join(' ', buildopts), zsync = self.appimagefilename[arch] + '.zsync', appname = self.appname), shell=True) else: if generalize: - subprocess.run("VERSION={version} ./appimagetool -v ./{appname}.AppDir/".format(version = self.genappversion, appname = self.appname), shell=True) + subprocess.run("VERSION={version} ./appimagetool {buildopts} -v ./{appname}.AppDir/".format(version = self.genappversion, buildopts = str.join(' ', buildopts), appname = self.appname), shell=True) with open(self.genappimagefilename[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) + subprocess.run("VERSION={version} ./appimagetool {buildopts} -v ./{appname}.AppDir/".format(version = self.appversion, buildopts = str.join(' ', buildopts), appname = self.appname), shell=True) print("Built AppImage version {version}".format(version = self.appversion)) diff --git a/scripts/loaih-build b/scripts/loaih-build index 8139578..76de886 100644 --- a/scripts/loaih-build +++ b/scripts/loaih-build @@ -2,6 +2,7 @@ # encoding: utf-8 import click +import yaml import loaih @click.command() @@ -12,7 +13,7 @@ import loaih @click.option('-o/-O', '--offline-help/--no-offline-help', 'offline', default = False, help="Include or not the offline help for the chosen languages. Default: no offline help") @click.option('-p/-P', '--portable/--no-portable', 'portable', default = False, help="Create a portable version of the AppImage or not. Default: no portable") @click.option('-r', '--repo-path', 'repo_path', default = '/srv/http/appimage.sys42.eu', type=str, help="Path to the final storage of the AppImage. Default: /srv/http/appimage.sys42.eu") -@click.option('-s/-S', '--sign/--no-sign', 'sign', default=False, help="Whether to sign the build. Default: no-sign") +@click.option('-s/-S', '--sign/--no-sign', 'sign', default=False, help="Wether to sign the build. Default: no-sign") @click.option('-u/-U', '--updatable/--no-updatable', 'updatable', default = True, help="Create an updatable version of the AppImage or not. Default: updatable") @click.argument('query') def build(arch, language, offline, portable, updatable, download_path, repo_path, check, sign, query): @@ -24,23 +25,60 @@ def build(arch, language, offline, portable, updatable, download_path, repo_path else: arches = [ arch.lower() ] - obj = loaih.Build(query, arches) + if query.endswith('.yml') or query.endswith('.yaml'): + # This is a buildfile. So we have to load the file and pass the build options ourselves. + config = {} + with open(query, 'r') as file: + config = yaml.safe_load(file) - obj.language = language - obj.offline_help = offline - obj.portable = portable - obj.updatable = updatable + # With the config file, we ignore all the command line options and set + # generic default. + for build in config['builds']: + # Loop a run for each build. + obj = loaih.Build(build['query'], arches) + + obj.language = build['language'] + obj.offline_help = build['offline_help'] + obj.portable = build['portable'] + obj.updatable = True + + if 'sign' in config['data'] and config['data']['sign']: + obj.sign = True + + if 'force' in config['data'] and config['data']['force']: + obj.storage_path = config['data']['repo'] + obj.version_strings() + else: + obj.check(config['data']['repo']) + + obj.download(config['data']['download']) + obj.build() + obj.checksums() + obj.publish() + del obj - if check: - obj.check(repo_path) else: - obj.storage_path = repo_path + obj = loaih.Build(query, arches) - obj.download(download_path) - obj.build() - obj.checksums() - obj.publish() - del obj + obj.language = language + obj.offline_help = offline + obj.portable = portable + obj.updatable = updatable + + if sign: + obj.sign = True + + if check: + obj.check(repo_path) + else: + obj.storage_path = repo_path + obj.version_strings() + + obj.download(download_path) + obj.build() + obj.checksums() + obj.publish() + del obj if __name__ == '__main__': build() From a8e522e12dced3926aba4d1a6f8f5b0d365a54cb Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Thu, 31 Mar 2022 01:51:37 +0200 Subject: [PATCH 07/10] Correzione piccolo problema di richiamo costante. --- loaih/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loaih/__init__.py b/loaih/__init__.py index 1c64989..3eb19c5 100644 --- a/loaih/__init__.py +++ b/loaih/__init__.py @@ -63,7 +63,7 @@ class Build(object): self.appversion = self.version + self.languagepart + self.helppart myver = str.join('.', self.version.split('.')[0:2]) self.genappversion = myver + self.languagepart + self.helppart - for arch in ARCHSTD: + for arch in Build.ARCHSTD: self.appimagefilename[arch] = self.appname + '-' + self.appversion + f'-{arch}.AppImage' self.genappimagefilename[arch] = self.appname + '-' + self.genappversion + f'-{arch}.AppImage' From b8b80ebdea1d68f243148d1209f9b4ec707506ba Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Thu, 31 Mar 2022 02:02:15 +0200 Subject: [PATCH 08/10] Cambiato lo standard dei file di build per allinearsi con l'opzione sign. --- fresh.yml | 4 +++- still.yml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fresh.yml b/fresh.yml index 1f8735a..146e19e 100644 --- a/fresh.yml +++ b/fresh.yml @@ -1,7 +1,9 @@ --- data: - storage: /srv/http/appimage.sys42.eu + repo: /srv/http/appimage.sys42.eu download: /var/tmp/downloads + force: no + sign: no builds: - query: fresh diff --git a/still.yml b/still.yml index 3d86642..bfe19b7 100644 --- a/still.yml +++ b/still.yml @@ -1,7 +1,9 @@ --- data: - storage: /srv/http/appimage.sys42.eu + repo: /srv/http/appimage.sys42.eu download: /var/tmp/downloads + force: no + sign: no builds: - query: still From 7ae5ac182a36eff4ab8bf7885a0b20f40ad52d67 Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Thu, 31 Mar 2022 02:12:46 +0200 Subject: [PATCH 09/10] Correzione logica di esecuzione e assegnazione attributi. --- loaih/__init__.py | 44 +++++++++++++++++++------------------------- scripts/loaih-build | 29 +++++++++++++++++------------ 2 files changed, 36 insertions(+), 37 deletions(-) diff --git a/loaih/__init__.py b/loaih/__init__.py index 3eb19c5..ea0728a 100644 --- a/loaih/__init__.py +++ b/loaih/__init__.py @@ -48,8 +48,23 @@ class Build(object): self.relative_path = [] self.full_path = '' - def version_strings(self): - """Build version strings based on the information received.""" + def calculate(self): + """Calculate exclusions and other variables.""" + # Incompatibilities - if portable and updatable are asked together, + # only portable will be built. + if self.portable and self.updatable: + 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 + + # Mandate to the private function to calculate the full_path available + # for the storage and the checks. + self.__calculate_full_path__() + # Building expected AppImageName self.languagepart = "." if ',' in self.language: @@ -68,25 +83,8 @@ class Build(object): self.genappimagefilename[arch] = self.appname + '-' + self.genappversion + f'-{arch}.AppImage' - def check(self, storage_path): + def check(self): """Checking if the requested AppImage has been already built.""" - # Mandate to the private function to calculate the full_path available - # for the storage and the checks. - self.__calculate_full_path__() - - # Incompatibilities - if portable and updatable are asked together, - # only portable will be built. - if self.portable and self.updatable: - 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 - - # Call the build for queries - self.version_strings() for arch in self.arch: # For generalized builds, we need to check if there are .ver file @@ -138,12 +136,8 @@ class Build(object): fullpath_arr.extend(self.relative_path) self.full_path = re.sub(r"/+", '/', str.join('/', fullpath_arr)) - def download(self, download_path): + def download(self): """Downloads the contents of the URL as it was a folder.""" - # Let's start with defining which files are to be downloaded. - # Let's explore the remote folder. - self.download_path = download_path - for arch in self.arch: # Checking if a valid path has been provided if self.url[arch] == '-': diff --git a/scripts/loaih-build b/scripts/loaih-build index 76de886..7a1ead4 100644 --- a/scripts/loaih-build +++ b/scripts/loaih-build @@ -37,21 +37,23 @@ def build(arch, language, offline, portable, updatable, download_path, repo_path # Loop a run for each build. obj = loaih.Build(build['query'], arches) + # Configuration phase obj.language = build['language'] obj.offline_help = build['offline_help'] obj.portable = build['portable'] obj.updatable = True + obj.storage_path = config['data']['repo'] if 'repo' in config['data'] and config['data']['repo'] else '/srv/http/appimage.sys42.eu' + obj.download_path = config['data']['download'] if 'download' in config['data'] and config['data']['download'] else '/var/tmp/downloads' if 'sign' in config['data'] and config['data']['sign']: obj.sign = True - if 'force' in config['data'] and config['data']['force']: - obj.storage_path = config['data']['repo'] - obj.version_strings() - else: - obj.check(config['data']['repo']) + # Build phase + obj.calculate() + if not 'force' in config['data'] or not config['data']['force']: + obj.check() - obj.download(config['data']['download']) + obj.download() obj.build() obj.checksums() obj.publish() @@ -60,21 +62,24 @@ def build(arch, language, offline, portable, updatable, download_path, repo_path else: obj = loaih.Build(query, arches) + # Configuration phase obj.language = language obj.offline_help = offline obj.portable = portable obj.updatable = updatable + obj.storage_path = repo_path + obj.download_path = download_path if sign: obj.sign = True - if check: - obj.check(repo_path) - else: - obj.storage_path = repo_path - obj.version_strings() + # Running phase + obj.calculate() - obj.download(download_path) + if check: + obj.check() + + obj.download() obj.build() obj.checksums() obj.publish() From 72c36521f670f77b2fa22e2cdc50251debc5a748 Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Thu, 31 Mar 2022 02:53:45 +0200 Subject: [PATCH 10/10] Nei buildfile firmo per default. --- fresh.yml | 2 +- still.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fresh.yml b/fresh.yml index 146e19e..8678b0f 100644 --- a/fresh.yml +++ b/fresh.yml @@ -3,7 +3,7 @@ data: repo: /srv/http/appimage.sys42.eu download: /var/tmp/downloads force: no - sign: no + sign: yes builds: - query: fresh diff --git a/still.yml b/still.yml index bfe19b7..2a97d14 100644 --- a/still.yml +++ b/still.yml @@ -3,7 +3,7 @@ data: repo: /srv/http/appimage.sys42.eu download: /var/tmp/downloads force: no - sign: no + sign: yes builds: - query: still