Implemented better option checking and defaults for builds.

This commit is contained in:
emiliano.vavassori 2024-01-01 18:29:28 +01:00
parent 8c4bc65184
commit 03fc28a1bf
1 changed files with 21 additions and 9 deletions

View File

@ -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()