Changeset 525 for CMT/HEAD/source/cmt_project.cxx
- Timestamp:
- Nov 6, 2009, 12:02:54 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/source/cmt_project.cxx
r523 r525 1120 1120 1121 1121 /*----------------------------------------------------------*/ 1122 void Project::show_container () 1123 { 1124 Project* p = get_current (); 1125 1126 if (p == 0) return; 1127 Use* use = &(p->m_container); 1128 if (use->get_package_name () == "") return; 1129 1130 if (!use->located ()) 1131 { 1132 CmtMessage::warning ("container " + use->get_package_name () 1133 + " " + use->version + " " + use->path 1134 + " not found"); 1135 /* 1136 if (!Cmt::get_quiet ()) 1137 { 1138 cout << "# package " << use->get_package_name () << 1139 " " << use->version << " " << use->path << 1140 " not found" << 1141 endl; 1142 } 1143 */ 1144 CmtError::set (CmtError::package_not_found, use->get_package_name ()); 1145 } 1146 else 1147 { 1148 static const cmt_string empty; 1149 cmt_string p = use->real_path; 1150 if (use->path != "") 1151 { 1152 int pos = p.find_last_of (use->path); 1153 if (pos != cmt_string::npos) 1154 { 1155 p.erase (pos); 1156 } 1157 } 1158 1159 cout << "container " << use->get_package_name () 1160 << " " << use->version; 1161 1162 if (CmtSystem::absolute_path (use->path)) 1163 { 1164 if (!Cmt::get_quiet ()) 1165 { 1166 cout << " (" << use->path << ")"; 1167 } 1168 } 1169 else 1170 { 1171 cout << " " << use->path; 1172 } 1173 1174 if (!Cmt::get_quiet ()) 1175 { 1176 if (p != "") cout << " (" << p << ")"; 1177 if (use->auto_imports == Off) cout << " (no_auto_imports)"; 1178 } 1179 1180 cout << endl; 1181 } 1182 } 1183 /*----------------------------------------------------------*/ 1122 1184 void Project::show_specified_strategies_for_all () 1123 1185 { … … 1720 1782 1721 1783 //---------------------------------------------------------- 1722 const cmt_string& Project::get_container () const1723 { 1724 return (m_container );1784 const cmt_string& Project::get_container_name () const 1785 { 1786 return (m_container_name); 1725 1787 } 1726 1788 … … 1729 1791 { 1730 1792 return (m_container_version); 1793 } 1794 1795 //---------------------------------------------------------- 1796 const cmt_string& Project::get_container_path () const 1797 { 1798 return (m_container_path); 1731 1799 } 1732 1800 … … 1788 1856 1789 1857 //---------------------------------------------------------- 1790 void Project::set_container (const cmt_string& container)1791 { 1792 m_container = container;1858 void Project::set_container_name (const cmt_string& name) 1859 { 1860 m_container_name = name; 1793 1861 } 1794 1862 … … 1797 1865 { 1798 1866 m_container_version = container_version; 1867 } 1868 1869 //---------------------------------------------------------- 1870 void Project::set_container_path (const cmt_string& container_path) 1871 { 1872 m_container_path = container_path; 1799 1873 } 1800 1874 … … 1954 2028 A container statement is met in the project file 1955 2029 */ 1956 void Project::container_action (const cmt_string& name, const cmt_string& version) 1957 { 1958 //cerr << "Container action " << name << " " << version << endl; 1959 1960 set_container (name); 2030 void Project::container_action (const CmtSystem::cmt_string_vector& words) 2031 //void Project::container_action (const cmt_string& name, const cmt_string& version) 2032 { 2033 // 2034 // complete syntax : "container <package> <version> <path>" 2035 // minimal syntax : "container <package>" 2036 // 2037 // o if <version> is omitted then take any version available 2038 // o <version> can be specified using "v*" or "v<n>r*" or "v<n>r<m>p*" 2039 // 2040 // o the notation "v*" is preferred to omission (particularly since 2041 // omission does not permit <path>) 2042 // 2043 Use* use = &m_container; 2044 use->~Use (); 2045 if (words.size () < 2) return; 2046 2047 CmtSystem::cmt_string_vector ewords; 2048 for (int i = 1; i < words.size (); i++) 2049 { 2050 const cmt_string& w = words[i]; 2051 cmt_string ew = w; 2052 2053 Symbol::expand (ew); 2054 if (ew != w) 2055 { 2056 CmtSystem::cmt_string_vector ws; 2057 CmtSystem::split (ew, " ", ws); 2058 2059 for (int j = 0; j < ws.size (); ++j) 2060 { 2061 ewords.push_back (ws[j]); 2062 } 2063 } 2064 else 2065 { 2066 ewords.push_back (w); 2067 } 2068 } 2069 2070 cmt_string name, version, path; 2071 if (ewords.size () > 0) name = ewords[0]; 2072 if (ewords.size () > 1) version = ewords[1]; 2073 if (ewords.size () > 2) path = ewords[2]; 2074 2075 if (name != "") 2076 { 2077 use->set (name, version, path); 2078 use->get_package ()->remove_use (use); 2079 if (use->move_to ()) 2080 { 2081 cmt_string use_real; 2082 bool ok (false); 2083 if (!CmtSystem::absolute_path (use->path)) 2084 { 2085 ok = CmtSystem::realpath_ (use->real_path, use_real); 2086 } 2087 else 2088 { 2089 ok = CmtSystem::realpath_ (use->path, use_real); 2090 } 2091 if (ok && use_real.find (m_cmtpath_real) != 0) 2092 { 2093 use->~Use (); 2094 } 2095 } 2096 CmtSystem::cd (m_cmtpath_pwd + CmtSystem::file_separator () + "cmt"); 2097 } 2098 // cerr << CmtSystem::pwd () << endl; 2099 2100 set_container_name (name); 1961 2101 set_container_version (version); 2102 set_container_path (path); 1962 2103 } 1963 2104
Note: See TracChangeset
for help on using the changeset viewer.