Changeset 42


Ignore:
Timestamp:
Apr 25, 2005, 2:02:18 PM (19 years ago)
Author:
arnault
Message:

Preparing support for projects in CVS - See CL 270

Location:
CMT/HEAD
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/ChangeLog

    r41 r42  
     12005-04-25    <arnault@lal.in2p3.fr> 270
     2
     3        * source/cmt_cvs.cxx (class CvsImplementation): Accept empty
     4        argument for queries on subprojects
     5
     6        * source/cmt_cvs.cxx (class CvsImplementation): Accept empty
     7        argument for queries on subpackages
     8
     9        * source/cmt_cvs.cxx (class CvsImplementation): Selection for
     10        getting the mudule contents is done using the structure
     11        information.
     12
     13        * source/cmt_cvs.cxx (class CvsImplementation): Isolate specific
     14        behaviour into dedicated functions for getting the specific
     15        contents for packages or for projects.
     16
     17        * source/cmt_cvs.cxx (class CvsImplementation): Retrieve fields
     18        for structure and subprojects from the CVS pluggin.
     19
     20        * source/cmt_cvs.cxx (class CvsImplementation): Manage the
     21        protocol level related with the version of the CVS pluggin.
     22
     23        * source/cmt_cvs.cxx (class CvsImplementation): Suppress all dots
     24        from the tmpdir due to problems on Windows
     25
     26        * source/cmt_cvs.cxx (class CvsImplementation): Add support for
     27        struture_info and subprojects coming from the new CVS pluggin
     28
     29        * source/cmt_parser.cxx (do_cvssubprojects): Handle the
     30        cvssubprojects command
     31        (parser): Commands related with CVS should at least read the
     32        requirements file of CMT
     33
     34        * source/cmt_parser.h (enum): Add cvssubprojects action
     35
     36        * source/cmt_commands.cxx (CommandHelp): Add help for
     37        cvssubprojects command
     38
     39        * source/cmt_commands.cxx (do_cvssubprojects): Accept empty
     40        argument to query for subprojects at top of the repository
     41
     42        * source/cmt_commands.cxx (do_cvssubpackages): Accept empty
     43        argument to query for subpackages at top of the repository
     44
     45        * source/cmt_commands.cxx (ArgParser): Manage cvssubprojects command.
     46
     47        * source/cmt_commands.h (class ArgParser): Add cvssubprojects command
     48
     49        * source/cmt_use.cxx (fill_standard_macros): Production of a new
     50        standard macro for obtaining the project releases
     51
     52        * source/cmt_cvs.h (class Cvs): Add the subprojects function to
     53        query CVS about the existing subprojects of a given module.
     54
    1552005-04-23  Christian Arnault  <arnault@lal.in2p3.fr> 269
    256
  • CMT/HEAD/doc/CMTDoc.html

    r29 r42  
    77   tt.cmt {color:#00AA00; font-weight: normal; %background-color: #eeeeee}
    88   pre {color:#FF0000; background-color: #eeeeee; border-style: solid; border-width: 1; border-color: black; padding: 4}
    9    pre.cmt {color:#00AA00; background-color: #eeeeee; border-style: solid; border-width: 1; border-color: black; padding: 4}
     9   pre.cmt {font-family: courier; color:#00AA00; background-color: #eeeeee; border-style: solid; border-width: 1; border-color: black; padding: 4}
    1010   h2 {color:#0000FF}
    1111   h3 {color:#00AA00}
     
    2323<center>Christian Arnault</center>
    2424<center><tt>arnault@lal.in2p3.fr</tt></center></h2>
    25 <center><i>Document revision date : 2005-03-31</i></center><hr><h2><a href="#index">General index</a></h2>
     25<center><i>Document revision date : 2005-04-17</i></center><hr><h2><a href="#index">General index</a></h2>
    2626<hr><h2><a name="Presentation"></a><a href="#index"><tt>&nbsp;1</tt></a> - Presentation</h2>
    2727<blockquote>
     
    389389      platform specific tools will be dynamically reconfigured and
    390390      parameterized transparently.
     391
     392
    391393</blockquote>
    392394</blockquote>
    393395<hr><h2><a name="Defining and managing projects"></a><a href="#index"><tt>&nbsp;4</tt></a> - Defining and managing projects</h2>
    394396<blockquote>
     397
    395398  <p>In the CMT terminology, the complete software base is composed
    396399      of CMT packages. Those packages are organized into
     
    431434        packages.</li>
    432435</ul>
     436
    433437  <p>Projects receive detailed descriptions or specifications in a
    434438      dedicated <i>project file</i>
     
    438442  . It can receive the following
    439443    specifications:</p>
    440 <pre class="cmt">
    441 project &lt;project-name&gt;          [1]
     444
     445<pre>project &lt;project-name&gt;          [1]
    442446<i>project-use specifications...</i>   [2]
    443447<i>strategy specifications...</i>      [3]
    444448</pre>
     449
    445450  <ol>
    446451    <li>The project name specified here takes precedence over the
     
    539544  <p>Every strategy setting defines two mutually exclusive tags
    540545      and activates one of them.</p>
    541 <pre class="cmt">
     546<pre>
    542547&lt;project&gt;_&lt;have_item&gt;
    543548&lt;project&gt;_&lt;have_not_item&gt; </pre>
    544549<p>Examples</p>
    545 <pre class="cmt">
     550<pre>
    546551&lt;project&gt;_prototypes
    547552&lt;project&gt;_no_prototypes
     
    772777              or (in a <tt>requirements</tt>
    773778     file)
    774 <pre class="cmt">
     779<pre>
    775780path_append CMTPATH "/home/arnault/mydev"
    776781path_append CMTPATH "/ProjectB"</pre>
     
    11241129  </li>
    11251130</ul>
    1126 <pre class="cmt">
     1131<pre>
    11271132use Bar v7r5                    [1]</pre>
    11281133<i>or</i>
    1129 <pre class="cmt">
     1134<pre>
    11301135use Bar v7r5 A                  [2]</pre>
    11311136<i>or</i>
    1132 <pre class="cmt">
     1137<pre>
    11331138use Bar v7r5 /ProjectB/A        [3]</pre>
    11341139  <p>Given these keys, the referenced package is looked for
     
    11641169   statement (defined within a given package)
    11651170    containing : </p>
    1166 <pre class="cmt">
     1171<pre>
    11671172...
    11681173use Bar v7r5
     
    13781383      location path of an external software package. Here we take the
    13791384    example of the Anaphe utility: </p>
    1380 <pre class="cmt">
     1385<pre>
    13811386macro AnapheTOP "" \
    13821387      CERN  "/afs/cern.ch/sw/lhcxx" \
     
    16491654      <tt>target_B</tt>
    16501655    will in turn be active.</p>
    1651 <pre class="cmt">
     1656<pre>
    16521657library A -target_tag A.cxx
    16531658application P -target_tag P.cxx
     
    17341739            the <tt>set</tt>
    17351740   statement in a requirements file</li>
    1736 <pre class="cmt">
     1741<pre>
    17371742set CMTSITE "CERN"
    17381743set CMTCONFIG "${CMTBIN}" sun "Solaris-CC-dbg"</pre>
     
    17411746            using the <tt>tag</tt>
    17421747     statement (in a requirements file):
    1743 <pre class="cmt">
     1748<pre>
    17441749tag newtag tag1 tag2 tag3</pre>
    17451750              which means that:
     
    17571762     using the <tt>tag_exclude</tt>
    17581763     syntax.
    1759 <pre class="cmt">
     1764<pre>
    17601765tag_exclude debug optimized</pre>
    17611766          This example implies that the two tags <tt>debug</tt>
     
    18421847          will force the tag <tt>foo</tt>
    18431848    :
    1844 <pre class="cmt">
     1849<pre>
    18451850tag_apply foo</pre>
    18461851<pre>
     
    18571862    <li>
    18581863    <i>Implying a tag from another one using the tag association syntax</i>
    1859 <pre class="cmt">
     1864<pre>
    18601865tag Linux foo</pre>
    18611866<pre>
     
    18731878      <i>Through conventionally encoded values of <tt>CMTCONFIG</tt>
    18741879    </i>
    1875 <pre class="cmt">
     1880<pre>
    18761881tag Linux-foo Linux foo</pre>
    18771882<pre>
     
    19281933  <p>All symbol definitions providing specific values triggered by
    19291934      the active selectors will be selected, such as in:</p>
    1930 <pre class="cmt">
     1935<pre>
    19311936macro_append cppflags "" \
    19321937             debug    " -g "</pre>
     
    21392144      in the <tt>&nbsp;<a HREF='#The requirements file'>requirements</a>&nbsp;</tt>
    21402145      file :
    2141 <pre class="cmt">
     2146<pre>
    21422147...
    21432148macro Foo_linkopts " -lFoo " \
     
    22822287        in <tt>${CMTROOT}/fragments/tex</tt>
    22832288.) :</p>
    2284 <pre class="cmt">
     2289<pre>
    22852290============ tex =====================================
    22862291${CONSTITUENT} :: ${FILEPATH}/${NAME}.ps
     
    23002305    's <a HREF="#The         requirements file">requirements</a>
    23012306     file as follows :
    2302 <pre class="cmt">
     2307<pre>
    23032308make_fragment tex -header=tex_header</pre>
    23042309              where:
     
    23172322            to include in its &nbsp;<a HREF='#The requirements file'>requirements</a>&nbsp; file a statement similar
    23182323            to the following:
    2319 <pre class="cmt">
     2324<pre>
    23202325document tex MyDoc -s=../doc doc1.tex doc2.tex </pre>
    23212326              where:
     
    23442349    </ol>
    23452350    <p>The result for our example is: </p>
    2346 <pre class="cmt">
     2351<pre>
    23472352=========== MyDoc.make ===============================
    23482353
     
    24202425     be declared in the
    24212426    &nbsp;<a HREF='#The requirements file'>requirements</a>&nbsp; file of the provider package as follows:
    2422 <pre class="cmt">
     2427<pre>
    24232428make_fragment &lt;fragment-name&gt; [ options... ] </pre>
    24242429              where options may be :
     
    25492554    <li> rootcint
    25502555    <p>It generates C++ hubs for the Cint interpreter in Root. </p>
    2551 <pre class="cmt">
     2556<pre>
    25522557========= rootcint =========================================
    25532558$(src)${NAME}.cc :: ${FULLNAME}   
     
    25582563      <p>It generates C++ source files (xxx.g files) from Atlas' AGE
    25592564                description files. </p>
    2560 <pre class="cmt">
     2565<pre>
    25612566========= agetocxx =========================================
    25622567output=$(${CONSTITUENT}_output)
     
    25722577        cd $(bin); $(ar) $(${CONSTITUENT}lib) ${NAME}.o; /bin/rm -f ${NAME}.o
    25732578============================================================ </pre>
    2574 <pre class="cmt">
     2579<pre>
    25752580========= agetocxx_header ==================================
    25762581${CONSTITUENT}lib       = $(bin)lib${CONSTITUENT}.a
     
    25952600============================================================ </pre>
    25962601              It must be declared as follows :
    2597 <pre class="cmt">
     2602<pre>
    25982603make_fragment agetocxx -suffix=cxx -dependencies -header=agetocxx_header </pre>
    25992604  </li>
     
    28672872                      and are by default expected from the <tt>../src</tt>
    28682873                    directory</p>
    2869 <pre class="cmt">
     2874<pre>
    28702875library A A.cxx B.cxx</pre>
    28712876      <p>Then it is possible to change the default search
    28722877                      location as well as to use a simplified wildcarding
    28732878                    syntax:</p>
    2874 <pre class="cmt">
     2879<pre>
    28752880library A -s=A *.cxx -s=B *.cxx</pre>
    28762881      <ul>
     
    28992904                      regular expressions from general wildcarding
    29002905                    techniques:</p>
    2901 <pre class="cmt">
     2906<pre>
    29022907library A -s=A -x=[0-9] *.cxx -s=B -k=^B *.cxx</pre>
    29032908      <ul>
     
    29312936                      between the different targets, as in the following
    29322937                    example:</p>
    2933 <pre class="cmt">
     2938<pre>
    29342939library AXt  -suffix=Xt  *.cxx
    29352940library AXaw -suffix=Xaw *.cxx</pre>
     
    29442949      </tt>
    29452950                    character), such as in the next example:</p>
    2946 <pre class="cmt">
     2951<pre>
    29472952make_fragment doc_to_html                             (1)
    29482953
     
    30063011              automatically when the default make command is run.</p>
    30073012<p>One could, for instance specify within the requirements file :</p>
    3008 <pre class="cmt">
     3013<pre>
    30093014# Constituents belonging to the default <i>all</i> group
    30103015
     
    30603065   and is
    30613066              declared by the following statement:</p>
    3062 <pre class="cmt">
     3067<pre>
    30633068language fortran90 \
    30643069  -suffix=f90 -suffix=F90 \             [1]
     
    31003105  <tt>for</tt>
    31013106 macro).</p>
    3102 <pre class="cmt">
     3107<pre>
    31033108macro for             "f77" \
    31043109...
     
    31093114  , defined as
    31103115            follows:</p>
    3111 <pre class="cmt">
     3116<pre>
    31123117macro f90             "f90"
    31133118...
     
    31193124  <tt>-extra_output_suffix</tt>
    31203125 option like in:</p>
    3121 <pre class="cmt">
     3126<pre>
    31223127language idl -suffix=idl -fragment=idl -extra_output_suffix=_skel</pre>
    31233128            where, in this case, two object files are produced for each
     
    34753480</ul>
    34763481<p>Examples of such definition are : </p>
    3477 <pre class="cmt">
     3482<pre>
    34783483package CMT
    34793484
     
    35103515              concept of a generic shell command.
    35113516<p>An example of a symple action:</p>
    3512 <pre class="cmt">
     3517<pre>
    35133518action directory "ls $(dir_options)" WIN32 "dir $(dir_options)"</pre>
    35143519  <p>Like other symbols, actions can be visualized using
     
    35523557                            macro.
    35533558        <p>Example 1</p>
    3554 <pre class="cmt">
     3559<pre>
    35553560library A ...
    35563561action B ...
     
    35613566         will be rebuilt first.
    35623567        <p>Example 2</p>
    3563 <pre class="cmt">
     3568<pre>
    35643569library A ...
    35653570action B ...
     
    35813586  <p>Describe the relationships with other packages; the
    35823587            generic syntax is :</p>
    3583 <pre class="cmt">
     3588<pre>
    35843589use &lt;package&gt; [ &lt;version&gt; [ &lt;offset&gt; ] ]</pre>
    35853590  <p>Omitting the version specification means that the most
     
    35973602            CMTPATH).</p>
    35983603<p> Examples of such relationships are :</p>
    3599 <pre class="cmt">
     3604<pre>
    36003605use OnX v5r2
    36013606use CSet v2r3
     
    36413646  ). Suppose
    36423647            we have the following organization:</p>
    3643 <pre class="cmt">
     3648<pre>
    36443649----------------
    36453650package A
     
    37973802                        pattern which will apply the include_path statement as
    37983803                      follows:</p>
    3799 <pre class="cmt">
     3804<pre>
    38003805pattern -global include_path include_path ${&lt;package&gt;_root}/&lt;package&gt;/</pre>
    38013806      <p>For instance, a package named <tt>PackA</tt>
    38023807       will expand this
    38033808                      pattern as follows:</p>
    3804 <pre class="cmt">
     3809<pre>
    38053810include_path ${PackA_root}/PackA/</pre>
    38063811  </li>
     
    38113816                        paths must be explicited, through an environment
    38123817                      variable. The following pattern can automate this operation:</p>
    3813 <pre class="cmt">
     3818<pre>
    38143819pattern ld_library_path \
    38153820  path_remove LD_LIBRARY_PATH "/&lt;package&gt;/" ; \
     
    38193824                        would be concerned. These packages will simply have to
    38203825                      apply the pattern as follows:</p>
    3821 <pre class="cmt">
     3826<pre>
    38223827apply_pattern ld_library_path</pre>
    38233828      <p>The schema installed by this pattern provides first a
     
    38353840                        application. Then every make command would naturally
    38363841                      ensure its actual presence.</p>
    3837 <pre class="cmt">
     3842<pre>
    38383843pattern quality_test application &lt;package&gt;test &lt;package&gt;test.cxx &lt;other_sources&gt;</pre>
    38393844      <p>In this example, an additional pattern
     
    38563861      <p>Doing so, it is possible to specify custmization
    38573862                      values for user defined template parameters</p>
    3858 <pre class="cmt">
     3863<pre>
    38593864pattern TA macro &lt;base&gt;AAA "AAA"
    38603865
     
    38673872                        and thus using the pattern name as a plain CMT
    38683873                      keyword. The previous example becomes: </p>
    3869 <pre class="cmt">
     3874<pre>
    38703875TA base=abc
    38713876TA base=def</pre>
     
    39023907                        particular package by using the following
    39033908                      statement:</p>
    3904 <pre class="cmt">
     3909<pre>
    39053910ignore_pattern &lt;name&gt;</pre>
    39063911  </li>
     
    39303935</p>
    39313936<p>As an example suppose we define</p>
    3932 <pre class="cmt">
     3937<pre>
    39333938path        CMTPATH "/ProjectA"
    39343939path_append CMTPATH "/ProjectB"
     
    39483953  <a href="#Generated macros">automatic macros</a>
    39493954            (automatically setup for all used packages)
    3950 <pre class="cmt">
     3955<pre>
    39513956&lt;package&gt;_cmtpath
    39523957&lt;package&gt;_offset</pre>
     
    39593964  <p>Describe the specific directory branches to be added while
    39603965              configuring the package.</p>
    3961 <pre class="cmt">
     3966<pre>
    39623967branches &lt;branch-name&gt; ... </pre>
    39633968  <p> These branches will be created (if needed) at the same
     
    40754080  <p>Every strategy setting defines two mutually exclusive
    40764081            tags and activates one of them.</p>
    4077 <pre class="cmt">
     4082<pre>
    40784083&lt;project&gt;_&lt;have_item&gt;
    40794084&lt;project&gt;_&lt;have_not_item&gt; </pre>
    40804085            Examples
    4081 <pre class="cmt">
     4086<pre>
    40824087&lt;project&gt;_prototypes
    40834088&lt;project&gt;_no_prototypes
     
    43924397   file as
    43934398            follows :</p>
    4394 <pre class="cmt">
     4399<pre>
    43954400tag Foo                [1]
    43964401tag Bar Foo FooA FooB  [2]
     
    47754780                        contain the list of constituent names corresponding to
    47764781                      libraries that must be exported.</p>
    4777 <pre class="cmt">
     4782<pre>
    47784783library Foo ...
    47794784library Foo-utils ...
     
    51275132    <li>Run a shell command described in the macro named <tt>lock_command</tt>
    51285133     meant to install physical locks onto all files for this version of this package. A typical definition for this macro could be:
    5129 <pre class="cmt">
     5134<pre>
    51305135macro lock_command   "chmod -R a-w ../*" \
    51315136      WIN32          "attrib /S /D +R ../*"</pre>
     
    55395544      <li>Run a shell command described in the macro named <tt>unlock_command</tt>
    55405545       meant to remove physical locks from all files for this version of this package. A typical definition for this macro could be:
    5541 <pre class="cmt">
     5546<pre>
    55425547macro unlock_command "chmod -R g+w ../*" \
    55435548      WIN32          "attrib /S /D -R ../*"</pre>
     
    56455650              appropriate in all projects) is controlled by one option of the
    56465651            build strategy, which can take one of the two values:</p>
    5647 <pre class="cmt">
     5652<pre>
    56485653build_strategy prototypes
    56495654build_strategy no_prototypes</pre>
     
    60116016 file, containing (among other statements
    60126017        not shown for the sake of clarity) :
    6013 <pre class="cmt">
     6018<pre>
    60146019package OPACS
    60156020
     
    60286033   package would have just to provide a use
    60296034          statement like : </p>
    6030 <pre class="cmt">
     6035<pre>
    60316036use OPACS v3 </pre>
    60326037  <p>This procedure gives the complete benefit of the use
     
    69686973          <p>
    69696974                      A typical example of how to define such a macro could be : </p>
    6970 <pre class="cmt">
     6975<pre>
    69716976macro Cm_linkopts "-L$(CMROOT)/$(Cm_tag) -lCm -lm" </pre>
    69726977      </td>
     
    69866991        .  Thus,
    69876992                    a typical definition for this macro could be :
    6988 <pre class="cmt">
     6993<pre>
    69896994macro Cm_stamps "$(Cm_root)/$(Cm_tag)/Cm.stamp" </pre>
    69906995          <p>Then, these stamp file references are accumulated
     
    97539758<hr><h3><a name="The default strategies defined in CMT"></a><a href="#index"><tt>18.&nbsp;8</tt></a> - The default strategies defined in CMT</h3>
    97549759<blockquote>
    9755 <pre class="cmt">
     9760<pre>
    97569761  DefaultPrototypesStrategy = Prototypes,
    97579762  DefaultInstallAreaStrategy = WithoutInstallArea</pre>
  • CMT/HEAD/doc/gendoc.py

    r11 r42  
    174174    print '   tt.cmt {color:#00AA00; font-weight: normal; %background-color: #eeeeee}'
    175175    print '   pre {color:#FF0000; background-color: #eeeeee; border-style: solid; border-width: 1; border-color: black; padding: 4}'
    176     print '   pre.cmt {color:#00AA00; background-color: #eeeeee; border-style: solid; border-width: 1; border-color: black; padding: 4}'
     176    print '   pre.cmt {font-family: courier; color:#00AA00; background-color: #eeeeee; border-style: solid; border-width: 1; border-color: black; padding: 4}'
    177177    print '   h2 {color:#0000FF}'
    178178    print '   h3 {color:#00AA00}'
  • CMT/HEAD/mgr/VisualC.nmake

    r32 r42  
    11CMT_tag=$(tag)
    22CMTVERSION=HEAD
     3CMT_project=macro
    34cmt_hardware_query_command=uname -m
    45cmt_hardware=WIN32
  • CMT/HEAD/mgr/cmt.nmake

    r32 r42  
    33#  Application cmt
    44#
    5 #   Generated Sat Apr 02 23:11:18 2005  by arnault
     5#   Generated Mon Apr 25 12:01:50 2005  by ARNAULT
    66#
    77#====================================
  • CMT/HEAD/source/cmt.h

    r15 r42  
    126126  static void do_cvsbranches (const ArgParser& ap);
    127127  static void do_cvssubpackages (const ArgParser& ap);
     128  static void do_cvssubprojects (const ArgParser& ap);
    128129  static void do_cvstags (const ArgParser& ap);
    129130  static void do_do (const ArgParser& ap);
  • CMT/HEAD/source/cmt_commands.cxx

    r37 r42  
    7979  pv.push_back (&ArgParser::do_cvsbranches); i++;
    8080
    81   parsers.add ("cvss", i);
    82   parsers.add ("cvssu", i);
    83   parsers.add ("cvssub", i);
    84   parsers.add ("cvssubp", i);
    8581  parsers.add ("cvssubpa", i);
    8682  parsers.add ("cvssubpac", i);
     
    9187  parsers.add ("cvssubpackages", i);
    9288  pv.push_back (&ArgParser::do_cvssubpackages); i++;
     89
     90  parsers.add ("cvssubpr", i);
     91  parsers.add ("cvssubpro", i);
     92  parsers.add ("cvssubproj", i);
     93  parsers.add ("cvssubproje", i);
     94  parsers.add ("cvssubprojec", i);
     95  parsers.add ("cvssubproject", i);
     96  parsers.add ("cvssubprojects", i);
     97  pv.push_back (&ArgParser::do_cvssubprojects); i++;
    9398
    9499  parsers.add ("cvst", i);
     
    832837    {
    833838      fill_one_argument ();
    834       cmt.m_action = action_cvssubpackages;
    835     }
    836   else
    837     {
    838       if (!cmt.m_quiet) cerr << "#CMT> syntax error : cvssubpackages arguments missing" << endl;
    839       help_action = action_help;
    840       cmt.m_action = action_cvssubpackages;
    841     }
     839    }
     840
     841  cmt.m_action = action_cvssubpackages;
     842}
     843
     844void ArgParser::do_cvssubprojects ()
     845{
     846  if (argc > 0)
     847    {
     848      fill_one_argument ();
     849    }
     850
     851  cmt.m_action = action_cvssubprojects;
    842852}
    843853
     
    20572067  help_texts.add () =  "create_project <project> <name> [<path>] : create and configure a new project";
    20582068  help_texts.add () =  "cvsbranches <module>      : display the subdirectories for a module";
    2059   help_texts.add () =  "cvssubpackagess <module>  : display the subpackages for a module";
     2069  help_texts.add () =  "cvssubpackages <module>   : display the subpackages for a module";
     2070  help_texts.add () =  "cvssubprojects <module>   : display the subprojects for a module";
    20602071  help_texts.add () =  "cvstags <module>          : display the CVS tags for a module";
    20612072  help_texts.add () =  "do <action> [<param>=<value>] ... : Execute an action";
     
    21532164  help.add (action_cvsbranches, help_texts[action_cvsbranches]);
    21542165  help.add (action_cvssubpackages, help_texts[action_cvssubpackages]);
     2166  help.add (action_cvssubprojects, help_texts[action_cvssubprojects]);
    21552167  help.add (action_cvstags, help_texts[action_cvstags]);
    21562168  help.add (action_do, help_texts[action_do]);
  • CMT/HEAD/source/cmt_commands.h

    r11 r42  
    4242  void do_cvsbranches ();
    4343  void do_cvssubpackages ();
     44  void do_cvssubprojects ();
    4445  void do_cvstags ();
    4546  void do_do ();
  • CMT/HEAD/source/cmt_cvs.cxx

    r11 r42  
    148148    m_last_module = "";
    149149    m_last_cvs_infos = "";
     150    structure_info = "";
    150151    error_info = "";
    151152    tags_top_info = "";
     
    155156    branches_info = "";
    156157    subpackages_info = "";
     158    subprojects_info = "";
    157159  }
    158160
     
    185187    // the script named cmt_buildcvsinfos2.sh (referenced in the loginfo script)
    186188    //
    187     //  This script performs a scan in the CVS repository for currently 4 types of
     189    //  This script performs a scan in the CVS repository for the following types of
    188190    // information :
    189191    //
     192    //   the recognized structure below this module (none, project, package)
    190193    //   all top symbolic tags installed for the module
    191194    //   all symbolic tags installed for the module
    192195    //   all branches available below this module
    193196    //   all subpackages installed below the module.
     197    //   all subprojects installed below the module.
    194198    //
    195199    //    In principle, only modules corresponding to true CMT packages are considered.
     
    200204    //
    201205  void show_cvs_infos (const cmt_string& module)
    202       {
    203         if (module == "")
    204           {
    205             cout << "#CMT> cmt cvs needs a module name" << endl;
    206             return;
    207           }
    208 
    209         if (module == m_last_module)
    210           {
    211             if (m_verbose)
    212               {
    213                 cout << "#CMT> cvs infos for module " << module << " already there" << endl;
    214               }
    215           }
    216         else
    217           {
    218             m_last_module = module;
     206  {
     207    static const cmt_string cmtcvsinfos = ".cmtcvsinfos";
     208    static const cmt_string protocol_level = "/v1r1";
     209
     210    if (module == "")
     211      {
     212        cout << "#CMT> cmt cvs needs a module name" << endl;
     213        return;
     214      }
     215
     216    if (module == m_last_module)
     217      {
     218        if (m_verbose)
     219          {
     220            cout << "#CMT> cvs infos for module " << module << " already there" << endl;
     221          }
     222      }
     223    else
     224      {
     225        m_last_module = module;
    219226       
    220             cmt_string home_dir = CmtSystem::pwd ();
    221 
    222             //
    223             // Activities related with .cmtcvsinfos will occur in a temporary directory
    224             //
    225             cmt_string tmp_dir = CmtSystem::getenv ("TMPDIR");
    226             if (tmp_dir == "")
    227               {
    228                 tmp_dir = CmtSystem::file_separator ();
    229                 tmp_dir += "tmp";
    230               }
    231            
    232             if (!CmtSystem::cd (tmp_dir))
    233               {
    234                 tmp_dir = home_dir;
    235               }
    236            
    237             tmp_dir += CmtSystem::file_separator ();
    238             tmp_dir += "cmtcvs";
    239             {
    240               cmt_string temp = CmtSystem::get_temporary_name ();
    241               CmtSystem::basename (temp, temp);
    242               tmp_dir += temp;
    243             }
    244        
    245             if (!CmtSystem::test_directory (tmp_dir))
    246               {
    247                 if (!CmtSystem::mkdir (tmp_dir))
    248                   {
    249                     cout << "#CMT> Cannot create the temporary directory ["
    250                          << tmp_dir << "]" << endl;
    251                     return;
    252                   }
    253               }
    254            
    255             //trap "rm -rf ${tmp_dir}" 0 1 2 15
    256            
    257             if (!CmtSystem::cd (tmp_dir))
    258               {
    259                 cout << "#CMT> Cannot move to the temporary directory " << tmp_dir << endl;
    260 
    261                 if (m_verbose)
    262                   {
    263                     cout << "#CMT> now removing tmp_dir " << tmp_dir << " home=" << home_dir << endl;
    264                   }
    265                
    266                 CmtSystem::remove_directory (tmp_dir);
    267 
     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;
    268259                return;
    269260              }
     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;
    270268           
    271269            if (m_verbose)
    272270              {
    273                 cout << "#CMT> cvs infos are now obtained from the temporary directory " << CmtSystem::pwd () << endl; 
    274               }
    275            
    276             /*
    277               #
    278               # The script associated to such entries is supposed to :
    279               #  1) extract the set of <infos> from the ${module}/cmt/requirements file
    280               #  2) build an output of the form :
    281               #      <infos>=info1 info2 info3 ...
    282               #
    283               # Currently this script can be found in
    284               #
    285               # ${CMTROOT}/cmt/cmt_buildcvsinfos2.sh
    286               # %CMTROOT%/cmt/cmt_buildcvsinfos.py
    287               #
    288             */
    289            
    290             if (!CmtSystem::test_directory (".cmtcvsinfos"))
    291               {
    292                 CmtSystem::mkdir (".cmtcvsinfos");
    293               }
    294            
    295             CmtSystem::cd (".cmtcvsinfos");
    296            
    297             cmt_string cvsroot;
    298            
    299             CmtSystem::get_cvsroot (cvsroot);
    300            
    301             cmt_string command;
    302            
    303             command = "cvs";
    304             if (cvsroot != "")
    305               {
    306                 command += " -d ";
    307                 command += cvsroot;
    308               }
    309             command += " -Q import -m cmt ";
    310             if (m_cmtcvstest)
    311               {
    312                 command += ".cmtcvsinfos/cmtcvstest";
    313               }
    314             else
    315               {
    316                 command += ".cmtcvsinfos";
    317               }
    318             command += "/";
    319             command += module;
    320             command += " CMT v1";
    321            
    322             if (m_verbose || m_simulation)
    323               {
    324                 cout << "#CMT> Executing [" << command << "]" << endl;
    325               }
    326 
    327             m_last_cvs_infos = "";
    328             CmtSystem::execute (command, m_last_cvs_infos);
    329 
    330             if (m_verbose)
    331               {
    332271                cout << "#CMT> now removing tmp_dir " << tmp_dir << " home=" << home_dir << endl;
    333272              }
    334273           
    335274            CmtSystem::remove_directory (tmp_dir);
    336 
    337             CmtSystem::cd (home_dir);
    338           }
    339 
    340         /**
    341            Now retrieve all info fields :
    342 
    343              error=
    344              tags_top=
    345              tags=
    346              branches=
    347              subpackages=
    348 
    349          */
    350 
    351         Grep grep;
    352 
    353         grep.run (m_last_cvs_infos, "error=");
    354 
    355         if (grep.result () != "")
    356           {
    357             error_info = grep.result ();
    358             error_info.replace ("error=", "");
    359           }
    360         else
    361           {
    362             error_info = "";
    363           }
    364 
    365         grep.run (m_last_cvs_infos, "tags_top=");
    366 
    367         if (grep.result () != "")
    368           {
    369             tags_top_info = grep.result ();
    370             tags_top_info.replace ("tags_top=", "");
    371           }
    372         else
    373           {
    374             tags_top_info = "";
    375           }
    376 
    377         grep.run (m_last_cvs_infos, "tags=");
    378 
    379         if (grep.result () != "")
    380           {
    381             tags_info = grep.result ();
    382             tags_info.replace ("tags=", "");
    383           }
    384         else
    385           {
    386             tags_info = "";
    387           }
    388 
    389         grep.run (m_last_cvs_infos, "cvsversions_top=");
    390 
    391         if (grep.result () != "")
    392           {
    393             cvsversions_top_info = grep.result ();
    394             cvsversions_top_info.replace ("cvsversions_top=", "");
    395           }
    396         else
    397           {
    398             cvsversions_top_info = "";
    399           }
    400 
    401         grep.run (m_last_cvs_infos, "cvsversions=");
    402 
    403         if (grep.result () != "")
    404           {
    405             cvsversions_info = grep.result ();
    406             cvsversions_info.replace ("cvsversions=", "");
    407           }
    408         else
    409           {
    410             cvsversions_info = "";
    411           }
    412 
    413         cmt_string tag_filter = CmtSystem::getenv ("CMTCVSTAGFILTER");
    414 
    415         if (tag_filter != "")
    416           {
    417             cmt_string package;
    418             CmtSystem::basename (module, package);
    419            
    420             cmt_string pattern = "<package>";
    421            
    422             tag_filter.replace_all (pattern, package);
    423            
    424             cmt_regexp exp (tag_filter);
    425            
    426             cmt_string text;
    427            
    428             filter_list (tags_top_info, exp);
    429             filter_list (tags_info, exp);
    430             filter_list (cvsversions_top_info, exp);
    431             filter_list (cvsversions_info, exp);
    432           }
    433 
    434         if (m_cmtcvstest)
    435           {
    436             cout << "## tags_top_info=" << tags_top_info << endl;
    437             cout << "## tags_info=" << tags_info << endl;
    438             cout << "## cvsversions_top_info=" << cvsversions_top_info << endl;
    439             cout << "## cvsversions_info=" << cvsversions_info << endl;
    440           }
    441 
    442         grep.run (m_last_cvs_infos, "branches=");
    443 
    444         if (grep.result () != "")
    445           {
    446             branches_info = grep.result ();
    447             branches_info.replace ("branches=", "");
    448           }
    449         else
    450           {
    451             branches_info = "";
    452           }
    453 
    454         grep.run (m_last_cvs_infos, "subpackages=");
    455 
    456         if (grep.result () != "")
    457           {
    458             subpackages_info = grep.result ();
    459             subpackages_info.replace ("subpackages=", "");
    460           }
    461         else
    462           {
    463             subpackages_info = "";
    464           }
    465       }
    466 
     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); 
     346      }
     347   
     348    /**
     349       Now retrieve all info fields :
     350       
     351       structure=
     352       error=
     353       tags_top=
     354       tags=
     355       branches=
     356       subpackages=
     357       subprojects=
     358       
     359    */
     360
     361    Grep grep;
     362
     363    grep.run (m_last_cvs_infos, "structure=");
     364   
     365    if (grep.result () != "")
     366      {
     367        structure_info = grep.result ();
     368        structure_info.replace ("structure=", "");
     369      }
     370    else
     371      {
     372        // This may happen for old protocol level < v1r1
     373        structure_info = "package";
     374      }
     375   
     376    grep.run (m_last_cvs_infos, "error=");
     377   
     378    if (grep.result () != "")
     379      {
     380        error_info = grep.result ();
     381        error_info.replace ("error=", "");
     382      }
     383    else
     384      {
     385        error_info = "";
     386      }
     387   
     388    grep.run (m_last_cvs_infos, "tags_top=");
     389   
     390    if (grep.result () != "")
     391      {
     392        tags_top_info = grep.result ();
     393        tags_top_info.replace ("tags_top=", "");
     394      }
     395    else
     396      {
     397        tags_top_info = "";
     398      }
     399   
     400    grep.run (m_last_cvs_infos, "tags=");
     401   
     402    if (grep.result () != "")
     403      {
     404        tags_info = grep.result ();
     405        tags_info.replace ("tags=", "");
     406      }
     407    else
     408      {
     409        tags_info = "";
     410      }
     411   
     412    grep.run (m_last_cvs_infos, "cvsversions_top=");
     413   
     414    if (grep.result () != "")
     415      {
     416        cvsversions_top_info = grep.result ();
     417        cvsversions_top_info.replace ("cvsversions_top=", "");
     418      }
     419    else
     420      {
     421        cvsversions_top_info = "";
     422      }
     423   
     424    grep.run (m_last_cvs_infos, "cvsversions=");
     425   
     426    if (grep.result () != "")
     427      {
     428        cvsversions_info = grep.result ();
     429        cvsversions_info.replace ("cvsversions=", "");
     430      }
     431    else
     432      {
     433        cvsversions_info = "";
     434      }
     435   
     436    cmt_string tag_filter = CmtSystem::getenv ("CMTCVSTAGFILTER");
     437   
     438    if (tag_filter != "")
     439      {
     440        cmt_string package;
     441        CmtSystem::basename (module, package);
     442       
     443        cmt_string pattern = "<package>";
     444       
     445        tag_filter.replace_all (pattern, package);
     446       
     447        cmt_regexp exp (tag_filter);
     448       
     449        cmt_string text;
     450       
     451        filter_list (tags_top_info, exp);
     452        filter_list (tags_info, exp);
     453        filter_list (cvsversions_top_info, exp);
     454        filter_list (cvsversions_info, exp);
     455      }
     456   
     457    if (m_cmtcvstest)
     458      {
     459        cout << "## tags_top_info=" << tags_top_info << endl;
     460        cout << "## tags_info=" << tags_info << endl;
     461        cout << "## cvsversions_top_info=" << cvsversions_top_info << endl;
     462        cout << "## cvsversions_info=" << cvsversions_info << endl;
     463      }
     464   
     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      }
     500  }
     501 
    467502  void show_cvs_infos (const cmt_string& offset,
    468503                       const cmt_string& module)
     
    700735                                      const cmt_string& package,
    701736                                      const cmt_string& version)
    702       {
    703         cmt_string dir = m_home_dir;
    704 
    705         if (m_checkout_dir != "")
    706           {
    707             dir += CmtSystem::file_separator ();
    708             dir += m_checkout_dir;
    709           }
    710 
    711         dir += CmtSystem::file_separator ();
    712         dir += prefix;
    713         dir += CmtSystem::file_separator ();
    714         dir += package;
    715 
    716         if (Cmt::get_current_structuring_style () == with_version_directory)
    717           {
    718             dir += CmtSystem::file_separator ();
    719             dir += version;
    720           }
    721 
    722         CmtSystem::reduce_file_separators (dir);
    723 
    724         return (dir);
    725       }
     737  {
     738    cmt_string dir = m_home_dir;
     739   
     740    if (m_checkout_dir != "")
     741      {
     742        dir += CmtSystem::file_separator ();
     743        dir += m_checkout_dir;
     744      }
     745   
     746    dir += CmtSystem::file_separator ();
     747    dir += prefix;
     748    dir += CmtSystem::file_separator ();
     749    dir += package;
     750   
     751    if (Cmt::get_current_structuring_style () == with_version_directory)
     752      {
     753        dir += CmtSystem::file_separator ();
     754        dir += version;
     755      }
     756   
     757    CmtSystem::reduce_file_separators (dir);
     758   
     759    return (dir);
     760  }
     761
     762  bool really_checkout_project_contents (const cmt_string& prefix,
     763                                         const cmt_string& project,
     764                                         const cmt_string& version,
     765                                         const cmt_string& module,
     766                                         const cmt_string& basedir,
     767                                         bool at_head,
     768                                         const cmt_string& currentdir)
     769  {
     770    cmt_string dir = currentdir;
     771
     772    cout << "  # get project files " << endl;
     773
     774    cmt_string command = "cvs -Q co -P ";
     775    if (!at_head)
     776      {
     777        command += "-r ";
     778        command += version;
     779      }
     780
     781    command += "-d ";
     782    command += version;
     783
     784    command += " ";
     785    command += module;
     786    command += "/cmt";
     787
     788    int status = 0;
     789    int retry = 0;
     790   
     791    for (;;)
     792      {
     793        if (m_verbose || m_simulation)
     794          {
     795            cout << "#CMT> Executing [" << command << "]" << endl;
     796          }
     797       
     798        if (!m_simulation)
     799          {
     800            //status = CmtSystem::execute (command, out);
     801            status = CmtSystem::execute (command);
     802          }
     803       
     804        if (status != 0)
     805          {
     806            retry++;
     807           
     808            cout << "# Error getting project CMT contents: status=" << status << endl;
     809            cout << "#---------------------------------------------------------" << endl;
     810           
     811            if (retry > 5) exit(0);
     812          }
     813        else
     814          {
     815            break;
     816          }
     817      }
     818
     819    return (true);
     820  }
     821
     822  bool really_checkout_package_contents (const cmt_string& prefix,
     823                                         const cmt_string& package,
     824                                         const cmt_string& version,
     825                                         const cmt_string& module,
     826                                         const cmt_string& basedir,
     827                                         bool at_head,
     828                                         const cmt_string& currentdir)
     829  {
     830    cmt_string dir = currentdir;
     831
     832    cout << "  # get top files " << endl;
     833           
     834    cmt_string command = "cvs -Q co -P -l ";
     835    if (!at_head)
     836      {
     837        command += "-r ";
     838        command += version;
     839      }
     840   
     841    if (Cmt::get_current_structuring_style () == with_version_directory)
     842      {
     843        command += " -d ";
     844        command += version;
     845      }
     846    else
     847      {
     848        command += " -d ";
     849        command += package;
     850      }
     851   
     852    command += " ";
     853    command += module;
     854   
     855    if (m_cmtcvstest)
     856      {
     857        cmt_string cvsroot;
     858       
     859        CmtSystem::get_cvsroot (cvsroot);
     860       
     861        cout << "## cvsroot=" << cvsroot << " command[" << command << "]" << endl;
     862      }
     863   
     864    int status = 0;
     865    int retry = 0;
     866   
     867    for (;;)
     868      {
     869        if (m_verbose || m_simulation)
     870          {
     871            cout << "#CMT> Executing [" << command << "]" << endl;
     872          }
     873       
     874        if (!m_simulation)
     875          {
     876            //status = CmtSystem::execute (command, out);
     877            status = CmtSystem::execute (command);
     878          }
     879       
     880        if (status != 0)
     881          {
     882            retry++;
     883           
     884            cout << "# Error getting package CMT contents: status=" << status << endl;
     885            cout << "#---------------------------------------------------------" << endl;
     886           
     887            if (retry > 5) exit(0);
     888           
     889          }
     890        else
     891          {
     892            break;
     893          }
     894      }
     895
     896    if (Cmt::get_current_structuring_style () == with_version_directory)
     897      {
     898        if (m_simulation)
     899          {
     900            cout << "#CMT> Would mkdir " << version << endl;
     901          }
     902        else
     903          {
     904            if (m_verbose)
     905              {
     906                cout << "#CMT> About to mkdir " << version << endl;
     907              }
     908
     909            if (!CmtSystem::cd (version))
     910              {
     911                CmtSystem::mkdir (version);
     912                if (!CmtSystem::cd (version))
     913                  {
     914                    cout << "# Error creating the version directory :" << version << endl;
     915                    cout << "#---------------------------------------------------------" << endl;
     916                    return (false);
     917                  }
     918              }
     919           
     920            /*
     921              if (m_verbose)
     922              {
     923              cout << "#CMT> pwd.2=" << CmtSystem::pwd () << endl;
     924              }
     925            */
     926          }
     927       
     928        dir += CmtSystem::file_separator ();
     929        dir += version;
     930      }
     931    else
     932      {
     933        if (m_simulation)
     934          {
     935            cout << "#CMT> will mkdir " << package << endl;
     936          }
     937        else
     938          {
     939            if (!CmtSystem::cd (package))
     940              {
     941                if (m_verbose)
     942                  {
     943                    cout << "#CMT> About to mkdir " << package << endl;
     944                  }
     945                CmtSystem::mkdir (package);
     946                if (!CmtSystem::cd (package))
     947                  {
     948                    cout << "# Error creating the package directory :" << package << endl;
     949                    cout << "#---------------------------------------------------------" << endl;
     950                    return (false);
     951                  }
     952              }
     953           
     954            /*
     955              if (m_verbose)
     956              {
     957              cout << "#CMT> pwd.3=" << CmtSystem::pwd () << endl;
     958              }
     959            */
     960          }
     961       
     962        dir += CmtSystem::file_separator ();
     963        dir += package;
     964      }
     965   
     966    cmt_string entries_file_name;
     967    cmt_string text;
     968   
     969    cmt_string branches = CmtSystem::getenv ("CMTCVSBRANCHES");
     970   
     971    if (branches == "")
     972      {
     973        branches = branches_info;
     974      }
     975   
     976    CmtSystem::cmt_string_vector branch_vector;
     977   
     978    CmtSystem::split (branches, " \t", branch_vector);
     979   
     980    int i;
     981   
     982    cout << "  # get branches " << branches << endl;
     983   
     984    //command = "(";
     985    command = "";
     986   
     987    entries_file_name = "CVS";
     988    entries_file_name += CmtSystem::file_separator ();
     989    entries_file_name += "Entries";
     990   
     991    if (!text.read (entries_file_name))
     992      {
     993        // This happens when there were no top files
     994      }
     995   
     996    for (i = 0; i < branch_vector.size (); i++)
     997      {
     998        cmt_string& branch = branch_vector[i];
     999       
     1000        if (i > 0)
     1001          {
     1002            command += CmtSystem::command_separator ();
     1003          }
     1004       
     1005        //command += "cvs -Q co -P ";
     1006        command += "cvs -Q co ";
     1007       
     1008        //            if (branch != "cmt")
     1009        //              {
     1010        if (!at_head)
     1011          {
     1012            command += "-r ";
     1013            command += version;
     1014          }
     1015        //              }
     1016       
     1017        command += " -d ";
     1018        command += branch;
     1019        command += " ";
     1020        command += module;
     1021        command += "/";    // CVS uses the '/' notation on all platforms!!
     1022        command += branch;
     1023        //command += "\n";
     1024       
     1025        text += "D/";
     1026        text += branch;
     1027        text += "////\n";
     1028      }
     1029   
     1030    //command += "; echo cmtcvsstatus=$?) 2>&1 ";
     1031   
     1032    if (m_cmtcvstest)
     1033      {
     1034        cmt_string cvsroot;
     1035       
     1036        CmtSystem::get_cvsroot (cvsroot);
     1037       
     1038        cout << " cvsroot=" << cvsroot << " command[" << command << "]" << endl;
     1039      }
     1040   
     1041    status = 0;
     1042    retry = 0;
     1043   
     1044    for (;;)
     1045      {
     1046        if (m_verbose || m_simulation)
     1047          {
     1048            cout << "#CMT> Executing [" << command << "]" << endl;
     1049          }
     1050       
     1051        if (!m_simulation)
     1052          {
     1053            //status = CmtSystem::execute (command, out);
     1054            status = CmtSystem::execute (command);
     1055          }
     1056       
     1057        if (status != 0)
     1058          {
     1059            retry++;
     1060           
     1061            cout << "# Error getting package contents: status=" << status << endl;
     1062            cout << "#---------------------------------------------------------" << endl;
     1063           
     1064            if (retry > 5) exit(0);
     1065           
     1066          }
     1067        else
     1068          {
     1069            break;
     1070          }
     1071      }
     1072   
     1073    if (!CmtSystem::test_directory ("CVS"))
     1074      {
     1075        /**
     1076         * The CVS repository had not been created (this is generally
     1077         * due to the lack of top files)
     1078         */
     1079       
     1080        if (m_simulation)
     1081          {
     1082            cout << "#CMT> Would create the CVS directory" << endl;
     1083          }
     1084        else
     1085          {
     1086            if (m_verbose)
     1087              {
     1088                cout << "#CMT> About to mkdir " << "CVS" << endl;
     1089              }
     1090            CmtSystem::mkdir ("CVS");
     1091          }
     1092       
     1093        cmt_string s;
     1094       
     1095        // Let's create first the CVS/Root file.
     1096       
     1097        CmtSystem::get_cvsroot (s);
     1098        s += "\n";
     1099       
     1100        cmt_string f;
     1101       
     1102        f = "CVS";
     1103        f += CmtSystem::file_separator ();
     1104        f += "Root";
     1105       
     1106        if (m_simulation)
     1107          {
     1108            cout << "#CMT> Would fill in the CVS/Root file with " << endl;
     1109            cout << s << endl;
     1110          }
     1111        else
     1112          {
     1113            if (m_verbose)
     1114              {
     1115                cout << "#CMT> Fill in the CVS/Root file with " << endl;
     1116                cout << s << endl;
     1117              }
     1118            s.write (f);
     1119          }
     1120       
     1121        // Now we create the CVS/Repository file
     1122       
     1123        f = "CVS";
     1124        f += CmtSystem::file_separator ();
     1125        f += "Repository";
     1126       
     1127        CmtSystem::get_cvsroot (s);
     1128        if (s[0] == ':')
     1129          {
     1130            int pos = s.find (1, ":");
     1131            s.erase (0, pos+1);
     1132            pos = s.find (0, ":");
     1133            s.erase (0, pos+1);
     1134          }
     1135        s += "/";
     1136        s += module;
     1137        s += "\n";
     1138       
     1139        if (m_simulation)
     1140          {
     1141            cout << "#CMT> Would fill in the CVS/Repository file with " << endl;
     1142            cout << s << endl;
     1143          }
     1144        else
     1145          {
     1146            if (m_verbose)
     1147              {
     1148                cout << "#CMT> Fill in the CVS/Repository file with " << endl;
     1149                cout << s << endl;
     1150              }
     1151            s.write (f);
     1152          }
     1153      }
     1154   
     1155    if (m_simulation)
     1156      {
     1157        cout << "#CMT> Would write the top CVS/Entries file with " << endl;
     1158        cout << text << endl;
     1159      }
     1160    else
     1161      {
     1162        // Now the CVS/Entries is ready to be created.
     1163        if (m_verbose)
     1164          {
     1165            cout << "#CMT> Fill in the top CVS/Entries file with " << endl;
     1166            cout << text << endl;
     1167          }
     1168        text.write (entries_file_name);
     1169      }
     1170
     1171    return (true);
     1172  }
    7261173
    7271174  bool really_checkout_package (const cmt_string& prefix,
     
    7311178                                const cmt_string& basedir,
    7321179                                bool at_head)
    733       {
    734         cmt_string dir = basedir;
    735         cmt_string out;
    736 
    737         cout << "# ================= working on package " << package
    738              << " version " << version;
    739 
    740         if (at_head) cout << " (At head) ";
    741 
    742         {
    743           cmt_string full_prefix;
    744 
    745           full_prefix = m_offset;
    746           full_prefix += prefix;
    747 
    748           cmt_string echo_ppath;
     1180  {
     1181    cmt_string dir = basedir;
     1182    cmt_string out;
     1183   
     1184    cout << "# ================= working on " << structure_info << " " << package
     1185         << " version " << version;
     1186
     1187    if (at_head) cout << " (At head) ";
     1188
     1189    cmt_string full_prefix;
     1190
     1191    full_prefix = m_offset;
     1192    full_prefix += prefix;
     1193
     1194    cmt_string echo_ppath;
    7491195       
    750           if (prefix != "")
    751             {
    752               echo_ppath = " path ";
    753               echo_ppath += prefix;
    754             }
    755 
    756           cout << echo_ppath << endl;
    757         }
    758 
    759         CmtSystem::dirname (dir, dir);
    760 
    761         //if (Cmt::get_current_structuring_style () == with_version_directory)
    762         {
    763           if (m_simulation)
    764             {
    765               cout << "#CMT> Would mkdir " << dir << endl;
    766             }
    767           else
    768             {
    769               if (m_verbose)
    770                 {
    771                   cout << "#CMT> About to mkdir " << dir << endl;
    772                 }
    773              
    774               if (!CmtSystem::mkdir (dir))
    775                 {
    776                   cout << "# Error creating the base directory :" << dir << endl;
    777                   cout << "#---------------------------------------------------------" << endl;
    778                   return (false);
    779                 }
    780              
    781               CmtSystem::cd (dir);
    782              
    783               /*
    784               if (m_verbose)
    785                 {
    786                   cout << "#CMT> pwd.1=" << CmtSystem::pwd () << endl;
    787                 }
    788               */
    789             }
    790         }
    791        
    792         cout << "  # get top files " << endl;
    793            
    794         cmt_string command = "cvs -Q co -P -l ";
    795         if (!at_head)
    796           {
    797             command += "-r ";
    798             command += version;
    799           }
    800 
    801         if (Cmt::get_current_structuring_style () == with_version_directory)
    802           {
    803             command += " -d ";
    804             command += version;
    805           }
    806         else
    807           {
    808             command += " -d ";
    809             command += package;
    810           }
    811 
    812         command += " ";
    813         command += module;
    814                
    815         if (m_cmtcvstest)
    816           {
    817             cmt_string cvsroot;
    818            
    819             CmtSystem::get_cvsroot (cvsroot);
    820            
    821             cout << "## cvsroot=" << cvsroot << " command[" << command << "]" << endl;
    822           }
    823        
    824         int status = 0;
    825         int retry = 0;
    826 
    827         for (;;)
    828           {
    829             if (m_verbose || m_simulation)
    830               {
    831                 cout << "#CMT> Executing [" << command << "]" << endl;
    832               }
    833 
    834             if (!m_simulation)
    835               {
    836                 //status = CmtSystem::execute (command, out);
    837                 status = CmtSystem::execute (command);
    838               }
    839        
    840             if (status != 0)
    841               {
    842                 retry++;
    843 
    844                 cout << "# Error getting package CMT contents: status=" << status << endl;
    845                 cout << "#---------------------------------------------------------" << endl;
    846 
    847                 if (retry > 5) exit(0);
    848 
    849               }
    850             else
    851               {
    852                 break;
    853               }
    854           }
    855 
    856 
    857           {
    858             if (Cmt::get_current_structuring_style () == with_version_directory)
    859               {
    860                 if (m_simulation)
    861                   {
    862                     cout << "#CMT> Would mkdir " << version << endl;
    863                   }
    864                 else
    865                   {
    866                     if (m_verbose)
    867                       {
    868                         cout << "#CMT> About to mkdir " << version << endl;
    869                       }
    870                     if (!CmtSystem::cd (version))
    871                       {
    872                         CmtSystem::mkdir (version);
    873                         if (!CmtSystem::cd (version))
    874                           {
    875                             cout << "# Error creating the version directory :" << version << endl;
    876                             cout << "#---------------------------------------------------------" << endl;
    877                             return (false);
    878                           }
    879                       }
    880                    
    881                     /*
    882                     if (m_verbose)
    883                       {
    884                         cout << "#CMT> pwd.2=" << CmtSystem::pwd () << endl;
    885                       }
    886                     */
    887                   }
    888                
    889                 dir += CmtSystem::file_separator ();
    890                 dir += version;
    891               }
    892             else
    893               {
    894                 if (m_simulation)
    895                   {
    896                     cout << "#CMT> will mkdir " << package << endl;
    897                   }
    898                 else
    899                   {
    900                     if (!CmtSystem::cd (package))
    901                       {
    902                         if (m_verbose)
    903                           {
    904                             cout << "#CMT> About to mkdir " << package << endl;
    905                           }
    906                         CmtSystem::mkdir (package);
    907                         if (!CmtSystem::cd (package))
    908                           {
    909                             cout << "# Error creating the package directory :" << package << endl;
    910                             cout << "#---------------------------------------------------------" << endl;
    911                             return (false);
    912                           }
    913                       }
    914                    
    915                     /*
    916                     if (m_verbose)
    917                       {
    918                         cout << "#CMT> pwd.3=" << CmtSystem::pwd () << endl;
    919                       }
    920                     */
    921                   }
    922                
    923                 dir += CmtSystem::file_separator ();
    924                 dir += package;
    925               }
    926           }
    927                
    928         cmt_string entries_file_name;
    929         cmt_string text;
    930        
    931         cmt_string branches = CmtSystem::getenv ("CMTCVSBRANCHES");
    932        
    933         if (branches == "")
    934           {
    935             branches = branches_info;
    936           }
    937        
    938         CmtSystem::cmt_string_vector branch_vector;
    939        
    940         CmtSystem::split (branches, " \t", branch_vector);
    941        
    942         int i;
    943        
    944         cout << "  # get branches " << branches << endl;
    945        
    946         //command = "(";
    947         command = "";
    948 
    949         entries_file_name = "CVS";
    950         entries_file_name += CmtSystem::file_separator ();
    951         entries_file_name += "Entries";
    952        
    953         if (!text.read (entries_file_name))
    954           {
    955               // This happens when there were no top files
    956           }
    957        
    958         for (i = 0; i < branch_vector.size (); i++)
    959           {
    960             cmt_string& branch = branch_vector[i];
    961 
    962             if (i > 0)
    963               {
    964                 command += CmtSystem::command_separator ();
    965               }
    966            
    967               //command += "cvs -Q co -P ";
    968             command += "cvs -Q co ";
    969            
    970 //            if (branch != "cmt")
    971 //              {
    972             if (!at_head)
    973               {
    974                 command += "-r ";
    975                 command += version;
    976               }
    977 //              }
    978            
    979             command += " -d ";
    980             command += branch;
    981             command += " ";
    982             command += module;
    983             command += "/";    // CVS uses the '/' notation on all platforms!!
    984             command += branch;
    985             //command += "\n";
    986            
    987             text += "D/";
    988             text += branch;
    989             text += "////\n";
    990           }
    991 
    992         //command += "; echo cmtcvsstatus=$?) 2>&1 ";
    993 
    994         if (m_cmtcvstest)
    995           {
    996             cmt_string cvsroot;
    997            
    998             CmtSystem::get_cvsroot (cvsroot);
    999            
    1000             cout << " cvsroot=" << cvsroot << " command[" << command << "]" << endl;
    1001           }
    1002        
    1003         status = 0;
    1004         retry = 0;
    1005 
    1006         for (;;)
    1007           {
    1008             if (m_verbose || m_simulation)
    1009               {
    1010                 cout << "#CMT> Executing [" << command << "]" << endl;
    1011               }
    1012 
    1013             if (!m_simulation)
    1014               {
    1015                 //status = CmtSystem::execute (command, out);
    1016                 status = CmtSystem::execute (command);
    1017               }
    1018        
    1019             if (status != 0)
    1020               {
    1021                 retry++;
    1022 
    1023                 cout << "# Error getting package contents: status=" << status << endl;
    1024                 cout << "#---------------------------------------------------------" << endl;
    1025 
    1026                 if (retry > 5) exit(0);
    1027 
    1028               }
    1029             else
    1030               {
    1031                 break;
    1032               }
    1033           }
    1034 
    1035           {
    1036             if (!CmtSystem::test_directory ("CVS"))
    1037               {
    1038                   /**
    1039                    * The CVS repository had not been created (this is generally
    1040                    * due to the lack of top files)
    1041                    */
    1042                
    1043                 if (m_simulation)
    1044                   {
    1045                     cout << "#CMT> Would create the CVS directory" << endl;
    1046                   }
    1047                 else
    1048                   {
    1049                     if (m_verbose)
    1050                       {
    1051                         cout << "#CMT> About to mkdir " << "CVS" << endl;
    1052                       }
    1053                     CmtSystem::mkdir ("CVS");
    1054                   }
    1055 
    1056                 cmt_string s;
    1057                
    1058                   // Let's create first the CVS/Root file.
    1059                
    1060                 CmtSystem::get_cvsroot (s);
    1061                 s += "\n";
    1062                
    1063                 cmt_string f;
    1064                
    1065                 f = "CVS";
    1066                 f += CmtSystem::file_separator ();
    1067                 f += "Root";
    1068                
    1069                 if (m_simulation)
    1070                   {
    1071                     cout << "#CMT> Would fill in the CVS/Root file with " << endl;
    1072                     cout << s << endl;
    1073                   }
    1074                 else
    1075                   {
    1076                     if (m_verbose)
    1077                       {
    1078                         cout << "#CMT> Fill in the CVS/Root file with " << endl;
    1079                         cout << s << endl;
    1080                       }
    1081                     s.write (f);
    1082                   }
    1083                
    1084                   // Now we create the CVS/Repository file
    1085                
    1086                 f = "CVS";
    1087                 f += CmtSystem::file_separator ();
    1088                 f += "Repository";
    1089                
    1090                 CmtSystem::get_cvsroot (s);
    1091                 if (s[0] == ':')
    1092                   {
    1093                     int pos = s.find (1, ":");
    1094                     s.erase (0, pos+1);
    1095                     pos = s.find (0, ":");
    1096                     s.erase (0, pos+1);
    1097                   }
    1098                 s += "/";
    1099                 s += module;
    1100                 s += "\n";
    1101                
    1102                 if (m_simulation)
    1103                   {
    1104                     cout << "#CMT> Would fill in the CVS/Repository file with " << endl;
    1105                     cout << s << endl;
    1106                   }
    1107                 else
    1108                   {
    1109                     if (m_verbose)
    1110                       {
    1111                         cout << "#CMT> Fill in the CVS/Repository file with " << endl;
    1112                         cout << s << endl;
    1113                       }
    1114                     s.write (f);
    1115                   }
    1116               }
    1117            
    1118             if (m_simulation)
    1119               {
    1120                 cout << "#CMT> Would write the top CVS/Entries file with " << endl;
    1121                 cout << text << endl;
    1122               }
    1123             else
    1124               {
    1125                 // Now the CVS/Entries is ready to be created.
    1126                 if (m_verbose)
    1127                   {
    1128                     cout << "#CMT> Fill in the top CVS/Entries file with " << endl;
    1129                     cout << text << endl;
    1130                   }
    1131                 text.write (entries_file_name);
    1132               }
    1133           }
    1134 
    1135         return (true);
    1136       }
     1196    if (prefix != "")
     1197      {
     1198        echo_ppath = " path ";
     1199        echo_ppath += prefix;
     1200      }
     1201   
     1202    cout << echo_ppath << endl;
     1203
     1204    CmtSystem::dirname (dir, dir);
     1205
     1206    //if (Cmt::get_current_structuring_style () == with_version_directory)
     1207
     1208    if (m_simulation)
     1209      {
     1210        cout << "#CMT> Would mkdir " << dir << endl;
     1211      }
     1212    else
     1213      {
     1214        if (m_verbose)
     1215          {
     1216            cout << "#CMT> About to mkdir " << dir << endl;
     1217          }
     1218       
     1219        if (!CmtSystem::mkdir (dir))
     1220          {
     1221            cout << "# Error creating the base directory :" << dir << endl;
     1222            cout << "#---------------------------------------------------------" << endl;
     1223            return (false);
     1224          }
     1225       
     1226        CmtSystem::cd (dir);
     1227       
     1228        /*
     1229          if (m_verbose)
     1230          {
     1231          cout << "#CMT> pwd.1=" << CmtSystem::pwd () << endl;
     1232          }
     1233        */
     1234      }
     1235       
     1236    if (structure_info == "package")
     1237      {
     1238        really_checkout_package_contents (prefix,
     1239                                          package,
     1240                                          version,
     1241                                          module,
     1242                                          basedir,
     1243                                          at_head,
     1244                                          dir);
     1245      }
     1246    else if (structure_info == "project")
     1247      {
     1248        really_checkout_project_contents (prefix,
     1249                                          package,
     1250                                          version,
     1251                                          module,
     1252                                          basedir,
     1253                                          at_head,
     1254                                          dir);
     1255      }
     1256
     1257    return (true);
     1258  }
    11371259
    11381260  cmt_string find_matching_version (const cmt_string& expression)
     
    15441666        cmt_string out;
    15451667
    1546         show_cvs_infos (CmtSystem::getenv ("CMTCVSOFFSET"), module);
     1668        show_cvs_infos (CmtSystem::getenv ("CMTCVSOFFSET"), (module == "") ? "." : module);
    15471669
    15481670        if (error_info != "")
     
    15531675          {
    15541676            cout << subpackages_info << endl;
     1677          }
     1678      }
     1679
     1680  void subprojects (const cmt_string& module)
     1681      {
     1682        cmt_string out;
     1683
     1684        show_cvs_infos (CmtSystem::getenv ("CMTCVSOFFSET"), (module == "") ? "." : module);
     1685
     1686        if (error_info != "")
     1687          {
     1688            cout << error_info << endl;
     1689          }
     1690        else
     1691          {
     1692            cout << subprojects_info << endl;
    15551693          }
    15561694      }
     
    16261764        version = version_tag;
    16271765      }
    1628    
     1766
    16291767    CmtSystem::dirname (module, prefix);
    16301768    CmtSystem::basename (module, package);
     
    17461884
    17471885  void checkout (const CmtSystem::cmt_string_vector& arguments)
    1748       {
    1749         if (arguments.size () < 1)
    1750           {
    1751             help ();
    1752             return;
    1753           }
    1754        
    1755         if (CmtSystem::getenv ("CVSROOT") == "")
    1756           {
    1757             cout << "# Please set CVSROOT first !" << endl;
    1758             return;
    1759           }
    1760              
    1761         if (CmtSystem::getenv ("CMTCVSTEST") != "")
    1762           {
    1763             m_cmtcvstest = true;
    1764           }
    1765         else
    1766           {
    1767             m_cmtcvstest = false;
    1768           }
    1769 
    1770         m_home_dir = CmtSystem::pwd ();
    1771         m_checkout_dir = "";
    1772         m_offset = "";
    1773         m_branch_suffix = "";
    1774 
    1775         cmt_string module;
    1776              
    1777         m_recursive = false;
    1778 
    1779         bool need_version_tag = false;
    1780         cmt_string version_tag;
    1781 
    1782         bool need_checkout_dir = false;
    1783         bool need_offset = false;
    1784         bool need_requirements_file = false;
    1785 
    1786         m_simulation = false;
    1787         //m_verbose = true;
    1788         m_verbose = false;
    1789 
    1790         bool need_branch_suffix = false;
    1791 
    1792         m_head = true;
    1793 
    1794         m_offset = CmtSystem::getenv ("CMTCVSOFFSET");
    1795         if (m_offset != "")
    1796           {
    1797             m_offset += "/";
    1798             m_offset.replace_all ("//", "/");
    1799           }
    1800 
    1801         for (int arg = 0; arg < arguments.size (); arg++)
    1802           {
    1803             const cmt_string& option = arguments[arg];
    1804 
    1805             if (need_version_tag)
    1806               {
    1807                 need_version_tag = false;
    1808 
    1809                 if (option == "HEAD")
    1810                   {
    1811                     m_head = true;
    1812                   }
    1813                 else
    1814                   {
    1815                     version_tag = option;
    1816                   }
    1817               }
    1818             else if (need_checkout_dir)
    1819               {
    1820                 need_checkout_dir = false;
    1821                 m_checkout_dir = option;
    1822               }
    1823             else if (need_offset)
    1824               {
    1825                 need_offset = false;
    1826                 m_offset = option;
    1827                 m_offset += '/';
    1828                 m_offset.replace_all ("//", "/");
    1829               }
    1830             else if (need_branch_suffix)
    1831               {
    1832                 need_branch_suffix = false;
    1833                 m_branch_suffix = "-";
    1834                 m_branch_suffix += option;
    1835               }
    1836             else if (need_requirements_file)
    1837               {
    1838                 need_requirements_file = false;
    1839                 m_head = false;
    1840                 checkout_from_requirements (option);
    1841               }
    1842             else
    1843               {
    1844                 if (option == "-R")
    1845                   {
    1846                     m_recursive = true;
    1847                   }
    1848                 else if (option == "-l")
    1849                   {
    1850                     m_recursive = false;
    1851                   }
    1852                 else if (option == "-r")
    1853                   {
    1854                     need_version_tag = true;
    1855                     m_head = false;
    1856                   }
    1857                 else if (option == "-d")
    1858                   {
    1859                     need_checkout_dir = true;
    1860                   }
    1861                 else if (option == "-o")
    1862                   {
    1863                     need_offset = true;
    1864                   }
    1865                 else if (option == "-n")
    1866                   {
    1867                     m_simulation = true;
    1868                   }
    1869                 else if (option == "-v")
    1870                   {
    1871                     m_verbose = true;
    1872                   }
    1873                 else if (option == "-branch")
    1874                   {
    1875                     need_branch_suffix = true;
    1876                   }
    1877                 else if (option == "-requirements")
    1878                   {
    1879                     need_requirements_file = true;
    1880                   }
    1881                 else if (option == "--help")
    1882                   {
    1883                     help ();
    1884                     return;
    1885                   }
    1886                 else if (option[0] == '-')
    1887                   {
    1888                     help ();
    1889                     return;
    1890                   }
    1891                 else
    1892                   {
    1893                     do_checkout (option, version_tag);
    1894                   }
    1895               }
    1896           }
    1897 
    1898       }
     1886  {
     1887    if (arguments.size () < 1)
     1888      {
     1889        help ();
     1890        return;
     1891      }
     1892   
     1893    if (CmtSystem::getenv ("CVSROOT") == "")
     1894      {
     1895        cout << "# Please set CVSROOT first !" << endl;
     1896        return;
     1897      }
     1898   
     1899    if (CmtSystem::getenv ("CMTCVSTEST") != "")
     1900      {
     1901        m_cmtcvstest = true;
     1902      }
     1903    else
     1904      {
     1905        m_cmtcvstest = false;
     1906      }
     1907   
     1908    m_home_dir = CmtSystem::pwd ();
     1909    m_checkout_dir = "";
     1910    m_offset = "";
     1911    m_branch_suffix = "";
     1912   
     1913    cmt_string module;
     1914   
     1915    m_recursive = false;
     1916   
     1917    bool need_version_tag = false;
     1918    cmt_string version_tag;
     1919   
     1920    bool need_checkout_dir = false;
     1921    bool need_offset = false;
     1922    bool need_requirements_file = false;
     1923   
     1924    m_simulation = false;
     1925    //m_verbose = true;
     1926    m_verbose = false;
     1927   
     1928    bool need_branch_suffix = false;
     1929   
     1930    m_head = true;
     1931   
     1932    m_offset = CmtSystem::getenv ("CMTCVSOFFSET");
     1933    if (m_offset != "")
     1934      {
     1935        m_offset += "/";
     1936        m_offset.replace_all ("//", "/");
     1937      }
     1938   
     1939    for (int arg = 0; arg < arguments.size (); arg++)
     1940      {
     1941        const cmt_string& option = arguments[arg];
     1942       
     1943        if (need_version_tag)
     1944          {
     1945            need_version_tag = false;
     1946           
     1947            if (option == "HEAD")
     1948              {
     1949                m_head = true;
     1950              }
     1951            else
     1952              {
     1953                version_tag = option;
     1954              }
     1955          }
     1956        else if (need_checkout_dir)
     1957          {
     1958            need_checkout_dir = false;
     1959            m_checkout_dir = option;
     1960          }
     1961        else if (need_offset)
     1962          {
     1963            need_offset = false;
     1964            m_offset = option;
     1965            m_offset += '/';
     1966            m_offset.replace_all ("//", "/");
     1967          }
     1968        else if (need_branch_suffix)
     1969          {
     1970            need_branch_suffix = false;
     1971            m_branch_suffix = "-";
     1972            m_branch_suffix += option;
     1973          }
     1974        else if (need_requirements_file)
     1975          {
     1976            need_requirements_file = false;
     1977            m_head = false;
     1978            checkout_from_requirements (option);
     1979          }
     1980        else
     1981          {
     1982            if (option == "-R")
     1983              {
     1984                m_recursive = true;
     1985              }
     1986            else if (option == "-l")
     1987              {
     1988                m_recursive = false;
     1989              }
     1990            else if (option == "-r")
     1991              {
     1992                need_version_tag = true;
     1993                m_head = false;
     1994              }
     1995            else if (option == "-d")
     1996              {
     1997                need_checkout_dir = true;
     1998              }
     1999            else if (option == "-o")
     2000              {
     2001                need_offset = true;
     2002              }
     2003            else if (option == "-n")
     2004              {
     2005                m_simulation = true;
     2006              }
     2007            else if (option == "-v")
     2008              {
     2009                m_verbose = true;
     2010              }
     2011            else if (option == "-branch")
     2012              {
     2013                need_branch_suffix = true;
     2014              }
     2015            else if (option == "-requirements")
     2016              {
     2017                need_requirements_file = true;
     2018              }
     2019            else if (option == "--help")
     2020              {
     2021                help ();
     2022                return;
     2023              }
     2024            else if (option[0] == '-')
     2025              {
     2026                help ();
     2027                return;
     2028              }
     2029            else
     2030              {
     2031                do_checkout (option, version_tag);
     2032              }
     2033          }
     2034      }
     2035  }
    18992036
    19002037private:
     
    19132050  cmt_string m_last_module;
    19142051  cmt_string m_last_cvs_infos;
     2052  cmt_string structure_info;
    19152053  cmt_string error_info;
    19162054  cmt_string tags_top_info;
     
    19202058  cmt_string branches_info;
    19212059  cmt_string subpackages_info;
     2060  cmt_string subprojects_info;
    19222061};
    19232062
     
    22042343}
    22052344
     2345void Cvs::subprojects (const cmt_string& module)
     2346{
     2347  CvsImplementation cvs;
     2348
     2349  cvs.subprojects (module);
     2350}
     2351
    22062352void Cvs::checkout (const CmtSystem::cmt_string_vector& arguments)
    22072353{
  • CMT/HEAD/source/cmt_cvs.h

    r11 r42  
    1717  static void branches (const cmt_string& module);
    1818  static void subpackages (const cmt_string& module);
     19  static void subprojects (const cmt_string& module);
    1920  static void checkout (const CmtSystem::cmt_string_vector& arguments);
    2021
  • CMT/HEAD/source/cmt_parser.cxx

    r22 r42  
    24652465{
    24662466  Cvs::subpackages (ap.arguments[0]);
     2467}
     2468
     2469//----------------------------------------------------------
     2470void Cmt::do_cvssubprojects (const ArgParser& ap)
     2471{
     2472  Cvs::subprojects (ap.arguments[0]);
    24672473}
    24682474
     
    47954801    case action_create :
    47964802      // case action_create_project :
    4797       // case action_cvsbranches :
    4798       // case action_cvssubpackages :
    4799       // case action_cvstags :
     4803    case action_cvsbranches :
     4804    case action_cvssubpackages :
     4805    case action_cvssubprojects :
     4806    case action_cvstags :
    48004807    case action_do :
    48014808    case action_expand_model :
     
    49054912      // case action_cvsbranches :
    49064913      // case action_cvssubpackages :
     4914      // case action_cvssubprojects :
    49074915      // case action_cvstags :
    49084916    case action_do :
     
    50075015      // case action_cvsbranches :
    50085016      // case action_cvssubpackages :
     5017      // case action_cvssubprojects :
    50095018      // case action_cvstags :
    50105019    case action_do :
     
    51155124          // case action_cvsbranches :
    51165125          // case action_cvssubpackages :
     5126          // case action_cvssubprojects :
    51175127          // case action_cvstags :
    51185128          // case action_do :
     
    52745284        case action_cvssubpackages :
    52755285          do_cvssubpackages (ap);
     5286          break;
     5287        case action_cvssubprojects :
     5288          do_cvssubprojects (ap);
    52765289          break;
    52775290        case action_cvstags :
  • CMT/HEAD/source/cmt_parser.h

    r11 r42  
    235235  action_cvsbranches,
    236236  action_cvssubpackages,
     237  action_cvssubprojects,
    237238  action_cvstags,
    238239  action_do,
  • CMT/HEAD/source/cmt_system.cxx

    r38 r42  
    604604bool CmtSystem::remove_directory (const cmt_string& name)
    605605{
    606   //cout << "Try to remove directory " << name << endl;
     606  //cerr << "Try to remove directory " << name << endl;
    607607
    608608  cmt_string_vector files;
     
    616616      if (test_directory (file))
    617617        {
     618          //cerr << "D=" << file << endl;
    618619          if (!remove_directory (file)) return (false);
    619620        }
    620621      else
    621622        {
     623          //cerr << "F=" << file << endl;
    622624          if (!remove_file (file)) return (false);
    623625        }
    624626    }
    625  
     627
    626628  int status = ::rmdir (name);
    627629  if (status != 0)
  • CMT/HEAD/source/cmt_use.cxx

    r11 r42  
    29952995    }
    29962996  buffer += "\"";
     2997
     2998  buffer += "macro ";
     2999  buffer += package_name;
     3000  buffer += "_project_release";
     3001  buffer += " \"";
     3002  if (p != 0)
     3003    {
     3004      buffer += p->get_release ();
     3005    }
     3006  buffer += "\"";
    29973007}
    29983008
Note: See TracChangeset for help on using the changeset viewer.