From 32c6bb939e80d648969d3d5afc21af4e187da8d2 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Fri, 4 Oct 2024 11:44:30 -0400 Subject: [PATCH 1/2] Add conda hash to mulled-hash utility --- 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..a019f774386b 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_hash.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_hash.py @@ -1,6 +1,9 @@ #!/usr/bin/env python """Produce a mulled hash for specified conda targets. +Galaxy does not use the "v1" hash format for uncontainerized conda dependencies. For the mulled hash for conda +dependencies, use `--hash conda` + Examples Produce a mulled hash with: @@ -9,6 +12,7 @@ """ from ._cli import arg_parser +from ..conda_util import hash_conda_packages from .mulled_build import target_str_to_targets from .util import ( v1_image_name, @@ -16,16 +20,23 @@ ) +IMAGE_FUNCS = { + "conda": lambda x: f"mulled-v1-{hash_conda_packages(x)}", + "v1": v1_image_name, + "v2": v2_image_name, +} + + def main(argv=None): """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") + parser.add_argument("--hash", dest="hash", choices=["conda", "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 + image_name = IMAGE_FUNCS[args.hash] print(image_name(targets)) From 0d8a01124510132f0e3139f758c5fe9011903aea Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Fri, 4 Oct 2024 12:36:47 -0400 Subject: [PATCH 2/2] Update lib/galaxy/tool_util/deps/mulled/mulled_hash.py Co-authored-by: Nicola Soranzo --- lib/galaxy/tool_util/deps/mulled/mulled_hash.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tool_util/deps/mulled/mulled_hash.py b/lib/galaxy/tool_util/deps/mulled/mulled_hash.py index a019f774386b..e0efe62e3879 100644 --- a/lib/galaxy/tool_util/deps/mulled/mulled_hash.py +++ b/lib/galaxy/tool_util/deps/mulled/mulled_hash.py @@ -33,7 +33,7 @@ def main(argv=None): parser.add_argument( "targets", metavar="TARGETS", default=None, help="Comma-separated packages for calculating the mulled hash." ) - parser.add_argument("--hash", dest="hash", choices=["conda", "v1", "v2"], default="v2") + parser.add_argument("--hash", dest="hash", choices=IMAGE_FUNCS.keys(), default="v2") args = parser.parse_args() targets = target_str_to_targets(args.targets) image_name = IMAGE_FUNCS[args.hash]