Changeset 655 for CMT/HEAD


Ignore:
Timestamp:
Nov 13, 2013, 2:26:58 PM (11 years ago)
Author:
rybkin
Message:

See C.L. 514

Location:
CMT/HEAD
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/ChangeLog

    r654 r655  
     12013-11-13    <rybkin@lal.in2p3.fr> 514
     2
     3        * source/cmt_use.cxx: In class Use get_strategy function, make use of now
     4        fast get_project function rather than compute, in fill_standard_macros,
     5        get_package_name, get_project functions, simplify code
     6        * source/cmt_parser.cxx: In class Cmt install_scripts functions, make
     7        generated setup and cleanup scrips call CMT executable directly rather than
     8        via shell script wrapper
     9        * src/setup.sh: Reduce usage of external shell utilities by using POSIX
     10        shell features instead
     11        * src/cleanup.sh: idem, unset everything set by setup.sh
     12        * src/setup.csh: Reduce usage of external shell utilities by using C shell
     13        features instead
     14        * src/cleanup.csh: idem, unset everything set by setup.csh
     15        * src/cleanup.tcsh: Add script to unset TCSH specific environment setup
     16        * src/cleanup.zsh: Add script to unset Z shell specific environment setup
     17        * src/cleanup.bash: Add script to unset BASH specific environment setup
     18       
    1192013-11-08    <rybkin@lal.in2p3.fr> 513
    220
  • CMT/HEAD/source/cmt_parser.cxx

    r654 r655  
    62626262              fprintf (f, "endif\n");
    62636263              fprintf (f, "source ${CMTROOT}/mgr/setup.csh\n");
    6264               fprintf (f, "set cmt%stempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n", mangled_package.c_str ());
     6264              fprintf (f, "set cmt%stempfile=`${CMTROOT}/${CMTBIN}/cmt.exe -quiet build temporary_name`\n", mangled_package.c_str ());
    62656265              fprintf (f, "if $status != 0 then\n  set cmt%stempfile=/tmp/cmt.$$\nendif\n", mangled_package.c_str ());
    6266               //fprintf (f, "${CMTROOT}/mgr/cmt setup -%s "
    6267               fprintf (f, "${CMTROOT}/mgr/cmt %s -%s "
     6266              fprintf (f, "${CMTROOT}/${CMTBIN}/cmt.exe %s -%s "
    62686267                       "-pack=%s -version=%s -path=%s %s $* >${cmt%stempfile}\n",
    62696268                       action.c_str (),
     
    62766275              fprintf (f,
    62776276                       "if ( $status != 0 ) then\n"
    6278                        "  echo \"${CMTROOT}/mgr/cmt %s -%s "
     6277                       "  echo \"${CMTROOT}/${CMTBIN}/cmt.exe %s -%s "
    62796278                       "-pack=%s -version=%s -path=%s %s $* >${cmt%stempfile}\"\n"
    62806279                       "  set cmt%sstatus=2\n"
     
    63226321              fprintf (f, "fi\n");
    63236322              fprintf (f, ". ${CMTROOT}/mgr/setup.sh\n");
    6324               fprintf (f, "cmt%stempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n", mangled_package.c_str ());
     6323              fprintf (f, "cmt%stempfile=`${CMTROOT}/${CMTBIN}/cmt.exe -quiet build temporary_name`\n", mangled_package.c_str ());
    63256324              fprintf (f, "if test ! $? = 0 ; then cmt%stempfile=/tmp/cmt.$$; fi\n", mangled_package.c_str ());
    6326               //fprintf (f, "${CMTROOT}/mgr/cmt setup -%s "
    6327               fprintf (f, "${CMTROOT}/mgr/cmt %s -%s "
     6325              fprintf (f, "${CMTROOT}/${CMTBIN}/cmt.exe %s -%s "
    63286326                       "-pack=%s -version=%s -path=%s %s $* >${cmt%stempfile}\n",
    63296327                       action.c_str (),
     
    63366334              fprintf (f,
    63376335                       "if test $? != 0 ; then\n"
    6338                        "  echo >&2 \"${CMTROOT}/mgr/cmt %s -%s "
     6336                       "  echo >&2 \"${CMTROOT}/${CMTBIN}/cmt.exe %s -%s "
    63396337                       "-pack=%s -version=%s -path=%s %s $* >${cmt%stempfile}\"\n"
    63406338                       "  cmt%sstatus=2\n"
     
    63706368          else if (mode[i] == Bat)
    63716369            {
    6372               //fprintf (f, "rem Setting %s %s in %%~d0%%~p0\n",
    63736370              fprintf (f, "rem %s %s %s in %%~d0%%~p0\n",
    63746371                       action.c_str (),
  • CMT/HEAD/source/cmt_use.cxx

    r652 r655  
    36533653bool Use::get_strategy (const cmt_string& name) const
    36543654{
    3655   const Project* p =
     3655  const Project* p = get_project ();
     3656    /*
    36563657    Project::find_by_cmtpath (m_realpath.size ()
    36573658                              ? Project::find_in_cmt_paths (m_realpath, true)
    36583659                              : Project::find_in_cmt_paths (real_path)
    36593660                              );
    3660   //  const Project* p = Project::find_by_cmtpath (Project::find_in_cmt_paths (real_path));
     3661    */
    36613662
    36623663  bool strategy;
     
    37983799  buffer += "\n";
    37993800 
     3801  const Project* p = m_project
     3802    ? m_project
     3803    : Project::find_by_cmtpath (cmtpath)
     3804    ;
     3805  /*
    38003806  const Project* p (m_project);
    38013807  if (!p)
    38023808    p = Project::find_by_cmtpath (cmtpath);
     3809  */
    38033810
    38043811  buffer += "macro ";
     
    45564563  static const cmt_string null = "";
    45574564
     4565  return m_package ? m_package->get_name () : null ;
     4566  /*
    45584567  Package* p = m_package;
    45594568  if (p == 0) return (null);
    45604569
    45614570  return (p->get_name ());
     4571  */
    45624572}
    45634573
     
    57715781    return m_project;
    57725782
     5783  return Project::find_by_cmtpath (m_realpath.size ()
     5784                                   ? Project::find_in_cmt_paths (m_realpath, true)
     5785                                   : Project::find_in_cmt_paths (real_path)
     5786                                   );
     5787  /*
    57735788  cmt_string cmtpath = m_realpath.size ()
    57745789    ? Project::find_in_cmt_paths (m_realpath, true)
     
    57765791    ;
    57775792  return Project::find_by_cmtpath (cmtpath);
     5793  */
    57785794  /*
    57795795  Project* p;
  • CMT/HEAD/src/cleanup.csh

    r11 r655  
    22# Copyright Christian Arnault LAL-Orsay CNRS
    33# arnault@lal.in2p3.fr
     4# Modified by Grigory Rybkin
    45# See the complete license in cmt_license.txt "http://www.cecill.info".
    56#-----------------------------------------------------------
    67
    7 set newpath=
     8unsetenv CMTBIN
     9unsetenv CMTCONFIG
    810
    9 foreach p ( `echo ${PATH} | sed 's#:# #g'` )
    10   echo ${p} | egrep '/CMT/' >& /dev/null
    11   set s=${status}
    12   if ( "${s}" != 0 ) then
    13     if ( ${newpath} == "" ) then
    14       set newpath=${p}
     11if ( $?CMTROOT == 1 ) then
     12if ( $?0 == 0 ) then
     13if ( $?tcsh == 1 ) then
     14  source ${CMTROOT}/src/cleanup.tcsh
     15else if ( "${shell:t}" == "tcsh" ) then
     16  source ${CMTROOT}/src/cleanup.tcsh
     17endif
     18endif
     19endif
     20
     21unsetenv CMTROOT
     22
     23# Remove CMT entries, if any
     24set newpath=()
     25foreach p (${path:q})
     26  if ( "${p}" !~ "*/CMT/*" ) then
     27    if ( ${#newpath} != 0 ) then
     28      set newpath=(${newpath:q} ${p:q})
    1529    else
    16       set newpath=${newpath}:${p}
     30      set newpath=(${p:q})
    1731    endif
    1832  endif
    1933end
    2034
    21 setenv PATH ${newpath}
    22 unsetenv CMTCONFIG
    23 unsetenv CMTROOT
     35set path=(${newpath:q})
     36unset newpath
    2437
     38unalias cmt
     39
     40if ( $?CLASSPATH == 1 ) then
     41if ( "${CLASSPATH}" =~ "*/CMT/*" ) then
     42# Remove CMT entries
     43  set _p="${CLASSPATH}"
     44  while ( "$_p" =~ "*:*" )
     45  set _p="${_p:s/:/ /}"
     46  end
     47
     48  set newpath=
     49  foreach p (${_p})
     50    if ( "${p}" !~ "*/CMT/*" ) then
     51      if ( "${newpath}" != "" ) then
     52        set newpath=${newpath}:${p}
     53      else
     54        set newpath=${p}
     55      endif
     56    endif
     57  end
     58
     59  if ( "${newpath}" != "" ) then
     60    setenv CLASSPATH ${newpath}
     61  else
     62    unsetenv CLASSPATH
     63  endif
     64  unset _p newpath
     65endif
     66endif
     67
     68unalias jcmt
     69
     70# Unset MAKEFLAGS, if looks set by CMT
     71if ( $?MAKEFLAGS == 1 ) then
     72if ( "$MAKEFLAGS" =~ "*QUICK=1" ) then
     73  unsetenv MAKEFLAGS
     74endif
     75endif
  • CMT/HEAD/src/cleanup.sh

    r11 r655  
    22# Copyright Christian Arnault LAL-Orsay CNRS
    33# arnault@lal.in2p3.fr
     4# Modified by Grigory Rybkin
    45# See the complete license in cmt_license.txt "http://www.cecill.info".
    56#-----------------------------------------------------------
    67
    7 newpath=""
    8 for p in `echo ${PATH} | sed 's/:/ /g'`; do
    9   if test ! "`echo ${p} | egrep CMT`" ; then
    10     if test "${newpath}" = "" ; then
    11       newpath=${p}
    12     else
    13       newpath=${newpath}:${p}
     8[ -z ${CMTBIN+CMT} ] || unset CMTBIN
     9[ -z ${CMTCONFIG+CMT} ] || unset CMTCONFIG
     10
     11if [ "${CMTROOT+CMT}" = CMT ]; then
     12if [ -n "$-" ] && [ "${-#*i}" != "$-" ]; then
     13if [ -n "${ZSH_NAME-}" ]; then
     14  . ${CMTROOT}/src/cleanup.zsh
     15elif [ -n "${BASH-}" ]; then
     16  . ${CMTROOT}/src/cleanup.bash
     17fi
     18fi
     19fi
     20
     21[ -z ${CMTROOT+CMT} ] || unset CMTROOT
     22
     23cmt_clean_path()
     24{
     25# Remove CMT entries, if any
     26  _np=
     27  _p="$1"
     28  while [ -n "$_p" ]; do
     29    __p="${_p#:}"
     30    while [ "$__p" != "$_p" ]; do
     31      _p="${__p}"
     32      __p="${_p#:}"
     33    done
     34    _e="${_p%%:*}"
     35    _p="${_p#${_e}}"
     36    if [ "${_e%/CMT/*}" = "${_e}" ] && [ -n "${_e}" ]; then
     37      if [ -n "${_np}" ]; then
     38        _np="${_np}:${_e}"
     39      else
     40        _np="${_e}"
     41      fi
    1442    fi
     43  done
     44  echo "$_np"
     45  unset _np _p __p _e
     46}
     47
     48if [ "${PATH%/CMT/*}" != "${PATH}" ]; then
     49  newpath=`cmt_clean_path "${PATH}"`
     50  PATH=${newpath}
     51  unset newpath
     52fi
     53
     54if alias cmt >/dev/null 2>&1; then
     55  unalias cmt
     56fi
     57
     58if [ -n "${CLASSPATH-}" ]; then
     59if [ "${CLASSPATH%/CMT/*}" != "${CLASSPATH}" ]; then
     60  newpath=`cmt_clean_path "${CLASSPATH}"`
     61  if [ -n "${newpath}" ]; then
     62    CLASSPATH=${newpath}
     63  else
     64    unset CLASSPATH
    1565  fi
    16 done
     66  unset newpath
     67fi
     68fi
    1769
    18 PATH=${newpath}; export PATH
     70if alias jcmt >/dev/null 2>&1; then
     71  unalias jcmt
     72fi
    1973
    20 CMTCONFIG=; export CMTCONFIG
    21 CMTROOT=; export CMTROOT
     74unset -f cmt_clean_path
     75
     76# Unset MAKEFLAGS, if looks set by CMT
     77if [ "${MAKEFLAGS+CMT}" = CMT ]; then
     78if [ "${MAKEFLAGS%QUICK=1}" != "${MAKEFLAGS}" ]; then
     79  unset MAKEFLAGS
     80fi
     81fi
  • CMT/HEAD/src/setup.csh

    r612 r655  
    66#-----------------------------------------------------------
    77
    8 setenv CMTBIN `uname`-`uname -m | tr -d ' '`
     8# Remove spaces, if any
     9set _m="`uname -m`"
     10while ( "$_m" =~ "* *" )
     11set _m="${_m:s/ //}"
     12end
     13setenv CMTBIN `uname`-"$_m"
     14unset _m
    915
    1016if ( $?CMTCONFIG == 0 ) then
     
    1521if ( $?tcsh == 1 ) then
    1622  source ${CMTROOT}/src/setup.tcsh
    17 else if ( `basename "$shell"` == "tcsh" ) then
     23else if ( "${shell:t}" == "tcsh" ) then
    1824  source ${CMTROOT}/src/setup.tcsh
    1925endif
    2026endif
    2127
     28# Remove CMT entries, if any
    2229set newpath=()
    23 foreach p (${path})
     30foreach p (${path:q})
    2431  if ( "${p}" !~ "*/CMT/*" ) then
    2532    if ( ${#newpath} != 0 ) then
    26       set newpath=(${newpath} ${p})
     33      set newpath=(${newpath:q} ${p:q})
    2734    else
    28       set newpath=(${p})
     35      set newpath=(${p:q})
    2936    endif
    3037  endif
    3138end
    3239
    33 set path=(${newpath} "${CMTROOT}/${CMTBIN}")
     40set path=(${newpath:q} "${CMTROOT}/${CMTBIN}")
     41unset newpath
     42
    3443alias cmt '${CMTROOT}/${CMTBIN}/cmt.exe'
    35 unset newpath
    3644
    3745if ( $?CLASSPATH == 0 ) then
     
    4250  setenv CLASSPATH ${CLASSPATH}:${CMTROOT}/java/cmt.jar
    4351else
     52# Remove CMT entries
     53  set _p="${CLASSPATH}"
     54  while ( "$_p" =~ "*:*" )
     55  set _p="${_p:s/:/ /}"
     56  end
     57
    4458  set newpath=
    45   foreach p ( `echo ${CLASSPATH} | tr ':' ' '` )
     59  foreach p (${_p})
    4660    if ( "${p}" !~ "*/CMT/*" ) then
    4761      if ( "${newpath}" != "" ) then
     
    5872    setenv CLASSPATH ${CMTROOT}/java/cmt.jar
    5973  endif
    60   unset newpath
     74  unset _p newpath
    6175endif
    6276
  • CMT/HEAD/src/setup.sh

    r611 r655  
    66#-----------------------------------------------------------
    77
    8 CMTBIN=`uname`-`uname -m | tr -d ' '`; export CMTBIN
     8# Remove spaces, if any
     9_m="`uname -m`"
     10_nm=
     11while [ -n "$_m" ]; do
     12  _t="${_m#?}"
     13  _a="${_m%${_t}}"
     14  if [ "${_a}" != " " ]; then
     15    _nm="${_nm}${_a}"
     16  fi
     17  _m="$_t"
     18done
     19CMTBIN=`uname`-"$_nm"; export CMTBIN
     20unset _m _nm _t _a
    921
    1022if test "${CMTCONFIG}" = "" ; then
     
    2032fi
    2133
     34cmt_clean_path()
     35{
     36# Remove CMT entries, if any
     37  _np=
     38  _p="$1"
     39  while [ -n "$_p" ]; do
     40    __p="${_p#:}"
     41    while [ "$__p" != "$_p" ]; do
     42      _p="${__p}"
     43      __p="${_p#:}"
     44    done
     45    _e="${_p%%:*}"
     46    _p="${_p#${_e}}"
     47    if [ "${_e%/CMT/*}" = "${_e}" ] && [ -n "${_e}" ]; then
     48      if [ -n "${_np}" ]; then
     49        _np="${_np}:${_e}"
     50      else
     51        _np="${_e}"
     52      fi
     53    fi
     54  done
     55  echo "$_np"
     56  unset _np _p __p _e
     57}
     58
    2259if [ "${PATH%/CMT/*}" = "${PATH}" ]; then
    2360  PATH=${PATH}:${CMTROOT}/${CMTBIN}; export PATH
    2461else
    25   newpath=
    26   for p in `echo ${PATH} | tr ':' ' '`; do
    27     if [ "${p%/CMT/*}" = "${p}" ]; then
    28       if [ -n "${newpath}" ]; then
    29         newpath=${newpath}:${p}
    30       else
    31         newpath=${p}
    32       fi
    33     fi
    34   done
    35 
     62  newpath=`cmt_clean_path "${PATH}"`
    3663  PATH=${newpath}:${CMTROOT}/${CMTBIN}; export PATH
    3764  unset newpath
    3865fi
    3966
    40 alias cmt='${CMTROOT}/${CMTBIN}/cmt.exe'; export cmt
     67alias cmt='${CMTROOT}/${CMTBIN}/cmt.exe'
    4168
    4269if [ -z "${CLASSPATH-}" ]; then
     
    4572  CLASSPATH=${CLASSPATH}:${CMTROOT}/java/cmt.jar; export CLASSPATH
    4673else
    47   newpath=
    48   for p in `echo ${CLASSPATH-} | tr ':' ' '`; do
    49     if [ "${p%/CMT/*}" = "${p}" ]; then
    50       if [ -n "${newpath}" ]; then
    51         newpath=${newpath}:${p}
    52       else
    53         newpath=${p}
    54       fi
    55     fi
    56   done
    57 
     74  newpath=`cmt_clean_path "${CLASSPATH}"`
    5875  if [ -n "${newpath}" ]; then
    5976    CLASSPATH=${newpath}:${CMTROOT}/java/cmt.jar; export CLASSPATH
     
    6481fi
    6582
    66 alias jcmt='(java cmt_parser)'; export jcmt
     83alias jcmt='(java cmt_parser)'
     84
     85unset -f cmt_clean_path
    6786
    6887# Set MAKEFLAGS, if unset (similar to NPROC with Plan 9 mk utility)
Note: See TracChangeset for help on using the changeset viewer.