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()
@ -133,13 +138,13 @@ def batch(yamlfile, verbose):
@click.option('--check', '-c', is_flag=True, default=False, help="Checks in the repository path if the queried version is existent. Default: do not check")
@click.option('--checksums', '-e', is_flag=True, default=False, help="Create checksums for each created file (AppImage). Default: do not create checksums.")
@click.option('--keep-downloads', '-k', 'keep', is_flag=True, default=False, help="Keep the downloads folder after building the AppImage. Default: do not keep.")
@click.option('--languages', '-l', '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('--offline-help', '-o', 'offline', is_flag=True, default = False, help="Include the offline help pages for the chosen languages. Default: no offline help")
@click.option('--portable', '-p', 'portable', is_flag=True, default = False, help="Create a portable version of the AppImage or not. Default: no portable")
@click.option('--languages', '-l', '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('--offline-help', '-o', 'offline', is_flag=True, default=False, help="Include the offline help pages for the chosen languages. Default: no offline help")
@click.option('--portable', '-p', 'portable', is_flag=True, default=False, help="Create a portable version of the AppImage or not. Default: no portable")
@click.option('--sign', '-s', is_flag=True, default=False, help="Sign the build with your default GPG key. Default: do not sign")
@click.option('--updatable', '-u', is_flag=True, default = False, help="Create an updatable AppImage (compatible with zsync2). Default: not updatable")
@click.option('--download-path', '-d', default = './downloads', type=str, help="Path to the download folder. Default: ./downloads")
@click.option('--repo-path', '-r', default = '.', type=str, help="Path to the final storage of the AppImage. Default: current directory")
@click.option('--updatable', '-u', is_flag=True, default=False, help="Create an updatable AppImage (compatible with zsync2). Default: not updatable")
@click.option('--download-path', '-d', default='./downloads', type=str, help="Path to the download folder. Default: ./downloads")
@click.option('--repo-path', '-r', default='.', type=str, help="Path to the final storage of the AppImage. Default: current directory")
@click.argument('query')
def build(arch, language, offline, portable, updatable, download_path, repo_path, check, checksums, sign, keep, query):
"""Builds an Appimage with the provided options."""
@ -155,9 +160,9 @@ 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 = ['x86', 'x86_64']
else:
arches = [ arch.lower() ]
arches = [arch.lower()]
for myquery in queries:
for appbuild in loaih.build.Collection(myquery, arches):