From: vsr Date: Mon, 26 May 2014 07:00:17 +0000 (+0400) Subject: Modify the way the application is generated within KERNEL module installation procedure X-Git-Tag: V7_4_0~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2203fa163e6601d78528d267744bd9bb9d9d6545;p=tools%2Finstall.git Modify the way the application is generated within KERNEL module installation procedure - Generate config file - Generate application using appli_gen.py script --- diff --git a/config_files/KERNEL.sh b/config_files/KERNEL.sh index 00df5a7..8f9b84e 100755 --- a/config_files/KERNEL.sh +++ b/config_files/KERNEL.sh @@ -127,21 +127,7 @@ try_preinstalled pickup_env() { make_env ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE} ${PRODUCT_DIR} -if [ -f ${PRODUCT_DIR}/bin/salome/createAppli.sh ] ; then - pushd ${PRODUCT_DIR} > /dev/null - version=`cat bin/salome/VERSION | awk -F: '{print $2}' | tr -d '[:space:]'` - dir="${HOME}/salome_appli_${version}" - ./bin/salome/createAppli.sh ${dir} - if [ -d ${dir}/env.d ] ; then - rm -rf ${dir}/env.d/*.sh - fi - if [ ! -e ${dir}/env.d ] ; then - mkdir -p ${dir}/env.d - fi - cp -f ${PRODUCT_DIR}/salome.sh ${dir}/env.d - popd > /dev/null -fi -./create_application.sh ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_DIR} +./create_config.sh ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_DIR} make_env ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" ${PRODUCT_TYPE}_src ${PRODUCT_SRC_DIR} } diff --git a/config_files/common.sh b/config_files/common.sh index 1687a64..f33e2aa 100755 --- a/config_files/common.sh +++ b/config_files/common.sh @@ -15,6 +15,7 @@ export DELIM="------" export SHRC="salome.sh" export CSHRC="salome.csh" +export CFGRC="salome.cfg" ##################################################### # !WARNING! This is current SALOME version number @@ -115,7 +116,7 @@ make_env() install_root=$1; shift install_work=$1; -for i in ${SHRC} ${CSHRC} ; do +for i in ${SHRC} ${CSHRC} ${CFGRC} ; do if [ -e ${install_work}/${i} ]; then rm ${install_work}/${i} fi @@ -127,6 +128,7 @@ if [ $# -eq 4 ] ; then product_env=${install_work}/env_${product_name}.sh (test -e ${product_env} && rm ${product_env} ) fi + ### !!! writing salome.sh file !!! -> define INST_ROOT cat >> ${install_work}/${SHRC} < /dev/null - if [ $? -eq 0 ] ; then - cat >> ${install_work}/${SHRC} < set inital variables pre_vars="PATH LD_LIBRARY_PATH LD_RUN_PATH PYTHONPATH TCLLIBPATH" for i in ${pre_vars} ; do @@ -162,6 +154,12 @@ endif EOF done +### !!! writing salome.cfs file !!! -> set inital variables +cat >> ${install_work}/${CFGRC} < dump products environment files, changing 'export' by 'setenv(a|p)' where necessary ### Note, that for performance reasons temporary environment files used during installation procedure itself ### are created without using setenv(a|p) aliases. @@ -386,13 +384,24 @@ cat ${INSTALL_WORK}/_tmp1 >> ${install_work}/_${CSHRC} 2>/dev/null rm -f ${INSTALL_WORK}/_tmp1 ${INSTALL_WORK}/_tmp2 +# 7. Create a salome.cfg file from salome.sh +cat ${install_work}/${SHRC} | grep -v -e "^## " | grep -v "PV_PLUGIN_PATH" | awk 'BEGIN {v=1} /if / {v=0;} /fi/ {v=1;} {if (match($0, "KERNEL")) exit 0; else if(v==1 && match($0, "^ *fi *$")==0) print $0;}' >> ${install_work}/${CFGRC} +sed -i "s%export PATH=\(.*\):\${\?PATH}\?%ADD_TO_PATH: \1%g" ${install_work}/${CFGRC} +sed -i "s%export LD_LIBRARY_PATH=\(.*\):\${\?LD_LIBRARY_PATH}\?%ADD_TO_LD_LIBRARY_PATH: \1%g" ${install_work}/${CFGRC} +sed -i "s%export PYTHONPATH=\(.*\):\${\?PYTHONPATH}\?%ADD_TO_PYTHONPATH: \1%g" ${install_work}/${CFGRC} +sed -i "s%export %%g" ${install_work}/${CFGRC} +sed -i "s%INST_ROOT%ROOT_SALOME%g" ${install_work}/${CFGRC} +sed -i "s%\${\?\([A-Za-z0-9_]\+\)}\?%\%(\1)s%g" ${install_work}/${CFGRC} + if [ $# -eq 5 ] ; then product_dir=$5 - if [ -e ${product_dir} ] ; then + if [ -d ${product_dir} ] ; then test -e ${product_dir}/${SHRC} && mv ${product_dir}/${SHRC} ${product_dir}/${SHRC}_`date +%F_%T` cp ${install_work}/_${SHRC} ${product_dir}/${SHRC} test -e ${product_dir}/${CSHRC} && mv ${product_dir}/${CSHRC} ${product_dir}/${CSHRC}_`date +%F_%T` cp ${install_work}/_${CSHRC} ${product_dir}/${CSHRC} + test -e ${product_dir}/${CFGRC} && mv ${product_dir}/${CFGRC} ${product_dir}/${CFGRC}_`date +%F_%T` + cp ${install_work}/${CFGRC} ${product_dir}/${CFGRC} fi fi sed -e 's%setenv ENV_FOR_LAUNCH 1%setenv ENV_FOR_LAUNCH 0%' ${install_work}/_${CSHRC} > ${install_root}/env_build.csh @@ -402,6 +411,7 @@ cp -f ${install_work}/_${CSHRC} ${install_root}/env_products.csh cp -f ${install_work}/_${SHRC} ${install_root}/env_products.sh rm -f ${install_work}/_${SHRC} ${install_work}/_${CSHRC} + ### !!! copying build.csh and build.sh scripts if [ -e ./build.csh ] && [ ! -e ${install_root}/build.csh ]; then cp -f ./build.csh ${install_root} @@ -409,6 +419,7 @@ fi if [ -e ./build.sh ] && [ ! -e ${install_root}/build.sh ]; then cp -f ./build.sh ${install_root} fi + ### !!! copying release notes for p in `ls ../` ; do export pdf=`echo ${p} | sed s/[.]/" "/g | awk '{print $2}'` diff --git a/config_files/create_application.sh b/config_files/create_application.sh index 2facfd8..3681346 100755 --- a/config_files/create_application.sh +++ b/config_files/create_application.sh @@ -1,7 +1,7 @@ #!/bin/bash -noprofile #################################################################################### -# File : create_config.sh +# File : create_application.sh # Created : Fri May 30 10:40:01 2008 # Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com) # Project : SALOME @@ -23,14 +23,25 @@ export PRODUCT_DIR=$5 # --- configuration file --- CONFIG_FILE=${INSTALL_WORK}/config_appli.xml +# -- spacing for configuration file --- +SPACING=" " + +# ---------------------------------- # create and source environment file +# ---------------------------------- + make_env ${INST_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" "${INSTALL_PRODUCTS}" source ${INSTALL_WORK}/${SHRC} -# remove config file +# ---------------------------------- +# create config file +# ---------------------------------- + +# remove previous config file if [ -e ${CONFIG_FILE} ] ; then - rm ${CONFIG_FILE} + rm -f ${CONFIG_FILE} fi + # create empty config file touch ${CONFIG_FILE} @@ -38,31 +49,38 @@ touch ${CONFIG_FILE} echo "" >> ${CONFIG_FILE} # tag : path to the environment script -echo " " >> ${CONFIG_FILE} +echo "${SPACING}" >> ${CONFIG_FILE} + +# tag : path to the context file +echo "${SPACING}" >> ${CONFIG_FILE} + +# tag +echo "${SPACING}" >> ${CONFIG_FILE} # begin tag -echo " " >> ${CONFIG_FILE} +echo "${SPACING}" >> ${CONFIG_FILE} # for each module create tag -ALL_ENV="`env | awk -F_ '/[a-zA-Z0-9]*_ROOT_DIR/ { print $1 }' | grep -v -E '^SALOME$'`" +ALL_ENV="KERNEL GUI `env | awk -F_ '/[a-zA-Z0-9]*_ROOT_DIR/ { print $1 }' | grep -v -E '^(SALOME|KERNEL|GUI)$' | sort -u`" for p in ${ALL_ENV} ; do pvar=${p}_ROOT_DIR pdir=${!pvar} + # if it's a SALOME module, it should have share/salome/resources sub-directory if [ -d ${pdir}/share/salome/resources ] ; then case ${p} in - KERNEL | GUI | *PLUGIN ) echo " " >> ${CONFIG_FILE} ;; - * ) echo " " >> ${CONFIG_FILE} ;; + KERNEL | GUI | COMPONENT | *CALCULATOR | RANDOMIZER | DSCCODE | *PLUGIN ) echo "${SPACING}${SPACING}" >> ${CONFIG_FILE} ;; + * ) echo "${SPACING}${SPACING}" >> ${CONFIG_FILE} ;; esac fi done # end tag -echo " " >> ${CONFIG_FILE} +echo "${SPACING}" >> ${CONFIG_FILE} # tag : path to the samples directory if [ -n ${DATA_DIR} ] && [ -d ${DATA_DIR} ] ; then - echo " " >> ${CONFIG_FILE} + echo "${SPACING}" >> ${CONFIG_FILE} fi # end tag @@ -70,5 +88,14 @@ echo "" >> ${CONFIG_FILE} # copy resulting confuguration file to the KERNEL module if [ -n "${PRODUCT_DIR}" ] && [ -d ${PRODUCT_DIR} ] ; then - cp -f ${CONFIG_FILE} ${PRODUCT_DIR}/bin/salome + cp -f ${CONFIG_FILE} ${PRODUCT_DIR} +fi + +# ---------------------------------- +# generate application +# ---------------------------------- + +if [ -f ${PRODUCT_DIR}/bin/salome/appli_gen.py ] ; then + version=`head -n1 ${PRODUCT_DIR}/bin/salome/VERSION | awk -F: '{print $2}' | tr -d '[:space:]'` + ${PRODUCT_DIR}/bin/salome/appli_gen.py --prefix=${INST_ROOT}/salome_appli_${version} --config=${PRODUCT_DIR}/config_appli.xml >& /dev/null fi