Changeset 331
- Timestamp:
- Nov 20, 2006, 10:39:18 PM (18 years ago)
- Location:
- CMT/v1r20b1/source
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/v1r20b1/source/cmt_parser.cxx
r329 r331 1364 1364 1365 1365 if (use->discarded) continue; 1366 if (use->m_hidden) continue; 1366 1367 1367 1368 if (!use->located ()) -
CMT/v1r20b1/source/cmt_project.cxx
r330 r331 582 582 project->get_release (), "", ""); 583 583 project_use->done = true; //false; 584 project_use->discarded = false; 584 project_use->discarded = false;//true; //false; 585 project_use->m_hidden = true; 585 586 project_use->selected = true; 586 587 project_use->m_located = true; -
CMT/v1r20b1/source/cmt_use.cxx
r295 r331 1335 1335 discarded = false; 1336 1336 selected = false; 1337 m_hidden = false; 1337 1338 auto_imports = Unspecified; 1338 1339 … … 1424 1425 1425 1426 //---------------------------------------------------------- 1426 int Use::reach_package (const cmt_string& from_path )1427 int Use::reach_package (const cmt_string& from_path, const cmt_string& n_version) 1427 1428 { 1428 1429 if (Cmt::get_debug ()) … … 1431 1432 << version << ")from " << from_path << endl; 1432 1433 } 1433 1434 1434 1435 // 1435 1436 // We try to reach a package/version starting from from_path … … 1511 1512 if (Cmt::get_debug ()) 1512 1513 { 1513 cout << "Use::reach_package-5>" << endl;1514 cout << "Use::reach_package-5>" << endl; 1514 1515 } 1515 1516 … … 1526 1527 1527 1528 if (CmtSystem::test_file ("cmt/requirements")) 1528 1529 { 1529 1530 CmtSystem::cd ("cmt"); 1530 1531 … … 1532 1533 1533 1534 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); 1578 1578 } 1579 1579 else if (!CmtSystem::cd (version)) … … 1595 1595 1596 1596 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 } 1597 1633 1598 1634 int i; … … 1711 1747 { 1712 1748 public: 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 1714 1751 { 1715 1752 } … … 1727 1764 m_use->alternate_paths.clear (); 1728 1765 1729 if (m_use->reach_package (path ))1766 if (m_use->reach_package (path, this->native_version)) 1730 1767 { 1731 1768 if (Cmt::get_debug ()) … … 1761 1798 Use* m_use; 1762 1799 bool m_found; 1800 cmt_string native_version; 1763 1801 }; 1764 1802 1765 1803 //---------------------------------------------------------- 1766 bool Use::move_to ( )1804 bool Use::move_to (const cmt_string& native_version) 1767 1805 { 1768 1806 if (m_located) … … 1778 1816 } 1779 1817 1780 reach_package (real_path );1818 reach_package (real_path, native_version); 1781 1819 1782 1820 return (true); … … 1790 1828 if (expanded_path == "") 1791 1829 { 1792 if (reach_package ("" ))1830 if (reach_package ("", native_version)) 1793 1831 { 1794 1832 if (Cmt::get_debug ()) … … 1821 1859 if (CmtSystem::absolute_path (expanded_path)) 1822 1860 { 1823 if (reach_package (expanded_path ))1861 if (reach_package (expanded_path, native_version)) 1824 1862 { 1825 1863 if (Cmt::get_debug ()) … … 1839 1877 { 1840 1878 cout << "move_to5> " << real_path << endl; 1841 } 1842 1879 } 1880 1843 1881 return (true); 1844 1882 } … … 1850 1888 // 1851 1889 1852 UseProjectAction pa (this );1890 UseProjectAction pa (this, native_version); 1853 1891 1854 1892 Project::broadcast (pa); … … 2321 2359 2322 2360 do_need_new = need_new (path, package_name, version, &old_use, context_use); 2323 // 2361 //cout <<"native_version: "<<native_version<<" "<<version<<endl; 2324 2362 2325 2363 … … 2412 2450 * we have created a new Use (which has to be validated) 2413 2451 */ 2414 bool found = use->move_to ( );2452 bool found = use->move_to (native_version); 2415 2453 2416 2454 if (Cmt::get_debug ()) … … 2480 2518 if (use != 0) use->discard (); 2481 2519 use = old_use; 2482 found = use->move_to ( );2520 found = use->move_to (native_version); 2483 2521 } 2484 2522 else … … 2512 2550 * current directory is moved to the selected one 2513 2551 */ 2514 found = use->move_to ( );2552 found = use->move_to (native_version); 2515 2553 } 2516 2554 } -
CMT/v1r20b1/source/cmt_use.h
r328 r331 88 88 void author_action (const CmtSystem::cmt_string_vector& words); 89 89 void manager_action (const CmtSystem::cmt_string_vector& words); 90 bool move_to ( );90 bool move_to (const cmt_string& native_version=""); 91 91 void discard (); 92 92 void undiscard (); … … 155 155 bool selected; /* used for recursive access */ 156 156 bool m_located; 157 bool m_hidden; 157 158 ScopeType initial_scope; 158 159 … … 174 175 private: 175 176 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=""); 177 178 void select (); 178 179 void unselect ();
Note: See TracChangeset
for help on using the changeset viewer.