From 0d71f2457054ce6b14a70aa27b631dcfa15c7e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= Date: Wed, 16 May 2012 12:48:26 +0200 Subject: [PATCH] add -C option to build This allow to build a lot of image in their respective directory --- bin/is | 9 +++++++++ completion/bash/is | 2 +- completion/zsh/_installsystems | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/is b/bin/is index 1972768..9ec7b2a 100755 --- a/bin/is +++ b/bin/is @@ -107,6 +107,11 @@ def c_build(args): ''' for path in args.paths: arrow("Build %s" % path) + # chdir inside path if --chdir + if args.chdir: + cwd = os.getcwdu() + os.chdir(path) + path = "." arrowlevel(1) # build start time t0 = time.time() @@ -119,6 +124,8 @@ def c_build(args): t1 = time.time() dt = int(t1 - t0) arrow(u"Build time: %s" % datetime.timedelta(seconds=dt)) + if args.chdir: + os.chdir(cwd) arrowlevel(-1) def c_cat(args): @@ -456,6 +463,8 @@ def arg_parser_init(): p = subparser.add_parser("build", help=c_build.__doc__.lower()) p.add_argument("-c", "--no-check", action="store_true", help="do not check compilation before adding scripts") + p.add_argument("-C", "--chdir", action="store_true", + help="build image inside source image directory, not in current directory") p.add_argument("-f", "--force", action="store_true", help="rebuild image if already exists") p.add_argument("-p", "--payload", action="store_true", diff --git a/completion/bash/is b/completion/bash/is index 6c78454..926ee76 100644 --- a/completion/bash/is +++ b/completion/bash/is @@ -70,7 +70,7 @@ _is() { (( args > 2 )) && _filedir '?(u)isimage' ;; build) - [[ "$cur" == -* ]] && _opt '-h --help -f --force -p --payload -c --no-check -s --no-script' && return 0 + [[ "$cur" == -* ]] && _opt '-h --help -f --force -p --payload -c --no-check -s --no-script -C --chdir' && return 0 _count_args (( args >= 2 )) && _filedir -d ;; diff --git a/completion/zsh/_installsystems b/completion/zsh/_installsystems index 4f22575..54455e5 100644 --- a/completion/zsh/_installsystems +++ b/completion/zsh/_installsystems @@ -130,6 +130,7 @@ _is() { (build) args+=( '(-c --no-check)'{-c,--no-check}'[do not check compilation before adding scripts]' + '(-C --chdir)'{-C,--chdir}'[build image inside source image directory]' '(-f --force)'{-f,--force}'[rebuild image if already exists]' '(-p --payload)'{-p,--payload}'[rebuild payloads if already exists]' '(-s --no-script)'{-s,--no-script}"[doesn't execute build script]" -- GitLab