conda-forge / openjdk-feedstock

A conda-smithy repository for openjdk.
BSD 3-Clause "New" or "Revised" License
4 stars 35 forks source link

Fixes #87. Ensure deactivate.sh works if activate.sh is not run #139

Closed hugobuddel closed 1 year ago

hugobuddel commented 1 year ago

It can happen that the deactivate script is run when the activate script has not been run. The deactivate script should therefore be robust in verifying all relevant variables are set.

Checklist

Closes #87

conda-forge-webservices[bot] commented 1 year ago

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

hugobuddel commented 1 year ago

I'm building the package now, and will try to replicate the two problems described in #139 once the package is built.

Only the bash scripts have been changed. Perhaps the two sets of windows scripts should be updated as well? I have no convenient way of testing those though.

hugobuddel commented 1 year ago

This indeed seems to work. E.g., combining the two tests in #87 :

openjdktest3.sh :

set -Eeuo pipefail

JAVA_HOME=/hello/there
echo "At the start JAVA_HOME is $JAVA_HOME"

source "$CONDA_PREFIX/etc/profile.d/conda.sh"
conda create -y -n openjdktest
conda activate openjdktest
conda install -c local -y openjdk
conda deactivate

echo "Halfway through JAVA_HOME is $JAVA_HOME"

conda activate openjdktest
conda deactivate

echo "At the end JAVA_HOME is $JAVA_HOME"

Then running it, bash openjdktest3.sh:

At the start JAVA_HOME is /hello/there                                
Collecting package metadata (current_repodata.json): done                                                                                   
[...]
Executing transaction: done
Halfway through JAVA_HOME is /hello/there
At the end JAVA_HOME is /hello/there

Two conclusions:

So what remains is porting this to the two sets of windows scripts. That is something I will not do myself, so I consider this good enough for now.

hugobuddel commented 1 year ago

Oops, forgot to commit the activate script. Test still valid (or actually, now valid), because it was ran locally.

Increased the build number from 0 to 1.

hugobuddel commented 1 year ago

@conda-forge-admin, please rerender