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("--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("--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("--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 return parser
@ -86,15 +86,15 @@ if __name__ == "__main__":
kwargs = dict() kwargs = dict()
kwargs['debug'] = args.debug kwargs['debug'] = args.debug
docker_args = [ docker_args = []
"run",
"--rm",
]
# Append custom arguments # Append custom arguments
if len(args.override_run_flags) > 0: if len(args.override_docker_args) > 0:
docker_args += args.override_run_flags docker_args += args.override_docker_args
else: else:
docker_args += [ "run", "--rm" ]
# volumes definition # volumes definition
docker_args += [ docker_args += [
"-v", "{:s}:/src:ro".format(project_dir), "-v", "{:s}:/src:ro".format(project_dir),
@ -109,13 +109,13 @@ if __name__ == "__main__":
if proxy_var in os.environ: if proxy_var in os.environ:
docker_args += ["-e", "{:s}={:s}".format(proxy_var, os.environ[proxy_var])] docker_args += ["-e", "{:s}={:s}".format(proxy_var, os.environ[proxy_var])]
if args.debug: if args.debug:
kwargs['pty'] = True kwargs['pty'] = True
docker_args += ["-it", image_tag, "/bin/sh"] docker_args += ["-it", image_tag, "/bin/sh"]
helper_cmd = " ".join(["/usr/bin/python3", "/tamarin/lib/build.py", args.profile, args.architecture]) 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)) print("Executer '{:s}' pour lancer la construction du paquet.".format(helper_cmd))
else: else:
docker_args += [image_tag, "/usr/bin/python3", "/tamarin/lib/build.py", args.profile, args.architecture] docker_args += [image_tag, "/usr/bin/python3", "/tamarin/lib/build.py", args.profile, args.architecture]
# Start container # Start container
tamarin.run_docker(docker_args, **kwargs) tamarin.run_docker(docker_args, **kwargs)