Changeset 525 for CMT


Ignore:
Timestamp:
Nov 6, 2009, 12:02:54 PM (15 years ago)
Author:
rybkin
Message:

See C.L. 412

Location:
CMT/HEAD
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/ChangeLog

    r524 r525  
     12009-11-06    <rybkin@lal.in2p3.fr> 412
     2
     3        * source/cmt_project.h: In class Project, introduce (static) function
     4        show_container, functions get_container_name, get_container_path,
     5        set_container_name, set_container_path, and drop functions get_container,
     6        set_container, add and drop class members accordingly, change
     7        container_action function signature to allow for the generic CMT container
     8        statement syntax
     9        * source/cmt_project.cxx: Implement the introduced and modified functions
     10        * source/cmt_syntax.cxx: In class KwdContainer, modify function action to
     11        reflect the changes above
     12        * source/cmt_commands.cxx: Introduce and implement "cmt show container"
     13        command making use of the functions introduced above
     14        * source/cmt_parser.h: idem
     15        * source/cmt_parser.cxx: idem
     16        * source/cmt.h: idem
     17        * src/setup.tcsh: Add completion for "cmt show container" command in TCSH
     18        * src/setup.zsh: Add completion for "cmt show container" command in Z shell
     19       
    1202009-10-15    <rybkin@lal.in2p3.fr> 411
    221
  • CMT/HEAD/source/cmt.h

    r521 r525  
    165165  static void do_show_constituent_names (const ArgParser& ap);
    166166  static void do_show_constituents (const ArgParser& ap);
     167  static void do_show_container (const ArgParser& ap);
    167168  static void do_show_cycles (const ArgParser& ap);
    168169  static void do_show_fragment (const ArgParser& ap);
  • CMT/HEAD/source/cmt_commands.cxx

    r496 r525  
    13111311        {
    13121312          cmt.m_action = action_show_constituents;
     1313        }
     1314      else if (arg == "container")
     1315        {
     1316          cmt.m_action = action_show_container;
    13131317        }
    13141318      else if (arg == "cycles")
     
    23402344  help.add (action_show_constituent_names, help_texts[action_show_constituent_names]);
    23412345  help.add (action_show_constituents, help_texts[action_show_constituents]);
     2346  help.add (action_show_container, help_texts[action_show_container]);
    23422347  help.add (action_show_cycles, help_texts[action_show_cycles]);
    23432348  help.add (action_show_fragment, help_texts[action_show_fragment]);
  • CMT/HEAD/source/cmt_parser.cxx

    r523 r525  
    39323932
    39333933//----------------------------------------------------------
     3934void Cmt::do_show_container (const ArgParser& /*ap*/)
     3935{
     3936  Project::show_container ();
     3937}
     3938
     3939//----------------------------------------------------------
    39343940void Cmt::do_show_cycles (const ArgParser& /*ap*/)
    39353941{
     
    57115717    case action_show_constituent_names :
    57125718    case action_show_constituents :
     5719    case action_show_container :
    57135720    case action_show_cycles :
    57145721    case action_show_fragment :
     
    58235830    case action_show_constituent_names :
    58245831    case action_show_constituents :
     5832    case action_show_container :
    58255833    case action_show_cycles :
    58265834    case action_show_fragment :
     
    59275935    case action_show_constituent_names :
    59285936    case action_show_constituents :
     5937    case action_show_container :
    59295938    case action_show_cycles :
    59305939    case action_show_fragment :
     
    60416050          // case action_show_cmtpath_patterns :
    60426051          // case action_show_constituent :
     6052          // case action_show_container :
    60436053          // case action_show_constituent_names :
    60446054          // case action_show_constituents :
     
    62486258        case action_show_branches :
    62496259          do_show_branches (ap);
     6260          break;
     6261        case action_show_container :
     6262          do_show_container (ap);
    62506263          break;
    62516264        case action_show_clients :
  • CMT/HEAD/source/cmt_parser.h

    r272 r525  
    285285  action_show_constituent_names,
    286286  action_show_constituents,
     287  action_show_container,
    287288  action_show_cycles,
    288289  action_show_fragment,
  • CMT/HEAD/source/cmt_project.cxx

    r523 r525  
    11201120
    11211121/*----------------------------------------------------------*/
     1122void Project::show_container ()
     1123{
     1124  Project* p = get_current ();
     1125
     1126  if (p == 0) return;
     1127  Use* use = &(p->m_container);
     1128  if (use->get_package_name () == "") return;
     1129
     1130          if (!use->located ())
     1131            {
     1132              CmtMessage::warning ("container " + use->get_package_name ()
     1133                                   + " " + use->version + " " + use->path
     1134                                   + " not found");
     1135              /*
     1136              if (!Cmt::get_quiet ())
     1137                {
     1138                  cout << "# package " << use->get_package_name () <<
     1139                    " " << use->version << " " << use->path <<
     1140                    " not found" <<
     1141                    endl;
     1142                }
     1143              */
     1144              CmtError::set (CmtError::package_not_found, use->get_package_name ());
     1145            }
     1146          else
     1147            {
     1148              static const cmt_string empty;
     1149              cmt_string p = use->real_path;
     1150              if (use->path != "")
     1151                {
     1152                  int pos = p.find_last_of (use->path);
     1153                  if (pos != cmt_string::npos)
     1154                    {
     1155                      p.erase (pos);
     1156                    }
     1157                }
     1158             
     1159              cout << "container " << use->get_package_name ()
     1160                   << " " << use->version;
     1161
     1162              if (CmtSystem::absolute_path (use->path))
     1163                {
     1164                  if (!Cmt::get_quiet ())
     1165                    {
     1166                      cout << " (" << use->path << ")";
     1167                    }
     1168                }
     1169              else
     1170                {
     1171                  cout << " " << use->path;
     1172                }
     1173
     1174              if (!Cmt::get_quiet ())
     1175                {
     1176                  if (p != "") cout << " (" << p << ")";
     1177                  if (use->auto_imports == Off) cout << " (no_auto_imports)";
     1178                }
     1179
     1180              cout << endl;
     1181            }
     1182}
     1183/*----------------------------------------------------------*/
    11221184void Project::show_specified_strategies_for_all ()
    11231185{
     
    17201782
    17211783//----------------------------------------------------------
    1722 const cmt_string& Project::get_container () const
    1723 {
    1724   return (m_container);
     1784const cmt_string& Project::get_container_name () const
     1785{
     1786  return (m_container_name);
    17251787}
    17261788
     
    17291791{
    17301792  return (m_container_version);
     1793}
     1794
     1795//----------------------------------------------------------
     1796const cmt_string& Project::get_container_path () const
     1797{
     1798  return (m_container_path);
    17311799}
    17321800
     
    17881856
    17891857//----------------------------------------------------------
    1790 void Project::set_container (const cmt_string& container)
    1791 {
    1792   m_container = container;
     1858void Project::set_container_name (const cmt_string& name)
     1859{
     1860  m_container_name = name;
    17931861}
    17941862
     
    17971865{
    17981866  m_container_version = container_version;
     1867}
     1868
     1869//----------------------------------------------------------
     1870void Project::set_container_path (const cmt_string& container_path)
     1871{
     1872  m_container_path = container_path;
    17991873}
    18001874
     
    19542028   A container statement is met in the project file
    19552029*/
    1956 void Project::container_action (const cmt_string& name, const cmt_string& version)
    1957 {
    1958   //cerr << "Container action " << name << " " << version << endl;
    1959 
    1960   set_container (name);
     2030void Project::container_action (const CmtSystem::cmt_string_vector& words)
     2031//void Project::container_action (const cmt_string& name, const cmt_string& version)
     2032{
     2033  //
     2034  // complete syntax : "container <package> <version> <path>" 
     2035  // minimal syntax  : "container <package>"
     2036  //
     2037  //  o if <version> is omitted then take any version available
     2038  //  o <version> can be specified using "v*" or "v<n>r*" or "v<n>r<m>p*"
     2039  //
     2040  //  o the notation "v*" is preferred to omission (particularly since
     2041  //    omission does not permit <path>)
     2042  //
     2043  Use* use = &m_container;
     2044  use->~Use ();
     2045  if (words.size () < 2) return;
     2046
     2047  CmtSystem::cmt_string_vector ewords;
     2048  for (int i = 1; i < words.size (); i++)
     2049    {
     2050      const cmt_string& w = words[i];
     2051      cmt_string ew = w;
     2052
     2053      Symbol::expand (ew);
     2054      if (ew != w)
     2055        {
     2056          CmtSystem::cmt_string_vector ws;
     2057          CmtSystem::split (ew, " ", ws);
     2058
     2059          for (int j = 0; j < ws.size (); ++j)
     2060            {
     2061              ewords.push_back (ws[j]);
     2062            }
     2063        }
     2064      else
     2065        {
     2066          ewords.push_back (w);
     2067        }
     2068    }
     2069
     2070  cmt_string name, version, path;
     2071  if (ewords.size () > 0) name = ewords[0];
     2072  if (ewords.size () > 1) version = ewords[1];
     2073  if (ewords.size () > 2) path = ewords[2];
     2074
     2075  if (name != "")
     2076    {
     2077      use->set (name, version, path);
     2078      use->get_package ()->remove_use (use);
     2079      if (use->move_to ())
     2080        {
     2081          cmt_string use_real;
     2082          bool ok (false);
     2083          if (!CmtSystem::absolute_path (use->path))
     2084            {
     2085              ok = CmtSystem::realpath_ (use->real_path, use_real);
     2086            }
     2087          else
     2088            {
     2089              ok = CmtSystem::realpath_ (use->path, use_real);
     2090            }
     2091          if (ok && use_real.find (m_cmtpath_real) != 0)
     2092            {
     2093              use->~Use ();
     2094            }
     2095        }
     2096      CmtSystem::cd (m_cmtpath_pwd + CmtSystem::file_separator () + "cmt");
     2097    }
     2098  //  cerr << CmtSystem::pwd () << endl;
     2099
     2100  set_container_name (name);
    19612101  set_container_version (version);
     2102  set_container_path (path);
    19622103}
    19632104
  • CMT/HEAD/source/cmt_project.h

    r515 r525  
    112112  static void clear_all ();
    113113  static void show_all ();
     114  static void show_container ();
    114115  static void show_specified_strategies_for_all ();
    115116  static void show_paths (const CmtSystem::cmt_string_vector& arguments);
     
    136137  const cmt_string& get_name () const;
    137138  const cmt_string& get_release () const;
    138   const cmt_string& get_container () const;
     139  const cmt_string& get_container_name () const;
    139140  const cmt_string& get_container_version () const;
     141  const cmt_string& get_container_path () const;
     142  //  const Use& get_container () const;
    140143  const cmt_string& get_cmtpath () const;
    141144  const cmt_string& get_cmtpath_real () const;
     
    152155  void set_name (const cmt_string& name);
    153156  void set_release (const cmt_string& release);
    154   void set_container (const cmt_string& container);
     157  //  void set_container (const cmt_string& container);
     158  void set_container_name (const cmt_string& name);
    155159  void set_container_version (const cmt_string& version);
     160  void set_container_path (const cmt_string& path);
    156161  void set_cmtpath (const cmt_string& path);
    157162  void set_cmtpath_real (const cmt_string& path);
     
    166171  void add_child (Project* p);
    167172
    168   void container_action (const cmt_string& name, const cmt_string& version);
     173  void container_action (const CmtSystem::cmt_string_vector& words);
     174  //  void container_action (const cmt_string& name, const cmt_string& version);
    169175  void use_action (const cmt_string& name, const cmt_string& release);
    170176
     
    208214  cmt_string m_author;
    209215  cmt_string m_release;
    210   cmt_string m_container;
     216  cmt_string m_container_name;
    211217  cmt_string m_container_version;
     218  cmt_string m_container_path;
     219  Use m_container;
    212220
    213221  ProjectPtrVector m_parents;
  • CMT/HEAD/source/cmt_syntax.cxx

    r523 r525  
    363363               int line_number)
    364364  {
    365     project->container_action (words[1], words[2]);
     365    project->container_action (words);
     366    //project->container_action (words[1], words[2]);
    366367  }
    367368};
  • CMT/HEAD/src/setup.tcsh

    r272 r525  
    88complete cmt p/1/'(broadcast build check check_files checkout co cleanup config create expand filter help lock relocate remove run setup show system unlock version cvstags cvsbranches cvssubpackages cvssubprojects)'/ \
    99 n/build/'(CMT_pacman constituent_makefile constituents_makefile dependencies library_links make_setup msdev os9_makefile prototype readme tag_makefile temporary_name triggers win_makefile)'/ \
    10  n/show/'(action action_names action_value actions all_tags applied_patterns author branches clients cmtpath_patterns constituent constituent_names constituents cycles fragment fragments groups include_dirs language languages macro macro_names macro_value macros manager packages path pattern patterns projects project_author pwd set set_names set_value sets strategies tags use_paths uses versions)'/ \
     10 n/show/'(action action_names action_value actions all_tags applied_patterns author branches clients cmtpath_patterns constituent constituent_names constituents container cycles fragment fragments groups include_dirs language languages macro macro_names macro_value macros manager packages path pattern patterns projects project_author pwd set set_names set_value sets strategies tags use_paths uses versions)'/ \
    1111 n/check/'(configuration files version)'/ \
    1212 n/expand/'(model)'/ \
  • CMT/HEAD/src/setup.zsh

    r272 r525  
    2626   'w[1,remove] p[3]' -X '> give version tag' - \
    2727   'w[1,remove] p[4]' -X '> give a path if not located from the current path ' - \
    28    's[show],c[-1,show]' -k '(action,action_names,action_value,actions,all_tags,applied_patterns,author,branches,clients,cmtpath_patterns,constituent,constituent_names,constituents,cycles,fragment,fragments,groups,include_dirs,language,languages,macro,macro_names,macro_value,macros,manager,packages,path,pattern,patterns,projects,project_author,pwd,set,set_names,set_value,sets,strategies,tags,use_paths,uses,versions)' - \
     28   's[show],c[-1,show]' -k '(action,action_names,action_value,actions,all_tags,applied_patterns,author,branches,clients,cmtpath_patterns,constituent,constituent_names,constituents,container,cycles,fragment,fragments,groups,include_dirs,language,languages,macro,macro_names,macro_value,macros,manager,packages,path,pattern,patterns,projects,project_author,pwd,set,set_names,set_value,sets,strategies,tags,use_paths,uses,versions)' - \
    2929   'w[1,show] c[-1,constituent]' -K cmt_constituents - \
    3030   'w[1,show] c[-1,fragment]' -K cmt_fragments - \
Note: See TracChangeset for help on using the changeset viewer.