Changeset 43 for CMT


Ignore:
Timestamp:
Apr 26, 2005, 11:37:39 AM (19 years ago)
Author:
arnault
Message:

Improvements for cmt cvs operations WRT projects - See CL 271

Location:
CMT/HEAD
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/ChangeLog

    r42 r43  
     12005-04-26  Christian Arnault  <arnault@lal.in2p3.fr> 271
     2
     3        * source/cmt_cvs.cxx: Add recursive passes for cvs co -R on projects (not completed)
     4        Add support/checking of protocol level against CVS pluggin
     5        Detection of non-installation of the CVS pluggin
     6
     7        * mgr/requirements: Add a macro cmt_cvs_protocol_level to specify
     8        the expected protocol level with the CVS pluggin
     9
    1102005-04-25    <arnault@lal.in2p3.fr> 270
    211
  • CMT/HEAD/mgr/cmt_dependencies.make

    r19 r43  
    1717cmt_pattern_cxx_dependencies =  ../source/cmt_pattern.cxx   ../source/cmt_std.h   ../source/cmt_string.h   ../source/cmt_vector.h   ../source/cmt_parser.h   ../source/cmt_regexp.h   ../source/cmt_system.h   ../source/cmt.h   ../source/cmt_map.h   ../source/cmt_pattern.h   ../source/cmt_include.h   ../source/cmt_script.h   ../source/cmt_scope_section.h   ../source/cmt_use.h   ../source/cmt_branch.h   ../source/cmt_fragment.h   ../source/cmt_group.h   ../source/cmt_constituent.h   ../source/cmt_language.h   ../source/cmt_tag.h   ../source/cmt_symbol.h   ../source/cmt_awk.h   ../source/cmt_project.h   ../source/cmt_cmtpath_pattern.h   ../source/cmt_database.h   ../source/cmt_error.h   ../source/cmt_syntax.h
    1818cmt_language_cxx_dependencies =  ../source/cmt_language.cxx   ../source/cmt_std.h   ../source/cmt_string.h   ../source/cmt_vector.h   ../source/cmt_regexp.h   ../source/cmt_system.h   ../source/cmt.h   ../source/cmt_parser.h   ../source/cmt_fragment.h   ../source/cmt_language.h   ../source/cmt_branch.h   ../source/cmt_group.h   ../source/cmt_constituent.h   ../source/cmt_map.h   ../source/cmt_pattern.h   ../source/cmt_include.h   ../source/cmt_script.h   ../source/cmt_scope_section.h   ../source/cmt_use.h   ../source/cmt_tag.h   ../source/cmt_symbol.h   ../source/cmt_awk.h   ../source/cmt_project.h   ../source/cmt_cmtpath_pattern.h   ../source/cmt_database.h
    19 cmt_cvs_cxx_dependencies =  ../source/cmt_cvs.cxx   ../source/cmt_std.h   ../source/cmt_string.h   ../source/cmt_vector.h   ../source/cmt_parser.h   ../source/cmt_regexp.h   ../source/cmt_system.h   ../source/cmt.h   ../source/cmt_cvs.h   ../source/cmt_awk.h
     19cmt_cvs_cxx_dependencies =  ../source/cmt_cvs.cxx   ../source/cmt_std.h   ../source/cmt_string.h   ../source/cmt_vector.h   ../source/cmt_parser.h   ../source/cmt_regexp.h   ../source/cmt_system.h   ../source/cmt.h   ../source/cmt_cvs.h   ../source/cmt_awk.h   ../source/cmt_map.h   ../source/cmt_include.h   ../source/cmt_script.h   ../source/cmt_pattern.h   ../source/cmt_scope_section.h   ../source/cmt_use.h   ../source/cmt_tag.h   ../source/cmt_symbol.h
    2020cmt_group_cxx_dependencies =  ../source/cmt_group.cxx   ../source/cmt_std.h   ../source/cmt_string.h   ../source/cmt_vector.h   ../source/cmt_regexp.h   ../source/cmt_system.h   ../source/cmt.h   ../source/cmt_parser.h   ../source/cmt_group.h   ../source/cmt_branch.h   ../source/cmt_fragment.h   ../source/cmt_constituent.h   ../source/cmt_language.h   ../source/cmt_map.h   ../source/cmt_pattern.h   ../source/cmt_include.h   ../source/cmt_script.h   ../source/cmt_scope_section.h   ../source/cmt_use.h   ../source/cmt_tag.h   ../source/cmt_symbol.h   ../source/cmt_awk.h   ../source/cmt_project.h   ../source/cmt_cmtpath_pattern.h   ../source/cmt_database.h
    2121cmt_database_cxx_dependencies =  ../source/cmt_database.cxx   ../source/cmt_vector.h   ../source/cmt_std.h   ../source/cmt_string.h   ../source/cmt_regexp.h   ../source/cmt_system.h   ../source/cmt.h   ../source/cmt_parser.h   ../source/cmt_branch.h   ../source/cmt_fragment.h   ../source/cmt_group.h   ../source/cmt_constituent.h   ../source/cmt_language.h   ../source/cmt_map.h   ../source/cmt_pattern.h   ../source/cmt_include.h   ../source/cmt_script.h   ../source/cmt_scope_section.h   ../source/cmt_use.h   ../source/cmt_tag.h   ../source/cmt_symbol.h   ../source/cmt_awk.h   ../source/cmt_project.h   ../source/cmt_cmtpath_pattern.h   ../source/cmt_database.h
  • CMT/HEAD/mgr/requirements

    r33 r43  
    638638language yacc    -suffix=y -prototypes -linker=$(clink)
    639639language lex     -suffix=l -prototypes -linker=$(clink)
     640
     641#
     642# Protocol level for the CVS pluggin
     643#
     644
     645macro cmt_cvs_protocol_level "v1r1"
    640646
    641647#
  • CMT/HEAD/source/cmt_cvs.cxx

    r42 r43  
    1111#include "cmt_cvs.h"
    1212#include "cmt_awk.h"
     13#include "cmt_symbol.h"
    1314
    1415/**
     
    116117public:
    117118  RecursivePass2 (CvsImplementation& cvs);
     119  void begin ();
     120  void filter (const cmt_string& line);
     121
     122private:
     123  CvsImplementation& m_cvs;
     124};
     125
     126/**
     127
     128     RecursivePass3 : simply validate use statements in a project file
     129                      and echo those that really need to be handled.
     130
     131 */
     132class RecursivePass3 : public Awk
     133{
     134public:
     135
     136  void begin ();
     137  void filter (const cmt_string& line);
     138  const cmt_string& result () const;
     139
     140private:
     141  cmt_string m_result;
     142  bool m_first;
     143};
     144
     145/**
     146
     147     RecursivePass4 : after filtering the use statements really perform the
     148                      project checkouts.
     149
     150 */
     151class CvsImplementation;
     152class RecursivePass4 : public Awk
     153{
     154public:
     155  RecursivePass4 (CvsImplementation& cvs);
    118156  void begin ();
    119157  void filter (const cmt_string& line);
     
    157195    subpackages_info = "";
    158196    subprojects_info = "";
     197
     198    m_protocol_level = "";
     199
     200    Symbol* symbol = Symbol::find ("cmt_cvs_protocol_level");
     201    if (symbol != 0)
     202      {
     203        m_protocol_level = symbol->build_macro_value ();
     204        Symbol::expand (m_protocol_level);
     205      }
    159206  }
    160207
     
    179226          }
    180227      }
     228
     229  /**
     230     This function will check the protocol level with the CVS pluggin.
     231     The expected level is defined in a macro (in the requirements file of CMT)
     232     The protocol level characterizes the structure of the message received from the CVS pluggin
     233     and depends on its version.
     234
     235     In order to know if the pluggin is installed AND if the support for this version is
     236     installed, we checkout CVSROOT/loginfo which should contain entries with selection patterns
     237
     238     .cmtcvsinfos/<protocol_level>
     239
     240     However old versions only offer as pattern:
     241
     242     .cmtcvsinfos/
     243
     244     In this function we'll detect if the effective protocol level satisifies the
     245     level expected for this release of CMT
     246   */
     247  bool check_protocol ()
     248  {
     249    static bool done = false;
     250    static bool found = true;
     251
     252    if (done) return (found);
     253    done = true;
     254
     255    cmt_string cvsroot;
     256       
     257    CmtSystem::get_cvsroot (cvsroot);
     258       
     259    cmt_string command;
     260       
     261    command = "cvs";
     262    if (cvsroot != "")
     263      {
     264        command += " -d ";
     265        command += cvsroot;
     266      }
     267    command += " -Q co -p CVSROOT/loginfo ";
     268
     269    if (m_verbose || m_simulation)
     270      {
     271        cout << "#CMT> Executing [" << command << "]" << endl;
     272      }
     273   
     274    if (!m_simulation)
     275      {
     276        found = false;
     277
     278        cmt_string loginfo;
     279
     280        CmtSystem::execute (command, loginfo);
     281
     282        cmt_string pattern = ".cmtcvsinfos/";
     283        pattern += m_protocol_level;
     284
     285        int pos = loginfo.find (pattern);
     286
     287        if (pos != cmt_string::npos)
     288          {
     289            found = true;
     290          }
     291      }
     292
     293    if (m_verbose)
     294      {
     295        if (found)
     296          {
     297            cout << "#CMT> Protocol level " << m_protocol_level << endl;
     298          }
     299        else
     300          {
     301            cout << "#CMT> The CVS pluggin is not installed or is not at protocol level " << m_protocol_level << endl;
     302          }
     303      }
     304   
     305    return (found);
     306  }
     307
     308  void retreive_cvs_infos (const cmt_string& module)
     309  {
     310    static const cmt_string cmtcvsinfos = ".cmtcvsinfos";
     311
     312    cmt_string home_dir = CmtSystem::pwd ();
     313       
     314    //
     315    // Activities related with .cmtcvsinfos will occur in a temporary directory
     316    //
     317    cmt_string tmp_dir = CmtSystem::getenv ("TMPDIR");
     318    if (tmp_dir == "")
     319      {
     320        tmp_dir = CmtSystem::file_separator ();
     321        tmp_dir += "tmp";
     322      }
     323   
     324    if (!CmtSystem::cd (tmp_dir))
     325      {
     326        tmp_dir = home_dir;
     327      }
     328   
     329    tmp_dir += CmtSystem::file_separator ();
     330    tmp_dir += "cmtcvs";
     331    {
     332      cmt_string temp = CmtSystem::get_temporary_name ();
     333      CmtSystem::basename (temp, temp);
     334      temp.replace_all (".", "");
     335      tmp_dir += temp;
     336    }
     337   
     338    if (!CmtSystem::test_directory (tmp_dir))
     339      {
     340        if (!CmtSystem::mkdir (tmp_dir))
     341          {
     342            cout << "#CMT> Cannot create the temporary directory ["
     343                 << tmp_dir << "]" << endl;
     344            return;
     345          }
     346      }
     347   
     348    //trap "rm -rf ${tmp_dir}" 0 1 2 15
     349   
     350    if (!CmtSystem::cd (tmp_dir))
     351      {
     352        cout << "#CMT> Cannot move to the temporary directory " << tmp_dir << endl;
     353       
     354        if (m_verbose)
     355          {
     356            cout << "#CMT> now removing tmp_dir " << tmp_dir << " home=" << home_dir << endl;
     357          }
     358       
     359        CmtSystem::remove_directory (tmp_dir);
     360       
     361        return;
     362      }
     363   
     364    if (m_verbose)
     365      {
     366        cout << "#CMT> cvs infos are now obtained from the temporary directory " << CmtSystem::pwd () << endl; 
     367      }
     368   
     369    /*
     370      #
     371      # The script associated to such entries is supposed to :
     372      #  1) extract the set of <infos> from the ${module}/cmt/requirements file
     373      #  2) build an output of the form :
     374      #      <infos>=info1 info2 info3 ...
     375      #
     376      # Currently this script can be found in
     377      #
     378      # ${CMTROOT}/cmt/cmt_buildcvsinfos2.sh
     379      # %CMTROOT%/cmt/cmt_buildcvsinfos.py
     380      #
     381    */
     382   
     383    if (!CmtSystem::test_directory (cmtcvsinfos))
     384      {
     385        CmtSystem::mkdir (cmtcvsinfos);
     386      }
     387   
     388    CmtSystem::cd (cmtcvsinfos);
     389   
     390    cmt_string cvsroot;
     391   
     392    CmtSystem::get_cvsroot (cvsroot);
     393   
     394    cmt_string command;
     395   
     396    command = "cvs";
     397    if (cvsroot != "")
     398      {
     399        command += " -d ";
     400        command += cvsroot;
     401      }
     402    command += " -Q import -m cmt ";
     403   
     404    command += cmtcvsinfos;
     405   
     406    if (m_cmtcvstest)
     407      {
     408        command += "/cmtcvstest";
     409      }
     410   
     411    if (m_protocol_level != "")
     412      {
     413        command += "/";
     414        command += m_protocol_level;
     415      }
     416    command += "/";
     417    command += module;
     418    command += " CMT v1";
     419   
     420    if (m_verbose || m_simulation)
     421      {
     422        cout << "#CMT> Executing [" << command << "]" << endl;
     423      }
     424   
     425    m_last_cvs_infos = "";
     426    CmtSystem::execute (command, m_last_cvs_infos);
     427   
     428    if (m_verbose)
     429      {
     430        cout << "#CMT> now removing tmp_dir " << tmp_dir << " home=" << home_dir << endl;
     431      }
     432   
     433    CmtSystem::cd (home_dir);
     434    CmtSystem::remove_directory (tmp_dir);     
     435  }
    181436
    182437    //
     
    205460  void show_cvs_infos (const cmt_string& module)
    206461  {
    207     static const cmt_string cmtcvsinfos = ".cmtcvsinfos";
    208     static const cmt_string protocol_level = "/v1r1";
     462    if (!check_protocol ())
     463      {
     464        cout << "#CMT> The CVS pluggin is not installed or is not at protocol level " << m_protocol_level << endl;
     465        return;
     466      }
    209467
    210468    if (module == "")
     
    225483        m_last_module = module;
    226484       
    227         cmt_string home_dir = CmtSystem::pwd ();
    228        
    229         //
    230         // Activities related with .cmtcvsinfos will occur in a temporary directory
    231         //
    232         cmt_string tmp_dir = CmtSystem::getenv ("TMPDIR");
    233         if (tmp_dir == "")
    234           {
    235             tmp_dir = CmtSystem::file_separator ();
    236             tmp_dir += "tmp";
    237           }
    238        
    239         if (!CmtSystem::cd (tmp_dir))
    240           {
    241             tmp_dir = home_dir;
    242           }
    243        
    244         tmp_dir += CmtSystem::file_separator ();
    245         tmp_dir += "cmtcvs";
    246         {
    247           cmt_string temp = CmtSystem::get_temporary_name ();
    248           CmtSystem::basename (temp, temp);
    249           temp.replace_all (".", "");
    250           tmp_dir += temp;
    251         }
    252 
    253         if (!CmtSystem::test_directory (tmp_dir))
    254           {
    255             if (!CmtSystem::mkdir (tmp_dir))
    256               {
    257                 cout << "#CMT> Cannot create the temporary directory ["
    258                      << tmp_dir << "]" << endl;
    259                 return;
    260               }
    261           }
    262        
    263         //trap "rm -rf ${tmp_dir}" 0 1 2 15
    264        
    265         if (!CmtSystem::cd (tmp_dir))
    266           {
    267             cout << "#CMT> Cannot move to the temporary directory " << tmp_dir << endl;
    268            
    269             if (m_verbose)
    270               {
    271                 cout << "#CMT> now removing tmp_dir " << tmp_dir << " home=" << home_dir << endl;
    272               }
    273            
    274             CmtSystem::remove_directory (tmp_dir);
    275            
    276             return;
    277           }
    278        
    279         if (m_verbose)
    280           {
    281             cout << "#CMT> cvs infos are now obtained from the temporary directory " << CmtSystem::pwd () << endl; 
    282           }
    283        
    284         /*
    285           #
    286           # The script associated to such entries is supposed to :
    287           #  1) extract the set of <infos> from the ${module}/cmt/requirements file
    288           #  2) build an output of the form :
    289           #      <infos>=info1 info2 info3 ...
    290           #
    291           # Currently this script can be found in
    292           #
    293           # ${CMTROOT}/cmt/cmt_buildcvsinfos2.sh
    294           # %CMTROOT%/cmt/cmt_buildcvsinfos.py
    295           #
    296         */
    297        
    298         if (!CmtSystem::test_directory (cmtcvsinfos))
    299           {
    300             CmtSystem::mkdir (cmtcvsinfos);
    301           }
    302        
    303         CmtSystem::cd (cmtcvsinfos);
    304        
    305         cmt_string cvsroot;
    306        
    307         CmtSystem::get_cvsroot (cvsroot);
    308        
    309         cmt_string command;
    310        
    311         command = "cvs";
    312         if (cvsroot != "")
    313           {
    314             command += " -d ";
    315             command += cvsroot;
    316           }
    317         command += " -Q import -m cmt ";
    318 
    319         command += cmtcvsinfos;
    320 
    321         if (m_cmtcvstest)
    322           {
    323             command += "/cmtcvstest";
    324           }
    325 
    326         command += protocol_level;
    327         command += "/";
    328         command += module;
    329         command += " CMT v1";
    330        
    331         if (m_verbose || m_simulation)
    332           {
    333             cout << "#CMT> Executing [" << command << "]" << endl;
    334           }
    335        
    336         m_last_cvs_infos = "";
    337         CmtSystem::execute (command, m_last_cvs_infos);
    338        
    339         if (m_verbose)
    340           {
    341             cout << "#CMT> now removing tmp_dir " << tmp_dir << " home=" << home_dir << endl;
    342           }
    343        
    344         CmtSystem::cd (home_dir);
    345         CmtSystem::remove_directory (tmp_dir); 
     485        retreive_cvs_infos (module);
    346486      }
    347487   
     
    434574      }
    435575   
     576    grep.run (m_last_cvs_infos, "branches=");
     577   
     578    if (grep.result () != "")
     579      {
     580        branches_info = grep.result ();
     581        branches_info.replace ("branches=", "");
     582      }
     583    else
     584      {
     585        branches_info = "";
     586      }
     587   
     588    grep.run (m_last_cvs_infos, "subpackages=");
     589   
     590    if (grep.result () != "")
     591      {
     592        subpackages_info = grep.result ();
     593        subpackages_info.replace ("subpackages=", "");
     594      }
     595    else
     596      {
     597        subpackages_info = "";
     598      }
     599   
     600    grep.run (m_last_cvs_infos, "subprojects=");
     601   
     602    if (grep.result () != "")
     603      {
     604        subprojects_info = grep.result ();
     605        subprojects_info.replace ("subprojects=", "");
     606      }
     607    else
     608      {
     609        subprojects_info = "";
     610      }
     611
    436612    cmt_string tag_filter = CmtSystem::getenv ("CMTCVSTAGFILTER");
    437613   
     
    463639      }
    464640   
    465     grep.run (m_last_cvs_infos, "branches=");
    466    
    467     if (grep.result () != "")
    468       {
    469         branches_info = grep.result ();
    470         branches_info.replace ("branches=", "");
    471       }
    472     else
    473       {
    474         branches_info = "";
    475       }
    476    
    477     grep.run (m_last_cvs_infos, "subpackages=");
    478    
    479     if (grep.result () != "")
    480       {
    481         subpackages_info = grep.result ();
    482         subpackages_info.replace ("subpackages=", "");
    483       }
    484     else
    485       {
    486         subpackages_info = "";
    487       }
    488    
    489     grep.run (m_last_cvs_infos, "subprojects=");
    490    
    491     if (grep.result () != "")
    492       {
    493         subprojects_info = grep.result ();
    494         subprojects_info.replace ("subprojects=", "");
    495       }
    496     else
    497       {
    498         subprojects_info = "";
    499       }
    500641  }
    501642 
     
    770911    cmt_string dir = currentdir;
    771912
    772     cout << "  # get project files " << endl;
    773 
     913    cout << "  # get project files into " << dir << endl;
     914
     915    if (m_simulation)
     916      {
     917        cout << "#CMT> Would mkdir " << version << endl;
     918      }
     919    else
     920      {
     921        if (m_verbose)
     922          {
     923            cout << "#CMT> About to mkdir " << version << endl;
     924          }
     925
     926        CmtSystem::mkdir (version);
     927        CmtSystem::cd (version);
     928      }
     929
     930    dir += CmtSystem::file_separator ();
     931    dir += version;
     932
     933   
    774934    cmt_string command = "cvs -Q co -P ";
    775935    if (!at_head)
     
    779939      }
    780940
    781     command += "-d ";
    782     command += version;
     941    command += "-d cmt ";
    783942
    784943    command += " ";
     
    13261485          {
    13271486            cout << "#CMT> checkout_package> prefix=" << prefix
    1328                  << " package=" << package
     1487                 << " " << structure_info << "=" << package
    13291488                 << " specified_version=" << specified_version
    13301489                 << endl;
     
    13481507        if (version == "")
    13491508          {
    1350             cout << "# ================= No version specified for package " << package << endl;
     1509            cout << "# ================= No version specified for " << structure_info << " " << package << endl;
    13511510            return;
    13521511          }
     
    13861545            dir = build_version_directory (prefix, package, version);
    13871546
    1388             cout << "# ================= Package " << package
     1547            cout << "# ================= " << structure_info << " " << package
    13891548                 << " version " << version << echo_ppath
    13901549                 << " already installed in " << dir << endl;
     
    14071566            if (version.find ("*") != cmt_string::npos)
    14081567              {
    1409                 cout << "# ================= Package " << package
     1568                cout << "# ================= " << structure_info << " " << package
    14101569                     << " version " << version << echo_ppath
    14111570                     << " has wild cards and will not be considered." << endl;
     
    14431602            if (CmtSystem::test_directory (dir))
    14441603              {
    1445                 cout << "# ================= Package " << package
     1604                cout << "# ================= " << structure_info << " " << package
    14461605                     << " version " << version << echo_ppath
    14471606                     << " already installed." << endl;
     
    14631622          }
    14641623
     1624        /*
     1625        if (m_verbose)
     1626          {
     1627            cout << "#CMT> pwd.4=" << CmtSystem::pwd () << " structure=" << structure_info << endl;
     1628          }
     1629        */
     1630
    14651631          //
    14661632          //  Now reach the newly checked out package.
     
    14691635        if (m_simulation)
    14701636          {
    1471             cout << "#CMT> Package directory not really created " << dir << endl;
    1472           }
    1473         else
     1637            cout << "#CMT> " << structure_info << " directory not really created " << dir << endl;
     1638          }
     1639        else if (structure_info == "package")
    14741640          {
    14751641            if (!CmtSystem::cd (dir))
     
    15471713              }
    15481714          }
     1715        else if (structure_info == "project")
     1716          {
     1717
     1718            if (m_verbose)
     1719              {
     1720                cout << "#CMT> dir=" << dir << endl;
     1721              }
     1722
     1723            if (!CmtSystem::cd (dir))
     1724              {
     1725                cout << "#CMT> Project directory not created " << dir << endl;
     1726              }
     1727
     1728            cmt_string file_name;
     1729           
     1730            file_name = "cmt";
     1731            file_name += CmtSystem::file_separator ();
     1732            file_name += "project.cmt";
     1733           
     1734            if (!CmtSystem::test_file (file_name))
     1735              {
     1736                cout << "# " << package << " not a CMT project" << endl;
     1737                return;
     1738              }
     1739
     1740            if (recursive)
     1741              {
     1742                checkout_from_project_file (file_name);
     1743              }
     1744          }
    15491745      }
    15501746
     
    15661762    RecursivePass2 p2 (*this);
    15671763    p2.run (p1.result ());
     1764  }
     1765
     1766  /**
     1767   *   We provide a path to a project file. From it we read the use
     1768   *  statements, and we try to checkout the corresponding projects.
     1769   */
     1770  void checkout_from_project_file (const cmt_string& file_name)
     1771  {
     1772    static cmt_regexp expression ("^[ \t]*use[ \t]");
     1773
     1774    cmt_string text;
     1775
     1776    text.read (file_name);
     1777
     1778    RecursivePass3 p3;
     1779    p3.run (text, expression);
     1780
     1781    RecursivePass4 p4 (*this);
     1782    p4.run (p3.result ());
    15681783  }
    15691784
     
    17841999    if (m_verbose)
    17852000      {
    1786         cout << "#CMT> about to checkout package " << package << " version " << version << " into " << top_dir << endl;
     2001        cout << "#CMT> about to checkout " << structure_info
     2002             << " " << package << " version " << version << " into " << top_dir << endl;
    17872003      }
    17882004   
     
    18062022      }
    18072023    */
    1808    
    1809     cmt_string file_name;
    1810    
    1811     file_name = "cmt";
    1812     file_name += CmtSystem::file_separator ();
    1813     file_name += "requirements";
    1814    
    1815     if (CmtSystem::test_file (file_name))
    1816       {
    1817         top_dir += CmtSystem::file_separator ();
    1818         top_dir += "cmt";
    1819         CmtSystem::cd ("cmt");
    1820 
    1821         /*
     2024
     2025    if (structure_info == "project")
     2026      {
     2027        cmt_string file_name;
     2028   
     2029        file_name = "cmt";
     2030        file_name += CmtSystem::file_separator ();
     2031        file_name += "project.cmt";
     2032       
     2033        if (CmtSystem::test_file (file_name))
     2034          {
     2035            cout << "#CMT> project " << package << " has been checked out" << endl;
     2036          }
     2037        else
     2038          {
     2039            cout << "# " << package << " was not properly checked out and is missing its cmt/project.cmt file" << endl;
     2040            return;
     2041          }
     2042      }
     2043    else
     2044      {
     2045        cmt_string file_name;
     2046   
     2047        file_name = "cmt";
     2048        file_name += CmtSystem::file_separator ();
     2049        file_name += "requirements";
     2050       
     2051        if (CmtSystem::test_file (file_name))
     2052          {
     2053            top_dir += CmtSystem::file_separator ();
     2054            top_dir += "cmt";
     2055            CmtSystem::cd ("cmt");
     2056           
     2057            /*
     2058              if (m_verbose)
     2059              {
     2060              cout << "#CMT> pwd.9=" << CmtSystem::pwd () << endl;
     2061              }
     2062            */
     2063          }
     2064        else
     2065          {
     2066            file_name = "mgr";
     2067            file_name += CmtSystem::file_separator ();
     2068            file_name += "requirements";
     2069           
     2070            if (CmtSystem::test_file (file_name))
     2071              {
     2072                top_dir += CmtSystem::file_separator ();
     2073                top_dir += "mgr";
     2074                CmtSystem::cd ("mgr");
     2075               
     2076                /*
     2077                  if (m_verbose)
     2078                  {
     2079                  cout << "#CMT> pwd.10=" << CmtSystem::pwd () << endl;
     2080                  }
     2081                */
     2082              }
     2083            else
     2084              {
     2085                cout << "# " << package << " was not properly checked out and is missing its cmt/requirements file" << endl;
     2086                return;
     2087              }
     2088          }
     2089       
    18222090        if (m_verbose)
    18232091          {
    1824             cout << "#CMT> pwd.9=" << CmtSystem::pwd () << endl;
    1825           }
    1826         */
    1827       }
    1828     else
    1829       {
    1830         file_name = "mgr";
    1831         file_name += CmtSystem::file_separator ();
    1832         file_name += "requirements";
     2092            cout << "#CMT> package " << package << " has been checked out" << endl;
     2093          }
     2094       
     2095        if (m_recursive)
     2096          {
     2097            if (m_verbose || m_simulation)
     2098              {
     2099                cout << "#CMT> Executing [" << "cmt -quiet broadcast cmt -quiet config" << "]" << endl;
     2100              }
     2101           
     2102            if (!m_simulation)
     2103              {
     2104                CmtSystem::execute ("cmt -quiet broadcast cmt -quiet config");
     2105              }
     2106          }
     2107        else
     2108          {
     2109            if (m_verbose || m_simulation)
     2110              {
     2111                cout << "#CMT> Executing [" << "cmt -quiet config" << "]" << endl;
     2112              }
    18332113       
    1834         if (CmtSystem::test_file (file_name))
    1835           {
    1836             top_dir += CmtSystem::file_separator ();
    1837             top_dir += "mgr";
    1838             CmtSystem::cd ("mgr");
    1839 
    1840             /*
    1841             if (m_verbose)
    1842               {
    1843                 cout << "#CMT> pwd.10=" << CmtSystem::pwd () << endl;
    1844               }
    1845             */
    1846           }
    1847         else
    1848           {
    1849             cout << "# " << package << " was not properly checked out and is missing its cmt/requirements file" << endl;
    1850             return;
    1851           }
    1852       }
    1853    
    1854     if (m_verbose)
    1855       {
    1856         cout << "#CMT> package " << package << " has been checked out" << endl;
    1857       }
    1858 
    1859     if (m_recursive)
    1860       {
    1861         if (m_verbose || m_simulation)
    1862           {
    1863             cout << "#CMT> Executing [" << "cmt -quiet broadcast cmt -quiet config" << "]" << endl;
    1864           }
    1865        
    1866         if (!m_simulation)
    1867           {
    1868             CmtSystem::execute ("cmt -quiet broadcast cmt -quiet config");
    1869           }
    1870       }
    1871     else
    1872       {
    1873         if (m_verbose || m_simulation)
    1874           {
    1875             cout << "#CMT> Executing [" << "cmt -quiet config" << "]" << endl;
    1876           }
    1877        
    1878         if (!m_simulation)
    1879           {
    1880             CmtSystem::execute ("cmt -quiet config");
     2114            if (!m_simulation)
     2115              {
     2116                CmtSystem::execute ("cmt -quiet config");
     2117              }
    18812118          }
    18822119      }
     
    20482285  cmt_string m_branch_suffix;
    20492286
     2287  cmt_string m_protocol_level;
    20502288  cmt_string m_last_module;
    20512289  cmt_string m_last_cvs_infos;
     
    23222560//--------------------------------------------------------------------
    23232561
     2562void RecursivePass3::begin ()
     2563{
     2564  m_first = true;
     2565  m_result = "";
     2566}
     2567
     2568void RecursivePass3::filter (const cmt_string& line)
     2569{
     2570  History& h = History::instance ();
     2571 
     2572  if (h.is_installed (line)) return;
     2573 
     2574  CmtSystem::cmt_string_vector words;
     2575 
     2576  CmtSystem::split (line, " \t", words);
     2577
     2578  enum
     2579  {
     2580    need_project,
     2581    need_version,
     2582    no_need
     2583  } state = need_project;
     2584
     2585  cmt_string project;
     2586  cmt_string version;
     2587
     2588  for (int i = 1; i < words.size (); i++)
     2589    {
     2590      const cmt_string& s = words[i];
     2591
     2592      switch (state)
     2593        {
     2594          case need_project:
     2595            project = s;
     2596            state = need_version;
     2597            break;
     2598          case need_version:
     2599            version = s;
     2600            state = no_need;
     2601            break;
     2602        }
     2603    }
     2604 
     2605  if (version.find ("*") != cmt_string::npos)
     2606    {
     2607        /*
     2608      cout << "# ================= Project " << project
     2609           << " version " << version << " " << path
     2610           << " has wild cards and will not be considered." << endl;
     2611        */
     2612      return;
     2613    }
     2614
     2615  /**
     2616   *  At the first pass, we simply accumulate the not-yet handled
     2617   *  use statements.
     2618   */
     2619 
     2620  m_result += line;
     2621  m_result += "\n";
     2622 
     2623  if (m_first)
     2624    {
     2625      m_first = false;
     2626      cout << "  # --> now propagate cmt checkout to :" << endl;
     2627    }
     2628 
     2629  cout << "  #     " << project << " " << version << endl;
     2630}
     2631
     2632const cmt_string& RecursivePass3::result () const
     2633{
     2634  return (m_result);
     2635}
     2636
     2637//--------------------------------------------------------------------
     2638
     2639RecursivePass4::RecursivePass4 (CvsImplementation& cvs) : m_cvs (cvs)
     2640{
     2641}
     2642
     2643void RecursivePass4::begin ()
     2644{
     2645}
     2646
     2647void RecursivePass4::filter (const cmt_string& line)
     2648{
     2649    //if (CmtSystem::testenv ("CMTTESTAWK")) cout << "RecursivePass4::filter> "
     2650    //                                          << "line=[" << line << "]" << endl;
     2651
     2652  /**
     2653   *   At the second pass, the lines are really handled. Thus
     2654   *   the lines are stored into m_installed so as to avoid
     2655   *   later on re-installation.
     2656   */
     2657 
     2658  History& h = History::instance ();
     2659 
     2660  if (h.is_installed (line)) return;
     2661 
     2662  h.install (line);
     2663 
     2664  CmtSystem::cmt_string_vector words;
     2665 
     2666  CmtSystem::split (line, " \t", words);
     2667
     2668  enum
     2669  {
     2670    need_project,
     2671    need_version,
     2672    no_need
     2673  } state = need_project;
     2674
     2675  cmt_string project;
     2676  cmt_string version;
     2677
     2678  for (int i = 1; i < words.size (); i++)
     2679    {
     2680      const cmt_string& s = words[i];
     2681
     2682      switch (state)
     2683        {
     2684          case need_project:
     2685            project = s;
     2686            state = need_version;
     2687            break;
     2688          case need_version:
     2689            version = s;
     2690            state = no_need;
     2691            break;
     2692        }
     2693    }
     2694
     2695  if (version.find ("*") != cmt_string::npos)
     2696    {
     2697        /*
     2698      cout << "# ================= Project " << project
     2699           << " version " << version
     2700           << " has wild cards and will not be considered." << endl;
     2701        */
     2702    }
     2703  else
     2704    {
     2705      m_cvs.checkout_package ("", project, version);
     2706    }
     2707}
     2708
     2709//--------------------------------------------------------------------
     2710
    23242711void Cvs::tags (const CmtSystem::cmt_string_vector& arguments)
    23252712{
Note: See TracChangeset for help on using the changeset viewer.