Changeset 331


Ignore:
Timestamp:
Nov 20, 2006, 10:39:18 PM (18 years ago)
Author:
garonne
Message:

native version support

Location:
CMT/v1r20b1/source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • CMT/v1r20b1/source/cmt_parser.cxx

    r329 r331  
    13641364                 
    13651365          if (use->discarded) continue;
     1366          if (use->m_hidden) continue;
    13661367
    13671368          if (!use->located ())
  • CMT/v1r20b1/source/cmt_project.cxx

    r330 r331  
    582582                                      project->get_release (), "", "");                                                         
    583583      project_use->done      = true; //false;
    584       project_use->discarded = false;
     584      project_use->discarded = false;//true; //false;
     585      project_use->m_hidden  = true;
    585586      project_use->selected  = true;
    586587      project_use->m_located = true;
  • CMT/v1r20b1/source/cmt_use.cxx

    r295 r331  
    13351335  discarded = false;
    13361336  selected  = false;
     1337  m_hidden  = false;
    13371338  auto_imports = Unspecified;
    13381339
     
    14241425
    14251426//----------------------------------------------------------
    1426 int Use::reach_package (const cmt_string& from_path)
     1427int Use::reach_package (const cmt_string& from_path, const cmt_string& n_version)
    14271428{
    14281429  if (Cmt::get_debug ())
     
    14311432           << version << ")from " << from_path << endl;
    14321433    }
    1433 
     1434   
    14341435  //
    14351436  // We try to reach a package/version starting from from_path
     
    15111512  if (Cmt::get_debug ())
    15121513    {
    1513       cout << "Use::reach_package-5>" << endl;
     1514        cout << "Use::reach_package-5>" << endl;
    15141515    }
    15151516
     
    15261527
    15271528  if (CmtSystem::test_file ("cmt/requirements"))
    1528     {
     1529  {
    15291530      CmtSystem::cd ("cmt");
    15301531
     
    15321533
    15331534      if (CmtSystem::test_file ("version.cmt"))
    1534         {
    1535           cmt_string v;
    1536 
    1537           v.read ("version.cmt");
    1538           int pos;
    1539           pos = v.find ('\n');
    1540           if (pos != cmt_string::npos) v.erase (pos);
    1541           pos = v.find ('\r');
    1542           if (pos != cmt_string::npos) v.erase (pos);
    1543 
    1544           CompareStatus s = compare_versions (version, v);
    1545 
    1546           if (Cmt::get_debug ())
    1547             {
    1548               cout << "Use::reach_package-6.1> version=" << version << " v=" << v << " s=" << s << endl;
    1549             }
    1550 
    1551           switch (s)
    1552             {
    1553             case IdenticalIds:
    1554             case ExplicitOldMajorIdWinsAgainstWildarded:
    1555             case ExplicitOldMinorIdWinsAgainstWildarded:
    1556             case ExplicitOldPatchIdWinsAgainstWildarded:
    1557               break;
    1558             case ExplicitNewMajorIdWinsAgainstWildarded:
    1559             case ExplicitNewMinorIdWinsAgainstWildarded:
    1560             case NewMinorIdGreaterThanOld:
    1561             case ExplicitNewPatchIdWinsAgainstWildarded:
    1562             case NewPatchIdGreaterThanOld:
    1563               break;
    1564             case OldMajorIdGreaterThanNew:
    1565             case NewMajorIdGreaterThanOld:
    1566               break;
    1567             case IncompatibleMajorIds:
    1568               return (0);
    1569             }
    1570           version = v;
    1571         }
    1572       else if (version == "")
    1573         {
    1574           version = "v0";
    1575         }
    1576 
    1577       return (1);
     1535          {
     1536               cmt_string v;
     1537
     1538               v.read ("version.cmt");
     1539               int pos;
     1540               pos = v.find ('\n');
     1541               if (pos != cmt_string::npos) v.erase (pos);
     1542               pos = v.find ('\r');
     1543               if (pos != cmt_string::npos) v.erase (pos);
     1544
     1545               CompareStatus s = compare_versions (version, v);
     1546
     1547               if (Cmt::get_debug ())
     1548               {
     1549                   cout << "Use::reach_package-6.1> version=" << version << " v=" << v << " s=" << s << endl;
     1550                }
     1551
     1552               switch (s)
     1553               {
     1554                   case IdenticalIds:
     1555                   case ExplicitOldMajorIdWinsAgainstWildarded:
     1556                   case ExplicitOldMinorIdWinsAgainstWildarded:
     1557                   case ExplicitOldPatchIdWinsAgainstWildarded:
     1558                       break;
     1559                   case ExplicitNewMajorIdWinsAgainstWildarded:
     1560                   case ExplicitNewMinorIdWinsAgainstWildarded:
     1561                   case NewMinorIdGreaterThanOld:
     1562                   case ExplicitNewPatchIdWinsAgainstWildarded:
     1563                   case NewPatchIdGreaterThanOld:
     1564                       break;
     1565                   case OldMajorIdGreaterThanNew:
     1566                   case NewMajorIdGreaterThanOld:
     1567                       break;
     1568                   case IncompatibleMajorIds:
     1569                   return (0);
     1570               }
     1571               version = v;
     1572           }
     1573       else if (version == "")
     1574           {
     1575               version = "v0";
     1576           }
     1577        return (1);
    15781578    }
    15791579  else if (!CmtSystem::cd (version))
     
    15951595
    15961596          CmtSystem::scan_dir (name, versions);
     1597          if (n_version != "")
     1598          {
     1599              static CmtSystem::cmt_string_vector native_versions;           
     1600              for (int i = 0; i < versions.size (); i++)
     1601              {
     1602                  cmt_string path;
     1603                  if (CmtSystem::test_directory (versions[i]))
     1604                  {
     1605                      path  = versions[i];
     1606                      path += CmtSystem::file_separator ();
     1607                      path += "cmt";
     1608                  }
     1609                  else
     1610                  {
     1611                      path = "cmt";
     1612                  }
     1613                  path += CmtSystem::file_separator ();
     1614                  path += "native_version.cmt";       
     1615                                 
     1616                  if (CmtSystem::test_file (path))
     1617                      {
     1618                          cmt_string nv;
     1619                          nv.read (path);
     1620                          int pos = nv.find ('\n');
     1621                          if (pos != cmt_string::npos) nv.erase (pos);
     1622                          pos = nv.find ('\r');
     1623                          if (pos != cmt_string::npos) nv.erase (pos);
     1624                          if (nv == n_version)
     1625                          {
     1626                               cmt_string& name_entry = native_versions.add ();
     1627                               name_entry += versions[i];
     1628                          }
     1629                      }                   
     1630              }
     1631              versions = native_versions;
     1632          }
    15971633         
    15981634          int i;
     
    17111747{
    17121748public:
    1713   UseProjectAction (Use* use) : m_use (use), m_found (false)
     1749  UseProjectAction (Use* use, cmt_string n_version="") : m_use (use), m_found (false), native_version(n_version)
     1750 
    17141751  {
    17151752  }
     
    17271764    m_use->alternate_paths.clear ();
    17281765
    1729     if (m_use->reach_package (path))
     1766    if (m_use->reach_package (path, this->native_version))
    17301767      {
    17311768        if (Cmt::get_debug ())
     
    17611798  Use* m_use;
    17621799  bool m_found;
     1800  cmt_string native_version;
    17631801};
    17641802
    17651803//----------------------------------------------------------
    1766 bool Use::move_to ()
     1804bool Use::move_to (const cmt_string& native_version)
    17671805{
    17681806  if (m_located)
     
    17781816        }
    17791817
    1780       reach_package (real_path);
     1818      reach_package (real_path, native_version);
    17811819
    17821820      return (true);
     
    17901828  if (expanded_path == "")
    17911829    {
    1792       if (reach_package (""))
     1830      if (reach_package ("", native_version))
    17931831        {
    17941832          if (Cmt::get_debug ())
     
    18211859  if (CmtSystem::absolute_path (expanded_path))
    18221860    {
    1823       if (reach_package (expanded_path))
     1861      if (reach_package (expanded_path,  native_version))
    18241862        {
    18251863          if (Cmt::get_debug ())
     
    18391877                {
    18401878                  cout << "move_to5> " << real_path << endl;
    1841                 }
    1842              
     1879                }             
     1880
    18431881              return (true);
    18441882            }
     
    18501888  //
    18511889     
    1852   UseProjectAction pa (this);
     1890  UseProjectAction pa (this, native_version);
    18531891
    18541892  Project::broadcast (pa);
     
    23212359
    23222360  do_need_new = need_new (path, package_name, version, &old_use, context_use);
    2323   // cout <<"native_version: "<<native_version<<" "<<version<<endl;
     2361  //cout <<"native_version: "<<native_version<<" "<<version<<endl;
    23242362   
    23252363
     
    24122450   *         we have created a new Use (which has to be validated)
    24132451   */
    2414   bool found = use->move_to ();
     2452  bool found = use->move_to (native_version);
    24152453
    24162454  if (Cmt::get_debug ())
     
    24802518          if (use != 0) use->discard ();
    24812519          use = old_use;
    2482           found = use->move_to ();
     2520          found = use->move_to (native_version);
    24832521        }
    24842522      else
     
    25122550           *   current directory is moved to the selected one
    25132551           */
    2514           found = use->move_to ();
     2552          found = use->move_to (native_version);
    25152553        }
    25162554    }
  • CMT/v1r20b1/source/cmt_use.h

    r328 r331  
    8888  void author_action (const CmtSystem::cmt_string_vector& words);
    8989  void manager_action (const CmtSystem::cmt_string_vector& words);
    90   bool move_to ();
     90  bool move_to (const cmt_string& native_version="");
    9191  void discard ();
    9292  void undiscard ();
     
    155155  bool selected;                 /* used for recursive access       */
    156156  bool m_located;
     157  bool m_hidden;
    157158  ScopeType initial_scope;
    158159
     
    174175private:
    175176  void clear ();
    176   int reach_package (const cmt_string& current_path);
     177  int reach_package (const cmt_string& current_path, const cmt_string& n_version="");
    177178  void select ();
    178179  void unselect ();
Note: See TracChangeset for help on using the changeset viewer.