-
Notifications
You must be signed in to change notification settings - Fork 134
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: success check does not consider pkg_dir #836 #838
Conversation
@bgruening @daler Ready to review. Somehow I cannot request it from the normal UI. |
@jpfeuffer just to clarify, is OpenMS is using bioconda-utils for internal builds? |
Hey @daler |
Ah, ok. Can you point to where (and how) you are calling it then? I bet if it's not exactly how we call it in bioconda-recipes then that might introduce behavior that we don't otherwise test for. |
Sure! Yes, you might not be using the # output must be a valid conda "channel" (otherwise I think I encountered problems)
mkdir -p output/noarch
touch output/noarch/repodata.json
conda activate bioconda
mamba update -y bioconda-utils
conda index output
git clone https://github.com/bioconda/bioconda-recipes && cd bioconda-recipes # we usually use our own fork with ntly changes
bioconda-utils build --docker --pkg_dir $WORKSPACE/output --packages openms-meta # feel free to choose any pkg
bioconda-utils build --docker --pkg_dir $WORKSPACE/output --packages pyopenms Note: you cannot run them together because of #751 |
So the default behavior is for Does it work if you remove the |
Yes, I think it works without |
I think it would be ok to merge as-is since we don't use Can you write a test for this in the |
@daler Ready. I am 90% sure it will fail on master. |
@daler Do you need anything else? |
Hi, has there been any progress with this PR? |
bioconda_utils/build.py
Outdated
platform = os.environ.get('OSTYPE', sys.platform) | ||
if platform.startswith("darwin"): | ||
platform = 'osx' | ||
elif platform == "linux-gnu": | ||
platform = "linux" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The platform can be inferred from RepoData().native_platform()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, make sure that you indent only with 4 spaces.
|
Sorry, I don't know what that means. I merely added the review suggestion. I guess this error is also why the suggested code was not used in the place where I copied it from 🤷. |
any update here? |
@johanneskoester @daler any updates on this? |
@johanneskoester @daler any updates? |
any news? |
WalkthroughThe changes introduced in the pull request primarily affect two files: In Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (5)
bioconda_utils/build.py (2)
8-11
: Remove unused importsThe imports
sys
andtime
are not used in the code.Apply this diff to remove the unused imports:
import logging import os -import sys -import time🧰 Tools
🪛 Ruff
10-10:
sys
imported but unusedRemove unused import:
sys
(F401)
11-11:
time
imported but unusedRemove unused import:
time
(F401)
145-150
: LGTM! The fix correctly handles pkg_dir in Docker buildsThe implementation properly adjusts package paths when using a Docker builder with a custom package directory, fixing the success check issue.
Consider these improvements:
- Add type hints for pkg_paths parameter
- Add error handling for platform conversion
-def build(recipe: str, pkg_paths: List[str] = None, +def build( + recipe: str, + pkg_paths: Optional[List[str]] = None, ... ): ... if docker_builder.pkg_dir is not None: try: 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] + except Exception as e: + logger.error("Failed to adjust package paths: %s", str(e)) + return BuildResult(False, None)test/test_utils.py (3)
255-277
: LGTM! The test effectively validates pkg_dir handling.The test is well-structured and directly addresses the PR objective of fixing pkg_dir handling in the build process. It properly sets up a docker builder with a specific pkg_dir and verifies the build result.
Consider adding cleanup of the output directory after the test:
def test_single_build_pkg_dir(recipes_fixture): """ Builds the "one" recipe with pkg_dir. """ + output_dir = os.getcwd() + "/output" logger.error("Making recipe builder") docker_builder = docker_utils.RecipeBuilder( use_host_conda_bld=True, - pkg_dir=os.getcwd() + "/output", + pkg_dir=output_dir, 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 + # Cleanup + if os.path.exists(output_dir): + shutil.rmtree(output_dir)
261-262
: Improve error logging message.The log message could be more descriptive about what's being created.
- logger.error("Making recipe builder") + logger.error("Creating docker recipe builder with pkg_dir")
268-269
: Enhance build logging message.The log message could include the pkg_dir path for better debugging.
- logger.error("Fixture: Building 'one' within docker with pkg_dir") + logger.error("Fixture: Building 'one' within docker with pkg_dir: %s", docker_builder.pkg_dir)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
bioconda_utils/build.py
(2 hunks)test/test_utils.py
(1 hunks)
🧰 Additional context used
🪛 Ruff
bioconda_utils/build.py
10-10: sys
imported but unused
Remove unused import: sys
(F401)
11-11: time
imported but unused
Remove unused import: time
(F401)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks everyone!
🤖 I have created a release \*beep\* \*boop\* --- ## [3.5.0](https://www.github.com/bioconda/bioconda-utils/compare/v3.4.1...v3.5.0) (2024-11-29) ### Features * add rust to should_use_compilers lint ([#1018](https://www.github.com/bioconda/bioconda-utils/issues/1018)) ([0dacce9](https://www.github.com/bioconda/bioconda-utils/commit/0dacce91865e649061b7d18008c34789287c65fa)) ### Bug Fixes * success check does not consider pkg_dir [#836](https://www.github.com/bioconda/bioconda-utils/issues/836) ([#838](https://www.github.com/bioconda/bioconda-utils/issues/838)) ([6240d31](https://www.github.com/bioconda/bioconda-utils/commit/6240d31e706b91b4b217ab10305fb84aabd8a147)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
completely untested but it is an obvious bug.
If you want to change the package dirs earlier in the code somewhere, please suggest changes