Implementato buildfile yml.

This commit is contained in:
Emiliano Vavassori 2022-03-30 01:36:27 +02:00
parent b21d14324a
commit 42be51b82e
2 changed files with 108 additions and 13 deletions

65
fresh.yml Normal file
View File

@ -0,0 +1,65 @@
---
data:
storage: /srv/http/appimage.sys42.eu
download: /var/tmp/downloads
builds:
- query: fresh
language: basic
offline_help: no
portable: no
- query: fresh
language: basic
offline_help: yes
portable: no
- query: fresh
language: basic
offline_help: no
portable: yes
- query: fresh
language: basic
offline_help: yes
portable: yes
- query: fresh
language: standard
offline_help: no
portable: no
- query: fresh
language: standard
offline_help: yes
portable: no
- query: fresh
language: standard
offline_help: no
portable: yes
- query: fresh
language: standard
offline_help: yes
portable: yes
- query: fresh
language: full
offline_help: no
portable: no
- query: fresh
language: full
offline_help: yes
portable: no
- query: fresh
language: full
offline_help: no
portable: yes
- query: fresh
language: full
offline_help: yes
portable: yes

View File

@ -2,6 +2,7 @@
# encoding: utf-8 # encoding: utf-8
import click import click
import yaml
import loaih import loaih
@click.command() @click.command()
@ -22,23 +23,52 @@ def build(arch, language, offline, portable, updatable, download, storage, check
else: else:
arches = [ arch.lower().decode('utf-8') ] arches = [ arch.lower().decode('utf-8') ]
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 # With the config file, we ignore all the command line options and set
obj.offline_help = offline # generic default.
obj.portable = portable for build in config['builds']:
obj.updatable = updatable # Loop a run for each build.
obj = loaih.Build(build['query'], [u'x86', u'x86_64'])
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
if check:
obj.check(storage)
else: else:
obj.storage_path = storage obj = loaih.Build(query, arches)
obj.download(download) obj.language = language
obj.build() obj.offline_help = offline
obj.checksums() obj.portable = portable
obj.publish() obj.updatable = updatable
del obj
if check:
obj.check(storage)
else:
obj.storage_path = storage
obj.download(download)
obj.build()
obj.checksums()
obj.publish()
del obj
if __name__ == '__main__': if __name__ == '__main__':
build() build()