Changeset 181


Ignore:
Timestamp:
Apr 27, 2006, 1:20:07 PM (18 years ago)
Author:
garonne
Message:

add the cmt relocate command

Location:
CMT/HEAD/source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/source/cmt.h

    r109 r181  
    131131  static void do_do (const ArgParser& ap);
    132132  static void do_expand_model (const ArgParser& ap);
    133   static void do_filter (const ArgParser& ap);
    134   static void do_help (const ArgParser& ap);
    135   static void do_lock (const ArgParser& ap);
    136   static void do_remove (const ArgParser& ap);
     133  static void do_filter       (const ArgParser& ap);
     134  static void do_help         (const ArgParser& ap);
     135  static void do_lock         (const ArgParser& ap);
     136  static void do_relocate     (const ArgParser& ap);
     137  static void do_remove       (const ArgParser& ap);
    137138  static void do_remove_library_links (const ArgParser& ap);
    138139  static void do_run (const ArgParser& ap);
  • CMT/HEAD/source/cmt_commands.cxx

    r151 r181  
    135135  pv.push_back (&ArgParser::do_lock); i++;
    136136
    137   parsers.add ("re", i);
     137  parsers.add ("rel", i);
     138  parsers.add ("relo", i);
     139  parsers.add ("reloc", i);
     140  parsers.add ("reloca", i);
     141  parsers.add ("relocat", i);
     142  parsers.add ("relocate", i);
     143  pv.push_back (&ArgParser::do_relocate); i++;
     144
    138145  parsers.add ("rem", i);
    139146  parsers.add ("remo", i);
     
    992999    }
    9931000}
     1001
     1002
     1003void ArgParser::do_relocate ()
     1004{
     1005  cmt.m_action = action_relocate;
     1006}
     1007
    9941008
    9951009void ArgParser::do_remove ()
     
    21052119  help_texts.add () =  "load";
    21062120  help_texts.add () =  "lock [<p> <v> [<path>]] : lock a package";
     2121  help_texts.add () =  "relocate                : generate only setup scripts";
    21072122  help_texts.add () =  "remove <package> <version> [<path>] : remove a package version";
    21082123  help_texts.add () =  "remove library_links    : remove symbolic links towards all imported libraries";
     
    22012216  help.add (action_load, help_texts[action_load]);
    22022217  help.add (action_lock, help_texts[action_lock]);
     2218  help.add (action_relocate, help_texts[action_relocate]);
    22032219  help.add (action_remove, help_texts[action_remove]);
    22042220  help.add (action_remove_library_links, help_texts[action_remove_library_links]);
  • CMT/HEAD/source/cmt_commands.h

    r109 r181  
    4343  void do_cvssubpackages ();
    4444  void do_cvssubprojects ();
    45   void do_cvstags ();
    46   void do_do ();
    47   void do_expand ();
    48   void do_filter ();
    49   void do_help ();
    50   void do_lock ();
    51   void do_remove ();
    52   void do_run ();
     45  void do_cvstags  ();
     46  void do_do       ();
     47  void do_expand   ();
     48  void do_filter   ();
     49  void do_help     ();
     50  void do_lock     ();
     51  void do_relocate ();
     52  void do_remove   ();
     53  void do_run      ();
    5354  void do_run_sequence ();
    5455  void do_set ();
  • CMT/HEAD/source/cmt_parser.cxx

    r180 r181  
    21752175
    21762176  //cout << "do_config> current style=" << Me.m_current_style << endl;
     2177
     2178  Me.m_quiet = true;
     2179
     2180  if (!reach_current_package ())
     2181    {
     2182      cout << "Cannot read the requirements file" << endl;
     2183      return;
     2184    }
     2185
     2186  install_setup_scripts ();
     2187  install_cleanup_scripts ();
     2188
     2189  CmtSystem::cd ("..");
     2190
     2191  Branch::BranchVector& branches = Branch::branches ();
     2192
     2193  int i;
     2194
     2195  for (i = 0; i < branches.size (); i++)
     2196    {
     2197      const Branch& branch = branches[i];
     2198      const cmt_string& branch_name = branch.name ();
     2199
     2200      if (!CmtSystem::test_directory (branch_name))
     2201        {
     2202          if (!CmtSystem::mkdir (branch_name))
     2203            {
     2204              cout << "Cannot create the " << branch_name <<" branch" << endl;
     2205            }
     2206          else
     2207            {
     2208              cout << "Installing the " << branch_name << " directory" << endl;
     2209            }
     2210        }
     2211      else
     2212        {
     2213          cout << branch_name << " directory already installed" << endl;
     2214        }
     2215    }
     2216}
     2217
     2218
     2219//----------------------------------------------------------
     2220void Cmt::do_relocate (const ArgParser& ap)
     2221{
     2222  if (CmtLock::check () == CmtLock::locked_by_another_user)
     2223    {
     2224      CmtError::set (CmtError::conflicting_lock, "relocate>");
     2225      return;
     2226    }
     2227
     2228  Use& current_use = Use::current ();
     2229
     2230  if (Me.m_debug)
     2231    {
     2232      cout << "Cmt::do_relocate> " << endl;
     2233      cout << "pwd "          << CmtSystem::pwd () << endl;
     2234      cout << "current_dir "  << Me.m_current_dir << endl;
     2235      cout << "default_path " << Me.m_default_path << endl;
     2236      cout << "cmt config "   <<
     2237          Me.m_current_package << " " <<
     2238          Me.m_current_version << " " <<
     2239          Me.m_current_path << endl;
     2240    }
     2241
     2242  if (Me.m_current_package == "CMT")     return;
     2243  if (Me.m_current_package == "methods") return;
     2244
     2245  cmt_string branch;
     2246
     2247  CmtSystem::basename (Me.m_current_dir, branch);
     2248
     2249  if ((branch != "mgr") && (branch != "cmt"))
     2250    {
     2251
     2252        //
     2253        // Here we are in a standalone package (ie completely unstructured)
     2254        //
     2255
     2256      if (CmtSystem::test_file ("requirements"))
     2257        {
     2258          cout << "------------------------------------------" << endl;
     2259          cout << "Configuring environment for standalone package." << endl;
     2260          cout << "CMT version " << Me.m_cmt_version << "." << endl;
     2261          cout << "System is "   << Me.m_cmt_config << endl;
     2262          cout << "------------------------------------------" << endl;
     2263
     2264          install_test_setup_scripts ();
     2265          install_test_cleanup_scripts ();
     2266
     2267          Generator::build_default_makefile ();
     2268        }
     2269      else
     2270        {
     2271          cout << "==============================================" << endl;
     2272          cout << "cmt relocate must be operated either upon "
     2273            "an existing package" << endl;
     2274          cout << " (ie. when a requirements file already exists)" << endl;
     2275          cout << "   > cd ..." << endl;
     2276          cout << "   > cmt relocate" << endl;
     2277          cout << "or to create a new package" << endl;
     2278          cout << "   > cmt relocate <package> <version> [<path>]" << endl;
     2279          cout << "==============================================" << endl;
     2280        }
     2281
     2282      return;
     2283    }
     2284
     2285  configure_current_package ();
     2286
     2287  Generator::build_default_makefile ();
     2288 
     2289  CmtSystem::cd ("..");   
     2290  CmtSystem::cd (branch);
     2291
     2292  Use& use = Use::current ();
     2293
     2294  use.set (Me.m_current_package,
     2295           Me.m_current_version,
     2296           Me.m_current_path,
     2297           "",
     2298           "");
     2299
     2300  use.change_path (Me.m_current_path);
     2301  use.style     = Me.m_current_style;
    21772302
    21782303  Me.m_quiet = true;
     
    49055030    case action_load :
    49065031    case action_lock :
     5032    case action_relocate:
    49075033    case action_remove :
    49085034    case action_remove_library_links :
     
    50155141      // case action_lock :
    50165142      // case action_remove :
     5143    case action_relocate:
    50175144    case action_remove_library_links :
    50185145    case action_run :
     
    51185245    case action_lock :
    51195246      // case action_remove :
     5247    case action_relocate :
    51205248    case action_remove_library_links :
    51215249    case action_run :
     
    52315359        case action_load :
    52325360        case action_lock :
     5361        case action_relocate :
    52335362        case action_remove :
    52345363        case action_remove_library_links :
     
    54075536        case action_lock :
    54085537          do_lock (ap);
     5538          break;
     5539        case action_relocate :
     5540          do_relocate (ap);
    54095541          break;
    54105542        case action_remove :
  • CMT/HEAD/source/cmt_parser.h

    r83 r181  
     1
    12//-----------------------------------------------------------
    23// Copyright Christian Arnault LAL-Orsay CNRS
     
    257258  action_load,
    258259  action_lock,
     260  action_relocate,
    259261  action_remove,
    260262  action_remove_library_links,
Note: See TracChangeset for help on using the changeset viewer.