Ignore:
Timestamp:
Jan 13, 2014, 4:09:37 PM (10 years ago)
Author:
rybkin
Message:

merge -r 646:663 HEAD

Location:
CMT/v1r25-branch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CMT/v1r25-branch

  • CMT/v1r25-branch/source/cmt_commands.cxx

    r612 r664  
    33// arnault@lal.in2p3.fr
    44// Modified by garonne@lal.in2p3.fr
     5// Modified by Grigory Rybkin
    56// See the complete license in cmt_license.txt "http://www.cecill.info".
    67//-----------------------------------------------------------
     
    256257  pv.push_back (&ArgParser::option_no_cleanup); i++;
    257258
     259  parsers.add ("-no_strip_p", i);
     260  parsers.add ("-no_strip_pa", i);
     261  parsers.add ("-no_strip_pat", i);
     262  parsers.add ("-no_strip_path", i);
     263  pv.push_back (&ArgParser::option_no_strip_path); i++;
     264
    258265  parsers.add ("-pac", i);
    259266  parsers.add ("-pack", i);
     
    263270  parsers.add ("-path", i);
    264271  pv.push_back (&ArgParser::option_path); i++;
     272
     273  parsers.add ("-strip_p", i);
     274  parsers.add ("-strip_pa", i);
     275  parsers.add ("-strip_pat", i);
     276  parsers.add ("-strip_path", i);
     277  pv.push_back (&ArgParser::option_strip_path); i++;
    265278
    266279  parsers.add ("-pr", i);
     
    346359  parsers.add ("-without_cmt", i);
    347360  pv.push_back (&ArgParser::option_without_cmt); i++;
     361
     362  parsers.add ("-with_p", i);
     363  parsers.add ("-with_pr", i);
     364  parsers.add ("-with_pro", i);
     365  parsers.add ("-with_proj", i);
     366  parsers.add ("-with_proje", i);
     367  parsers.add ("-with_projec", i);
     368  parsers.add ("-with_project", i);
     369  parsers.add ("-with_projects", i);
     370  pv.push_back (&ArgParser::option_with_projects); i++;
     371
     372  parsers.add ("-without_p", i);
     373  parsers.add ("-without_pr", i);
     374  parsers.add ("-without_pro", i);
     375  parsers.add ("-without_proj", i);
     376  parsers.add ("-without_proje", i);
     377  parsers.add ("-without_projec", i);
     378  parsers.add ("-without_project", i);
     379  parsers.add ("-without_projects", i);
     380  pv.push_back (&ArgParser::option_without_projects); i++;
    348381
    349382  parsers.add ("-warn", i);
     
    19031936{
    19041937  cmt.m_disable_warnings = true;
    1905   if (CmtMessage::level () <= Warning)
    1906     CmtMessage::set_level (Error);
     1938//   if (CmtMessage::level () <= Warning)
     1939//     CmtMessage::set_level (Error);
     1940  if (!Cmt::add_cmt_flag ("-disable_warnings"))
     1941    CmtError::set (CmtError::system_error, "Cannot add flag `-disable_warnings'");
    19071942}
    19081943
     
    19101945{
    19111946  cmt.m_quiet = true;
    1912   if (CmtMessage::level () <= Error)
    1913     CmtMessage::set_level (Fatal);
     1947//   if (CmtMessage::level () <= Error)
     1948//     CmtMessage::set_level (Fatal);
     1949  if (!Cmt::add_cmt_flag ("-quiet"))
     1950    CmtError::set (CmtError::system_error, "Cannot add flag `-quiet'");
    19141951}
    19151952
     
    19181955{
    19191956  cmt.m_warnings = true;
    1920   if (CmtMessage::level () != Warning)
    1921     CmtMessage::set_level (Warning);
     1957//   if (CmtMessage::level () != Warning)
     1958//     CmtMessage::set_level (Warning);
     1959  if (!Cmt::add_cmt_flag ("-warnings"))
     1960    CmtError::set (CmtError::system_error, "Cannot add flag `-warnings'");
    19221961}
    19231962
     
    19521991    {
    19531992      CmtSystem::cmt_string_vector words;
    1954 
    19551993      CmtSystem::split (arg, ":", words);
    19561994
    19571995      cmt.m_current_access = UserMode;
     1996
     1997      cmt.m_current_package = "";
     1998      cmt.m_current_version = "";
     1999      cmt.m_current_path = "";
    19582000
    19592001      if (words.size () > 0) cmt.m_current_package = words[0];
    19602002      if (words.size () > 1) cmt.m_current_version = words[1];
    19612003      if (words.size () > 2) cmt.m_current_path    = words[2];
    1962       (Use::current()).set (cmt.m_current_package,
    1963                             cmt.m_current_version,
    1964                             cmt.m_current_path);
    1965 
    1966       Use& use = Use::current();
    1967       if (use.get_package_name () == "cmt_standalone")
    1968         {
    1969           if (!CmtSystem::cd (use.path) || !CmtSystem::test_file ("requirements"))
    1970             {
    1971               CmtError::set (CmtError::package_not_found, use.get_info ());
    1972               return;
    1973             }
    1974           use.style = none_style;
    1975           use.structuring_style = without_version_directory;
    1976           use.change_path (CmtSystem::pwd ());
    1977         }
    1978       else if (!use.move_to ("", true))
    1979         {
    1980           CmtError::set (CmtError::package_not_found, use.get_info ());
    1981           return;
    1982         }
    1983       Project::order_all ();
    1984       Cmt::guess_current_project ();
    19852004    }
    19862005}
     
    19952014
    19962015      cmt.m_current_package = arg;
    1997       cmt.m_current_version = "";
    1998 
    1999       /*
    2000       cerr << "ArgParser::option_pack> "
    2001            << " cp=" << cmt.m_current_package
    2002            << " cv=" << cmt.m_current_version
    2003            << " cp=" << cmt.m_current_path << endl;
    2004       */
    2005 
    2006       (Use::current()).set (cmt.m_current_package,
    2007                             cmt.m_current_version,
    2008                             cmt.m_current_path);
     2016      //      cmt.m_current_version = "";
     2017
    20092018    }
    20102019}
     
    20162025      cmt.m_current_access = UserMode;
    20172026      cmt.m_current_version = arg;
    2018 
    2019       /*
    2020       cerr << "ArgParser::option_version> "
    2021            << " cp=" << cmt.m_current_package
    2022            << " cv=" << cmt.m_current_version
    2023            << " cp=" << cmt.m_current_path << endl;
    2024       */
    2025 
    2026       (Use::current()).set (cmt.m_current_package,
    2027                             cmt.m_current_version,
    2028                             cmt.m_current_path);
    20292027    }
    20302028}
     
    20362034      cmt.m_current_access = UserMode;
    20372035      cmt.m_current_path = arg;
    2038 
    2039       /*
    2040       cerr << "ArgParser::option_path> "
    2041            << " cp=" << cmt.m_current_package
    2042            << " cv=" << cmt.m_current_version
    2043            << " cp=" << cmt.m_current_path << endl;
    2044       */
    2045 
    2046       (Use::current()).set (cmt.m_current_package,
    2047                             cmt.m_current_version,
    2048                             cmt.m_current_path);
    2049 
    2050       //IProjectFactory& factory = ProjectFactory::instance ();
    2051       //CmtSystem::add_cmt_path (cmt.m_current_path, "argument", factory);
    2052       Use& use = Use::current();
    2053       if (use.get_package_name () == "cmt_standalone")
    2054         {
    2055           if (!CmtSystem::cd (use.path) || !CmtSystem::test_file ("requirements"))
    2056             {
    2057               CmtError::set (CmtError::package_not_found, use.get_info ());
    2058               return;
    2059             }
    2060           use.style = none_style;
    2061           use.structuring_style = without_version_directory;
    2062           use.change_path (CmtSystem::pwd ());
    2063         }
    2064       else if (!use.move_to ("", true))
    2065         {
    2066           CmtError::set (CmtError::package_not_found, use.get_info ());
    2067           return;
    2068         }
    2069       Project::order_all ();
    2070       Cmt::guess_current_project ();
    20712036    }
    20722037}
     
    20792044void ArgParser::option_e ()
    20802045{
    2081   //CmtMessage::warning ("extra statement = " + arg);
    20822046  extra_line = arg;
    20832047}
     
    20892053      cmt.m_cmt_home = arg;
    20902054    }
     2055}
     2056
     2057void ArgParser::option_no_strip_path ()
     2058{
     2059  cmt.m_strip_path = false;
     2060  if (!Cmt::add_cmt_flag ("-no_strip_path"))
     2061    CmtMessage::error ("Cannot add flag `-no_strip_path'");
     2062}
     2063
     2064void ArgParser::option_strip_path ()
     2065{
     2066  cmt.m_strip_path = true;
     2067  if (!Cmt::add_cmt_flag ("-strip_path"))
     2068    CmtMessage::error ("Cannot add flag `-strip_path'");
    20912069}
    20922070
     
    20982076  if (arg != "")
    20992077    {
     2078      cmt.m_tags.clear ();
     2079      CmtSystem::cmt_string_vector words;
     2080      CmtSystem::split (arg, " \t,", words);
     2081      for (int i = 0; i < words.size (); i++)
     2082        {
     2083          bool has (false);
     2084          for (int j = 0; j < cmt.m_tags.size (); j++)
     2085            {
     2086              if (cmt.m_tags[j] == words[i])
     2087                {
     2088                  has = true;
     2089                  break;
     2090                }
     2091            }
     2092          if (!has)
     2093            cmt.m_tags.push_back (words[i]);
     2094        }
     2095
     2096      if (cmt.m_tags.size () != 0)
     2097        {
     2098          cmt.m_extra_tags.clear ();
     2099          cmt.m_tags_add.clear ();
     2100          cmt.m_tags_remove.clear ();
     2101        }
     2102
     2103      /*
    21002104      Tag* tag;
    21012105      CmtSystem::cmt_string_vector words;
     
    21512155        // To be sure that a tag
    21522156        Cmt::guess_current_project ();
     2157      */
    21532158    }
    21542159}
     
    21562161void ArgParser::option_tag_add ()
    21572162{
     2163  CmtSystem::cmt_string_vector words;
     2164  CmtSystem::split (arg, " \t,", words);
     2165  for (int i = 0; i < words.size (); i++)
     2166    {
     2167      bool has (false);
     2168      for (int j = 0; j < cmt.m_tags_add.size (); j++)
     2169        {
     2170          if (cmt.m_tags_add[j] == words[i])
     2171            {
     2172              has = true;
     2173              break;
     2174            }
     2175        }
     2176      if (!has)
     2177        {
     2178          cmt.m_tags_add.push_back (words[i]);
     2179        }
     2180     
     2181      for (int j = 0; j < cmt.m_tags_remove.size (); j++)
     2182        {
     2183          if (cmt.m_tags_remove[j] == words[i])
     2184            {
     2185              cmt.m_tags_remove.erase(j);
     2186              break;
     2187            }
     2188        }
     2189    }
     2190  /*
    21582191  Tag* tag;
    21592192  CmtSystem::cmt_string_vector words;
     
    21882221        }
    21892222    }
     2223  */
    21902224}
    21912225
    21922226void ArgParser::option_tag_remove ()
    21932227{
     2228  CmtSystem::cmt_string_vector words;
     2229  CmtSystem::split (arg, " \t,", words);
     2230  for (int i = 0; i < words.size (); i++)
     2231    {
     2232      bool has (false);
     2233      for (int j = 0; j < cmt.m_tags_remove.size (); j++)
     2234        {
     2235          if (cmt.m_tags_remove[j] == words[i])
     2236            {
     2237              has = true;
     2238              break;
     2239            }
     2240        }
     2241      if (!has)
     2242        {
     2243          cmt.m_tags_remove.push_back (words[i]);
     2244        }
     2245
     2246      for (int j = 0; j < cmt.m_extra_tags.size (); j++)
     2247        {
     2248          if (cmt.m_extra_tags[j] == words[i])
     2249            {
     2250              cmt.m_extra_tags.erase(j);
     2251              break;
     2252            }
     2253        }
     2254      for (int j = 0; j < cmt.m_tags.size (); j++)
     2255        {
     2256          if (cmt.m_tags[j] == words[i])
     2257            {
     2258              cmt.m_tags.erase(j);
     2259              break;
     2260            }
     2261        }
     2262      for (int j = 0; j < cmt.m_tags_add.size (); j++)
     2263        {
     2264          if (cmt.m_tags_add[j] == words[i])
     2265            {
     2266              cmt.m_tags_add.erase(j);
     2267              break;
     2268            }
     2269        }
     2270    }
     2271  /*
    21942272  Tag::TagPtrVector tags = Tag::tags ();
    21952273  int i;
    21962274  Tag* tag;
    2197 
    2198   /*
    2199     for (i = 0; i < tags.size (); i++)
    2200     {
    2201     tag = tags[i];
    2202     if ((tag != 0) &&
    2203     (tag->selected))
    2204     {
    2205     if (!cmt.m_quiet) cerr << "  original tag_list=" << tag->name << tag->priority << endl;
    2206     }
    2207     }
    2208   */
    22092275
    22102276  CmtSystem::cmt_string_vector words;
     
    22592325            const cmt_string& a = words[i];
    22602326
    2261             //fprintf (stderr, "  a=[%s]\n", a.c_str ());
    2262 
    22632327            /// Then restore uname if the specified tag is CMTCONFIG
    22642328              if (a == CmtSystem::get_cmt_config ())
     
    22832347              tag->mark ("arguments");
    22842348          }
     2349  */
    22852350}
    22862351
     
    23072372}
    23082373
     2374void ArgParser::option_with_projects ()
     2375{
     2376  cmt.m_use_projects = true;
     2377  if (!Cmt::add_cmt_flag ("-with_projects"))
     2378    CmtMessage::error ("Cannot add flag `-with_projects'");
     2379}
     2380
     2381void ArgParser::option_without_projects ()
     2382{
     2383  cmt.m_use_projects = false;
     2384  if (!Cmt::add_cmt_flag ("-without_projects"))
     2385    CmtMessage::error ("Cannot add flag `-without_projects'");
     2386}
     2387
    23092388void ArgParser::option_with_version_directory ()
    23102389{
    23112390  cmt.m_current_structuring_style = with_version_directory;
    23122391
    2313   StrategyDef* def = StrategyMgr::find_strategy ("VersionDirectory");
    2314   if (def != 0)
    2315     {
    2316       def->m_default_value = true;
    2317       def->m_priority_value = false;
    2318     }
     2392  if (!Cmt::add_cmt_flag ("-with_version_directory"))
     2393    CmtError::set (CmtError::system_error, "Cannot add flag `-with_version_directory'");
     2394
    23192395}
    23202396
     
    23232399  cmt.m_current_structuring_style = without_version_directory;
    23242400
    2325   StrategyDef* def = StrategyMgr::find_strategy ("VersionDirectory");
    2326   if (def != 0)
    2327     {
    2328       def->m_default_value = false;
    2329       def->m_priority_value = true;
    2330     }
     2401  if (!Cmt::add_cmt_flag ("-without_version_directory"))
     2402    CmtError::set (CmtError::system_error, "Cannot add flag `-without_version_directory'");
     2403
    23312404}
    23322405
     
    23982471  cout << "#   -path=<path>            : set root path" << endl;
    23992472  cout << "#   -f=<requirements-file>  : set input file" << endl;
    2400   cout << "#   -e=<statement>          : add a one line statement" << endl;
     2473  cout << "#   -e=<statement(s)>       : add (multiple) statement(s)" << endl;
    24012474  cout << "#   -tag=<tag-list>         : select a new tag-set" << endl;
    24022475  cout << "#   -tag_add=<tag-list>     : add specific comma-separated tag(s)" << endl;
     
    24082481  cout << "#   -no_cleanup             : inhibit install area cleanup" << endl;
    24092482  cout << "#   -xml                    : output in XML format (cmt setup, cmt show projects, cmt show uses)" << endl;
     2483  cout << "#   -user_context=<path>    : set user context package/project directory" << endl;
     2484  cout << "#   -home=<path>            : set home package/project directory" << endl;
    24102485}
    24112486
Note: See TracChangeset for help on using the changeset viewer.