Changeset 553 for CMT/HEAD


Ignore:
Timestamp:
Aug 25, 2010, 12:12:14 PM (14 years ago)
Author:
rybkin
Message:

See C.L. 438

Location:
CMT/HEAD
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/ChangeLog

    r552 r553  
     12010-08-25    <rybkin@lal.in2p3.fr> 438
     2
     3        * source/cmt_parser.cxx: In class Cmt, in functions install_setup_scripts,
     4        install_cleanup_scripts, install_test_setup_scripts,
     5        install_test_cleanup_scripts, dos_script_prefix, ensure that in
     6        setup/cleanup scripts, shell variable name holding temporary file name
     7        - with script contents - contains package name, so as to avoid name clashes
     8        in case user provided scripts invoke CMT generated setup/cleanup scripts
     9        from other packages (which lead to temporary file not being cleaned up).
     10        In functions do_config, do_relocate, do not use functions
     11        install_test_setup_scripts, install_test_cleanup_scripts for standalone
     12        package, use install_setup_scripts, install_cleanup_scripts instead as for
     13        standard packages
     14       
    1152010-08-24    <rybkin@lal.in2p3.fr> 437
    216
  • CMT/HEAD/source/cmt_parser.cxx

    r550 r553  
    28032803            }
    28042804
    2805           install_test_setup_scripts ();
    2806           install_test_cleanup_scripts ();
     2805          install_setup_scripts ();
     2806          install_cleanup_scripts ();
     2807          //install_test_setup_scripts ();
     2808          //install_test_cleanup_scripts ();
    28072809
    28082810          Generator::build_default_makefile ();
     
    29862988          cout << "------------------------------------------" << endl;
    29872989            }
    2988           install_test_setup_scripts ();
    2989           install_test_cleanup_scripts ();
     2990          install_setup_scripts ();
     2991          install_cleanup_scripts ();
     2992          //install_test_setup_scripts ();
     2993          //install_test_cleanup_scripts ();
    29902994
    29912995          Generator::build_default_makefile ();
     
    51435147                               const cmt_string& cmt_root,
    51445148                               const cmt_string& package,
     5149                               const cmt_string& mangled_package,
    51455150                               const cmt_string& version,
    51465151                               const cmt_string& path,
     
    51765181  fprintf (f, "if NOT DEFINED CMTROOT set CMTROOT=%s& set PATH=%%CMTROOT%%\\%%CMTBIN%%;%%PATH%%& set CMTBIN=VisualC& if not defined CMTCONFIG set CMTCONFIG=%%CMTBIN%%\n", cmt_root.c_str ());
    51775182  fprintf (f, "\n");
    5178   fprintf (f, "set cmttempfile=\"%%TEMP%%\\tmpsetup.bat\"\n");
     5183  fprintf (f, "set cmt%stempfile=\"%%TEMP%%\\cmt%stempfile.bat\"\n", mangled_package.c_str (), mangled_package.c_str ());
    51795184  fprintf (f, "%%CMTROOT%%\\%%CMTBIN%%\\cmt.exe %s -bat "
    51805185           " -pack=%s -version=%s -path=\"%%~d0%%~p0%s\" "
    51815186           " %s "
    5182            "%%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9 >%%cmttempfile%%\n",
     5187           "%%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9 >%%cmt%stempfile%%\n",
    51835188           action.c_str (),
    51845189           package.c_str (),
    51855190           version.c_str (),
    51865191           no_device.c_str (),
    5187            option.c_str ());
    5188   fprintf (f, "if exist %%cmttempfile%% call %%cmttempfile%%\n");
    5189   fprintf (f, "if exist %%cmttempfile%% del %%cmttempfile%%\n");
    5190   fprintf (f, "set cmttempfile=\n");
     5192           option.c_str (), mangled_package.c_str ());
     5193  fprintf (f, "if exist %%cmt%stempfile%% call %%cmt%stempfile%%\n", mangled_package.c_str (), mangled_package.c_str ());
     5194  fprintf (f, "if exist %%cmt%stempfile%% del %%cmt%stempfile%%\n", mangled_package.c_str (), mangled_package.c_str ());
     5195  fprintf (f, "set cmt%stempfile=\n", mangled_package.c_str ());
     5196}
     5197
     5198//----------------------------------------------------------
     5199//  Mangle text so that it consists solely of
     5200//  letters, numbers, and underscores
     5201//  (any other characters are replaced with X).
     5202//  Then text, prefixed with a letter or underscore,
     5203//  can be used as shell variable name
     5204//----------------------------------------------------------
     5205static cmt_string mangle (const cmt_string& text)
     5206{
     5207  cmt_string result;
     5208  int allocated = text.size ();
     5209  char* const buffer = (char*) malloc (allocated + 1);
     5210  char* b (buffer);
     5211  const char* t = text.c_str ();
     5212  while (*t)
     5213    {
     5214      if (isalnum (*t) || *t == '_')
     5215        *b++ = *t++;
     5216      else
     5217        {
     5218          *b++ = 'X'; t++;
     5219        }
     5220    }
     5221  *b = '\0';
     5222  result = buffer;
     5223  free (buffer);
     5224  return result;
    51915225}
    51925226
     
    52315265  cmt_string version = Me.m_current_version;
    52325266  if (version == "v*") version = "";
     5267  cmt_string mangled_package = mangle (Me.m_current_package);
    52335268
    52345269  for (i = 0; i < modes; i++)
     
    52495284              fprintf (f, "endif\n");
    52505285              fprintf (f, "source ${CMTROOT}/mgr/setup.csh\n");
    5251               fprintf (f, "set tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
    5252               fprintf (f, "if $status != 0 then\n  set tempfile=/tmp/cmt.$$\nendif\n");
     5286              fprintf (f, "set cmt%stempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n", mangled_package.c_str ());
     5287              fprintf (f, "if $status != 0 then\n  set cmt%stempfile=/tmp/cmt.$$\nendif\n", mangled_package.c_str ());
    52535288              fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s "
    5254                        "-pack=%s -version=%s -path=%s $* >${tempfile}\n",
     5289                       "-pack=%s -version=%s -path=%s $* >${cmt%stempfile}\n",
    52555290                       suffix[i].c_str (),
    52565291                       Me.m_current_package.c_str (),
    52575292                       version.c_str (),
    5258                        Me.m_current_path.c_str ());
     5293                       Me.m_current_path.c_str (), mangled_package.c_str ());
    52595294              fprintf (f,
    52605295                       "if ( $status != 0 ) then\n"
    52615296                       "  echo \"${CMTROOT}/mgr/cmt cleanup -%s "
    5262                        "-pack=%s -version=%s -path=%s $* >${tempfile}\"\n"
     5297                       "-pack=%s -version=%s -path=%s $* >${cmt%stempfile}\"\n"
    52635298                       "  set cmtcleanupstatus=2\n"
    5264                        "  /bin/rm -f ${tempfile}\n"
     5299                       "  /bin/rm -f ${cmt%stempfile}\n"
     5300                       "  unset cmt%stempfile\n"
    52655301                       "  exit $cmtcleanupstatus\n"
    52665302                       "endif\n"
    52675303                       "set cmtcleanupstatus=0\n"
    5268                        "source ${tempfile}\n"
     5304                       "source ${cmt%stempfile}\n"
    52695305                       "if ( $status != 0 ) then\n"
    52705306                       "  set cmtcleanupstatus=2\n"
    52715307                       "endif\n"
    5272                        "/bin/rm -f ${tempfile}\n"
     5308                       "/bin/rm -f ${cmt%stempfile}\n"
     5309                       "unset cmt%stempfile\n"
    52735310                       "exit $cmtcleanupstatus\n",
    52745311                       suffix[i].c_str (),
    52755312                       Me.m_current_package.c_str (),
    52765313                       version.c_str (),
    5277                        Me.m_current_path.c_str ());
     5314                       Me.m_current_path.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str ());
    52785315            }
    52795316          else if (mode[i] == Sh)
     
    52835320              fprintf (f, "fi\n");
    52845321              fprintf (f, ". ${CMTROOT}/mgr/setup.sh\n");
    5285               fprintf (f, "tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
    5286               fprintf (f, "if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi\n");
     5322              fprintf (f, "cmt%stempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n", mangled_package.c_str ());
     5323              fprintf (f, "if test ! $? = 0 ; then cmt%stempfile=/tmp/cmt.$$; fi\n", mangled_package.c_str ());
    52875324              fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s "
    5288                        "-pack=%s -version=%s -path=%s $* >${tempfile}\n",
     5325                       "-pack=%s -version=%s -path=%s $* >${cmt%stempfile}\n",
    52895326                       suffix[i].c_str (),
    52905327                       Me.m_current_package.c_str (),
    52915328                       version.c_str (),
    5292                        Me.m_current_path.c_str ());
     5329                       Me.m_current_path.c_str (), mangled_package.c_str ());
    52935330              fprintf (f,
    52945331                       "if test $? != 0 ; then\n"
    52955332                       "  echo >&2 \"${CMTROOT}/mgr/cmt cleanup -%s "
    5296                        "-pack=%s -version=%s -path=%s $* >${tempfile}\"\n"
     5333                       "-pack=%s -version=%s -path=%s $* >${cmt%stempfile}\"\n"
    52975334                       "  cmtcleanupstatus=2\n"
    5298                        "  /bin/rm -f ${tempfile}\n"
     5335                       "  /bin/rm -f ${cmt%stempfile}\n"
     5336                       "  unset cmt%stempfile\n"
    52995337                       "  return $cmtcleanupstatus\n"
    53005338                       "fi\n"
    53015339                       "cmtcleanupstatus=0\n"
    5302                        ". ${tempfile}\n"
     5340                       ". ${cmt%stempfile}\n"
    53035341                       "if test $? != 0 ; then\n"
    53045342                       "  cmtcleanupstatus=2\n"
    53055343                       "fi\n"
    5306                        "/bin/rm -f ${tempfile}\n"
     5344                       "/bin/rm -f ${cmt%stempfile}\n"
     5345                       "unset cmt%stempfile\n"
    53075346                       "return $cmtcleanupstatus\n",
    53085347                       suffix[i].c_str (),
    53095348                       Me.m_current_package.c_str (),
    53105349                       version.c_str (),
    5311                        Me.m_current_path.c_str ());
     5350                       Me.m_current_path.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str ());
    53125351            }
    53135352          else if (mode[i] == Bat)
    53145353            {
    53155354              dos_script_prefix (f, Me.m_cmt_root,
    5316                                  Me.m_current_package, version, Me.m_current_path,
     5355                                 Me.m_current_package, mangled_package, version, Me.m_current_path,
    53175356                                 "cleanup");
    53185357            }
     
    53835422  cmt_string version = Me.m_current_version;
    53845423  if (version == "v*") version = "";
     5424  cmt_string mangled_package = mangle (Me.m_current_package);
    53855425
    53865426  for (i = 0; i < modes; i++)
     
    54075447              fprintf (f, "endif\n");
    54085448              fprintf (f, "source ${CMTROOT}/mgr/setup.csh\n");
    5409               fprintf (f, "\n");
    5410               fprintf (f, "set tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
    5411               fprintf (f, "if $status != 0 then\n  set tempfile=/tmp/cmt.$$\nendif\n");
     5449              fprintf (f, "set cmt%stempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n", mangled_package.c_str ());
     5450              fprintf (f, "if $status != 0 then\n  set cmt%stempfile=/tmp/cmt.$$\nendif\n", mangled_package.c_str ());
    54125451              fprintf (f, "${CMTROOT}/mgr/cmt setup -%s "
    5413                        "-pack=%s -version=%s -path=%s %s $* >${tempfile}\n",
     5452                       "-pack=%s -version=%s -path=%s %s $* >${cmt%stempfile}\n",
    54145453                       suffix[i].c_str (),
    54155454                       Me.m_current_package.c_str (),
    54165455                       version.c_str (),
    54175456                       Me.m_current_path.c_str (),
    5418                        no_cleanup_opt.c_str ());
     5457                       no_cleanup_opt.c_str (), mangled_package.c_str ());
    54195458              fprintf (f,
    54205459                       "if ( $status != 0 ) then\n"
    54215460                       "  echo \"${CMTROOT}/mgr/cmt setup -%s "
    5422                        "-pack=%s -version=%s -path=%s %s $* >${tempfile}\"\n"
     5461                       "-pack=%s -version=%s -path=%s %s $* >${cmt%stempfile}\"\n"
    54235462                       "  set cmtsetupstatus=2\n"
    5424                        "  /bin/rm -f ${tempfile}\n"
     5463                       "  /bin/rm -f ${cmt%stempfile}\n"
     5464                       "  unset cmt%stempfile\n"
    54255465                       "  exit $cmtsetupstatus\n"
    54265466                       "endif\n"
    54275467                       "set cmtsetupstatus=0\n"
    5428                        "source ${tempfile}\n"
     5468                       "source ${cmt%stempfile}\n"
    54295469                       "if ( $status != 0 ) then\n"
    54305470                       "  set cmtsetupstatus=2\n"
    54315471                       "endif\n"
    5432                        "/bin/rm -f ${tempfile}\n"
     5472                       "/bin/rm -f ${cmt%stempfile}\n"
     5473                       "unset cmt%stempfile\n"
    54335474                       "exit $cmtsetupstatus\n",
    54345475                       suffix[i].c_str (),
     
    54365477                       version.c_str (),
    54375478                       Me.m_current_path.c_str (),
    5438                        no_cleanup_opt.c_str ());
     5479                       no_cleanup_opt.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str ());
    54395480            }
    54405481          else if (mode[i] == Sh)
     
    54505491              fprintf (f, "fi\n");
    54515492              fprintf (f, ". ${CMTROOT}/mgr/setup.sh\n");
    5452               fprintf (f, "\n");
    5453               fprintf (f, "tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
    5454               fprintf (f, "if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi\n");
     5493              fprintf (f, "cmt%stempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n", mangled_package.c_str ());
     5494              fprintf (f, "if test ! $? = 0 ; then cmt%stempfile=/tmp/cmt.$$; fi\n", mangled_package.c_str ());
    54555495              fprintf (f, "${CMTROOT}/mgr/cmt setup -%s "
    5456                        "-pack=%s -version=%s -path=%s %s $* >${tempfile}\n",
     5496                       "-pack=%s -version=%s -path=%s %s $* >${cmt%stempfile}\n",
    54575497                       suffix[i].c_str (),
    54585498                       Me.m_current_package.c_str (),
    54595499                       version.c_str (),
    54605500                       Me.m_current_path.c_str (),
    5461                        no_cleanup_opt.c_str ());
     5501                       no_cleanup_opt.c_str (), mangled_package.c_str ());
    54625502              fprintf (f,
    54635503                       "if test $? != 0 ; then\n"
    54645504                       "  echo >&2 \"${CMTROOT}/mgr/cmt setup -%s "
    5465                        "-pack=%s -version=%s -path=%s %s $* >${tempfile}\"\n"
     5505                       "-pack=%s -version=%s -path=%s %s $* >${cmt%stempfile}\"\n"
    54665506                       "  cmtsetupstatus=2\n"
    5467                        "  /bin/rm -f ${tempfile}\n"
     5507                       "  /bin/rm -f ${cmt%stempfile}\n"
     5508                       "  unset cmt%stempfile\n"
    54685509                       "  return $cmtsetupstatus\n"
    54695510                       "fi\n"
    54705511                       "cmtsetupstatus=0\n"
    5471                        ". ${tempfile}\n"
     5512                       ". ${cmt%stempfile}\n"
    54725513                       "if test $? != 0 ; then\n"
    54735514                       "  cmtsetupstatus=2\n"
    54745515                       "fi\n"
    5475                        "/bin/rm -f ${tempfile}\n"
     5516                       "/bin/rm -f ${cmt%stempfile}\n"
     5517                       "unset cmt%stempfile\n"
    54765518                       "return $cmtsetupstatus\n",
    54775519                       suffix[i].c_str (),
     
    54795521                       version.c_str (),
    54805522                       Me.m_current_path.c_str (),
    5481                        no_cleanup_opt.c_str ());
     5523                       no_cleanup_opt.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str ());
    54825524            }
    54835525          else if (mode[i] == Bat)
     
    54875529                       version.c_str ());
    54885530              dos_script_prefix (f, Me.m_cmt_root,
    5489                                  Me.m_current_package, version, Me.m_current_path,
     5531                                 Me.m_current_package, mangled_package, version, Me.m_current_path,
    54905532                                 "setup", no_cleanup_opt);
    54915533            }
     
    55495591  cmt_string version = Me.m_current_version;
    55505592  if (version == "v*") version = "";
     5593  cmt_string mangled_package = mangle (Me.m_current_package);
    55515594
    55525595  for (i = 0; i < modes; i++)
     
    55675610              fprintf (f, "endif\n");
    55685611              fprintf (f, "source ${CMTROOT}/mgr/setup.csh\n");
    5569               fprintf (f, "set tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
    5570               fprintf (f, "if $status != 0 then\n  set tempfile=/tmp/cmt.$$\nendif\n");
    5571               fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s -pack=cmt_standalone -path=%s $* >${tempfile}\n",
     5612              fprintf (f, "set cmt%stempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n", mangled_package.c_str ());
     5613              fprintf (f, "if $status != 0 then\n  set cmt%stempfile=/tmp/cmt.$$\nendif\n", mangled_package.c_str ());
     5614              fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s -pack=cmt_standalone -path=%s $* >${cmt%stempfile}\n",
    55725615                       suffix[i].c_str (),
    5573                        Me.m_current_path.c_str ());
     5616                       Me.m_current_path.c_str (), mangled_package.c_str ());
    55745617              fprintf (f,
    55755618                       "if ( $status != 0 ) then\n"
    55765619                       "  echo \"${CMTROOT}/mgr/cmt cleanup -%s "
    5577                        "-pack=cmt_standalone -path=%s $* >${tempfile}\"\n"
     5620                       "-pack=cmt_standalone -path=%s $* >${cmt%stempfile}\"\n"
    55785621                       "  set cmtcleanupstatus=2\n"
    5579                        "  /bin/rm -f ${tempfile}\n"
     5622                       "  /bin/rm -f ${cmt%stempfile}\n"
     5623                       "  unset cmt%stempfile\n"
    55805624                       "  exit $cmtcleanupstatus\n"
    55815625                       "endif\n"
    55825626                       "set cmtcleanupstatus=0\n"
    5583                        "source ${tempfile}\n"
     5627                       "source ${cmt%stempfile}\n"
    55845628                       "if ( $status != 0 ) then\n"
    55855629                       "  set cmtcleanupstatus=2\n"
    55865630                       "endif\n"
    5587                        "/bin/rm -f ${tempfile}\n"
     5631                       "/bin/rm -f ${cmt%stempfile}\n"
     5632                       "unset cmt%stempfile\n"
    55885633                       "exit $cmtcleanupstatus\n",
    55895634                       suffix[i].c_str (),
    5590                        Me.m_current_path.c_str ());
     5635                       Me.m_current_path.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str ());
    55915636            }
    55925637          else if (mode[i] == Sh)
     
    55965641              fprintf (f, "fi\n");
    55975642              fprintf (f, ". ${CMTROOT}/mgr/setup.sh\n");
    5598               fprintf (f, "tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
    5599               fprintf (f, "if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi\n");
    5600               fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s -pack=cmt_standalone -path=%s $* >${tempfile}\n",
     5643              fprintf (f, "cmt%stempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n", mangled_package.c_str ());
     5644              fprintf (f, "if test ! $? = 0 ; then cmt%stempfile=/tmp/cmt.$$; fi\n", mangled_package.c_str ());
     5645              fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s -pack=cmt_standalone -path=%s $* >${cmt%stempfile}\n",
    56015646                       suffix[i].c_str (),
    5602                        Me.m_current_path.c_str ());
     5647                       Me.m_current_path.c_str (), mangled_package.c_str ());
    56035648              fprintf (f,
    56045649                       "if test $? != 0 ; then\n"
    56055650                       "  echo >&2 \"${CMTROOT}/mgr/cmt cleanup -%s "
    5606                        "-pack=cmt_standalone -path=%s $* >${tempfile}\"\n"
     5651                       "-pack=cmt_standalone -path=%s $* >${cmt%stempfile}\"\n"
    56075652                       "  cmtcleanupstatus=2\n"
    5608                        "  /bin/rm -f ${tempfile}\n"
     5653                       "  /bin/rm -f ${cmt%stempfile}\n"
     5654                       "  unset cmt%stempfile\n"
    56095655                       "  return $cmtcleanupstatus\n"
    56105656                       "fi\n"
    56115657                       "cmtcleanupstatus=0\n"
    5612                        ". ${tempfile}\n"
     5658                       ". ${cmt%stempfile}\n"
    56135659                       "if test $? != 0 ; then\n"
    56145660                       "  cmtcleanupstatus=2\n"
    56155661                       "fi\n"
    5616                        "/bin/rm -f ${tempfile}\n"
     5662                       "/bin/rm -f ${cmt%stempfile}\n"
     5663                       "unset cmt%stempfile\n"
    56175664                       "return $cmtcleanupstatus\n",
    56185665                       suffix[i].c_str (),
    5619                        Me.m_current_path.c_str ());
     5666                       Me.m_current_path.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str ());
    56205667            }
    5621           else
     5668          else if (mode[i] == Bat)
    56225669            {
    56235670              dos_script_prefix (f, Me.m_cmt_root,
    5624                                  "cmt_standalone", "", Me.m_current_path,
     5671                                 "cmt_standalone", "cmt_standalone", "", Me.m_current_path,
    56255672                                 "cleanup");
    56265673            }
     
    57215768  int i;
    57225769
     5770  cmt_string version = Me.m_current_version;
     5771  if (version == "v*") version = "";
     5772  cmt_string mangled_package = mangle (Me.m_current_package);
     5773
    57235774  for (i = 0; i < modes; i++)
    57245775    {
     
    57415792              fprintf (f, "endif\n");
    57425793              fprintf (f, "source ${CMTROOT}/mgr/setup.csh\n");
    5743               fprintf (f, "set tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
    5744               fprintf (f, "if $status != 0 then\n  set tempfile=/tmp/cmt.$$\nendif\n");
    5745               fprintf (f, "${CMTROOT}/mgr/cmt setup -%s -pack=cmt_standalone -path=%s %s $* >${tempfile}\n",
     5794              fprintf (f, "set cmt%stempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n", mangled_package.c_str ());
     5795              fprintf (f, "if $status != 0 then\n  set cmt%stempfile=/tmp/cmt.$$\nendif\n", mangled_package.c_str ());
     5796              fprintf (f, "${CMTROOT}/mgr/cmt setup -%s -pack=cmt_standalone -path=%s %s $* >${cmt%stempfile}\n",
    57465797                       suffix[i].c_str (),
    57475798                       Me.m_current_path.c_str (),
    5748                        no_cleanup_opt.c_str ());
     5799                       no_cleanup_opt.c_str (), mangled_package.c_str ());
    57495800              fprintf (f,
    57505801                       "if ( $status != 0 ) then\n"
    57515802                       "  echo \"${CMTROOT}/mgr/cmt setup -%s "
    5752                        "-pack=cmt_standalone -path=%s %s $* >${tempfile}\"\n"
     5803                       "-pack=cmt_standalone -path=%s %s $* >${cmt%stempfile}\"\n"
    57535804                       "  set cmtsetupstatus=2\n"
    5754                        "  /bin/rm -f ${tempfile}\n"
     5805                       "  /bin/rm -f ${cmt%stempfile}\n"
     5806                       "  unset cmt%stempfile\n"
    57555807                       "  exit $cmtsetupstatus\n"
    57565808                       "endif\n"
    57575809                       "set cmtsetupstatus=0\n"
    5758                        "source ${tempfile}\n"
     5810                       "source ${cmt%stempfile}\n"
    57595811                       "if ( $status != 0 ) then\n"
    57605812                       "  set cmtsetupstatus=2\n"
    57615813                       "endif\n"
    5762                        "/bin/rm -f ${tempfile}\n"
     5814                       "/bin/rm -f ${cmt%stempfile}\n"
     5815                       "unset cmt%stempfile\n"
    57635816                       "exit $cmtsetupstatus\n",
    57645817                       suffix[i].c_str (),
    57655818                       Me.m_current_path.c_str (),
    5766                        no_cleanup_opt.c_str ());
     5819                       no_cleanup_opt.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str ());
    57675820            }
    57685821          else if (mode[i] == Sh)
     
    57755828              fprintf (f, "fi\n");
    57765829              fprintf (f, ". ${CMTROOT}/mgr/setup.sh\n");
    5777               fprintf (f, "\n");
    5778               fprintf (f, "tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
    5779               fprintf (f, "if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi\n");
    5780               fprintf (f, "${CMTROOT}/mgr/cmt setup -%s -pack=cmt_standalone -path=%s %s $* >${tempfile}\n",
     5830              fprintf (f, "cmt%stempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n", mangled_package.c_str ());
     5831              fprintf (f, "if test ! $? = 0 ; then cmt%stempfile=/tmp/cmt.$$; fi\n", mangled_package.c_str ());
     5832              fprintf (f, "${CMTROOT}/mgr/cmt setup -%s -pack=cmt_standalone -path=%s %s $* >${cmt%stempfile}\n",
    57815833                       suffix[i].c_str (),
    57825834                       Me.m_current_path.c_str (),
    5783                        no_cleanup_opt.c_str ());
     5835                       no_cleanup_opt.c_str (), mangled_package.c_str ());
    57845836              fprintf (f,
    57855837                       "if test $? != 0 ; then\n"
    57865838                       "  echo >&2 \"${CMTROOT}/mgr/cmt setup -%s "
    5787                        "-pack=cmt_standalone -path=%s %s $* >${tempfile}\"\n"
     5839                       "-pack=cmt_standalone -path=%s %s $* >${cmt%stempfile}\"\n"
    57885840                       "  cmtsetupstatus=2\n"
    5789                        "  /bin/rm -f ${tempfile}\n"
     5841                       "  /bin/rm -f ${cmt%stempfile}\n"
     5842                       "  unset cmt%stempfile\n"
    57905843                       "  return $cmtsetupstatus\n"
    57915844                       "fi\n"
    57925845                       "cmtsetupstatus=0\n"
    5793                        ". ${tempfile}\n"
     5846                       ". ${cmt%stempfile}\n"
    57945847                       "if test $? != 0 ; then\n"
    57955848                       "  cmtsetupstatus=2\n"
    57965849                       "fi\n"
    5797                        "/bin/rm -f ${tempfile}\n"
     5850                       "/bin/rm -f ${cmt%stempfile}\n"
     5851                       "unset cmt%stempfile\n"
    57985852                       "return $cmtsetupstatus\n",
    57995853                       suffix[i].c_str (),
    58005854                       Me.m_current_path.c_str (),
    5801                        no_cleanup_opt.c_str ());
     5855                       no_cleanup_opt.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str (), mangled_package.c_str ());
    58025856            }
    5803           else
     5857          else if (mode[i] == Bat)
    58045858            {
    58055859              fprintf (f, "rem Setting standalone package\n");
    58065860              dos_script_prefix (f, Me.m_cmt_root,
    5807                                  "cmt_standalone", "", Me.m_current_path,
     5861                                 "cmt_standalone", "cmt_standalone", "", Me.m_current_path,
    58085862                                 "setup", no_cleanup_opt);
    58095863            }
Note: See TracChangeset for help on using the changeset viewer.