1
0
Fork 0

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