From 03fc28a1bfdfb3699c951d4f20ff7bc757f1d18d Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Mon, 1 Jan 2024 18:29:28 +0100 Subject: [PATCH] Implemented better option checking and defaults for builds. --- loaih/script.py | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/loaih/script.py b/loaih/script.py index aaa2e44..d08a531 100644 --- a/loaih/script.py +++ b/loaih/script.py @@ -136,17 +136,21 @@ def batch(yamlfile, verbose): # Globals for yamlfile gvars = {} - gvars['storage_path'] = "/srv/http/appimage.sys42.eu" - if 'repo' in config['data'] and config['data']['repo']: - gvars['storage_path'] = config['data']['repo'] - gvars['download_path'] = "/var/tmp/downloads" if 'download' in config['data'] and config['data']['download']: gvars['download_path'] = config['data']['download'] + gvars['force'] = False + if 'force' in config['data'] and config['data']['force']: + gvars['force'] = config['data']['force'] + + gvars['storage_path'] = "/srv/http/appimage" + if 'repo' in config['data'] and config['data']['repo']: + gvars['storage_path'] = config['data']['repo'] + gvars['remoterepo'] = False gvars['remote_host'] = '' - gvars['remote_path'] = "/var/lib/nethserver/vhost/appimages" + gvars['remote_path'] = "/srv/http/appimage" if 'http' in gvars['storage_path']: gvars['remoterepo'] = True gvars['remote_host'] = "ciccio.libreitalia.org" @@ -156,6 +160,7 @@ def batch(yamlfile, verbose): if 'remote_path' in config['data'] and config['data']['remote_path']: gvars['remote_path'] = config['data']['remote_path'] + gvars['sign'] = False if 'sign' in config['data'] and config['data']['sign']: gvars['sign'] = True @@ -168,9 +173,15 @@ def batch(yamlfile, verbose): for obj in collection: # Configuration phase obj.verbose = verbose - obj.language = cbuild['language'] - obj.offline_help = cbuild['offline_help'] - obj.portable = cbuild['portable'] + obj.language = 'basic' + if 'language' in cbuild and cbuild['language']: + obj.language = cbuild['language'] + obj.offline_help = False + if 'offline_help' in cbuild and cbuild['offline_help']: + obj.offline_help = cbuild['offline_help'] + obj.portable = False + if 'portable' in cbuild and cbuild['portable']: + obj.portable = cbuild['portable'] obj.updatable = True obj.storage_path = gvars['storage_path'] obj.download_path = gvars['download_path'] @@ -181,7 +192,8 @@ def batch(yamlfile, verbose): # Build phase obj.calculate() - obj.check() + if not gvars['force']: + obj.check() obj.download() obj.build() obj.checksums()