Skip to content

Commit

Permalink
fix: Pass pkg_format to container-based build (#994)
Browse files Browse the repository at this point in the history
This way we should be able to switch to `pkg_format: 2` (i.e., build
`.conda` packages) via config from `bioconda-common`.

Signed-off-by: Marcel Bargull <[email protected]>
  • Loading branch information
mbargull authored Jun 2, 2024
1 parent 4755eca commit e3f23ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
21 changes: 8 additions & 13 deletions bioconda_utils/docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@
grep -vF "Warning: 'file://{self.container_staging}' already in 'channels' list, moving to the top" >&2
)
# Pass on conda_pkg_format ("2" for .conda instead of .tar.bz2) from host's conda-build config.
test -n '{self.conda_pkg_format}' && conda config --set conda_build.pkg_format '{self.conda_pkg_format}'
# The actual building...
# we explicitly point to the meta.yaml, in order to keep
# conda-build from building all subdirectories
Expand Down Expand Up @@ -155,18 +158,6 @@ class DockerBuildError(Exception):



def get_host_conda_bld():
"""
Identifies the conda-bld directory on the host.
Assumes that conda-build is installed.
"""
# v0.16.2: this used to have a side effect, calling conda build purge
# hopefully, it's not actually needed.
build_conf = utils.load_conda_build_config()
return build_conf.build_folder


class RecipeBuilder(object):
def __init__(
self,
Expand Down Expand Up @@ -286,7 +277,11 @@ def __init__(
self.container_recipe = container_recipe
self.container_staging = container_staging

self.host_conda_bld = get_host_conda_bld()
conda_build_config = utils.load_conda_build_config()
# Identify conda-bld directory on the host.
self.host_conda_bld = conda_build_config.croot
# Pass on config to choose wheter to build .tar.bz2 or .conda format.
self.conda_pkg_format = conda_build_config.conda_pkg_format or ""

if use_host_conda_bld:
self.pkg_dir = self.host_conda_bld
Expand Down
9 changes: 0 additions & 9 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1291,18 +1291,9 @@ def test_pkg_test_conda_package_format(
r.write_recipes()
docker_builder = None
if mulled_test:
# Override conda_build.pkg_format in build_script_template.
build_script_template = re.sub(
"^(conda config.*)",
f"conda config --set conda_build.pkg_format {pkg_format}\n\\1",
docker_utils.BUILD_SCRIPT_TEMPLATE,
count=1,
flags=re.M,
)
docker_builder = docker_utils.RecipeBuilder(
use_host_conda_bld=True,
docker_base_image=DOCKER_BASE_IMAGE,
build_script_template=build_script_template,
)
build_result = build.build_recipes(
r.basedir,
Expand Down

0 comments on commit e3f23ed

Please sign in to comment.