diff mbox series

[v6,34/35] Auto-import Docker support files

Message ID 1610080146-14968-35-git-send-email-tsimpson@quicinc.com
State New
Headers show
Series [v6,01/35] Hexagon Update MAINTAINERS file | expand

Commit Message

Taylor Simpson Jan. 8, 2021, 4:29 a.m. UTC
From: Alessandro Di Federico <ale@rev.ng>

Signed-off-by: Alessandro Di Federico <ale@rev.ng>
---
 tests/docker/docker.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Alex Bennée Jan. 12, 2021, 11:58 a.m. UTC | #1
Taylor Simpson <tsimpson@quicinc.com> writes:

> From: Alessandro Di Federico <ale@rev.ng>
>
> Signed-off-by: Alessandro Di Federico <ale@rev.ng>
> ---
>  tests/docker/docker.py | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/tests/docker/docker.py b/tests/docker/docker.py
> index 36b7868..d473566 100755
> --- a/tests/docker/docker.py
> +++ b/tests/docker/docker.py
> @@ -28,6 +28,7 @@ from io import StringIO, BytesIO
>  from shutil import copy, rmtree
>  from pwd import getpwuid
>  from datetime import datetime, timedelta
> +from glob import glob
>  
>  
>  FILTERED_ENV_NAMES = ['ftp_proxy', 'http_proxy', 'https_proxy']
> @@ -466,7 +467,8 @@ class BuildCommand(SubCommand):
>                      return 1
>  
>              # Is there a .pre file to run in the build context?
> -            docker_pre = os.path.splitext(args.dockerfile)[0]+".pre"
> +            basename = os.path.splitext(args.dockerfile)[0]
> +            docker_pre = basename + ".pre"
>              if os.path.exists(docker_pre):
>                  stdout = DEVNULL if args.quiet else None
>                  rc = subprocess.call(os.path.realpath(docker_pre),
> @@ -488,7 +490,9 @@ class BuildCommand(SubCommand):
>                  _copy_binary_with_libs(args.include_executable,
>                                         qpath, docker_dir)
>  
> -            for filename in args.extra_files or []:
> +            extra_files = args.extra_files or []
> +            extra_files += glob(basename + ".*")
> +            for filename in extra_files:

Hmm not so sure about this magic. What's wrong with the existing
--extra-files mechanism? 

>                  _copy_with_mkdir(filename, docker_dir)
>                  cksum += [(filename, _file_checksum(filename))]
Alex Bennée Jan. 12, 2021, 6:26 p.m. UTC | #2
Alessandro Di Federico <ale@rev.ng> writes:

> On Tue, 12 Jan 2021 11:58:30 +0000
> Alex Bennée <alex.bennee@linaro.org> wrote:
>
>> > -            for filename in args.extra_files or []:
>> > +            extra_files = args.extra_files or []
>> > +            extra_files += glob(basename + ".*")
>> > +            for filename in extra_files:  
>> 
>> Hmm not so sure about this magic. What's wrong with the existing
>> --extra-files mechanism? 
>
> I'd be OK with using that, but how can I automate it?
>
> It is my understanding that `--extra-files` is only set by through the
> EXTRA_FILES environment variable. Therefore the user should do
> something like this:
>
>     make check-tcg \
>         DOCKER_IMAGE=debian-hexagon-cross \
>         DOCKER_CROSS_CC_GUEST=hexagon-unknown-linux-musl-clang \
>         EXTRA_FILES="..."

I'm confused - extra-files is while building the docker image, not
running it.

>
> Or am I missing some part of how this works?

Add an explicit rule in Makefile.include:

  docker-image-debian-hexagon-cross: EXTRA_FILES=foo.bar
diff mbox series

Patch

diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 36b7868..d473566 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -28,6 +28,7 @@  from io import StringIO, BytesIO
 from shutil import copy, rmtree
 from pwd import getpwuid
 from datetime import datetime, timedelta
+from glob import glob
 
 
 FILTERED_ENV_NAMES = ['ftp_proxy', 'http_proxy', 'https_proxy']
@@ -466,7 +467,8 @@  class BuildCommand(SubCommand):
                     return 1
 
             # Is there a .pre file to run in the build context?
-            docker_pre = os.path.splitext(args.dockerfile)[0]+".pre"
+            basename = os.path.splitext(args.dockerfile)[0]
+            docker_pre = basename + ".pre"
             if os.path.exists(docker_pre):
                 stdout = DEVNULL if args.quiet else None
                 rc = subprocess.call(os.path.realpath(docker_pre),
@@ -488,7 +490,9 @@  class BuildCommand(SubCommand):
                 _copy_binary_with_libs(args.include_executable,
                                        qpath, docker_dir)
 
-            for filename in args.extra_files or []:
+            extra_files = args.extra_files or []
+            extra_files += glob(basename + ".*")
+            for filename in extra_files:
                 _copy_with_mkdir(filename, docker_dir)
                 cksum += [(filename, _file_checksum(filename))]