Skip to content

Commit d4f0af2

Browse files
authored
Merge branch 'master' into old-git
2 parents c3a6aa0 + f07033b commit d4f0af2

File tree

8 files changed

+45
-16
lines changed

8 files changed

+45
-16
lines changed

configs/lumi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ defaults:
1212
composable: true
1313
# if this is not a thing which exist
1414
# I will do a singularity pull
15-
container_src: 'docker://opensuse/leap:15.3'
15+
container_src: 'docker://opensuse/leap:15.4'
1616
# name of the container image when on disk
1717
container_image: container.sif
1818
sqfs_image: img.sqfs

create_inst.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ echo "export install_root=$CW_INSTALLATION_PATH" >> _extra_envs.sh
5050
echo "export install_root=$CW_INSTALLATION_PATH" >> _vars.sh
5151
export install_root=$CW_INSTALLATION_PATH
5252

53+
54+
55+
5356
if [[ "$CW_UPDATE_INSTALLATION" == "yes" ]];then
5457
_CONTAINER_EXEC="singularity --silent exec -B _deploy/$CW_SQFS_IMAGE:$CW_SOURCE_MOUNT_POINT:image-src=/ _deploy/$CW_CONTAINER_IMAGE"
5558
export SINGULARITY_BIND="$SINGULARITY_BIND,$PWD/_inst_dir:$CW_INSTALLATION_PATH,$_inst_path/_bin:$_inst_path/bin"
@@ -79,10 +82,28 @@ fi
7982
# There should be a separate folder so that removal is easier
8083
(cd _inst_dir && rm -f _vars.sh common_functions.sh _sing_inst_script.sh _pre_install.sh _post_install.sh $CW_TEMPLATE_SCRIPT _extra_user_envs.sh _extra_envs.sh )
8184

85+
8286
if [[ ! ${CW_NO_FIX_PERM+defined} ]];then
8387
print_info "Fixing permissions within squashfs image" 2
8488
chmod -R ugo+rwX _inst_dir
8589
fi
90+
91+
# Save old configurations in separate folder so they are not overridden
92+
counter=0
93+
while true;do
94+
if [[ -e _inst_dir/previous_input/$counter ]]; then
95+
counter=$((counter+1))
96+
else
97+
mkdir -p _inst_dir/previous_input/$counter
98+
break
99+
fi
100+
done
101+
for fp in "${CW_INSTALLATION_FILE_PATHS[@]}";do
102+
n=$(basename $fp)
103+
mv _inst_dir/$n _inst_dir/previous_input/$counter
104+
done
105+
#######
106+
86107
mksquashfs _inst_dir/ _deploy/$CW_SQFS_IMAGE -processors $_cpus $CW_SQFS_OPTIONS
87108

88109
# Check if we need to fix group permissions

post.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@ if [[ ${CW_UPDATE_INSTALLATION+defined } && "$CW_UPDATE_INSTALLATION" == "yes" ]
1717
fi
1818
cp -rd $CW_BUILD_TMPDIR/_deploy/* $CW_INSTALLATION_PREFIX/
1919
mkdir -p $CW_INSTALLATION_PREFIX/share
20-
if [[ ${CW_INSTALLATION_FILE_PATHS+defined} ]]; then
21-
for _fil in ${CW_INSTALLATION_FILE_PATHS[@]}; do
22-
mv $CW_BUILD_TMPDIR/_inst_dir/$( basename $_fil ) $CW_INSTALLATION_PREFIX/share
23-
done
20+
if [[ ${CW_INSTALLATION_FILE_PATHS+defined} ]];then
21+
cp -r $CW_BUILD_TMPDIR/_inst_dir/previous_input* $CW_INSTALLATION_PREFIX/share
2422
fi
25-
echo "tag: $(cd $SCRIPT_DIR; git describe --tags)" > $CW_INSTALLATION_PREFIX/share/VERSION.yml
26-
echo "commit: $(cd $SCRIPT_DIR; git rev-parse --short HEAD )" >> $CW_INSTALLATION_PREFIX/share/VERSION.yml
23+
echo "tag: $(cd $SCRIPT_DIR; git describe --tags 2>/dev/null)" > $CW_INSTALLATION_PREFIX/share/VERSION.yml
24+
echo "commit: $(cd $SCRIPT_DIR; git rev-parse --short HEAD 2>/dev/null )" >> $CW_INSTALLATION_PREFIX/share/VERSION.yml
2725
echo "build-time: $(date)" >> $CW_INSTALLATION_PREFIX/share/VERSION.yml
2826

2927
cp $CW_BUILD_TMPDIR/conf.yaml $CW_INSTALLATION_PREFIX/share

templates/conda_modify.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
#!/bin/bash
2-
cd $CW_INSTALLATION_PATH
2+
cd $CW_BUILD_TMPDIR
33
echo "export env_root=$CW_INSTALLATION_PATH/miniconda/envs/$CW_ENV_NAME/" >> _extra_envs.sh
44
echo "export env_root=$CW_INSTALLATION_PATH/miniconda/envs/$CW_ENV_NAME/" >> _vars.sh
5+
cd $CW_INSTALLATION_PATH
56
export env_root=$CW_INSTALLATION_PATH/miniconda/envs/$CW_ENV_NAME/
67
eval "$($CW_INSTALLATION_PATH/miniconda/bin/conda shell.bash hook)"
78
cd $CW_WORKDIR
89
source $CW_INSTALLATION_PATH/_pre_install.sh
910
conda activate $CW_ENV_NAME
1011
if [[ ${CW_REQUIREMENTS_FILE+defined} ]];then
11-
pip install -r $( basename "$CW_REQUIREMENTS_FILE" )
12+
print_info "Installing requirements file" 1
13+
pip install -r $( basename "$CW_REQUIREMENTS_FILE" ) > $CW_BUILD_TMPDIR/_pip.log &
14+
bg_pid=$!
15+
wait $bg_pid
16+
follow_log $bg_pid $CW_BUILD_TMPDIR/_pip.log 10
1217
fi
1318
cd $CW_WORKDIR
1419
source $CW_INSTALLATION_PATH/_post_install.sh

templates/venv.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ python3 -m venv $_SP $CW_ENV_NAME
2626
source $CW_INSTALLATION_PATH/$CW_ENV_NAME/bin/activate
2727

2828
if [[ ${CW_REQUIREMENTS_FILE+defined} ]];then
29-
pip install --disable-pip-version-check -r "$( basename $CW_REQUIREMENTS_FILE)"
29+
pip install --disable-pip-version-check -r "$( basename $CW_REQUIREMENTS_FILE)" > $CW_BUILD_TMPDIR/_pip.log &
30+
bg_pid=$!
31+
wait $bg_pid
32+
follow_log $bg_pid $CW_BUILD_TMPDIR/_pip.log 10
3033
fi
3134
cd $CW_WORKDIR
3235
print_info "Running user supplied commands" 1

templates/venv_modify.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ source $CW_INSTALLATION_PATH/$CW_ENV_NAME/bin/activate
1717
if [[ ${CW_REQUIREMENTS_FILE+defined} ]];then
1818
print_info "Installing requirements file" 1
1919
pip install --disable-pip-version-check -r "$( basename $CW_REQUIREMENTS_FILE)" > $CW_BUILD_TMPDIR/_pip.log &
20-
follow_log $! $CW_BUILD_TMPDIR/_pip.log 10
20+
bg_pid=$!
21+
wait $bg_pid
22+
follow_log $bg_pid $CW_BUILD_TMPDIR/_pip.log 10
2123
fi
2224
cd $CW_WORKDIR
2325
#print_info "Running user supplied commands" 1

tests/more_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ t_run "pip-containerize new --prefix subdir/PIP_INSTALL_DIR_3 subdir/req.txt" "P
6767

6868
rm -fr PIP_INSTALL_DIR
6969
mkdir PIP_INSTALL_DIR
70-
t_run "wrap-container -w /usr/sbin/sln --prefix PIP_INSTALL_DIR test_container.sif" "wrap-container works with single target"
70+
t_run "wrap-container -w /usr/sbin/zdump --prefix PIP_INSTALL_DIR test_container.sif" "wrap-container works with single target"
7171

7272
rm -fr PIP_INSTALL_DIR
7373
mkdir PIP_INSTALL_DIR

tests/tests.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,20 @@ t_run "test -z $rc_res" "User .condarc is ignored"
8585
export CW_ENABLE_CONDARC=1
8686
t_run "conda-containerize new --pre-install=pre.sh conda_base.yml --prefix CONDA_INSTALL_DIR | grep -q $HOME/.conda/pkgs" "User .condarc can be enabled"
8787
unset CW_ENABLE_CONDARC
88-
t_run "conda-containerize new conda_base.yml -r req.txt --prefix CONDA_INSTALL_DIR &>/dev/null" "Basic installation works"
88+
t_run "conda-containerize new --mamba conda_base.yml -r req.txt --prefix CONDA_INSTALL_DIR &>/dev/null" "Basic installation works"
8989
t_run "CONDA_INSTALL_DIR/bin/python -m venv VE " "Virtual environment creation works"
9090
t_run "VE/bin/python -c 'import sys;sys.exit( sys.prefix == sys.base_prefix )'" "Virtual environment is correct"
9191
t_run "VE/bin/pip install requests" "pip works for a venv"
9292
t_run "VE/bin/python -c 'import requests;print(requests.__file__)' | grep -q VE " "Package is installed correctly to venv"
93-
CONDA_INSTALL_DIR/bin/_debug_exec bash -c "\$(dirname \$(readlink -f \$(which python)))/../../../bin/conda list --explicit" > explicit_env.txt
93+
CONDA_INSTALL_DIR/bin/_debug_exec bash -c "\$(readlink -f \$env_root)/../../bin/conda list --explicit" > explicit_env.txt
9494
t_run "CONDA_INSTALL_DIR/bin/python -c 'import yaml'" "Package added by -r is there"
9595
t_run "conda-containerize update CONDA_INSTALL_DIR --post-install post.sh" "Update works"
9696
t_run "CONDA_INSTALL_DIR/bin/python -c 'import requests'" "Package added by update is there"
9797
rm -fr CONDA_INSTALL_DIR && mkdir CONDA_INSTALL_DIR
98-
t_run "conda-containerize new explicit_env.txt --prefix CONDA_INSTALL_DIR &>/dev/null" "Explicit env file works"
98+
t_run "conda-containerize new --mamba explicit_env.txt --prefix CONDA_INSTALL_DIR &>/dev/null" "Explicit env file works"
9999

100100
rm -fr CONDA_INSTALL_DIR && mkdir CONDA_INSTALL_DIR
101-
t_run "conda-containerize new dask_env.yaml --prefix CONDA_INSTALL_DIR &>/dev/null" "yaml ending is also supported"
101+
t_run "conda-containerize new --mamba dask_env.yaml --prefix CONDA_INSTALL_DIR &>/dev/null" "yaml ending is also supported"
102102
OLD_PATH=$PATH
103103
PATH="CONDA_INSTALL_DIR/bin:$PATH"
104104
t_run " \[ $(which python)==$(_debug_exec which python) \] " "Which returns same in and out"

0 commit comments

Comments
 (0)