OVerride all

This commit is contained in:
wpetit 2017-07-11 14:36:22 +02:00
parent 7f8a13bd52
commit f1bccc8e23
1 changed files with 14 additions and 14 deletions

28
package
View File

@ -21,7 +21,7 @@ def create_args_parser():
parser.add_argument("--rebuild", help="Ignore cache and rebuild container's image", action="store_true", default=False)
parser.add_argument("--debug", help="Will add extra output and start the container in interactive mode", action="store_true", default=False)
parser.add_argument("--cleanup", help="Clear the workspace and remove obsolete Docker images before build", action="store_true", default=False)
parser.add_argument("-f", "--override-run-flags", help="Override 'docker run' flags", default=[], action='append')
parser.add_argument("--override-docker-args", help="Override all 'docker run' arguments. You can use this flag multiple times to add custom arguments", default=[], action='append')
return parser
@ -86,15 +86,15 @@ if __name__ == "__main__":
kwargs = dict()
kwargs['debug'] = args.debug
docker_args = [
"run",
"--rm",
]
docker_args = []
# Append custom arguments
if len(args.override_run_flags) > 0:
docker_args += args.override_run_flags
if len(args.override_docker_args) > 0:
docker_args += args.override_docker_args
else:
docker_args += [ "run", "--rm" ]
# volumes definition
docker_args += [
"-v", "{:s}:/src:ro".format(project_dir),
@ -109,13 +109,13 @@ if __name__ == "__main__":
if proxy_var in os.environ:
docker_args += ["-e", "{:s}={:s}".format(proxy_var, os.environ[proxy_var])]
if args.debug:
kwargs['pty'] = True
docker_args += ["-it", image_tag, "/bin/sh"]
helper_cmd = " ".join(["/usr/bin/python3", "/tamarin/lib/build.py", args.profile, args.architecture])
print("Executer '{:s}' pour lancer la construction du paquet.".format(helper_cmd))
else:
docker_args += [image_tag, "/usr/bin/python3", "/tamarin/lib/build.py", args.profile, args.architecture]
if args.debug:
kwargs['pty'] = True
docker_args += ["-it", image_tag, "/bin/sh"]
helper_cmd = " ".join(["/usr/bin/python3", "/tamarin/lib/build.py", args.profile, args.architecture])
print("Executer '{:s}' pour lancer la construction du paquet.".format(helper_cmd))
else:
docker_args += [image_tag, "/usr/bin/python3", "/tamarin/lib/build.py", args.profile, args.architecture]
# Start container
tamarin.run_docker(docker_args, **kwargs)