Changeset 664 for CMT/v1r25-branch/source/cmt_commands.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_commands.cxx
r612 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 //----------------------------------------------------------- … … 256 257 pv.push_back (&ArgParser::option_no_cleanup); i++; 257 258 259 parsers.add ("-no_strip_p", i); 260 parsers.add ("-no_strip_pa", i); 261 parsers.add ("-no_strip_pat", i); 262 parsers.add ("-no_strip_path", i); 263 pv.push_back (&ArgParser::option_no_strip_path); i++; 264 258 265 parsers.add ("-pac", i); 259 266 parsers.add ("-pack", i); … … 263 270 parsers.add ("-path", i); 264 271 pv.push_back (&ArgParser::option_path); i++; 272 273 parsers.add ("-strip_p", i); 274 parsers.add ("-strip_pa", i); 275 parsers.add ("-strip_pat", i); 276 parsers.add ("-strip_path", i); 277 pv.push_back (&ArgParser::option_strip_path); i++; 265 278 266 279 parsers.add ("-pr", i); … … 346 359 parsers.add ("-without_cmt", i); 347 360 pv.push_back (&ArgParser::option_without_cmt); i++; 361 362 parsers.add ("-with_p", i); 363 parsers.add ("-with_pr", i); 364 parsers.add ("-with_pro", i); 365 parsers.add ("-with_proj", i); 366 parsers.add ("-with_proje", i); 367 parsers.add ("-with_projec", i); 368 parsers.add ("-with_project", i); 369 parsers.add ("-with_projects", i); 370 pv.push_back (&ArgParser::option_with_projects); i++; 371 372 parsers.add ("-without_p", i); 373 parsers.add ("-without_pr", i); 374 parsers.add ("-without_pro", i); 375 parsers.add ("-without_proj", i); 376 parsers.add ("-without_proje", i); 377 parsers.add ("-without_projec", i); 378 parsers.add ("-without_project", i); 379 parsers.add ("-without_projects", i); 380 pv.push_back (&ArgParser::option_without_projects); i++; 348 381 349 382 parsers.add ("-warn", i); … … 1903 1936 { 1904 1937 cmt.m_disable_warnings = true; 1905 if (CmtMessage::level () <= Warning) 1906 CmtMessage::set_level (Error); 1938 // if (CmtMessage::level () <= Warning) 1939 // CmtMessage::set_level (Error); 1940 if (!Cmt::add_cmt_flag ("-disable_warnings")) 1941 CmtError::set (CmtError::system_error, "Cannot add flag `-disable_warnings'"); 1907 1942 } 1908 1943 … … 1910 1945 { 1911 1946 cmt.m_quiet = true; 1912 if (CmtMessage::level () <= Error) 1913 CmtMessage::set_level (Fatal); 1947 // if (CmtMessage::level () <= Error) 1948 // CmtMessage::set_level (Fatal); 1949 if (!Cmt::add_cmt_flag ("-quiet")) 1950 CmtError::set (CmtError::system_error, "Cannot add flag `-quiet'"); 1914 1951 } 1915 1952 … … 1918 1955 { 1919 1956 cmt.m_warnings = true; 1920 if (CmtMessage::level () != Warning) 1921 CmtMessage::set_level (Warning); 1957 // if (CmtMessage::level () != Warning) 1958 // CmtMessage::set_level (Warning); 1959 if (!Cmt::add_cmt_flag ("-warnings")) 1960 CmtError::set (CmtError::system_error, "Cannot add flag `-warnings'"); 1922 1961 } 1923 1962 … … 1952 1991 { 1953 1992 CmtSystem::cmt_string_vector words; 1954 1955 1993 CmtSystem::split (arg, ":", words); 1956 1994 1957 1995 cmt.m_current_access = UserMode; 1996 1997 cmt.m_current_package = ""; 1998 cmt.m_current_version = ""; 1999 cmt.m_current_path = ""; 1958 2000 1959 2001 if (words.size () > 0) cmt.m_current_package = words[0]; 1960 2002 if (words.size () > 1) cmt.m_current_version = words[1]; 1961 2003 if (words.size () > 2) cmt.m_current_path = words[2]; 1962 (Use::current()).set (cmt.m_current_package,1963 cmt.m_current_version,1964 cmt.m_current_path);1965 1966 Use& use = Use::current();1967 if (use.get_package_name () == "cmt_standalone")1968 {1969 if (!CmtSystem::cd (use.path) || !CmtSystem::test_file ("requirements"))1970 {1971 CmtError::set (CmtError::package_not_found, use.get_info ());1972 return;1973 }1974 use.style = none_style;1975 use.structuring_style = without_version_directory;1976 use.change_path (CmtSystem::pwd ());1977 }1978 else if (!use.move_to ("", true))1979 {1980 CmtError::set (CmtError::package_not_found, use.get_info ());1981 return;1982 }1983 Project::order_all ();1984 Cmt::guess_current_project ();1985 2004 } 1986 2005 } … … 1995 2014 1996 2015 cmt.m_current_package = arg; 1997 cmt.m_current_version = ""; 1998 1999 /* 2000 cerr << "ArgParser::option_pack> " 2001 << " cp=" << cmt.m_current_package 2002 << " cv=" << cmt.m_current_version 2003 << " cp=" << cmt.m_current_path << endl; 2004 */ 2005 2006 (Use::current()).set (cmt.m_current_package, 2007 cmt.m_current_version, 2008 cmt.m_current_path); 2016 // cmt.m_current_version = ""; 2017 2009 2018 } 2010 2019 } … … 2016 2025 cmt.m_current_access = UserMode; 2017 2026 cmt.m_current_version = arg; 2018 2019 /*2020 cerr << "ArgParser::option_version> "2021 << " cp=" << cmt.m_current_package2022 << " cv=" << cmt.m_current_version2023 << " cp=" << cmt.m_current_path << endl;2024 */2025 2026 (Use::current()).set (cmt.m_current_package,2027 cmt.m_current_version,2028 cmt.m_current_path);2029 2027 } 2030 2028 } … … 2036 2034 cmt.m_current_access = UserMode; 2037 2035 cmt.m_current_path = arg; 2038 2039 /*2040 cerr << "ArgParser::option_path> "2041 << " cp=" << cmt.m_current_package2042 << " cv=" << cmt.m_current_version2043 << " cp=" << cmt.m_current_path << endl;2044 */2045 2046 (Use::current()).set (cmt.m_current_package,2047 cmt.m_current_version,2048 cmt.m_current_path);2049 2050 //IProjectFactory& factory = ProjectFactory::instance ();2051 //CmtSystem::add_cmt_path (cmt.m_current_path, "argument", factory);2052 Use& use = Use::current();2053 if (use.get_package_name () == "cmt_standalone")2054 {2055 if (!CmtSystem::cd (use.path) || !CmtSystem::test_file ("requirements"))2056 {2057 CmtError::set (CmtError::package_not_found, use.get_info ());2058 return;2059 }2060 use.style = none_style;2061 use.structuring_style = without_version_directory;2062 use.change_path (CmtSystem::pwd ());2063 }2064 else if (!use.move_to ("", true))2065 {2066 CmtError::set (CmtError::package_not_found, use.get_info ());2067 return;2068 }2069 Project::order_all ();2070 Cmt::guess_current_project ();2071 2036 } 2072 2037 } … … 2079 2044 void ArgParser::option_e () 2080 2045 { 2081 //CmtMessage::warning ("extra statement = " + arg);2082 2046 extra_line = arg; 2083 2047 } … … 2089 2053 cmt.m_cmt_home = arg; 2090 2054 } 2055 } 2056 2057 void ArgParser::option_no_strip_path () 2058 { 2059 cmt.m_strip_path = false; 2060 if (!Cmt::add_cmt_flag ("-no_strip_path")) 2061 CmtMessage::error ("Cannot add flag `-no_strip_path'"); 2062 } 2063 2064 void ArgParser::option_strip_path () 2065 { 2066 cmt.m_strip_path = true; 2067 if (!Cmt::add_cmt_flag ("-strip_path")) 2068 CmtMessage::error ("Cannot add flag `-strip_path'"); 2091 2069 } 2092 2070 … … 2098 2076 if (arg != "") 2099 2077 { 2078 cmt.m_tags.clear (); 2079 CmtSystem::cmt_string_vector words; 2080 CmtSystem::split (arg, " \t,", words); 2081 for (int i = 0; i < words.size (); i++) 2082 { 2083 bool has (false); 2084 for (int j = 0; j < cmt.m_tags.size (); j++) 2085 { 2086 if (cmt.m_tags[j] == words[i]) 2087 { 2088 has = true; 2089 break; 2090 } 2091 } 2092 if (!has) 2093 cmt.m_tags.push_back (words[i]); 2094 } 2095 2096 if (cmt.m_tags.size () != 0) 2097 { 2098 cmt.m_extra_tags.clear (); 2099 cmt.m_tags_add.clear (); 2100 cmt.m_tags_remove.clear (); 2101 } 2102 2103 /* 2100 2104 Tag* tag; 2101 2105 CmtSystem::cmt_string_vector words; … … 2151 2155 // To be sure that a tag 2152 2156 Cmt::guess_current_project (); 2157 */ 2153 2158 } 2154 2159 } … … 2156 2161 void ArgParser::option_tag_add () 2157 2162 { 2163 CmtSystem::cmt_string_vector words; 2164 CmtSystem::split (arg, " \t,", words); 2165 for (int i = 0; i < words.size (); i++) 2166 { 2167 bool has (false); 2168 for (int j = 0; j < cmt.m_tags_add.size (); j++) 2169 { 2170 if (cmt.m_tags_add[j] == words[i]) 2171 { 2172 has = true; 2173 break; 2174 } 2175 } 2176 if (!has) 2177 { 2178 cmt.m_tags_add.push_back (words[i]); 2179 } 2180 2181 for (int j = 0; j < cmt.m_tags_remove.size (); j++) 2182 { 2183 if (cmt.m_tags_remove[j] == words[i]) 2184 { 2185 cmt.m_tags_remove.erase(j); 2186 break; 2187 } 2188 } 2189 } 2190 /* 2158 2191 Tag* tag; 2159 2192 CmtSystem::cmt_string_vector words; … … 2188 2221 } 2189 2222 } 2223 */ 2190 2224 } 2191 2225 2192 2226 void ArgParser::option_tag_remove () 2193 2227 { 2228 CmtSystem::cmt_string_vector words; 2229 CmtSystem::split (arg, " \t,", words); 2230 for (int i = 0; i < words.size (); i++) 2231 { 2232 bool has (false); 2233 for (int j = 0; j < cmt.m_tags_remove.size (); j++) 2234 { 2235 if (cmt.m_tags_remove[j] == words[i]) 2236 { 2237 has = true; 2238 break; 2239 } 2240 } 2241 if (!has) 2242 { 2243 cmt.m_tags_remove.push_back (words[i]); 2244 } 2245 2246 for (int j = 0; j < cmt.m_extra_tags.size (); j++) 2247 { 2248 if (cmt.m_extra_tags[j] == words[i]) 2249 { 2250 cmt.m_extra_tags.erase(j); 2251 break; 2252 } 2253 } 2254 for (int j = 0; j < cmt.m_tags.size (); j++) 2255 { 2256 if (cmt.m_tags[j] == words[i]) 2257 { 2258 cmt.m_tags.erase(j); 2259 break; 2260 } 2261 } 2262 for (int j = 0; j < cmt.m_tags_add.size (); j++) 2263 { 2264 if (cmt.m_tags_add[j] == words[i]) 2265 { 2266 cmt.m_tags_add.erase(j); 2267 break; 2268 } 2269 } 2270 } 2271 /* 2194 2272 Tag::TagPtrVector tags = Tag::tags (); 2195 2273 int i; 2196 2274 Tag* tag; 2197 2198 /*2199 for (i = 0; i < tags.size (); i++)2200 {2201 tag = tags[i];2202 if ((tag != 0) &&2203 (tag->selected))2204 {2205 if (!cmt.m_quiet) cerr << " original tag_list=" << tag->name << tag->priority << endl;2206 }2207 }2208 */2209 2275 2210 2276 CmtSystem::cmt_string_vector words; … … 2259 2325 const cmt_string& a = words[i]; 2260 2326 2261 //fprintf (stderr, " a=[%s]\n", a.c_str ());2262 2263 2327 /// Then restore uname if the specified tag is CMTCONFIG 2264 2328 if (a == CmtSystem::get_cmt_config ()) … … 2283 2347 tag->mark ("arguments"); 2284 2348 } 2349 */ 2285 2350 } 2286 2351 … … 2307 2372 } 2308 2373 2374 void ArgParser::option_with_projects () 2375 { 2376 cmt.m_use_projects = true; 2377 if (!Cmt::add_cmt_flag ("-with_projects")) 2378 CmtMessage::error ("Cannot add flag `-with_projects'"); 2379 } 2380 2381 void ArgParser::option_without_projects () 2382 { 2383 cmt.m_use_projects = false; 2384 if (!Cmt::add_cmt_flag ("-without_projects")) 2385 CmtMessage::error ("Cannot add flag `-without_projects'"); 2386 } 2387 2309 2388 void ArgParser::option_with_version_directory () 2310 2389 { 2311 2390 cmt.m_current_structuring_style = with_version_directory; 2312 2391 2313 StrategyDef* def = StrategyMgr::find_strategy ("VersionDirectory"); 2314 if (def != 0) 2315 { 2316 def->m_default_value = true; 2317 def->m_priority_value = false; 2318 } 2392 if (!Cmt::add_cmt_flag ("-with_version_directory")) 2393 CmtError::set (CmtError::system_error, "Cannot add flag `-with_version_directory'"); 2394 2319 2395 } 2320 2396 … … 2323 2399 cmt.m_current_structuring_style = without_version_directory; 2324 2400 2325 StrategyDef* def = StrategyMgr::find_strategy ("VersionDirectory"); 2326 if (def != 0) 2327 { 2328 def->m_default_value = false; 2329 def->m_priority_value = true; 2330 } 2401 if (!Cmt::add_cmt_flag ("-without_version_directory")) 2402 CmtError::set (CmtError::system_error, "Cannot add flag `-without_version_directory'"); 2403 2331 2404 } 2332 2405 … … 2398 2471 cout << "# -path=<path> : set root path" << endl; 2399 2472 cout << "# -f=<requirements-file> : set input file" << endl; 2400 cout << "# -e=<statement > : add a one line statement" << endl;2473 cout << "# -e=<statement(s)> : add (multiple) statement(s)" << endl; 2401 2474 cout << "# -tag=<tag-list> : select a new tag-set" << endl; 2402 2475 cout << "# -tag_add=<tag-list> : add specific comma-separated tag(s)" << endl; … … 2408 2481 cout << "# -no_cleanup : inhibit install area cleanup" << endl; 2409 2482 cout << "# -xml : output in XML format (cmt setup, cmt show projects, cmt show uses)" << endl; 2483 cout << "# -user_context=<path> : set user context package/project directory" << endl; 2484 cout << "# -home=<path> : set home package/project directory" << endl; 2410 2485 } 2411 2486
Note: See TracChangeset
for help on using the changeset viewer.