From d1b6a114e3188a5394f2cf71cae925b2fdd70570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Dunand?= Date: Wed, 16 May 2012 11:47:43 +0200 Subject: [PATCH] Allow to build multiple images with build command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Luttringer --- bin/is | 28 ++++++++++++++++------------ completion/bash/is | 2 +- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/bin/is b/bin/is index a4f5a8d..1972768 100755 --- a/bin/is +++ b/bin/is @@ -105,17 +105,21 @@ def c_build(args): ''' Build a source image in the current directory ''' - # build start time - t0 = time.time() - # load source image - simg = SourceImage(args.path) - # do the job - simg.build(force=args.force, force_payload=args.payload, - check=not args.no_check, script=not args.no_script) - # compute building time - t1 = time.time() - dt = int(t1 - t0) - arrow(u"Build time: %s" % datetime.timedelta(seconds=dt)) + for path in args.paths: + arrow("Build %s" % path) + arrowlevel(1) + # build start time + t0 = time.time() + # load source image + simg = SourceImage(path) + # do the job + simg.build(force=args.force, force_payload=args.payload, + check=not args.no_check, script=not args.no_script) + # compute building time + t1 = time.time() + dt = int(t1 - t0) + arrow(u"Build time: %s" % datetime.timedelta(seconds=dt)) + arrowlevel(-1) def c_cat(args): ''' @@ -458,7 +462,7 @@ def arg_parser_init(): help="rebuild payloads if already exists") p.add_argument("-s", "--no-script", action="store_true", help="doesn't execute build script") - p.add_argument("path", nargs="?", default=u".") + p.add_argument("paths", nargs="*", default=u".") p.set_defaults(func=c_build) # cat command parser p = subparser.add_parser("cat", help=c_cat.__doc__.lower()) diff --git a/completion/bash/is b/completion/bash/is index f05eafa..6c78454 100644 --- a/completion/bash/is +++ b/completion/bash/is @@ -72,7 +72,7 @@ _is() { build) [[ "$cur" == -* ]] && _opt '-h --help -f --force -p --payload -c --no-check -s --no-script' && return 0 _count_args - (( args == 2 )) && _filedir -d + (( args >= 2 )) && _filedir -d ;; cat) [[ "$cur" == -* ]] && _opt '-h --help' && return 0 -- GitLab