diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-05-08 09:40:25 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-05-08 11:51:13 +0000 |
commit | b101897de2507cf0b2549f32f9cb89ccc98bcbcb (patch) | |
tree | 298e543269cd62252dc3cc41f30a5c63d4644f03 /scripts | |
parent | 3b69cc0b14b5089b6c8f49f7cd7bb2bf0d0b58ac (diff) | |
download | definitions-b101897de2507cf0b2549f32f9cb89ccc98bcbcb.tar.gz |
scripts/release-build: Add some error checks and warnings
The script is a bit tricky to use, otherwise.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/release-build | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/release-build b/scripts/release-build index 5525e9e9..e74ac593 100755 --- a/scripts/release-build +++ b/scripts/release-build @@ -17,10 +17,12 @@ import cliapp import morphlib + import os import subprocess import sys import time +import warnings class Build(object): @@ -60,6 +62,25 @@ class ReleaseApp(cliapp.Application): 'Baserock version of the systems being built', default='yy.ww') + def log_config(self): + def pretty_warnings(message, category, filename, lineno, + file=None, line=None): + return 'WARNING: %s\n' % (message) + + warnings.formatwarning = pretty_warnings + + def error(self, message): + raise cliapp.AppException(message) + + def check_args(self, args): + if len(args) == 0: + self.error( + "Please pass the name of the release cluster (e.g. " + "clusters/release.morph)") + + if len(args) > 1: + self.error("Too many arguments given.") + def process_args(self, args): '''Process the command line''' self.controllers = {} @@ -76,6 +97,8 @@ class ReleaseApp(cliapp.Application): self.loader = morphlib.morphloader.MorphologyLoader() self.finder = morphlib.morphologyfinder.MorphologyFinder(defs_repo) + self.check_args(args) + cluster_name = args[0] cluster, cluster_path = self.load_morphology(cluster_name) @@ -126,6 +149,10 @@ class ReleaseApp(cliapp.Application): system, _ = self.load_morphology(system_name) if system['arch'] in self.controllers: builds.append(Build(system_name, system['arch'], self)) + else: + warnings.warn( + "Not building '%s': no distbuild controller for %s " + "available." % (system['name'], system['arch'])) return builds def deploy_images(self, cluster, cluster_path): |