Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Pass pkg_format to container-based build #994

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.build_folder is actually the .../conda-bld/pkg_.... path if the Config would be initialized for some package pkg -- it just happens to be .../conda-bld/ since the pkg_... part is empty for a Config not created for a certain package/recipe.
The new code has the correct config.croot (which is always only the .../conda-bld part.



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