Removing unmet dependency.

This commit is contained in:
emiliano.vavassori 2023-12-09 23:35:57 +01:00
parent 3dbfef9fbe
commit 2277523f3c
1 changed files with 33 additions and 28 deletions

View File

@ -8,14 +8,15 @@ import sys
import json
import click
import yaml
from dotmap import DotMap
import loaih
import loaih.build
@click.group()
def cli():
"""Helps with command line commands."""
@cli.command()
@click.option('-j', '--json', 'jsonout', default=False, is_flag=True, help="Output format in json.")
@click.option('--default-to-current', '-d', is_flag=True, default=False, help="If no versions are found, default to current one (for daily builds). Default: do not default to current.")
@ -42,6 +43,7 @@ def getversion(query, jsonout, default_to_current):
for value in batchlist:
click.echo(value)
@cli.command()
@click.option("--verbose", '-v', is_flag=True, default=False, help="Show building phases.", show_default=True)
@click.argument("yamlfile")
@ -56,33 +58,36 @@ def batch(yamlfile, verbose):
click.echo(f"YAML file {yamlfile} does not exists or is unreadable.")
sys.exit(1)
# This is a buildfile. So we have to load the file and pass the build options ourselves.
# This is a buildfile. So we have to load the file and pass the build
# options ourselves.
config = {}
with open(os.path.abspath(yamlfile), 'r', encoding='utf-8') as file:
config = yaml.safe_load(file)
# Globals for yamlfile
gvars = DotMap()
gvars.storage_path = "/srv/http/appimage.sys42.eu"
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['storage_path'] = config['data']['repo']
gvars.download_path = "/var/tmp/downloads"
gvars['download_path'] = "/var/tmp/downloads"
if 'download' in config['data'] and config['data']['download']:
gvars.download_path = config['data']['download']
gvars['download_path'] = config['data']['download']
if 'http' in gvars.storage_path:
gvars.remoterepo = True
gvars.remote_host = "ciccio.libreitalia.org"
gvars['remoterepo'] = False
gvars['remote_host'] = ''
gvars['remote_path'] = "/var/lib/nethserver/vhost/appimages"
if 'http' in gvars['storage_path']:
gvars['remoterepo'] = True
gvars['remote_host'] = "ciccio.libreitalia.org"
if 'remote_host' in config['data'] and config['data']['remote_host']:
gvars.remote_host = config['data']['remote_host']
gvars['remote_host'] = config['data']['remote_host']
gvars.remote_path = "/var/lib/nethserver/vhost/appimages"
if 'remote_path' in config['data'] and config['data']['remote_path']:
gvars.remote_path = config['data']['remote_path']
gvars['remote_path'] = config['data']['remote_path']
if 'sign' in config['data'] and config['data']['sign']:
gvars.sign = True
gvars['sign'] = True
# With the config file, we ignore all the command line options and set
# generic default.
@ -106,12 +111,12 @@ def batch(yamlfile, verbose):
obj.offline_help = cbuild['offline_help']
obj.portable = cbuild['portable']
obj.updatable = True
obj.storage_path = gvars.storage_path
obj.download_path = gvars.download_path
obj.remoterepo = gvars.remoterepo
obj.remote_host = gvars.remote_host
obj.remote_path = gvars.remote_path
obj.sign = gvars.sign
obj.storage_path = gvars['storage_path']
obj.download_path = gvars['download_path']
obj.remoterepo = gvars['remoterepo']
obj.remote_host = gvars['remote_host']
obj.remote_path = gvars['remote_path']
obj.sign = gvars['sign']
# Build phase
obj.calculate()