From 551b7502dd2a56dad9a89537848bf71e91c2d75e Mon Sep 17 00:00:00 2001 From: Jakub Klama Date: Thu, 23 Apr 2015 19:34:34 +0200 Subject: [PATCH] Adapt existing build scripts to profiles, fixing typos, missing commas, etc while here. --- build/config/ports-installer.pyd | 2 +- build/lib/utils.py | 2 +- build/profiles/default/config.pyd | 2 +- build/tools/build-os.py | 2 +- build/tools/build-ports.py | 14 +++++++------- build/tools/checkout.py | 6 +++--- build/tools/profiles.py | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/build/config/ports-installer.pyd b/build/config/ports-installer.pyd index 92e0721..15f67cb 100644 --- a/build/config/ports-installer.pyd +++ b/build/config/ports-installer.pyd @@ -46,4 +46,4 @@ ports += { e("BUILD_TIMESTAMP=${BUILD_TIMESTAMP}"), e("REVISION=${GIT_REVISION}") ] -) \ No newline at end of file +} \ No newline at end of file diff --git a/build/lib/utils.py b/build/lib/utils.py index 6c74ba9..d844b31 100644 --- a/build/lib/utils.py +++ b/build/lib/utils.py @@ -205,7 +205,7 @@ def import_function(filename, fname): def elapsed(): timestamp = env('BUILD_STARTED', str(int(time.time()))) td = int(timestamp) - return str(datetime.timedelta(seconds=time.time() - td)) + return str(datetime.timedelta(seconds=time.time() - td)).split('.')[0] # XXX def info(fmt, *args): diff --git a/build/profiles/default/config.pyd b/build/profiles/default/config.pyd index b269ae4..2fe61bc 100644 --- a/build/profiles/default/config.pyd +++ b/build/profiles/default/config.pyd @@ -90,7 +90,7 @@ else: "ctl", # "cxgbe/t4_firmware", # "cxgbe/t5_firmware", - "syscons" + "syscons", "netgraph/ether", "netgraph/socket" ] diff --git a/build/tools/build-os.py b/build/tools/build-os.py index b1eb9df..f3023a8 100755 --- a/build/tools/build-os.py +++ b/build/tools/build-os.py @@ -139,7 +139,7 @@ def installkernel(destdir, log): info('Installing kernel in {0}', log) info('Log file: {0}', log) - modules = ' '.join(dsl['kernel_module']) + modules = ' '.join(config['kernel_modules']) sh( "env MAKEOBJDIRPREFIX=${OBJDIR}", "make", diff --git a/build/tools/build-ports.py b/build/tools/build-ports.py index dff96d2..0507442 100755 --- a/build/tools/build-ports.py +++ b/build/tools/build-ports.py @@ -63,8 +63,8 @@ def create_overlay(): def create_poudriere_config(): sh('mkdir -p ${DISTFILES_CACHE}') setfile('${POUDRIERE_ROOT}/etc/poudriere.conf', template('${BUILD_CONFIG}/templates/poudriere.conf', { - 'ports_repo': reposconf['repository']['ports']['path'], - 'ports_branch': reposconf['repository']['ports']['branch'], + 'ports_repo': config['repos'].where(name='ports')['path'], + 'ports_branch': config['repos'].where(name='ports')['branch'], })) tree = e('${POUDRIERE_ROOT}/etc/poudriere.d/ports/p') @@ -83,11 +83,11 @@ def create_ports_list(): sh('rm -rf', portoptions) f = open(portslist, 'w') - for port in installer_ports['ports'] + config['ports'].values(): + for port in installer_ports['ports'] + config['ports']: name = port['name'] if isinstance(port, dict) else port name_und = name.replace('/', '_') options_path = pathjoin(portoptions, name_und) - f.write('{0}\n'.format(port['name'])) + f.write('{0}\n'.format(name)) sh('mkdir -p', options_path) if isinstance(port, dict) and 'options' in port: @@ -128,12 +128,12 @@ def merge_freenas_ports(): def prepare_env(): - for cmd in jailconf.get('copy', []).values(): + for cmd in jailconf.get('copy', []): dest = os.path.join(e('${JAIL_DESTDIR}'), cmd['dest'][1:]) sh('rm -rf ${dest}') sh('cp -a', cmd['source'], dest) - for cmd in jailconf.get('link', []).values(): + for cmd in jailconf.get('link', []): flags = '-o {0}'.format(cmd['flags']) if 'flags' in cmd else '' dest = os.path.join(e('${JAIL_DESTDIR}'), cmd['dest'][1:]) sh('mkdir -p', os.path.dirname(dest)) @@ -143,7 +143,7 @@ def prepare_env(): def cleanup_env(): sh('umount -f ${PORTS_OVERLAY}') sh('rm -rf ${PORTS_OVERLAY}') - for cmd in jailconf.get('link', []).values(): + for cmd in jailconf.get('link', []): sh('umount -f', cmd['source']) diff --git a/build/tools/checkout.py b/build/tools/checkout.py index 0bbe497..fced1da 100755 --- a/build/tools/checkout.py +++ b/build/tools/checkout.py @@ -28,11 +28,11 @@ import os -from dsl import load_file +from dsl import load_profile_config from utils import sh, sh_str, info, debug, e, setfile, appendfile -dsl = load_file('${BUILD_CONFIG}/repos.pyd', os.environ) +dsl = load_profile_config() manifest = {sh_str("git config --get remote.origin.url"): sh_str("git rev-parse --short HEAD")} @@ -60,7 +60,7 @@ def generate_manifest(): appendfile('${BUILD_ROOT}/FreeBSD/repo-manifest', e('${k} ${v}')) if __name__ == '__main__': - for i in dsl['repository'].values(): + for i in dsl['repos']: info('Checkout: {0} -> {1}', i['name'], i['path']) debug('Repository URL: {0}', i['url']) debug('Local branch: {0}', i['branch']) diff --git a/build/tools/profiles.py b/build/tools/profiles.py index 4caab6e..8d9d061 100755 --- a/build/tools/profiles.py +++ b/build/tools/profiles.py @@ -32,7 +32,6 @@ from utils import glob, e, info def main(): - info("Selected profile: {0}", e('${PROFILE}') or 'default') info("Available profiles:") for i in glob("${BUILD_PROFILES}/*"): dsl = load_file(e("${i}/config.pyd"), os.environ) @@ -40,7 +39,8 @@ def main(): continue profile = dsl["profile"] - info('{0}', profile["name"]) + selected = e("${PROFILE}") == profile["name"] + info('* {0}{1}', profile["name"], " [selected]" if selected else "") info('\tDescription: {0}', profile["description"]) info('\tOwner: {0}', profile["owner"]) info('\tStatus: {0}', profile["status"])