Changeset 537 for CMT


Ignore:
Timestamp:
Mar 29, 2010, 12:33:45 PM (14 years ago)
Author:
rybkin
Message:

See C.L. 424

Location:
CMT/HEAD
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/ChangeLog

    r536 r537  
     12010-03-29    <rybkin@lal.in2p3.fr> 424
     2
     3        * source/cmt_commands.cxx: In functions option_path, option_use of class
     4        ArgParser, validate current use object reset from command line options,
     5        reorder and/or create projects, if needed
     6        * source/cmt_project.cxx: In function ProjectFactory::create_project, do
     7        not specify current project (and its tag). In function Project::order_all,
     8        specify current project (and its tag) based on current directory path or
     9        current use object real path, if the latter is located
     10        * source/cmt_parser.cxx: In function Cmt::guess_current_project, make use
     11        of current use object real path, if it is located, or current directory
     12        path otherwise. This allows for doing setup with setup scripts generated
     13        by "cmt config" from any place (with a correct CMTPROJECTPATH), resolving
     14        ticket #57
     15        * source/cmt_use.cxx: In function move_to, search for package in absolute
     16        path first, if it is specified
     17        * source/cmt_pattern.cxx: In function ApplyPattern::action, print warning
     18        pattern_not_found in DeveloperMode (i. e., in current package) only
     19       
    1202010-03-26    <rybkin@lal.in2p3.fr> 423
    221
  • CMT/HEAD/source/cmt_commands.cxx

    r528 r537  
    17361736                            cmt.m_current_version,
    17371737                            cmt.m_current_path);
     1738
     1739      Use& use = Use::current();
     1740      if (use.get_package_name () == "cmt_standalone")
     1741        {
     1742          if (!CmtSystem::cd (use.path) || !CmtSystem::test_file ("requirements"))
     1743            {
     1744              CmtError::set (CmtError::package_not_found, use.get_info ());
     1745              return;
     1746            }
     1747          use.style = none_style;
     1748          use.structuring_style = without_version_directory;
     1749          use.change_path (CmtSystem::pwd ());
     1750        }
     1751      else if (!use.move_to ("", true))
     1752        {
     1753          CmtError::set (CmtError::package_not_found, use.get_info ());
     1754          return;
     1755        }
     1756      Project::order_all ();
     1757      Cmt::guess_current_project ();
    17381758    }
    17391759}
     
    18031823      //IProjectFactory& factory = ProjectFactory::instance ();
    18041824      //CmtSystem::add_cmt_path (cmt.m_current_path, "argument", factory);
     1825      Use& use = Use::current();
     1826      if (use.get_package_name () == "cmt_standalone")
     1827        {
     1828          if (!CmtSystem::cd (use.path) || !CmtSystem::test_file ("requirements"))
     1829            {
     1830              CmtError::set (CmtError::package_not_found, use.get_info ());
     1831              return;
     1832            }
     1833          use.style = none_style;
     1834          use.structuring_style = without_version_directory;
     1835          use.change_path (CmtSystem::pwd ());
     1836        }
     1837      else if (!use.move_to ("", true))
     1838        {
     1839          CmtError::set (CmtError::package_not_found, use.get_info ());
     1840          return;
     1841        }
     1842      Project::order_all ();
     1843      Cmt::guess_current_project ();
    18051844    }
    18061845}
  • CMT/HEAD/source/cmt_parser.cxx

    r536 r537  
    47474747  cmt_string here = CmtSystem::pwd ();
    47484748
    4749   if (Project::find_in_cmt_paths (Me.m_current_dir) == "")
    4750     {
     4749  Use& use = Use::current();
     4750  cmt_string current_path (Me.m_current_dir);
     4751  if (use.located ())
     4752    {
     4753      current_path = use.real_path;
     4754      CmtMessage::verbose ("Using current use real_path `" + current_path + "'");
     4755    }
     4756
     4757  if (Project::find_in_cmt_paths (current_path) == "")
     4758    //  if (Project::find_in_cmt_paths (Me.m_current_dir) == "")
     4759    {
     4760      if (!CmtSystem::cd (current_path))
     4761        {
     4762          CmtError::set (CmtError::file_access_error, current_path);
     4763          CmtError::print ();
     4764          return;
     4765        }
    47514766      cmt_string project_file = "cmt";
    47524767      project_file += CmtSystem::file_separator ();
     
    47904805  Project::fill_cmtpaths (buffer);
    47914806  //cerr << "buffer = " << buffer << endl;
    4792   Use& use = Use::current();
     4807  //  Use& use = Use::current();
    47934808
    47944809  bool save_quiet = Me.m_quiet;
  • CMT/HEAD/source/cmt_pattern.cxx

    r535 r537  
    844844  if (p == 0)
    845845    {
     846      if (Cmt::get_current_access () == DeveloperMode)
     847        CmtMessage::warning (CmtError::get_error_name (CmtError::pattern_not_found) +
     848                             ": " + name +
     849                             " (applied by " + use->get_package_name () + ")"
     850                             );
     851      return;
     852      /*
    846853      if (use->get_current_scope () != ScopeUnspecified &&
    847854          use->get_current_scope () != ScopePublic)
    848855        return;
     856      */
    849857      /*
    850858      cmt_string use_info (use->get_package_name () +
     
    854862                           );
    855863      */
    856       CmtMessage::warning (CmtError::get_error_name (CmtError::pattern_not_found) +
    857                            ": " + name +
    858                            " (applied by " + use->get_package_name () + ")"
    859                            );
    860864      /*
    861865        CmtError::set (CmtError::pattern_not_found, name +
     
    869873        }
    870874      */
    871       return;
    872875    }
    873876
  • CMT/HEAD/source/cmt_project.cxx

    r536 r537  
    295295  */
    296296  cmt_string pwd_real;
    297   if (CmtSystem::realpath_ (pwd, pwd_real))
    298     {
    299       if (Cmt::get_current_dir_real ().find (pwd_real) == 0) is_current = true;
     297  if (!CmtSystem::realpath_ (pwd, pwd_real))
     298    {
     299      CmtError::set (CmtError::file_access_error, "Cannot compute real path `" +
     300                     pwd + "'");
     301      CmtError::print ();
     302      return 0;
     303      //      if (Cmt::get_current_dir_real ().find (pwd_real) == 0) is_current = true;
    300304    }
    301305
     
    597601  project->set_cmtpath_source (source);
    598602
    599   project->set_is_current (is_current);
    600 
     603  //  project->set_is_current (is_current);
     604  /*
    601605  if (is_current)
    602606    {
     
    611615      tag->mark ();
    612616    }
    613 
     617  */
    614618
    615619  //  Project::order_all ();
     
    974978  OrderedProjects.resize (size);
    975979
     980  Use& use = Use::current();
     981  cmt_string current_path (Cmt::get_current_dir ());
     982  if (use.located ())
     983    {
     984      current_path = use.real_path;
     985      CmtMessage::verbose ("Using current use real_path `" + current_path + "'");
     986    }
     987
     988  cmt_string current_path_real;
     989  if (!CmtSystem::realpath_ (current_path, current_path_real))
     990    {
     991      CmtError::set (CmtError::file_access_error, "Cannot compute real path `" +
     992                     current_path + "'");
     993      CmtError::print ();
     994      return;
     995      //CmtMessage::error ("Cannot compute real path `" + Use::current().real_path + "'");
     996    }
     997
     998  Project* p_cur (0);
    976999  for (int i = 0; i < size; i++)
    9771000    {
     
    9821005        p.m_order = -2;
    9831006      p.m_visits = 0;
     1007      //
     1008      // The current project specification
     1009      //
     1010      if (current_path_real.find (p.get_cmtpath_real ()) == 0)
     1011        {
     1012          if (p.is_current ()) continue;
     1013          p.set_is_current (true);
     1014          //
     1015          // The current project defines a tag with its name
     1016          //
     1017         
     1018          Tag* tag;
     1019         
     1020          tag = Tag::add (p.get_name (), PriorityConfig, "PROJECT", 0);
     1021          tag->mark ();
     1022
     1023          p_cur = &p;
     1024        }
     1025      else if (p.is_current ())
     1026        {
     1027          //
     1028          // Unset the tag with its name - TODO
     1029          //
     1030          p.set_is_current (false);
     1031        }
    9841032    }
    9851033
     
    10151063    }
    10161064
    1017   Project* p = get_current ();
     1065  Project* p (p_cur);
     1066  //  Project* p = get_current ();
    10181067
    10191068  //  cerr << "get_current: " << p << " offset: " << offset << endl;
  • CMT/HEAD/source/cmt_use.cxx

    r536 r537  
    19251925  cmt_string expanded_path = path;
    19261926
     1927  cmt_string here;
    19271928  if (curdir)
    1928     {
     1929    here = CmtSystem::pwd ();
     1930
     1931  //
     1932  // If the path specified in this use is a true absolute path,
     1933  // then we search the package from there first.
     1934  //
     1935  if (CmtSystem::absolute_path (expanded_path))
     1936    {
     1937      if (reach_package (expanded_path,  native_version))
     1938        {
     1939          if (Cmt::get_debug ())
     1940            {
     1941              cout << "move_to3> " << expanded_path << endl;
     1942            }
     1943
     1944          change_path (expanded_path);
     1945
     1946          return (true);
     1947        }
     1948      else if (alternate_versions.size () > 0)
     1949        {
     1950          if (select_alternate ())
     1951            {
     1952              if (Cmt::get_debug ())
     1953                {
     1954                  cout << "move_to5> " << real_path << endl;
     1955                }             
     1956
     1957              return (true);
     1958            }
     1959        }
     1960    }
     1961
    19291962  //
    19301963  // Try here.
    19311964  //
     1965  if (curdir)
     1966    {
    19321967//   if (expanded_path == "")
    19331968//     {
    19341969//       if (reach_package ("", native_version))
    1935       cmt_string here = CmtSystem::pwd ();
    19361970      if (reach_package (here,  native_version))
    19371971        {
     
    19571991            }
    19581992        }
     1993      return (false);
    19591994//     }
    19601995    } // end of curdir     
    1961 
    1962   //
    1963   // If the path specified in this use is a true absolute path,
    1964   // then we search the package from there first.
    1965   //
    1966   if (CmtSystem::absolute_path (expanded_path))
    1967     {
    1968       if (reach_package (expanded_path,  native_version))
    1969         {
    1970           if (Cmt::get_debug ())
    1971             {
    1972               cout << "move_to3> " << expanded_path << endl;
    1973             }
    1974 
    1975           change_path (expanded_path);
    1976 
    1977           return (true);
    1978         }
    1979       else if (alternate_versions.size () > 0)
    1980         {
    1981           if (select_alternate ())
    1982             {
    1983               if (Cmt::get_debug ())
    1984                 {
    1985                   cout << "move_to5> " << real_path << endl;
    1986                 }             
    1987 
    1988               return (true);
    1989             }
    1990         }
    1991     }
    1992   if (curdir) return (false);
    19931996     
    19941997  //
Note: See TracChangeset for help on using the changeset viewer.