From: vsr Date: Tue, 16 Nov 2004 09:30:33 +0000 (+0000) Subject: Fix PAL7001: X-Git-Tag: before_merge_from_SALOME2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=354c1d8604aa1e8be910d33d5501b9361b0ee1b9;p=tools%2Finstall.git Fix PAL7001: - modify salome.(c)sh and env_products.(c)sh: add commands to clean duplication from the environment variables (PATH, LD_LIBRARY_PATH, PYTHONPATH, LD_RUN_PATH) and use these commands to process environment where it is needed; - exclude non-existing directories from environment variables. --- diff --git a/config_files/COMPONENT_BIN_2.1.0.sh b/config_files/COMPONENT_BIN_2.1.0.sh index 77b6780..63375d6 100755 --- a/config_files/COMPONENT_BIN_2.1.0.sh +++ b/config_files/COMPONENT_BIN_2.1.0.sh @@ -19,10 +19,7 @@ cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh < ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh < ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh < ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh < ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh < ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh < ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh < ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh < ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh < ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh < ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh < ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh < add global functions cat >> ${install_work}/$SHRC <=1;i--){v=\$i;t=1;for(j=0;j<=n;j++){if(keys[j]==v){t=0;break;}};if(t)keys[n++]=v} ; for(j=n-1;j>=0;j--){printf "%s",keys[j];if(j>0) printf ":"} ; printf "\n"}'\` + export \$1=\$out_var +} EOF -product_sequence="$2" -#for i in `ls -a ${install_work} | grep -E "..*" | grep -v ".salome.*"` ; do -for i in $product_sequence ; do - cat ${install_work}/env_${i}.sh >> ${install_work}/$SHRC 2>/dev/null -done +### !!! writing salome.csh file !!! -> add global aliases +cat >> ${install_work}/$CSHRC <=1;i--){v=\$i;t=1;for(j=0;j<=n;j++){if(keys[j]==v){t=0;break;}};if(t)keys[n++]=v} ; for(j=n-1;j>=0;j--){printf "%s",keys[j];if(j>0) printf ":"} ; printf "\n"}'"'" -sed -e 's%^export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' -e 's%^#csh-specific %%g' ${INSTALL_WORK}/$SHRC > ${INSTALL_WORK}/_$CSHRC +alias setenva 'set a="\!:1" ; set b=\`printenv \$a\`:"'\!:2'" ; set b=\`cleandupr \$b\` ; setenv \$a \$b ; unset a, b' +alias setenvp 'set a="\!:1" ; set b="'\!:2'":\`printenv \$a\` ; set b=\`cleandup \$b\` ; setenv \$a \$b ; unset a, b' +EOF +### !!! writing salome.csh file !!! -> set inital variables pre_vars="PATH LD_LIBRARY_PATH LD_RUN_PATH PYTHONPATH" for i in $pre_vars ; do cat >> ${install_work}/$CSHRC <> ${INSTALL_WORK}/$CSHRC -rm -f ${INSTALL_WORK}/_$CSHRC +### !!! writing salome.(c)sh files !!! -> dump products environment files, changing 'export' by 'setenv(a|b)' where necessary +product_sequence="$2" +for i in $product_sequence ; do + sed -e 's%^export\([[:blank:]]*\)PATH=\$[{]\?PATH[}]\?:\(.*\)%setenva\1PATH \2%g' -e 's%^export\([[:blank:]]*\)PATH=\(.*\):\$[{]\?PATH[}]\?%setenvp\1PATH \2%g' ${install_work}/env_${i}.sh > ${INSTALL_WORK}/_tmp1 2>/dev/null + sed -e 's%^export\([[:blank:]]*\)LD_LIBRARY_PATH=\$[{]\?LD_LIBRARY_PATH[}]\?:\(.*\)%setenva\1LD_LIBRARY_PATH \2%g' -e 's%^export\([[:blank:]]*\)LD_LIBRARY_PATH=\(.*\):\$[{]\?LD_LIBRARY_PATH[}]\?%setenvp\1LD_LIBRARY_PATH \2%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null + sed -e 's%^export\([[:blank:]]*\)PYTHONPATH=\$[{]\?PYTHONPATH[}]\?:\(.*\)%setenva\1PYTHONPATH \2%g' -e 's%^export\([[:blank:]]*\)PYTHONPATH=\(.*\):\$[{]\?PYTHONPATH[}]\?%setenvp\1PYTHONPATH \2%g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null + sed -e 's%^export\([[:blank:]]*\)LD_RUN_PATH=\$[{]\?LD_RUN_PATH[}]\?:\(.*\)%setenva\1LD_RUN_PATH \2%g' -e 's%^export\([[:blank:]]*\)LD_RUN_PATH=\(.*\):\$[{]\?LD_RUN_PATH[}]\?%setenvp\1LD_RUN_PATH \2%g' ${INSTALL_WORK}/_tmp1 > ${INSTALL_WORK}/_tmp2 2>/dev/null + cat ${INSTALL_WORK}/_tmp2 >> ${install_work}/$SHRC 2>/dev/null + + sed -e 's%^export \([[:alnum:]_[:blank:]]*\)\=%setenv \1 %g' ${INSTALL_WORK}/_tmp2 > ${INSTALL_WORK}/_tmp1 2>/dev/null + cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/$CSHRC 2>/dev/null + + rm -f ${INSTALL_WORK}/_tmp1 ${INSTALL_WORK}/_tmp2 +done if [ $# -eq 4 ] ; then product_dir=$4