Don't set build_id in test phase if --no-build-id is given#2100
Don't set build_id in test phase if --no-build-id is given#2100msarahan merged 1 commit intoconda:2.1.xfrom
Conversation
Build work directory is deleted in test phase and it tries to delete the work dir with id. As a consequence, the test phase keeps the real work dir and then the next package build breaks because it tries to apply a patch it was already applied.
|
Good fix. Is this worth adding a regression test for? |
|
Sure. You'll have to guide me on it though |
|
I created an issue before seeing this PR: #2101 |
|
I'd just start with @gqmelo's nice example: translated into a test, I'd move the echo stuff into files, and then instead of the conda build cli commands, I'd instead call api.build: |
|
PS: test_api_build.py might be the right place for this test, but I'm not picky. |
| warn_on_use_of_SRC_DIR(metadata) | ||
|
|
||
| config.compute_build_id(metadata.name()) | ||
| if config.set_build_id: |
There was a problem hiding this comment.
So this will make the test phase run without the build id, right?
Then before tests the work dir will be removed. But what happens if the package has no tests or they are not run? Wouldn't the next conda build command reuse the dirty work dir?
There was a problem hiding this comment.
I think that without --dirty, the work dir would be cleaned up, but to be honest, I really never use --no-build-id. --no-build-id definitely breaks multiple builds happening at once, but it should still be clean for one build at a time.
There was a problem hiding this comment.
Also I'd like to add that in the example showed on #2101 if I replace the source url with a local path the work dir is overwritten and the example works
There was a problem hiding this comment.
Actually my example has no tests at all, so it seems the work dir is really not cleaned up when starting a new build with --no-build-id.
There was a problem hiding this comment.
So I checked and the work dir with --no-build-id was not being deleted because the cleanup code was taking the work dir modified by the test phase even when there is no test. So this PR also fixes this case.
|
PPS: CLI arguments are not always exactly the same as the underlying configuration setting. In particular, I try to keep positive logic in the configuration. Look at https://github.com/conda/conda-build/blob/master/conda_build/config.py#L57 if you want to see what to pass the API call. |
This test make sure the work dir is removed regardless of the --no-build-id option
This test make sure the work dir is removed regardless of the --no-build-id option
|
Hi there, thank you for your contribution! This pull request has been automatically locked because it has not had recent activity after being closed. Please open a new issue or pull request if needed. Thanks! |
Build work directory is deleted in test phase and it tries to
delete the work dir with id. As a consequence, the test phase
keeps the real work dir and then the next package build breaks
because it tries to apply a patch it was already applied.
cc @gqmelo
xref: conda-forge/conda-smithy#526 (comment)