Changeset 363 for CMT


Ignore:
Timestamp:
Feb 1, 2007, 3:12:40 PM (18 years ago)
Author:
garonne
Message:

see C.L 322

Location:
CMT/HEAD
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/ChangeLog

    r360 r363  
    1 
     12007-01-02 Vincent Garonne <garonne@lal.in2p3.fr> 322
     2
     3        * source/cmt_parser.cxx:  update to deal with the action return status code
     4         and the -no_auto_imports differents cases.
     5        * source/cmt_constituents.cxx: Add support for the -import=PkgA, PkgB
     6        * source/cmt_error.*: update to deal with the action return status code
     7        * source/cmt.cxx: return status code   
     8       
    292007-31-01 Vincent Garonne <garonne@lal.in2p3.fr> 321
    310
  • CMT/HEAD/source/cmt.cxx

    r11 r363  
    22// Copyright Christian Arnault LAL-Orsay CNRS
    33// arnault@lal.in2p3.fr
     4// Modified by garonne@lal.in2p3.fr
    45// See the complete license in cmt_license.txt "http://www.cecill.info".
    56//-----------------------------------------------------------
    67
    78#include "cmt.h"
     9
     10#include <stdlib.h>
    811
    912/*----------------------------------------------------------*/
     
    1215{
    1316   //cout << "argc=" << argc << endl;
    14 
    1517  int status = Cmt::parser (argc, argv);
    16 
     18  if (status !=0) return -1;
    1719  return (status);
    1820}
  • CMT/HEAD/source/cmt_constituent.cxx

    r11 r363  
    22// Copyright Christian Arnault LAL-Orsay CNRS
    33// arnault@lal.in2p3.fr
     4// Modified by garonne@lal.in2p3.fr
    45// See the complete license in cmt_license.txt "http://www.cecill.info".
    56//-----------------------------------------------------------
     
    210211      }
    211212    else if (w.substr (0, 8) == "-import=")
    212       {
    213         cmt_string& import = m_constituent.imports.add ();
    214         w.substr (8, import);
     213      {       
     214            cmt_string text_imports;
     215            w.substr (8, text_imports);
     216
     217            CmtSystem::cmt_string_vector imports;
     218
     219            CmtSystem::split (text_imports, ',', imports);
     220
     221            for (int i = 0; i < imports.size (); i++)
     222            {
     223                cmt_string& import = m_constituent.imports.add ();
     224                import             = imports[i] ;
     225            }       
    215226      }
    216227    else if (w.substr (0, 7) == "-group=")
     
    235246    else if (w.substr (0, 1) == "-")
    236247      {
    237         if (!Cmt::get_quiet ())
    238           {
     248           //if (!Cmt::get_quiet ())
     249           //{
    239250            cerr << "#CMT> Warning: bad option "
    240251                 << w << " in constituent " << m_constituent.name << endl;
    241252            //CmtError::set (CmtError::execution_error, cmd);
    242           }
     253           //}
    243254      }
    244255    else if ((equal = w.find ("=")) != cmt_string::npos)
  • CMT/HEAD/source/cmt_error.cxx

    r11 r363  
    22// Copyright Christian Arnault LAL-Orsay CNRS
    33// arnault@lal.in2p3.fr
     4// Modified by garonne@lal.in2p3.fr
    45// See the complete license in cmt_license.txt "http://www.cecill.info".
    56//-----------------------------------------------------------
     
    3536    error_names.add() = "unknown_command";
    3637    error_names.add() = "project_release_conflict";
     38    error_names.add() = "execution_failed";
     39    m_execution_error = 0;
    3740  }
    3841
     
    4548    m_code = CmtError::ok;
    4649    m_text = "";
     50    m_execution_error = 0 ;
    4751  }
    4852
    49   void set (CmtError::code code, const cmt_string& text)
     53  void set (CmtError::code code, const cmt_string& text, const int execution_error)
    5054  {
    5155    m_code = code;
    5256    m_text = text;
     57    m_execution_error = execution_error;
    5358  }
    5459
     
    5661  {
    5762    return (m_code);
     63  }
     64
     65  int get_last_execution_error ()
     66  {
     67      return m_execution_error;
    5868  }
    5969
     
    7484  cmt_string m_text;
    7585  cmt_vector<cmt_string> error_names;
     86  int m_execution_error;
    7687};
    7788
     
    110121
    111122//---------------------------------------------------------------
     123int CmtError::get_last_execution_error ()
     124{
     125  Error& e = Error::instance ();
     126
     127  return (e.get_last_execution_error ());
     128}
     129
     130//---------------------------------------------------------------
    112131const cmt_string& CmtError::get_error_name (code error)
    113132{
     
    118137
    119138//---------------------------------------------------------------
    120 void CmtError::set (code error, const cmt_string& text)
     139void CmtError::set (code error, const cmt_string& text, const int execution_error)
    121140{
    122141  Error& e = Error::instance ();
    123142
    124   e.set (error, text);
     143  e.set (error, text, execution_error);
    125144}
    126145
  • CMT/HEAD/source/cmt_error.h

    r11 r363  
    22// Copyright Christian Arnault LAL-Orsay CNRS
    33// arnault@lal.in2p3.fr
     4// Modified by garonne@lal.in2p3.fr
    45// See the complete license in cmt_license.txt "http://www.cecill.info".
    56//-----------------------------------------------------------
     
    3536    cannot_remove_lock,
    3637    conflicting_lock,
    37     unknown_command,
    38     project_release_conflict
     38    unknown_command,   
     39    project_release_conflict,
     40    execution_failed
    3941  } code;
    40 
     42 
     43 
    4144  static void clear ();
    4245  static code get_last_error_code ();
    4346  static bool has_pending_error ();
    4447  static const cmt_string& get_error_name (code error);
    45   static void set (code error, const cmt_string& text);
     48  static void set (code error, const cmt_string& text, const int execution_error=0);
     49
     50  static int get_last_execution_error ();
     51
    4652  static cmt_string get_last_error ();
    4753  static void print ();
     54   
    4855};
    4956
  • CMT/HEAD/source/cmt_parser.cxx

    r335 r363  
    27342734      cout << "Execute action " << ap.arguments[0] << " => " << cmd << endl;
    27352735
    2736       CmtSystem::execute (cmd);
     2736      int status = CmtSystem::execute (cmd);
     2737      if (status != 0)
     2738        CmtError::set (CmtError::execution_failed, ap.arguments[0], status);
     2739     
    27372740    }
    27382741}
     
    57635766  if (CmtError::has_pending_error ())
    57645767    {
    5765       int code = CmtError::get_last_error_code ();
     5768      int code = CmtError::get_last_error_code ();     
     5769      if (code == CmtError::execution_failed)
     5770      {
     5771          code = CmtError::get_last_execution_error();
     5772      }   
     5773     
    57665774      if (!Me.m_quiet) CmtError::print ();
    57675775      clear ();
     
    71547162                    if (u->discarded) continue;
    71557163
    7156                     Package* p = u->get_package ();
    7157                     if (p->is_cmt ()) continue;
     7164                            Package* p = u->get_package ();
     7165                            if (p->is_cmt ()) continue;
    71587166                   
    71597167                    u->fill_macro (buffer, "linkopts");
     
    71977205           
    71987206                if (u->discarded) continue;
    7199 
     7207               
    72007208                if (Cmt::get_debug ())
    72017209                  {
     
    72267234        for (i = 0; i < base_auto_imports_states.size (); i++)
    72277235          {
    7228             if (auto_imports_states[i] != base_auto_imports_states[i])
    7229               {
     7236           
     7237            if (base_auto_imports_states[i]== On && auto_imports_states[i] == Off)
     7238               continue;
     7239           
     7240            //if (auto_imports_states[i] != base_auto_imports_states[i])
     7241            //  {
    72307242                Use* u = Uses[i];
    72317243
    72327244                if (u->discarded) continue;
    7233 
    7234                 Package* p = u->get_package ();
    7235                 if (p->is_cmt ()) continue;
     7245                if (u->m_hidden)  continue;
     7246
     7247                        Package* p = u->get_package ();
     7248                        if (p->is_cmt ()) continue;
    72367249
    72377250                if (Cmt::get_debug ())
     
    72407253                  }
    72417254
    7242                 if (u->auto_imports != Off) continue;
     7255                //if (u->auto_imports != Off) continue;
    72437256
    72447257                imports.push_back (u);
    7245               }
     7258             // }
    72467259          }
    72477260       
Note: See TracChangeset for help on using the changeset viewer.