[PATCH 1/8] docker.py/build: support -t and -f arguments

Paolo Bonzini posted 8 patches 5 years, 9 months ago
Maintainers: "Philippe Mathieu-Daudé" <philmd@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Fam Zheng <fam@euphon.net>, "Alex Bennée" <alex.bennee@linaro.org>
There is a newer version of this series
[PATCH 1/8] docker.py/build: support -t and -f arguments
Posted by Paolo Bonzini 5 years, 9 months ago
The docker.py command line is subtly different from docker and podman's,
in that the tag and Dockerfile are passed via positional arguments.
Remove this gratuitous difference and just parse -f and -t.

-f was previously used by --extra-files, only keep the long option.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/docker/Makefile.include | 2 +-
 tests/docker/docker.py        | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index 43a8678688..262704663f 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -55,7 +55,7 @@ docker-image-%: $(DOCKER_FILES_DIR)/%.docker
 else
 docker-image-%: $(DOCKER_FILES_DIR)/%.docker
 	$(call quiet-command,\
-		$(DOCKER_SCRIPT) build qemu:$* $< \
+		$(DOCKER_SCRIPT) build -t qemu:$* -f $< \
 		$(if $V,,--quiet) $(if $(NOCACHE),--no-cache) \
 		$(if $(NOUSER),,--add-current-user) \
 		$(if $(EXTRA_FILES),--extra-files $(EXTRA_FILES))\
diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index d8268c1111..ad61747bae 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -391,16 +391,16 @@ class BuildCommand(SubCommand):
                             help="""Specify a binary that will be copied to the
                             container together with all its dependent
                             libraries""")
-        parser.add_argument("--extra-files", "-f", nargs='*',
+        parser.add_argument("--extra-files", nargs='*',
                             help="""Specify files that will be copied in the
                             Docker image, fulfilling the ADD directive from the
                             Dockerfile""")
         parser.add_argument("--add-current-user", "-u", dest="user",
                             action="store_true",
                             help="Add the current user to image's passwd")
-        parser.add_argument("tag",
+        parser.add_argument("-t", dest="tag",
                             help="Image Tag")
-        parser.add_argument("dockerfile",
+        parser.add_argument("-f", dest="dockerfile",
                             help="Dockerfile name")
 
     def run(self, args, argv):
-- 
2.18.2



Re: [PATCH 1/8] docker.py/build: support -t and -f arguments
Posted by Philippe Mathieu-Daudé 5 years, 9 months ago
On 4/22/20 7:23 PM, Paolo Bonzini wrote:
> The docker.py command line is subtly different from docker and podman's,
> in that the tag and Dockerfile are passed via positional arguments.
> Remove this gratuitous difference and just parse -f and -t.
> 
> -f was previously used by --extra-files, only keep the long option.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   tests/docker/Makefile.include | 2 +-
>   tests/docker/docker.py        | 6 +++---
>   2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
> index 43a8678688..262704663f 100644
> --- a/tests/docker/Makefile.include
> +++ b/tests/docker/Makefile.include
> @@ -55,7 +55,7 @@ docker-image-%: $(DOCKER_FILES_DIR)/%.docker
>   else
>   docker-image-%: $(DOCKER_FILES_DIR)/%.docker
>   	$(call quiet-command,\
> -		$(DOCKER_SCRIPT) build qemu:$* $< \
> +		$(DOCKER_SCRIPT) build -t qemu:$* -f $< \
>   		$(if $V,,--quiet) $(if $(NOCACHE),--no-cache) \
>   		$(if $(NOUSER),,--add-current-user) \
>   		$(if $(EXTRA_FILES),--extra-files $(EXTRA_FILES))\
> diff --git a/tests/docker/docker.py b/tests/docker/docker.py
> index d8268c1111..ad61747bae 100755
> --- a/tests/docker/docker.py
> +++ b/tests/docker/docker.py
> @@ -391,16 +391,16 @@ class BuildCommand(SubCommand):
>                               help="""Specify a binary that will be copied to the
>                               container together with all its dependent
>                               libraries""")
> -        parser.add_argument("--extra-files", "-f", nargs='*',
> +        parser.add_argument("--extra-files", nargs='*',
>                               help="""Specify files that will be copied in the
>                               Docker image, fulfilling the ADD directive from the
>                               Dockerfile""")
>           parser.add_argument("--add-current-user", "-u", dest="user",
>                               action="store_true",
>                               help="Add the current user to image's passwd")
> -        parser.add_argument("tag",
> +        parser.add_argument("-t", dest="tag",
>                               help="Image Tag")
> -        parser.add_argument("dockerfile",
> +        parser.add_argument("-f", dest="dockerfile",
>                               help="Dockerfile name")
>   
>       def run(self, args, argv):
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>