From 6240d31e706b91b4b217ab10305fb84aabd8a147 Mon Sep 17 00:00:00 2001 From: Julianus Pfeuffer Date: Tue, 19 Nov 2024 18:14:24 +0100 Subject: [PATCH] fix: success check does not consider pkg_dir #836 (#838) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit completely untested but it is an obvious bug. If you want to change the package dirs earlier in the code somewhere, please suggest changes --------- Co-authored-by: Ryan Dale Co-authored-by: Johannes Köster Co-authored-by: Johannes Köster Co-authored-by: Björn Grüning --- bioconda_utils/build.py | 12 ++++++++++-- test/test_utils.py | 24 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/bioconda_utils/build.py b/bioconda_utils/build.py index 9ba35d7495..bbdd0c426a 100644 --- a/bioconda_utils/build.py +++ b/bioconda_utils/build.py @@ -4,9 +4,11 @@ import subprocess as sp from collections import defaultdict, namedtuple -import os -import logging import itertools +import logging +import os +import sys +import time from typing import List, Optional from bioconda_utils.skiplist import Skiplist @@ -140,6 +142,12 @@ def build(recipe: str, pkg_paths: List[str] = None, noarch=is_noarch, live_logs=live_logs) # Use presence of expected packages to check for success + if docker_builder.pkg_dir is not None: + platform = utils.RepoData.native_platform() + subfolder = utils.RepoData.platform2subdir(platform) + conda_build_config = utils.load_conda_build_config(platform=subfolder) + pkg_paths = [p.replace(conda_build_config.output_folder, docker_builder.pkg_dir) for p in pkg_paths] + for pkg_path in pkg_paths: if not os.path.exists(pkg_path): logger.error( diff --git a/test/test_utils.py b/test/test_utils.py index 5c90751e8f..87d1caf184 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -252,6 +252,30 @@ def test_single_build_only(single_build): ensure_missing(pkg) +@pytest.mark.skipif(SKIP_DOCKER_TESTS, reason='skipping on osx') +@pytest.mark.long_running_2 +def test_single_build_pkg_dir(recipes_fixture): + """ + Builds the "one" recipe with pkg_dir. + """ + logger.error("Making recipe builder") + docker_builder = docker_utils.RecipeBuilder( + use_host_conda_bld=True, + pkg_dir=os.getcwd() + "/output", + docker_base_image=DOCKER_BASE_IMAGE) + mulled_test = False + logger.error("DONE") + logger.error("Fixture: Building 'one' within docker with pkg_dir") + res = build.build( + recipe=recipes_fixture.recipe_dirs['one'], + pkg_paths=recipes_fixture.pkgs['one'], + docker_builder=docker_builder, + mulled_test=mulled_test, + ) + logger.error("Fixture: Building 'one' within docker and pkg_dir -- DONE") + assert res.success + + @pytest.mark.skipif(SKIP_DOCKER_TESTS, reason='skipping on osx') def test_single_build_with_post_test(single_build): for pkg in single_build: