From a74517e43ce9420b26f9cc055ff3d2068ea18d09 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Wed, 10 Jul 2024 09:57:21 +0200 Subject: [PATCH 01/17] add tests for mulled v2 hashes to verify if the build is considered as part of the version or not --- lib/galaxy/tool_util/deps/mulled/util.py | 7 ++ .../tools/mulled_example_multi_2.xml | 79 +++++++++++++++++++ test/integration/test_container_resolvers.py | 5 ++ 3 files changed, 91 insertions(+) create mode 100644 test/functional/tools/mulled_example_multi_2.xml diff --git a/lib/galaxy/tool_util/deps/mulled/util.py b/lib/galaxy/tool_util/deps/mulled/util.py index a7eacb33806c..8f62617e45a3 100644 --- a/lib/galaxy/tool_util/deps/mulled/util.py +++ b/lib/galaxy/tool_util/deps/mulled/util.py @@ -335,7 +335,14 @@ def v2_image_name( >>> multi_targets_versionless = [build_target("samtools"), build_target("bwa")] >>> v2_image_name(multi_targets_versionless) 'mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40' + >>> targets_version_with_build = [build_target("samtools", version="1.3.1=h9071d68_10"), build_target("bedtools", version="2.26.0=0")] + >>> v2_image_name(targets_version_with_build) + 'mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:8e86df67d257ce6494ae12b2c60e1b94025ea529' + >>> targets_version_with_build = [build_target("samtools", version="1.3.1", build="h9071d68_10"), build_target("bedtools", version="2.26.0", build="0")] + >>> v2_image_name(targets_version_with_build) + 'mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619' """ + if name_override is not None: print( "WARNING: Overriding mulled image name, auto-detection of 'mulled' package attributes will fail to detect result." diff --git a/test/functional/tools/mulled_example_multi_2.xml b/test/functional/tools/mulled_example_multi_2.xml new file mode 100644 index 000000000000..5347dace94b7 --- /dev/null +++ b/test/functional/tools/mulled_example_multi_2.xml @@ -0,0 +1,79 @@ + + + + bedtools + samtools + + + + + + + samtools + bedtools + + '$out_file1' && +echo "Moo" >> '$out_file1' && +samtools >> '$out_file1' 2>&1 && +echo "Cow" >> '$out_file1' && + +touch "\${TMP:-/tmp}/job_tmp" && +touch "\${TEMP:-/tmp}/job_temp" && +touch "\${TMPDIR:-/tmp}/job_tmpdir" + ]]> + + + + + + + + + + + 10.1093/bioinformatics/btq033 + + @misc{SAM_def, + title={Definition of SAM/BAM format}, + url = {https://samtools.github.io/hts-specs/},} + + 10.1093/bioinformatics/btp352 + 10.1093/bioinformatics/btr076 + 10.1093/bioinformatics/btr509 + + @misc{Danecek_et_al, + Author={Danecek, P., Schiffels, S., Durbin, R.}, + title={Multiallelic calling model in bcftools (-m)}, + url = {http://samtools.github.io/bcftools/call-m.pdf},} + + + @misc{Durbin_VCQC, + Author={Durbin, R.}, + title={Segregation based metric for variant call QC}, + url = {http://samtools.github.io/bcftools/rd-SegBias.pdf},} + + + @misc{Li_SamMath, + Author={Li, H.}, + title={Mathematical Notes on SAMtools Algorithms}, + url = {http://www.broadinstitute.org/gatk/media/docs/Samtools.pdf},} + + + @misc{SamTools_github, + title={SAMTools GitHub page}, + url = {https://github.com/samtools/samtools},} + + + diff --git a/test/integration/test_container_resolvers.py b/test/integration/test_container_resolvers.py index 2188cf3f9bb2..4f9f31f38edd 100644 --- a/test/integration/test_container_resolvers.py +++ b/test/integration/test_container_resolvers.py @@ -480,6 +480,11 @@ class MulledTestCase: mulled_hash = "mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619-0" +class MulledTestCaseWithBuildInfo: + tool_id = "mulled_example_multi_2" + mulled_hash = "mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:8e86df67d257ce6494ae12b2c60e1b94025ea529-0" + + class TestDefaultContainerResolvers(DockerContainerResolverTestCase, ContainerResolverTestCases, MulledTestCase): """ Test default container resolvers From d7934912caa09ed4e2916c0923ee34e14fcc7216 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Wed, 10 Jul 2024 15:58:25 +0200 Subject: [PATCH 02/17] fix mulled v2 hash generation from strings the build information that may be contained in requirement versions is considered as part of the version in some places of the code - mulled container resolvers - mulled-build-tool - [planemo](https://github.com/galaxyproject/planemo/blob/b3e12a334e3d358ce30bf2c8c3f8d5a7a7e08136/planemo/conda.py#L116) in others it isn't: - mulled-hash - mulled-build-files - mulled_build which are the files that use the `target_str_to_targets` function. With this change the build info in version strings is always considered as part of the version. `mulled-build-files` is used in the multi-package-containers repo which led to wrong hashes in up to approx 50 tools (check with `grep "=[^,]*=" combinations/* | wc -l`). --- .../tool_util/deps/mulled/mulled_build.py | 11 ++++----- .../deps/mulled/mulled_build_tool.py | 24 ++++++++++++++----- .../tool_util/deps/mulled/mulled_hash.py | 20 ++++++++++++---- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_build.py b/lib/galaxy/tool_util/deps/mulled/mulled_build.py index be956c84a8b9..fb789075d4b3 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_build.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_build.py @@ -352,7 +352,7 @@ def mull_targets( with PrintProgress(): ret = involucro_context.exec_command(involucro_args) if singularity: - # we can not remove this folder as it contains the image wich is owned by root + # we can not remove this folder as it contains the image which is owned by root pass # shutil.rmtree('./singularity_import') return ret @@ -531,12 +531,7 @@ def target_str_to_targets(targets_raw): def parse_target(target_str): if "=" in target_str: package_name, version = target_str.split("=", 1) - build = None - if "=" in version: - version, build = version.split("=") - elif "--" in version: - version, build = version.split("--") - target = build_target(package_name, version, build) + target = build_target(package_name, version) else: target = build_target(target_str) return target @@ -584,6 +579,8 @@ def args_to_mull_targets_kwds(args): kwds["singularity_image_dir"] = args.singularity_image_dir if hasattr(args, "invfile"): kwds["invfile"] = args.invfile + if hasattr(args, "base_image"): + kwds["base_image"] = args.base_image kwds["involucro_context"] = context_from_args(args) diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py b/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py index a469bcd5eac9..bafaf61baa64 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py @@ -27,6 +27,23 @@ from galaxy.tool_util.deps.conda_util import CondaTarget +def _mulled_build_tool(tool, args): + """ + >>> import doctest + >>> doctest.ELLIPSIS_MARKER = '-ignore-' + >>> import argparse + >>> _mulled_build_tool("test/functional/tools/mulled_example_multi_1.xml", argparse.Namespace(dry_run=True, base_image="does-not-matter-here-but-test-is-fast", command="build", verbose=True, involucro_path="./involucro")) # doctest: +ELLIPSIS + -ignore- REPO=quay.io/biocontainers/mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619-0 -ignore- + >>> _mulled_build_tool("test/functional/tools/mulled_example_multi_2.xml", argparse.Namespace(dry_run=True, base_image="does-not-matter-here-but-test-is-fast", command="build", verbose=True, involucro_path="./involucro")) # doctest: +ELLIPSIS + -ignore- REPO=quay.io/biocontainers/mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:8e86df67d257ce6494ae12b2c60e1b94025ea529-0 -ignore- + """ + tool_source = get_tool_source(tool) + requirements, *_ = tool_source.parse_requirements_and_containers() + targets = requirements_to_mulled_targets(requirements) + kwds = args_to_mull_targets_kwds(args) + mull_targets(targets, **kwds) + + def main(argv=None) -> None: """Main entry-point for the CLI tool.""" parser = arg_parser(argv, globals()) @@ -35,12 +52,7 @@ def main(argv=None) -> None: parser.add_argument("command", metavar="COMMAND", help="Command (build-and-test, build, all)") parser.add_argument("tool", metavar="TOOL", default=None, help="Path to tool to build mulled image for.") args = parser.parse_args() - tool_source = get_tool_source(args.tool) - requirements, *_ = tool_source.parse_requirements_and_containers() - targets = requirements_to_mulled_targets(requirements) - kwds = args_to_mull_targets_kwds(args) - mull_targets(targets, **kwds) - + _mulled_build_tool(args.tool, args) def requirements_to_mulled_targets(requirements) -> List["CondaTarget"]: """Convert Galaxy's representation of requirements into a list of CondaTarget objects. diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_hash.py b/lib/galaxy/tool_util/deps/mulled/mulled_hash.py index 691e4ab7e749..bd93cfbe1f6b 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_hash.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_hash.py @@ -16,17 +16,29 @@ ) +def _mulled_hash(hash, targets): + """ + >>> _mulled_hash(hash="v2", targets="samtools=1.3.1,bedtools=2.26.0") + 'mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619' + >>> _mulled_hash(hash="v2", targets="samtools=1.3.1=h9071d68_10,bedtools=2.26.0=0") + 'mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:8e86df67d257ce6494ae12b2c60e1b94025ea529' + """ + targets = target_str_to_targets(targets) + image_name = v2_image_name if hash == "v2" else v1_image_name + return image_name(targets) + + def main(argv=None): - """Main entry-point for the CLI tool.""" + """ + Main entry-point for the CLI tool. + """ parser = arg_parser(argv, globals()) parser.add_argument( "targets", metavar="TARGETS", default=None, help="Comma-separated packages for calculating the mulled hash." ) parser.add_argument("--hash", dest="hash", choices=["v1", "v2"], default="v2") args = parser.parse_args() - targets = target_str_to_targets(args.targets) - image_name = v2_image_name if args.hash == "v2" else v1_image_name - print(image_name(targets)) + print(_mulled_hash(args.hash, args.targets)) __all__ = ("main",) From cf20090054faa08449ebf7e271be2da37855efa4 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Wed, 10 Jul 2024 16:25:10 +0200 Subject: [PATCH 03/17] remove integration test --- .../tools/mulled_example_multi_2.xml | 79 ------------------- test/integration/test_container_resolvers.py | 5 -- 2 files changed, 84 deletions(-) delete mode 100644 test/functional/tools/mulled_example_multi_2.xml diff --git a/test/functional/tools/mulled_example_multi_2.xml b/test/functional/tools/mulled_example_multi_2.xml deleted file mode 100644 index 5347dace94b7..000000000000 --- a/test/functional/tools/mulled_example_multi_2.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - bedtools - samtools - - - - - - - samtools - bedtools - - '$out_file1' && -echo "Moo" >> '$out_file1' && -samtools >> '$out_file1' 2>&1 && -echo "Cow" >> '$out_file1' && - -touch "\${TMP:-/tmp}/job_tmp" && -touch "\${TEMP:-/tmp}/job_temp" && -touch "\${TMPDIR:-/tmp}/job_tmpdir" - ]]> - - - - - - - - - - - 10.1093/bioinformatics/btq033 - - @misc{SAM_def, - title={Definition of SAM/BAM format}, - url = {https://samtools.github.io/hts-specs/},} - - 10.1093/bioinformatics/btp352 - 10.1093/bioinformatics/btr076 - 10.1093/bioinformatics/btr509 - - @misc{Danecek_et_al, - Author={Danecek, P., Schiffels, S., Durbin, R.}, - title={Multiallelic calling model in bcftools (-m)}, - url = {http://samtools.github.io/bcftools/call-m.pdf},} - - - @misc{Durbin_VCQC, - Author={Durbin, R.}, - title={Segregation based metric for variant call QC}, - url = {http://samtools.github.io/bcftools/rd-SegBias.pdf},} - - - @misc{Li_SamMath, - Author={Li, H.}, - title={Mathematical Notes on SAMtools Algorithms}, - url = {http://www.broadinstitute.org/gatk/media/docs/Samtools.pdf},} - - - @misc{SamTools_github, - title={SAMTools GitHub page}, - url = {https://github.com/samtools/samtools},} - - - diff --git a/test/integration/test_container_resolvers.py b/test/integration/test_container_resolvers.py index 4f9f31f38edd..2188cf3f9bb2 100644 --- a/test/integration/test_container_resolvers.py +++ b/test/integration/test_container_resolvers.py @@ -480,11 +480,6 @@ class MulledTestCase: mulled_hash = "mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619-0" -class MulledTestCaseWithBuildInfo: - tool_id = "mulled_example_multi_2" - mulled_hash = "mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:8e86df67d257ce6494ae12b2c60e1b94025ea529-0" - - class TestDefaultContainerResolvers(DockerContainerResolverTestCase, ContainerResolverTestCases, MulledTestCase): """ Test default container resolvers From 1ff21ee5a9690a218d6033e2340ff732c22cd258 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Thu, 11 Jul 2024 09:38:32 +0200 Subject: [PATCH 04/17] fix linter errors --- lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py b/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py index bafaf61baa64..7686b2fe7c50 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py @@ -36,7 +36,7 @@ def _mulled_build_tool(tool, args): -ignore- REPO=quay.io/biocontainers/mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619-0 -ignore- >>> _mulled_build_tool("test/functional/tools/mulled_example_multi_2.xml", argparse.Namespace(dry_run=True, base_image="does-not-matter-here-but-test-is-fast", command="build", verbose=True, involucro_path="./involucro")) # doctest: +ELLIPSIS -ignore- REPO=quay.io/biocontainers/mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:8e86df67d257ce6494ae12b2c60e1b94025ea529-0 -ignore- - """ + """ tool_source = get_tool_source(tool) requirements, *_ = tool_source.parse_requirements_and_containers() targets = requirements_to_mulled_targets(requirements) @@ -54,6 +54,7 @@ def main(argv=None) -> None: args = parser.parse_args() _mulled_build_tool(args.tool, args) + def requirements_to_mulled_targets(requirements) -> List["CondaTarget"]: """Convert Galaxy's representation of requirements into a list of CondaTarget objects. From 91ca899c60ee5f39bbb2055f0795a74d40b363d2 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Thu, 11 Jul 2024 09:39:20 +0200 Subject: [PATCH 05/17] resore test tool needed for unit test --- .../tools/mulled_example_multi_2.xml | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 test/functional/tools/mulled_example_multi_2.xml diff --git a/test/functional/tools/mulled_example_multi_2.xml b/test/functional/tools/mulled_example_multi_2.xml new file mode 100644 index 000000000000..5347dace94b7 --- /dev/null +++ b/test/functional/tools/mulled_example_multi_2.xml @@ -0,0 +1,79 @@ + + + + bedtools + samtools + + + + + + + samtools + bedtools + + '$out_file1' && +echo "Moo" >> '$out_file1' && +samtools >> '$out_file1' 2>&1 && +echo "Cow" >> '$out_file1' && + +touch "\${TMP:-/tmp}/job_tmp" && +touch "\${TEMP:-/tmp}/job_temp" && +touch "\${TMPDIR:-/tmp}/job_tmpdir" + ]]> + + + + + + + + + + + 10.1093/bioinformatics/btq033 + + @misc{SAM_def, + title={Definition of SAM/BAM format}, + url = {https://samtools.github.io/hts-specs/},} + + 10.1093/bioinformatics/btp352 + 10.1093/bioinformatics/btr076 + 10.1093/bioinformatics/btr509 + + @misc{Danecek_et_al, + Author={Danecek, P., Schiffels, S., Durbin, R.}, + title={Multiallelic calling model in bcftools (-m)}, + url = {http://samtools.github.io/bcftools/call-m.pdf},} + + + @misc{Durbin_VCQC, + Author={Durbin, R.}, + title={Segregation based metric for variant call QC}, + url = {http://samtools.github.io/bcftools/rd-SegBias.pdf},} + + + @misc{Li_SamMath, + Author={Li, H.}, + title={Mathematical Notes on SAMtools Algorithms}, + url = {http://www.broadinstitute.org/gatk/media/docs/Samtools.pdf},} + + + @misc{SamTools_github, + title={SAMTools GitHub page}, + url = {https://github.com/samtools/samtools},} + + + From 2c99d0e9cd98002c81d6872543957ef452bce060 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Thu, 11 Jul 2024 13:00:28 +0200 Subject: [PATCH 06/17] extend test to show that build information is still passed on --- lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py b/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py index 7686b2fe7c50..85fbf01d89fe 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py @@ -33,9 +33,9 @@ def _mulled_build_tool(tool, args): >>> doctest.ELLIPSIS_MARKER = '-ignore-' >>> import argparse >>> _mulled_build_tool("test/functional/tools/mulled_example_multi_1.xml", argparse.Namespace(dry_run=True, base_image="does-not-matter-here-but-test-is-fast", command="build", verbose=True, involucro_path="./involucro")) # doctest: +ELLIPSIS - -ignore- REPO=quay.io/biocontainers/mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619-0 -ignore- + -ignore- TARGETS=samtools=1.3.1,bedtools=2.26.0 -ignore- REPO=quay.io/biocontainers/mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619-0 -ignore- >>> _mulled_build_tool("test/functional/tools/mulled_example_multi_2.xml", argparse.Namespace(dry_run=True, base_image="does-not-matter-here-but-test-is-fast", command="build", verbose=True, involucro_path="./involucro")) # doctest: +ELLIPSIS - -ignore- REPO=quay.io/biocontainers/mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:8e86df67d257ce6494ae12b2c60e1b94025ea529-0 -ignore- + -ignore- TARGETS=samtools=1.3.1=h9071d68_10,bedtools=2.26.0=0 -ignore- REPO=quay.io/biocontainers/mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:8e86df67d257ce6494ae12b2c60e1b94025ea529-0 -ignore- """ tool_source = get_tool_source(tool) requirements, *_ = tool_source.parse_requirements_and_containers() From b9791d843131f1b241bc0fa9e0f55f6abfc03635 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Thu, 18 Jul 2024 10:13:01 +0200 Subject: [PATCH 07/17] Revert "remove integration test" This reverts commit 565e228df26efe309af7be408f45e81ac3f323fc. --- test/integration/test_container_resolvers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/integration/test_container_resolvers.py b/test/integration/test_container_resolvers.py index 2188cf3f9bb2..4f9f31f38edd 100644 --- a/test/integration/test_container_resolvers.py +++ b/test/integration/test_container_resolvers.py @@ -480,6 +480,11 @@ class MulledTestCase: mulled_hash = "mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619-0" +class MulledTestCaseWithBuildInfo: + tool_id = "mulled_example_multi_2" + mulled_hash = "mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:8e86df67d257ce6494ae12b2c60e1b94025ea529-0" + + class TestDefaultContainerResolvers(DockerContainerResolverTestCase, ContainerResolverTestCases, MulledTestCase): """ Test default container resolvers From 1e9ed3a800a2a131eac539c789f86ed69790d491 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Thu, 18 Jul 2024 14:30:22 +0200 Subject: [PATCH 08/17] Revert "fix mulled v2 hash generation from strings" This reverts commit e7bca837f08345980f240f633921dbcce174345e. --- .../tool_util/deps/mulled/mulled_build.py | 11 ++++++---- .../tool_util/deps/mulled/mulled_hash.py | 20 ++++--------------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_build.py b/lib/galaxy/tool_util/deps/mulled/mulled_build.py index fb789075d4b3..be956c84a8b9 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_build.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_build.py @@ -352,7 +352,7 @@ def mull_targets( with PrintProgress(): ret = involucro_context.exec_command(involucro_args) if singularity: - # we can not remove this folder as it contains the image which is owned by root + # we can not remove this folder as it contains the image wich is owned by root pass # shutil.rmtree('./singularity_import') return ret @@ -531,7 +531,12 @@ def target_str_to_targets(targets_raw): def parse_target(target_str): if "=" in target_str: package_name, version = target_str.split("=", 1) - target = build_target(package_name, version) + build = None + if "=" in version: + version, build = version.split("=") + elif "--" in version: + version, build = version.split("--") + target = build_target(package_name, version, build) else: target = build_target(target_str) return target @@ -579,8 +584,6 @@ def args_to_mull_targets_kwds(args): kwds["singularity_image_dir"] = args.singularity_image_dir if hasattr(args, "invfile"): kwds["invfile"] = args.invfile - if hasattr(args, "base_image"): - kwds["base_image"] = args.base_image kwds["involucro_context"] = context_from_args(args) diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_hash.py b/lib/galaxy/tool_util/deps/mulled/mulled_hash.py index bd93cfbe1f6b..691e4ab7e749 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_hash.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_hash.py @@ -16,29 +16,17 @@ ) -def _mulled_hash(hash, targets): - """ - >>> _mulled_hash(hash="v2", targets="samtools=1.3.1,bedtools=2.26.0") - 'mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619' - >>> _mulled_hash(hash="v2", targets="samtools=1.3.1=h9071d68_10,bedtools=2.26.0=0") - 'mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:8e86df67d257ce6494ae12b2c60e1b94025ea529' - """ - targets = target_str_to_targets(targets) - image_name = v2_image_name if hash == "v2" else v1_image_name - return image_name(targets) - - def main(argv=None): - """ - Main entry-point for the CLI tool. - """ + """Main entry-point for the CLI tool.""" parser = arg_parser(argv, globals()) parser.add_argument( "targets", metavar="TARGETS", default=None, help="Comma-separated packages for calculating the mulled hash." ) parser.add_argument("--hash", dest="hash", choices=["v1", "v2"], default="v2") args = parser.parse_args() - print(_mulled_hash(args.hash, args.targets)) + targets = target_str_to_targets(args.targets) + image_name = v2_image_name if args.hash == "v2" else v1_image_name + print(image_name(targets)) __all__ = ("main",) From c8ec6ae5b4e39a2e93b1a07ffb260825637137b3 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Thu, 18 Jul 2024 14:32:16 +0200 Subject: [PATCH 09/17] keep test --- lib/galaxy/tool_util/deps/mulled/mulled_hash.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_hash.py b/lib/galaxy/tool_util/deps/mulled/mulled_hash.py index 691e4ab7e749..9301acde632e 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_hash.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_hash.py @@ -16,6 +16,18 @@ ) +def _mulled_hash(hash, targets): + """ + >>> _mulled_hash(hash="v2", targets="samtools=1.3.1,bedtools=2.26.0") + 'mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619' + >>> _mulled_hash(hash="v2", targets="samtools=1.3.1=h9071d68_10,bedtools=2.26.0=0") + 'mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:8e86df67d257ce6494ae12b2c60e1b94025ea529' + """ + targets = target_str_to_targets(targets) + image_name = v2_image_name if hash == "v2" else v1_image_name + return image_name(targets) + + def main(argv=None): """Main entry-point for the CLI tool.""" parser = arg_parser(argv, globals()) @@ -25,8 +37,7 @@ def main(argv=None): parser.add_argument("--hash", dest="hash", choices=["v1", "v2"], default="v2") args = parser.parse_args() targets = target_str_to_targets(args.targets) - image_name = v2_image_name if args.hash == "v2" else v1_image_name - print(image_name(targets)) + print(_mulled_hash(args.hash, targets)) __all__ = ("main",) From 870a433d7b8dea17476af8a7daefb8afc5d91315 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Thu, 18 Jul 2024 17:05:52 +0200 Subject: [PATCH 10/17] fix .. the other way round --- lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py b/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py index 85fbf01d89fe..b8a5525531d4 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py @@ -20,8 +20,8 @@ add_single_image_arguments, args_to_mull_targets_kwds, mull_targets, + target_str_to_targets, ) -from .util import build_target if TYPE_CHECKING: from galaxy.tool_util.deps.conda_util import CondaTarget @@ -61,7 +61,8 @@ def requirements_to_mulled_targets(requirements) -> List["CondaTarget"]: Only package requirements are retained. """ package_requirements = [r for r in requirements if r.type == "package"] - targets = [build_target(r.name, r.version) for r in package_requirements] + target_str = ",".join([f"{r.name}={r.version}" for r in package_requirements]) + targets = target_str_to_targets(target_str) return targets From 3b2f842be0a69eb27ea8db5503d61dc5ca244681 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Fri, 19 Jul 2024 10:47:58 +0200 Subject: [PATCH 11/17] fix tests needs to be the same hash in all places and independent of given/absent build in the version. --- lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py | 3 ++- lib/galaxy/tool_util/deps/mulled/mulled_hash.py | 2 +- test/integration/test_container_resolvers.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py b/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py index b8a5525531d4..9ba211effb16 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py @@ -29,13 +29,14 @@ def _mulled_build_tool(tool, args): """ + test verifies that the v2 hashes are the identical with and without using a build in the versions >>> import doctest >>> doctest.ELLIPSIS_MARKER = '-ignore-' >>> import argparse >>> _mulled_build_tool("test/functional/tools/mulled_example_multi_1.xml", argparse.Namespace(dry_run=True, base_image="does-not-matter-here-but-test-is-fast", command="build", verbose=True, involucro_path="./involucro")) # doctest: +ELLIPSIS -ignore- TARGETS=samtools=1.3.1,bedtools=2.26.0 -ignore- REPO=quay.io/biocontainers/mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619-0 -ignore- >>> _mulled_build_tool("test/functional/tools/mulled_example_multi_2.xml", argparse.Namespace(dry_run=True, base_image="does-not-matter-here-but-test-is-fast", command="build", verbose=True, involucro_path="./involucro")) # doctest: +ELLIPSIS - -ignore- TARGETS=samtools=1.3.1=h9071d68_10,bedtools=2.26.0=0 -ignore- REPO=quay.io/biocontainers/mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:8e86df67d257ce6494ae12b2c60e1b94025ea529-0 -ignore- + -ignore- TARGETS=samtools=1.3.1=h9071d68_10,bedtools=2.26.0=0 -ignore- REPO=quay.io/biocontainers/mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619-0 -ignore- """ tool_source = get_tool_source(tool) requirements, *_ = tool_source.parse_requirements_and_containers() diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_hash.py b/lib/galaxy/tool_util/deps/mulled/mulled_hash.py index 9301acde632e..3b4766c61648 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_hash.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_hash.py @@ -21,7 +21,7 @@ def _mulled_hash(hash, targets): >>> _mulled_hash(hash="v2", targets="samtools=1.3.1,bedtools=2.26.0") 'mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619' >>> _mulled_hash(hash="v2", targets="samtools=1.3.1=h9071d68_10,bedtools=2.26.0=0") - 'mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:8e86df67d257ce6494ae12b2c60e1b94025ea529' + 'mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619' """ targets = target_str_to_targets(targets) image_name = v2_image_name if hash == "v2" else v1_image_name diff --git a/test/integration/test_container_resolvers.py b/test/integration/test_container_resolvers.py index 4f9f31f38edd..1d1fda4739ea 100644 --- a/test/integration/test_container_resolvers.py +++ b/test/integration/test_container_resolvers.py @@ -482,7 +482,7 @@ class MulledTestCase: class MulledTestCaseWithBuildInfo: tool_id = "mulled_example_multi_2" - mulled_hash = "mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:8e86df67d257ce6494ae12b2c60e1b94025ea529-0" + mulled_hash = "mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619-0" class TestDefaultContainerResolvers(DockerContainerResolverTestCase, ContainerResolverTestCases, MulledTestCase): From 2dcee3401f69361f83f87c9a2446810e413eaa37 Mon Sep 17 00:00:00 2001 From: M Bernt Date: Mon, 22 Jul 2024 15:04:55 +0200 Subject: [PATCH 12/17] Update lib/galaxy/tool_util/deps/mulled/util.py --- lib/galaxy/tool_util/deps/mulled/util.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/galaxy/tool_util/deps/mulled/util.py b/lib/galaxy/tool_util/deps/mulled/util.py index 8f62617e45a3..ddff7acd32b1 100644 --- a/lib/galaxy/tool_util/deps/mulled/util.py +++ b/lib/galaxy/tool_util/deps/mulled/util.py @@ -335,9 +335,6 @@ def v2_image_name( >>> multi_targets_versionless = [build_target("samtools"), build_target("bwa")] >>> v2_image_name(multi_targets_versionless) 'mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40' - >>> targets_version_with_build = [build_target("samtools", version="1.3.1=h9071d68_10"), build_target("bedtools", version="2.26.0=0")] - >>> v2_image_name(targets_version_with_build) - 'mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:8e86df67d257ce6494ae12b2c60e1b94025ea529' >>> targets_version_with_build = [build_target("samtools", version="1.3.1", build="h9071d68_10"), build_target("bedtools", version="2.26.0", build="0")] >>> v2_image_name(targets_version_with_build) 'mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619' From 5d97ed550af3be4ec847a2046a6bc07a7f69bb36 Mon Sep 17 00:00:00 2001 From: M Bernt Date: Mon, 2 Sep 2024 15:20:57 +0200 Subject: [PATCH 13/17] Remove doctest --- lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py b/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py index 9ba211effb16..a9dfea4d66d7 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py @@ -28,16 +28,6 @@ def _mulled_build_tool(tool, args): - """ - test verifies that the v2 hashes are the identical with and without using a build in the versions - >>> import doctest - >>> doctest.ELLIPSIS_MARKER = '-ignore-' - >>> import argparse - >>> _mulled_build_tool("test/functional/tools/mulled_example_multi_1.xml", argparse.Namespace(dry_run=True, base_image="does-not-matter-here-but-test-is-fast", command="build", verbose=True, involucro_path="./involucro")) # doctest: +ELLIPSIS - -ignore- TARGETS=samtools=1.3.1,bedtools=2.26.0 -ignore- REPO=quay.io/biocontainers/mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619-0 -ignore- - >>> _mulled_build_tool("test/functional/tools/mulled_example_multi_2.xml", argparse.Namespace(dry_run=True, base_image="does-not-matter-here-but-test-is-fast", command="build", verbose=True, involucro_path="./involucro")) # doctest: +ELLIPSIS - -ignore- TARGETS=samtools=1.3.1=h9071d68_10,bedtools=2.26.0=0 -ignore- REPO=quay.io/biocontainers/mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619-0 -ignore- - """ tool_source = get_tool_source(tool) requirements, *_ = tool_source.parse_requirements_and_containers() targets = requirements_to_mulled_targets(requirements) From 5895a57cc0da031f17bd969cb70244ea7e8c086c Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Tue, 3 Sep 2024 15:00:52 +0200 Subject: [PATCH 14/17] enable integration test --- test/functional/tools/sample_tool_conf.xml | 1 + test/integration/test_container_resolvers.py | 52 ++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/test/functional/tools/sample_tool_conf.xml b/test/functional/tools/sample_tool_conf.xml index bb9d7568f600..85e4e03dcc81 100644 --- a/test/functional/tools/sample_tool_conf.xml +++ b/test/functional/tools/sample_tool_conf.xml @@ -279,6 +279,7 @@ + diff --git a/test/integration/test_container_resolvers.py b/test/integration/test_container_resolvers.py index 1d1fda4739ea..1b4864dacd96 100644 --- a/test/integration/test_container_resolvers.py +++ b/test/integration/test_container_resolvers.py @@ -539,6 +539,58 @@ class TestDefaultContainerResolvers(DockerContainerResolverTestCase, ContainerRe } +class TestDefaultContainerResolversWithBuildInfo(DockerContainerResolverTestCase, ContainerResolverTestCases, MulledTestCaseWithBuildInfo): + """ + Same as TestDefaultContainerResolvers but with a tool using build info + serves to check if the mulled hashes are cumputed correctly + """ + + assumptions: Dict[str, Any] = { + "run": { + "output": [ + "bedtools v2.26.0", + "samtools: error while loading shared libraries: libcrypto.so.1.0.0", + ], + "cached": True, + "resolver_type": "mulled", # only used to check mulled / explicit + "cache_name": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", + "cache_namespace": "biocontainers", + }, + "list": [ + { + "resolver_type": "mulled", + "identifier": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", + "cached": False, + "cache_name": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", + "cache_namespace": "biocontainers", + }, + { + "resolver_type": "mulled", + "identifier": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", + "cached": False, + "cache_name": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", + "cache_namespace": "biocontainers", + }, + ], + "build": [ + { + "resolver_type": "mulled", + "identifier": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", + "cached": True, + "cache_name": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", + "cache_namespace": "biocontainers", + }, + { + "resolver_type": "cached_mulled", + "identifier": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", + "cached": True, + "cache_name": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", + "cache_namespace": "biocontainers", + }, + ], + } + + class TestDefaultSingularityContainerResolvers( SingularityContainerResolverTestCase, ContainerResolverTestCases, MulledTestCase ): From 8ad9bff2956eb1aec74566250f5d4bd892d6939e Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 24 Sep 2024 09:15:15 +0200 Subject: [PATCH 15/17] Fix linting --- test/integration/test_container_resolvers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/integration/test_container_resolvers.py b/test/integration/test_container_resolvers.py index 1b4864dacd96..8fa94a6c2a53 100644 --- a/test/integration/test_container_resolvers.py +++ b/test/integration/test_container_resolvers.py @@ -539,7 +539,9 @@ class TestDefaultContainerResolvers(DockerContainerResolverTestCase, ContainerRe } -class TestDefaultContainerResolversWithBuildInfo(DockerContainerResolverTestCase, ContainerResolverTestCases, MulledTestCaseWithBuildInfo): +class TestDefaultContainerResolversWithBuildInfo( + DockerContainerResolverTestCase, ContainerResolverTestCases, MulledTestCaseWithBuildInfo +): """ Same as TestDefaultContainerResolvers but with a tool using build info serves to check if the mulled hashes are cumputed correctly From 16e7cdf5446949847dffad705ecce0d284607a65 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Tue, 22 Oct 2024 09:50:13 +0200 Subject: [PATCH 16/17] remove integration test --- .../tools/mulled_example_multi_2.xml | 79 ------------------- test/functional/tools/sample_tool_conf.xml | 1 - test/integration/test_container_resolvers.py | 54 ------------- 3 files changed, 134 deletions(-) delete mode 100644 test/functional/tools/mulled_example_multi_2.xml diff --git a/test/functional/tools/mulled_example_multi_2.xml b/test/functional/tools/mulled_example_multi_2.xml deleted file mode 100644 index 5347dace94b7..000000000000 --- a/test/functional/tools/mulled_example_multi_2.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - bedtools - samtools - - - - - - - samtools - bedtools - - '$out_file1' && -echo "Moo" >> '$out_file1' && -samtools >> '$out_file1' 2>&1 && -echo "Cow" >> '$out_file1' && - -touch "\${TMP:-/tmp}/job_tmp" && -touch "\${TEMP:-/tmp}/job_temp" && -touch "\${TMPDIR:-/tmp}/job_tmpdir" - ]]> - - - - - - - - - - - 10.1093/bioinformatics/btq033 - - @misc{SAM_def, - title={Definition of SAM/BAM format}, - url = {https://samtools.github.io/hts-specs/},} - - 10.1093/bioinformatics/btp352 - 10.1093/bioinformatics/btr076 - 10.1093/bioinformatics/btr509 - - @misc{Danecek_et_al, - Author={Danecek, P., Schiffels, S., Durbin, R.}, - title={Multiallelic calling model in bcftools (-m)}, - url = {http://samtools.github.io/bcftools/call-m.pdf},} - - - @misc{Durbin_VCQC, - Author={Durbin, R.}, - title={Segregation based metric for variant call QC}, - url = {http://samtools.github.io/bcftools/rd-SegBias.pdf},} - - - @misc{Li_SamMath, - Author={Li, H.}, - title={Mathematical Notes on SAMtools Algorithms}, - url = {http://www.broadinstitute.org/gatk/media/docs/Samtools.pdf},} - - - @misc{SamTools_github, - title={SAMTools GitHub page}, - url = {https://github.com/samtools/samtools},} - - - diff --git a/test/functional/tools/sample_tool_conf.xml b/test/functional/tools/sample_tool_conf.xml index 85e4e03dcc81..bb9d7568f600 100644 --- a/test/functional/tools/sample_tool_conf.xml +++ b/test/functional/tools/sample_tool_conf.xml @@ -279,7 +279,6 @@ - diff --git a/test/integration/test_container_resolvers.py b/test/integration/test_container_resolvers.py index 8fa94a6c2a53..1d1fda4739ea 100644 --- a/test/integration/test_container_resolvers.py +++ b/test/integration/test_container_resolvers.py @@ -539,60 +539,6 @@ class TestDefaultContainerResolvers(DockerContainerResolverTestCase, ContainerRe } -class TestDefaultContainerResolversWithBuildInfo( - DockerContainerResolverTestCase, ContainerResolverTestCases, MulledTestCaseWithBuildInfo -): - """ - Same as TestDefaultContainerResolvers but with a tool using build info - serves to check if the mulled hashes are cumputed correctly - """ - - assumptions: Dict[str, Any] = { - "run": { - "output": [ - "bedtools v2.26.0", - "samtools: error while loading shared libraries: libcrypto.so.1.0.0", - ], - "cached": True, - "resolver_type": "mulled", # only used to check mulled / explicit - "cache_name": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", - "cache_namespace": "biocontainers", - }, - "list": [ - { - "resolver_type": "mulled", - "identifier": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", - "cached": False, - "cache_name": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", - "cache_namespace": "biocontainers", - }, - { - "resolver_type": "mulled", - "identifier": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", - "cached": False, - "cache_name": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", - "cache_namespace": "biocontainers", - }, - ], - "build": [ - { - "resolver_type": "mulled", - "identifier": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", - "cached": True, - "cache_name": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", - "cache_namespace": "biocontainers", - }, - { - "resolver_type": "cached_mulled", - "identifier": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", - "cached": True, - "cache_name": f"quay.io/biocontainers/{MulledTestCaseWithBuildInfo.mulled_hash}", - "cache_namespace": "biocontainers", - }, - ], - } - - class TestDefaultSingularityContainerResolvers( SingularityContainerResolverTestCase, ContainerResolverTestCases, MulledTestCase ): From da7926ad505af9f194d01f4e45cb60adc6c4661d Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Mon, 11 Nov 2024 15:50:36 +0100 Subject: [PATCH 17/17] fix bug for empty requirements an empty set of requirements gives an empty requirement string which was wrongly parsed to an CondaTarget with empty package name This triggered a `conda search ''` which took so much memory that other processes crashed. The fix is to parse an empty list of CondaTargets for an empty target string. In addition we check for empty package name during the creation of the CondaTarget (to make this more easily detectable in the future) --- lib/galaxy/tool_util/deps/conda_util.py | 2 +- lib/galaxy/tool_util/deps/mulled/mulled_build.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/galaxy/tool_util/deps/conda_util.py b/lib/galaxy/tool_util/deps/conda_util.py index 8bead7148a5d..ccc8cf2da06d 100644 --- a/lib/galaxy/tool_util/deps/conda_util.py +++ b/lib/galaxy/tool_util/deps/conda_util.py @@ -425,7 +425,7 @@ class CondaTarget: def __init__( self, package: str, version: Optional[str] = None, build: Optional[str] = None, channel: Optional[str] = None ) -> None: - if SHELL_UNSAFE_PATTERN.search(package) is not None: + if SHELL_UNSAFE_PATTERN.search(package) is not None or not package: raise ValueError(f"Invalid package [{package}] encountered.") self.capitalized_package = package self.package = package.lower() diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_build.py b/lib/galaxy/tool_util/deps/mulled/mulled_build.py index be956c84a8b9..422ac0a0b605 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_build.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_build.py @@ -527,8 +527,8 @@ def add_single_image_arguments(parser): ) -def target_str_to_targets(targets_raw): - def parse_target(target_str): +def target_str_to_targets(targets_raw: str) -> List[CondaTarget]: + def parse_target(target_str: str) -> CondaTarget: if "=" in target_str: package_name, version = target_str.split("=", 1) build = None @@ -541,8 +541,10 @@ def parse_target(target_str): target = build_target(target_str) return target - targets = [parse_target(_) for _ in targets_raw.split(",")] - return targets + if targets_raw.strip() == "": + return [] + else: + return [parse_target(_) for _ in targets_raw.split(",")] def args_to_mull_targets_kwds(args):