Ignore:
Timestamp:
Nov 20, 2009, 10:45:54 AM (15 years ago)
Author:
rybkin
Message:

See C.L. 414

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/source/cmt_parser.cxx

    r525 r527  
    25052505  //  configure_current_package ();
    25062506
    2507   Generator::build_default_makefile ();
     2507  //  Generator::build_default_makefile ();
    25082508
    25092509  CmtSystem::cmt_string_vector makes;
     
    25812581  install_cleanup_scripts ();
    25822582  install_native_version_file ();
     2583
     2584  Generator::build_default_makefile ();
    25832585
    25842586  CmtSystem::cd ("..");
     
    31993201  if (!CmtSystem::test_file (input))
    32003202    {
    3201       CmtMessage::error ("File " + input + " not found");
    3202       //      cerr << "#CMT> File " << input << " not found" << endl;
     3203      CmtError::set (CmtError::path_not_found, input);
     3204      //      CmtMessage::error ("File " + input + " not found");
    32033205      return;
    32043206    }
     
    32133215
    32143216  FILE* file = fopen (output, "wb");
    3215   if (file == NULL)
    3216     {
    3217       CmtMessage::error ("Cannot write filtered file " + output);
    3218       //      cerr << "#CMT> Cannot write filtered file " << output << endl;
     3217  if (file != NULL)
     3218    {
     3219      text.write (file);
     3220      CmtSystem::close_ostream (file, output);
     3221      //      fclose (file);
    32193222    }
    32203223  else
    32213224    {
    3222       text.write (file);
    3223       fclose (file);
     3225      CmtError::set (CmtError::file_access_error, output);
     3226      //      CmtMessage::error ("Cannot write filtered file " + output);
    32243227    }
    32253228}
     
    48124815              fprintf (f, "if $status != 0 then\n  set tempfile=/tmp/cmt.$$\nendif\n");
    48134816              fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s "
    4814                        "-pack=%s -version=%s -path=%s $* >${tempfile}; "
    4815                        "source ${tempfile}\n",
     4817                       "-pack=%s -version=%s -path=%s $* >${tempfile}\n",
    48164818                       suffix[i].c_str (),
    48174819                       Me.m_current_package.c_str (),
    48184820                       version.c_str (),
    48194821                       Me.m_current_path.c_str ());
    4820               fprintf (f, "/bin/rm -f ${tempfile}\n");
     4822              fprintf (f,
     4823                       "if ( $status == 0 ) then\n"
     4824                       "  source ${tempfile}\n"
     4825                       "  /bin/rm -f ${tempfile}\n"
     4826                       "else\n"
     4827                       "  echo \"${CMTROOT}/mgr/cmt cleanup -%s "
     4828                       "-pack=%s -version=%s -path=%s $* >${tempfile}\"\n"
     4829                       "  /bin/rm -f ${tempfile}\n"
     4830                       "  false\n"
     4831                       "endif\n",
     4832                       suffix[i].c_str (),
     4833                       Me.m_current_package.c_str (),
     4834                       version.c_str (),
     4835                       Me.m_current_path.c_str ());
    48214836            }
    48224837          else if (mode[i] == Sh)
     
    48294844              fprintf (f, "if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi\n");
    48304845              fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s "
    4831                        "-pack=%s -version=%s -path=%s $* >${tempfile}; "
    4832                        ". ${tempfile}\n",
     4846                       "-pack=%s -version=%s -path=%s $* >${tempfile}\n",
    48334847                       suffix[i].c_str (),
    48344848                       Me.m_current_package.c_str (),
    48354849                       version.c_str (),
    48364850                       Me.m_current_path.c_str ());
    4837               fprintf (f, "/bin/rm -f ${tempfile}\n");
     4851              fprintf (f,
     4852                       "if test $? = 0 ; then\n"
     4853                       "  . ${tempfile}\n"
     4854                       "  /bin/rm -f ${tempfile}\n"
     4855                       "else\n"
     4856                       "  echo >&2 \"${CMTROOT}/mgr/cmt cleanup -%s "
     4857                       "-pack=%s -version=%s -path=%s $* >${tempfile}\"\n"
     4858                       "  /bin/rm -f ${tempfile}\n"
     4859                       "  false\n"
     4860                       "fi\n",
     4861                       suffix[i].c_str (),
     4862                       Me.m_current_package.c_str (),
     4863                       version.c_str (),
     4864                       Me.m_current_path.c_str ());
    48384865            }
    48394866          else if (mode[i] == Bat)
     
    48464873          fprintf (f, "\n");
    48474874
    4848           fclose (f);
     4875          CmtSystem::close_ostream (f, file_name);
     4876          //          fclose (f);
    48494877
    48504878          cmt_string old_file_name = "cleanup";
     
    48544882          CmtSystem::compare_and_update_files (file_name, old_file_name);
    48554883        }
     4884      else
     4885        {
     4886          CmtError::set (CmtError::file_access_error, file_name);
     4887        }
    48564888    }
    48574889}
     
    49324964              fprintf (f, "if $status != 0 then\n  set tempfile=/tmp/cmt.$$\nendif\n");
    49334965              fprintf (f, "${CMTROOT}/mgr/cmt setup -%s "
    4934                        "-pack=%s -version=%s -path=%s %s $* >${tempfile}; "
    4935                        "source ${tempfile}\n",
     4966                       "-pack=%s -version=%s -path=%s %s $* >${tempfile}\n",
    49364967                       suffix[i].c_str (),
    49374968                       Me.m_current_package.c_str (),
     
    49394970                       Me.m_current_path.c_str (),
    49404971                       no_cleanup_opt.c_str ());
    4941               fprintf (f, "/bin/rm -f ${tempfile}\n");
     4972              fprintf (f,
     4973                       "if ( $status == 0 ) then\n"
     4974                       "  source ${tempfile}\n"
     4975                       "  /bin/rm -f ${tempfile}\n"
     4976                       "else\n"
     4977                       "  echo \"${CMTROOT}/mgr/cmt setup -%s "
     4978                       "-pack=%s -version=%s -path=%s %s $* >${tempfile}\"\n"
     4979                       "  /bin/rm -f ${tempfile}\n"
     4980                       "  false\n"
     4981                       "endif\n",
     4982                       suffix[i].c_str (),
     4983                       Me.m_current_package.c_str (),
     4984                       version.c_str (),
     4985                       Me.m_current_path.c_str (),
     4986                       no_cleanup_opt.c_str ());
    49424987            }
    49434988          else if (mode[i] == Sh)
     
    49575002              fprintf (f, "if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi\n");
    49585003              fprintf (f, "${CMTROOT}/mgr/cmt setup -%s "
    4959                        "-pack=%s -version=%s -path=%s %s $* >${tempfile}; "
    4960                        ". ${tempfile}\n",
     5004                       "-pack=%s -version=%s -path=%s %s $* >${tempfile}\n",
    49615005                       suffix[i].c_str (),
    49625006                       Me.m_current_package.c_str (),
     
    49645008                       Me.m_current_path.c_str (),
    49655009                       no_cleanup_opt.c_str ());
    4966               fprintf (f, "/bin/rm -f ${tempfile}\n");
     5010              fprintf (f,
     5011                       "if test $? = 0 ; then\n"
     5012                       "  . ${tempfile}\n"
     5013                       "  /bin/rm -f ${tempfile}\n"
     5014                       "else\n"
     5015                       "  echo >&2 \"${CMTROOT}/mgr/cmt setup -%s "
     5016                       "-pack=%s -version=%s -path=%s %s $* >${tempfile}\"\n"
     5017                       "  /bin/rm -f ${tempfile}\n"
     5018                       "  false\n"
     5019                       "fi\n",
     5020                       suffix[i].c_str (),
     5021                       Me.m_current_package.c_str (),
     5022                       version.c_str (),
     5023                       Me.m_current_path.c_str (),
     5024                       no_cleanup_opt.c_str ());
    49675025            }
    49685026          else if (mode[i] == Bat)
     
    49785036          fprintf (f, "\n");
    49795037
    4980           fclose (f);
     5038          CmtSystem::close_ostream (f, file_name);
     5039          //          fclose (f);
    49815040
    49825041          cmt_string old_file_name = "setup";
     
    49865045          CmtSystem::compare_and_update_files (file_name, old_file_name);
    49875046        }
     5047      else
     5048        {
     5049          CmtError::set (CmtError::file_access_error, file_name);
     5050        }
    49885051    }
    49895052}
     
    50495112              fprintf (f, "set tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
    50505113              fprintf (f, "if $status != 0 then\n  set tempfile=/tmp/cmt.$$\nendif\n");
    5051               fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s -pack=cmt_standalone -path=%s $* >${tempfile}; "
    5052                        "source ${tempfile}\n",
     5114              fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s -pack=cmt_standalone -path=%s $* >${tempfile}\n",
    50535115                       suffix[i].c_str (),
    50545116                       Me.m_current_path.c_str ());
    5055               fprintf (f, "/bin/rm -f ${tempfile}\n");
     5117              fprintf (f,
     5118                       "if ( $status == 0 ) then\n"
     5119                       "  source ${tempfile}\n"
     5120                       "  /bin/rm -f ${tempfile}\n"
     5121                       "else\n"
     5122                       "  echo \"${CMTROOT}/mgr/cmt cleanup -%s -pack=cmt_standalone -path=%s $* >${tempfile}\"\n"
     5123                       "  /bin/rm -f ${tempfile}\n"
     5124                       "  false\n"
     5125                       "endif\n",
     5126                       suffix[i].c_str (),
     5127                       Me.m_current_path.c_str ());
    50565128            }
    50575129          else if (mode[i] == Sh)
     
    50635135              fprintf (f, "tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
    50645136              fprintf (f, "if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi\n");
    5065               fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s -pack=cmt_standalone -path=%s $* >${tempfile}; "
    5066                        ". ${tempfile}\n",
     5137              fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s -pack=cmt_standalone -path=%s $* >${tempfile}\n",
    50675138                       suffix[i].c_str (),
    50685139                       Me.m_current_path.c_str ());
    5069               fprintf (f, "/bin/rm -f ${tempfile}\n");
     5140              fprintf (f,
     5141                       "if test $? = 0 ; then\n"
     5142                       "  . ${tempfile}\n"
     5143                       "  /bin/rm -f ${tempfile}\n"
     5144                       "else\n"
     5145                       "  echo >&2 \"${CMTROOT}/mgr/cmt cleanup -%s -pack=cmt_standalone -path=%s $* >${tempfile}\"\n"
     5146                       "  /bin/rm -f ${tempfile}\n"
     5147                       "  false\n"
     5148                       "fi\n",
     5149                       suffix[i].c_str (),
     5150                       Me.m_current_path.c_str ());
    50705151            }
    50715152          else
     
    50785159          fprintf (f, "\n");
    50795160
    5080           fclose (f);
     5161          CmtSystem::close_ostream (f, file_name);
     5162          //          fclose (f);
    50815163
    50825164          cmt_string old_file_name = "cleanup";
     
    50865168          CmtSystem::compare_and_update_files (file_name, old_file_name);
    50875169        }
     5170      else
     5171        {
     5172          CmtError::set (CmtError::file_access_error, file_name);
     5173        }
    50885174    }
    50895175}
     
    51045190            cerr << "Creating native_version file." << endl;   
    51055191
    5106           FILE* f = fopen ("new.native_version.cmt", "wb");
    5107 
     5192          cmt_string file_name ("new.native_version.cmt");
     5193          FILE* f = fopen (file_name.c_str (), "wb");
    51085194          if (f != NULL)
    51095195            {
    51105196              fprintf (f, "%s\n", value.c_str ());
     5197              CmtSystem::close_ostream (f, file_name);
     5198              //          fclose (f);
     5199             
     5200              CmtSystem::compare_and_update_files ("new.native_version.cmt", "native_version.cmt");
    51115201            }     
    5112 
    5113           fclose (f);
    5114 
    5115           CmtSystem::compare_and_update_files ("new.native_version.cmt", "native_version.cmt");
     5202          else
     5203            {
     5204              CmtError::set (CmtError::file_access_error, file_name);
     5205            }
    51165206        }
    51175207    }   
     
    51845274              fprintf (f, "set tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
    51855275              fprintf (f, "if $status != 0 then\n  set tempfile=/tmp/cmt.$$\nendif\n");
    5186               fprintf (f, "${CMTROOT}/mgr/cmt setup -%s -pack=cmt_standalone -path=%s %s $* >${tempfile}; "
    5187                        "source ${tempfile}\n",
     5276              fprintf (f, "${CMTROOT}/mgr/cmt setup -%s -pack=cmt_standalone -path=%s %s $* >${tempfile}\n",
    51885277                       suffix[i].c_str (),
    51895278                       Me.m_current_path.c_str (),
    51905279                       no_cleanup_opt.c_str ());
    5191               fprintf (f, "/bin/rm -f ${tempfile}\n");
     5280              fprintf (f,
     5281                       "if ( $status == 0 ) then\n"
     5282                       "  source ${tempfile}\n"
     5283                       "  /bin/rm -f ${tempfile}\n"
     5284                       "else\n"
     5285                       "  echo \"${CMTROOT}/mgr/cmt setup -%s -pack=cmt_standalone -path=%s %s $* >${tempfile}\"\n"
     5286                       "  /bin/rm -f ${tempfile}\n"
     5287                       "  false\n"
     5288                       "endif\n",
     5289                       suffix[i].c_str (),
     5290                       Me.m_current_path.c_str (),
     5291                       no_cleanup_opt.c_str ());
    51925292            }
    51935293          else if (mode[i] == Sh)
     
    52035303              fprintf (f, "tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
    52045304              fprintf (f, "if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi\n");
    5205               fprintf (f, "${CMTROOT}/mgr/cmt setup -%s -pack=cmt_standalone -path=%s %s $* >${tempfile}; "
    5206                        ". ${tempfile}\n",
     5305              fprintf (f, "${CMTROOT}/mgr/cmt setup -%s -pack=cmt_standalone -path=%s %s $* >${tempfile}\n",
    52075306                       suffix[i].c_str (),
    52085307                       Me.m_current_path.c_str (),
    52095308                       no_cleanup_opt.c_str ());
    5210               fprintf (f, "/bin/rm -f ${tempfile}\n");
     5309              fprintf (f,
     5310                       "if test $? = 0 ; then\n"
     5311                       "  . ${tempfile}\n"
     5312                       "  /bin/rm -f ${tempfile}\n"
     5313                       "else\n"
     5314                       "  echo >&2 \"${CMTROOT}/mgr/cmt setup -%s -pack=cmt_standalone -path=%s %s $* >${tempfile}\"\n"
     5315                       "  /bin/rm -f ${tempfile}\n"
     5316                       "  false\n"
     5317                       "fi\n",
     5318                       suffix[i].c_str (),
     5319                       Me.m_current_path.c_str (),
     5320                       no_cleanup_opt.c_str ());
    52115321            }
    52125322          else
     
    52205330          fprintf (f, "\n");
    52215331
    5222           fclose (f);
     5332          CmtSystem::close_ostream (f, file_name);
     5333          //          fclose (f);
    52235334
    52245335          cmt_string old_file_name = "setup";
     
    52285339          CmtSystem::compare_and_update_files (file_name, old_file_name);
    52295340        }
     5341      else
     5342        {
     5343          CmtError::set (CmtError::file_access_error, file_name);
     5344        }
    52305345    }
    52315346}
     
    56235738    {
    56245739      int code = CmtError::get_last_error_code ();
    5625       if (!Me.m_quiet) CmtError::print ();
     5740      CmtError::print ();
     5741      //      if (!Me.m_quiet) CmtError::print ();
    56265742      clear ();
    56275743
     
    63966512        }   
    63976513     
    6398       if (!Me.m_quiet) CmtError::print ();
     6514      CmtError::print ();
     6515      //      if (!Me.m_quiet) CmtError::print ();
    63996516      clear ();
    64006517      return (code);
Note: See TracChangeset for help on using the changeset viewer.