Changeset 664 for CMT/v1r25-branch/source/cmt_use.cxx
- Timestamp:
- Jan 13, 2014, 4:09:37 PM (10 years ago)
- Location:
- CMT/v1r25-branch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/v1r25-branch
-
CMT/v1r25-branch/source/cmt_use.cxx
r610 r664 3 3 // arnault@lal.in2p3.fr 4 4 // Modified by garonne@lal.in2p3.fr 5 // Modified by Grigory Rybkin 5 6 // See the complete license in cmt_license.txt "http://www.cecill.info". 6 7 //----------------------------------------------------------- … … 1826 1827 m_located = false; 1827 1828 m_package = 0; 1829 m_project = 0; 1828 1830 m_index = -1; 1829 1831 … … 1848 1850 m_package = 0; 1849 1851 } 1852 m_project = 0; 1850 1853 1851 1854 version = ""; … … 1923 1926 1924 1927 //---------------------------------------------------------- 1925 void Use::change_path (const cmt_string& new_path )1928 void Use::change_path (const cmt_string& new_path, const Project* project) 1926 1929 { 1927 1930 // … … 1929 1932 // where this package/version has been found. 1930 1933 // 1934 if (Cmt::get_debug ()) 1935 { 1936 cout << "|Use::change_path> path: " << new_path 1937 << " project: " << (project ? project->get_cmtpath () : "0") 1938 << " use: " << get_info () << endl; 1939 } 1931 1940 1932 1941 real_path = ""; 1933 1942 m_realpath = ""; 1934 1943 1935 if (new_path != "") 1944 m_project = 0; 1945 1946 if (new_path.size () != 0) 1947 // if (new_path != "") 1936 1948 { 1937 1949 if ((path.size () > 0) && … … 1951 1963 if (!CmtSystem::realpath_ (real_path, m_realpath)) 1952 1964 { 1953 CmtError::set (CmtError::file_access_error, "Cannot compute real path `" + 1954 real_path + "'"); 1965 CmtError::set (CmtError::file_access_error, 1966 "Cannot compute real path `" + real_path + "': " + 1967 get_info ()); 1955 1968 CmtError::print (); 1956 1969 return; … … 1958 1971 } 1959 1972 1973 if (project) 1974 m_project = project; 1975 1960 1976 m_located = true; 1977 1978 if (Cmt::get_debug ()) 1979 { 1980 cout << "<Use::change_path| real_path: " << real_path 1981 << " m_project: " << (m_project ? m_project->get_cmtpath () : "0") 1982 << " use: " << get_info () << endl; 1983 } 1961 1984 } 1962 1985 … … 2347 2370 } 2348 2371 2349 m_use->change_path (path );2372 m_use->change_path (path, &project); 2350 2373 2351 2374 m_found = true; … … 2355 2378 else if (m_use->alternate_versions.size () > 0) 2356 2379 { 2357 if (m_use->select_alternate ( ))2380 if (m_use->select_alternate (&project)) 2358 2381 { 2359 2382 if (Cmt::get_debug ()) … … 2448 2471 cout << "move_to2> " << expanded_path << endl; 2449 2472 } 2450 2451 2473 change_path (here); 2452 2453 2474 return (true); 2454 2475 } … … 2461 2482 cout << "move_to5> " << real_path << endl; 2462 2483 } 2463 2464 2484 return (true); 2465 2485 } 2466 2486 } 2487 2488 if (!CmtSystem::cd (here)) 2489 { 2490 CmtError::set (CmtError::file_access_error, here); 2491 } 2467 2492 return (false); 2468 2493 // } … … 2482 2507 2483 2508 //---------------------------------------------------------- 2484 bool Use::select_alternate ( )2509 bool Use::select_alternate (const Project* project) 2485 2510 { 2486 2511 int i; … … 2567 2592 } 2568 2593 2569 change_path (alternate_paths[selected_index] );2594 change_path (alternate_paths[selected_index], project); 2570 2595 return (true); 2571 2596 } … … 3568 3593 offset = ""; 3569 3594 3570 cmtpath = m_realpath.size () 3571 ? Project::find_in_cmt_paths (m_realpath, true) 3572 : Project::find_in_cmt_paths (real_path) 3573 ; 3574 const Project* p = Project::find_by_cmtpath (cmtpath); 3575 3595 const Project* p (0); 3596 if (m_project) 3597 { 3598 p = m_project; 3599 cmtpath = p->get_cmtpath (); 3600 } 3601 else 3602 { 3603 cmtpath = m_realpath.size () 3604 ? Project::find_in_cmt_paths (m_realpath, true) 3605 : Project::find_in_cmt_paths (real_path) 3606 ; 3607 p = Project::find_by_cmtpath (cmtpath); 3608 // const Project* p = Project::find_by_cmtpath (cmtpath); 3609 } 3576 3610 // if (cmtpath != "") 3577 3611 if (p != 0) … … 3590 3624 else if (!CmtSystem::realpath_ (real_path, offset)) 3591 3625 { 3592 CmtError::set (CmtError::file_access_error, "Cannot compute real path `" + 3593 real_path + "'"); 3626 CmtError::set (CmtError::file_access_error, 3627 "Cannot compute real path `" + real_path + "': " + 3628 get_info ()); 3594 3629 CmtError::print (); 3595 3630 return; … … 3619 3654 bool Use::get_strategy (const cmt_string& name) const 3620 3655 { 3621 const Project* p = 3656 const Project* p = get_project (); 3657 /* 3622 3658 Project::find_by_cmtpath (m_realpath.size () 3623 3659 ? Project::find_in_cmt_paths (m_realpath, true) 3624 3660 : Project::find_in_cmt_paths (real_path) 3625 3661 ); 3626 // const Project* p = Project::find_by_cmtpath (Project::find_in_cmt_paths (real_path));3662 */ 3627 3663 3628 3664 bool strategy; … … 3705 3741 buffer += "\n"; 3706 3742 3707 if (located ()) 3743 if (m_located) 3744 // if (located ()) 3708 3745 { 3709 3746 buffer += "macro "; … … 3725 3762 buffer += package_name; 3726 3763 } 3727 // if (style != no_version_style)3728 3764 if (structuring_style == with_version_directory) 3729 3765 { … … 3733 3769 buffer += "\""; 3734 3770 buffer += "\n"; 3771 } 3772 3773 if (action_setup == Cmt::get_action () && 3774 Requirements == Cmt::get_print_mode ()) 3775 { 3776 //cerr << "|Use::fill_standard_macros> Checking for " << prefix << "CONFIG" << endl; 3777 if (!discarded && 3778 get_package_name () != "cmt_standalone" && 3779 get_strategy ("SetupConfig")) 3780 { 3781 buffer += "macro "; 3782 buffer += prefix; 3783 buffer += "CONFIG"; 3784 buffer += " \""; 3785 buffer += CmtSystem::get_cmt_config (); 3786 buffer += "\""; 3787 buffer += "\n"; 3788 } 3735 3789 } 3736 3790 … … 3764 3818 buffer += "\n"; 3765 3819 3766 Project* p = Project::find_by_cmtpath (cmtpath); 3820 const Project* p = m_project 3821 ? m_project 3822 : Project::find_by_cmtpath (cmtpath) 3823 ; 3824 /* 3825 const Project* p (m_project); 3826 if (!p) 3827 p = Project::find_by_cmtpath (cmtpath); 3828 */ 3767 3829 3768 3830 buffer += "macro "; … … 4520 4582 static const cmt_string null = ""; 4521 4583 4584 return m_package ? m_package->get_name () : null ; 4585 /* 4522 4586 Package* p = m_package; 4523 4587 if (p == 0) return (null); 4524 4588 4525 4589 return (p->get_name ()); 4590 */ 4526 4591 } 4527 4592 … … 4829 4894 4830 4895 return (is_in_path); 4831 }4832 4833 //----------------------------------------------------------4834 bool Use::located () const4835 {4836 return (m_located);4837 4896 } 4838 4897 … … 5736 5795 5737 5796 //---------------------------------------------------------- 5738 Project* Use::get_project () 5797 const Project* Use::get_project () const 5739 5798 { 5799 if (m_project) 5800 return m_project; 5801 5802 return Project::find_by_cmtpath (m_realpath.size () 5803 ? Project::find_in_cmt_paths (m_realpath, true) 5804 : Project::find_in_cmt_paths (real_path) 5805 ); 5806 /* 5807 cmt_string cmtpath = m_realpath.size () 5808 ? Project::find_in_cmt_paths (m_realpath, true) 5809 : Project::find_in_cmt_paths (real_path) 5810 ; 5811 return Project::find_by_cmtpath (cmtpath); 5812 */ 5813 /* 5740 5814 Project* p; 5741 5815 cmt_string cmtpath = ""; … … 5744 5818 p = Project::find_by_cmtpath (cmtpath); 5745 5819 return p; 5820 */ 5746 5821 } 5747 5822
Note: See TracChangeset
for help on using the changeset viewer.