- Timestamp:
- Feb 7, 2006, 11:01:45 AM (18 years ago)
- Location:
- CMT/HEAD
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/ChangeLog
r143 r144 1 2006-02-07 Christian Arnault <arnault@lal.in2p3.fr> 295 2 3 * mgr/requirements: Protect cmtpath_patterns with strategies 4 use $(CMTCONFIG) instead of $(tag) in cmtpath_patterns 5 6 * source/cmt_parser.cxx (configure_cmt_path): Suppress warnings for bad paths at this stage 7 (do_check_configuration): Add set_standard_macros for do_check_configuration 8 9 * source/cmt_commands.cxx (do_check): Activate warnings for check configuration and for setup 10 11 * source/cmt_symbol.cxx (filter_path_value): Don't kill path item when they don't exist. 12 (action): Reset all_sets_done at each symbol definition. 13 (all_set): Protect against internal recursivity 14 (all_print): Print path settings here. 15 (check_all_paths): Add a new function to check all paths. 16 (SetBuilder::build): suppress detetion of overridings from here (move to SymbolValueList::show) 17 (PathBuilder::build): suppress detetion of overridings from here (move to SymbolValueList::show) 18 (MacroBuilder::build): suppress detetion of overridings from here (move to SymbolValueList::show) 19 (ActionBuilder::build): suppress detetion of overridings from here (move to SymbolValueList::show) 20 (SymbolValueList::show): Keep reset to null actions 21 Print overridings 22 23 * source/cmt_system.cxx: Add include cmt_map.h for putenv management 24 (class CMTPathManager): Suppress generation of an error when the CMTPATH item does not exist 25 26 2006-02-06 Christian Arnault <arnault@lal.in2p3.fr> 294 27 28 * source/cmt_cvs.cxx (class CvsImplementation): Uses the new CmtSystem::putenv API 29 30 * source/cmt_symbol.cxx (all_set): Uses the new CmtSystem::putenv API to fix setup problems 31 32 * source/cmt_system.h (class CmtSystem): Modifying the API of the internal putenv function 33 34 * source/cmt_system.cxx (putenv): Replacing the old putenv implementation with a new one using a static map 35 of all used environment variables so as to ensure a stable string 36 1 37 2006-01-31 <arnault@lal.in2p3.fr> 293 2 38 -
CMT/HEAD/mgr/cmt_dependencies.make
r79 r144 10 10 cmt_script_cxx_dependencies = ../source/cmt_script.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_script.h ../source/cmt_map.h ../source/cmt_include.h ../source/cmt_pattern.h ../source/cmt_scope_section.h ../source/cmt_use.h 11 11 cmt_string_cxx_dependencies = ../source/cmt_string.cxx ../source/cmt_std.h ../source/cmt_string.h 12 cmt_system_cxx_dependencies = ../source/cmt_system.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt_error.h 12 cmt_system_cxx_dependencies = ../source/cmt_system.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt_error.h ../source/cmt_map.h 13 13 cmt_tag_cxx_dependencies = ../source/cmt_tag.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_map.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_pattern.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_tag.h ../source/cmt_branch.h ../source/cmt_fragment.h ../source/cmt_group.h ../source/cmt_constituent.h ../source/cmt_language.h ../source/cmt_symbol.h ../source/cmt_awk.h ../source/cmt_project.h ../source/cmt_cmtpath_pattern.h ../source/cmt_database.h ../source/cmt_log.h 14 14 cmt_use_cxx_dependencies = ../source/cmt_use.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_map.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_pattern.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_error.h ../source/cmt_branch.h ../source/cmt_fragment.h ../source/cmt_group.h ../source/cmt_constituent.h ../source/cmt_language.h ../source/cmt_awk.h ../source/cmt_project.h ../source/cmt_cmtpath_pattern.h ../source/cmt_database.h ../source/cmt_syntax.h -
CMT/HEAD/mgr/requirements
r139 r144 656 656 657 657 cmtpath_pattern \ 658 macro cmt_installarea_paths "$(cmt_installarea_prefix)/$(tag)/bin" ; \ 659 macro_append cmt_installarea_paths " $(cmt_installarea_prefix)/$(tag)/lib" ; \ 660 macro_append cmt_installarea_paths " $(cmt_installarea_prefix)/share/lib" ; \ 661 macro_append cmt_installarea_paths " $(cmt_installarea_prefix)/share/bin" ; \ 662 macro_prepend use_linkopts " $(cmt_installarea_linkopts) " ; \ 663 macro_append shlibbuilder " $(cmt_installarea_linkopts) " 658 macro cmt_installarea_paths "$(cmt_installarea_prefix)/$(CMTCONFIG)/bin" 659 660 cmtpath_pattern \ 661 macro_append cmt_installarea_paths "" <project>_with_installarea " $(<project>_installarea_prefix)/$(CMTCONFIG)/lib" ; \ 662 macro_append cmt_installarea_paths "" <project>_with_installarea " $(<project>_installarea_prefix)/share/lib" ; \ 663 macro_append cmt_installarea_paths "" <project>_with_installarea " $(<project>_installarea_prefix)/share/bin" ; \ 664 macro_prepend use_linkopts "" <project>_with_installarea " $(<project>_installarea_linkopts) " ; \ 665 macro_append shlibbuilder "" <project>_with_installarea " $(<project>_installarea_linkopts) " 664 666 665 667 macro CMT_PATH_remove_regexp "/[^/]*/" WIN32 "\\[^\\]*\\" … … 675 677 path_remove_regexp CLASSPATH "" <project>_with_installarea "$(<project>_installarea_prefix_remove)$(CMT_PATH_remove_share_regexp)bin$" 676 678 679 677 680 cmtpath_pattern \ 678 681 path_prepend PATH "" \ 679 <project>_with_installarea&WIN32 "<path>/$(<project>_installarea_prefix)/${ tag}/bin" \680 <project>_with_installarea&Unix "<path>/$(<project>_installarea_prefix)/${ tag}/bin" ; \682 <project>_with_installarea&WIN32 "<path>/$(<project>_installarea_prefix)/${CMTCONFIG}/bin" \ 683 <project>_with_installarea&Unix "<path>/$(<project>_installarea_prefix)/${CMTCONFIG}/bin" ; \ 681 684 path_prepend PATH "" \ 682 <project>_with_installarea&WIN32 "<path>/$(<project>_installarea_prefix)/${ tag}/lib" \683 <project>_with_installarea&CYGWIN "<path>/$(<project>_installarea_prefix)/${ tag}/lib" ; \685 <project>_with_installarea&WIN32 "<path>/$(<project>_installarea_prefix)/${CMTCONFIG}/lib" \ 686 <project>_with_installarea&CYGWIN "<path>/$(<project>_installarea_prefix)/${CMTCONFIG}/lib" ; \ 684 687 path_prepend LD_LIBRARY_PATH "" \ 685 <project>_with_installarea&Unix "<path>/$(<project>_installarea_prefix)/${ tag}/lib" ; \688 <project>_with_installarea&Unix "<path>/$(<project>_installarea_prefix)/${CMTCONFIG}/lib" ; \ 686 689 path_prepend CLASSPATH "" <project>_with_installarea "<path>/$(<project>_installarea_prefix)/share/lib" ; \ 687 690 path_prepend CLASSPATH "" <project>_with_installarea "<path>/$(<project>_installarea_prefix)/share/bin" ; \ 688 691 macro_prepend cmt_installarea_linkopts "" \ 689 692 <project>_without_installarea "" \ 690 <project>_with_installarea&Unix " -L<path>/$(<project>_installarea_prefix)/$( tag)/lib " \691 <project>_with_installarea&WIN32 " /LIBPATH:<path>\$(<project>_installarea_prefix)\$( tag)\lib "693 <project>_with_installarea&Unix " -L<path>/$(<project>_installarea_prefix)/$(CMTCONFIG)/lib " \ 694 <project>_with_installarea&WIN32 " /LIBPATH:<path>\$(<project>_installarea_prefix)\$(CMTCONFIG)\lib " 692 695 693 696 set NEWCMTCONFIG "${cmt_hardware}-${cmt_system_version}-${cmt_compiler_version}" -
CMT/HEAD/source/cmt_commands.cxx
r109 r144 689 689 { 690 690 cmt.m_action = action_check_configuration; 691 cmt.m_warnings = true; 691 692 } 692 693 else if (arg == "files") … … 1108 1109 { 1109 1110 cmt.m_action = action_setup; 1111 cmt.m_warnings = true; 1110 1112 } 1111 1113 -
CMT/HEAD/source/cmt_cvs.cxx
r101 r144 1018 1018 static cmt_string CMTPATH; 1019 1019 1020 cmt_string cmtpath = CmtSystem::getenv("CMTPATH");1020 cmt_string cmtpath = Symbol::get_env_value ("CMTPATH"); 1021 1021 1022 1022 if (cmtpath.find (dir) == cmt_string::npos) 1023 1023 { 1024 CMTPATH = "CMTPATH="; 1025 CMTPATH += dir; 1024 CMTPATH = dir; 1026 1025 CMTPATH += ":"; 1027 1026 CMTPATH += cmtpath; 1028 1029 CmtSystem::putenv ( CMTPATH);1027 1028 CmtSystem::putenv ("CMTPATH", CMTPATH); 1030 1029 } 1031 1030 -
CMT/HEAD/source/cmt_parser.cxx
r141 r144 565 565 cmt_string s; 566 566 567 /*568 Symbol* symbol = Symbol::find ("CMTPATH");569 if (symbol != 0)570 {571 bool show_set_hidden = false;572 573 if (Me.m_action == action_show_set)574 {575 show_set_hidden = true;576 Me.m_action = action_none;577 }578 579 s = symbol->build_macro_value ();580 Symbol::expand (s);581 582 if (show_set_hidden)583 {584 show_set_hidden = false;585 Me.m_action = action_show_set;586 }587 }588 else589 {590 s = CmtSystem::getenv ("CMTPATH");591 }592 */593 594 567 s = Symbol::get_env_value ("CMTPATH"); 595 568 596 569 { 597 570 bool q = Me.m_quiet; 598 bool w = Me.m_warnings;599 571 Me.m_quiet = true; 600 Me.m_warnings = true;601 572 Symbol::filter_path_value ("CMTPATH", s); 602 Me.m_warnings = w;603 573 Me.m_quiet = q; 604 574 } … … 1962 1932 Tag* tag; 1963 1933 1934 set_standard_macros (); 1935 1964 1936 static CmtSystem::cmt_string_vector tags; 1965 1937 … … 1979 1951 } 1980 1952 1953 Symbol::check_all_paths (); 1954 1981 1955 env = CmtSystem::getenv ("CMTSITE"); 1982 1956 if (env == "") … … 1995 1969 cerr << "#CMT> The CMTSITE value " << env << " is not used in any tag expression. Please check spelling" << endl; 1996 1970 } 1971 1997 1972 } 1998 1973 … … 4012 3987 IProjectFactory& factory = ProjectFactory::instance (); 4013 3988 factory.create_project ("", pwd, "CurrentProject", 0); 4014 4015 /*4016 cmt_string temp = "path_prepend CMTPATH \"";4017 temp += pwd;4018 temp += "\"";4019 4020 Use& use = Use::current();4021 4022 SyntaxParser::parse_requirements_line (temp, &use);4023 */4024 3989 4025 3990 break; … … 5191 5156 case action_unlock : 5192 5157 // case action_version : 5193 reach_current_package (); 5194 use_user_context_requirements (); 5158 { 5159 bool w = Me.m_warnings; 5160 Me.m_warnings = false; 5161 reach_current_package (); 5162 use_user_context_requirements (); 5163 Me.m_warnings = w; 5164 } 5195 5165 break; 5196 5166 default: … … 7536 7506 7537 7507 Me.m_recursive = true; 7538 Me.m_debug = false;7508 //Me.m_debug = false; 7539 7509 use = Use::add (Me.m_default_path, "CMT", Me.m_cmt_version, "", "", 0); 7540 7510 Me.m_recursive = recursive_copy; -
CMT/HEAD/source/cmt_symbol.cxx
r136 r144 876 876 if (Cmt::get_warnings ()) 877 877 { 878 c err << "#CMT> Warning: Wrong " << name << " item " << t<< endl;878 cout << "#CMT> Warning: Wrong path item " << t << " in " << name << endl; 879 879 } 880 881 t = "";882 880 } 883 881 } … … 975 973 const cmt_string& default_value = words[2]; 976 974 975 Cmt::reset_all_sets_done (); 976 977 977 if (Cmt::get_debug ()) 978 978 { … … 1301 1301 //cerr << "all_set" << endl; 1302 1302 1303 static bool running = false; 1304 1305 1303 1306 if (Cmt::get_debug ()) 1304 1307 { 1305 cout << " Symbol::all_set> done" << Cmt::get_all_sets_done ()<< endl;1308 cout << "\nSymbol::all_set> done=" << running << endl; 1306 1309 } 1307 1310 1308 1311 if (Cmt::get_all_sets_done ()) return; 1309 1312 1313 if (running) return; 1314 1315 running = true; 1310 1316 Cmt::set_all_sets_done (); 1311 1317 … … 1313 1319 Use::UsePtrVector& Uses = Use::get_ordered_uses (); 1314 1320 1315 static CmtSystem::cmt_string_vector envs;1316 1317 envs.clear ();1318 1319 1321 int number; 1320 1322 1321 1323 if (Symbols.size () == 0) 1322 1324 { 1323 //running = false;1325 running = false; 1324 1326 return; 1325 1327 } … … 1336 1338 if (value != "") 1337 1339 { 1338 cmt_string& temp = envs.add (); 1339 1340 temp = symbol.name; 1341 temp += '='; 1342 temp += value; 1340 Symbol::expand (value); 1341 1342 CmtSystem::putenv (symbol.name, value); 1343 1343 } 1344 1344 } … … 1360 1360 if (use.get_strategy ("SetupConfig")) 1361 1361 { 1362 cmt_string & temp = envs.add ();1362 cmt_string temp; 1363 1363 1364 1364 temp = use.prefix; 1365 temp += "CONFIG="; 1366 temp += cmtconfig; 1365 temp += "CONFIG"; 1366 1367 CmtSystem::putenv (temp, cmtconfig); 1367 1368 } 1368 1369 1369 1370 if (use.get_strategy ("SetupRoot")) 1370 1371 { 1371 cmt_string & temp = envs.add ();1372 cmt_string temp; 1372 1373 1373 1374 temp = use.prefix; 1374 temp += "ROOT="; 1375 temp += use.get_full_path (); 1375 temp += "ROOT"; 1376 1377 CmtSystem::putenv (temp, use.get_full_path ()); 1376 1378 } 1377 1379 } … … 1385 1387 if (use.get_strategy ("SetupConfig")) 1386 1388 { 1387 cmt_string & temp = envs.add ();1388 1389 cmt_string temp; 1390 1389 1391 temp = use.prefix; 1390 temp += "CONFIG="; 1391 temp += cmtconfig; 1392 temp += "CONFIG"; 1393 1394 CmtSystem::putenv (temp, cmtconfig); 1392 1395 } 1393 1396 1394 1397 if (use.get_strategy ("SetupRoot")) 1395 1398 { 1396 cmt_string & temp = envs.add ();1397 1399 cmt_string temp; 1400 1398 1401 temp = use.prefix; 1399 temp += "ROOT="; 1400 temp += use.get_full_path (); 1402 temp += "ROOT"; 1403 1404 CmtSystem::putenv (temp, use.get_full_path ()); 1401 1405 } 1402 1406 } … … 1415 1419 filter_path_value (symbol.name, value); 1416 1420 1417 cmt_string& temp = envs.add (); 1418 1419 temp = symbol.name; 1420 temp += '='; 1421 temp += value; 1421 #ifdef WIN32 1422 value.replace_all ("/", "\\"); 1423 #endif 1424 1425 if (Cmt::get_debug ()) 1426 { 1427 cerr << "Symbol::all_set-2> " << symbol.name << " = " << value << endl; 1428 } 1429 1430 CmtSystem::putenv (symbol.name, value); 1422 1431 } 1423 1432 } 1424 1433 1425 for (number = 0; number < envs.size (); number++) 1426 { 1427 cmt_string& env = envs[number]; 1428 Symbol::expand (env); 1429 1430 #ifdef WIN32 1431 env.replace_all ("/", "\\"); 1432 #endif 1433 1434 if (Cmt::get_debug ()) 1435 { 1436 cout << "Symbol::all_set> " << env << endl; 1437 } 1438 CmtSystem::putenv (env); 1439 } 1440 1441 //running = false; 1434 running = false; 1442 1435 } 1443 1436 … … 1457 1450 if ((symbol.type == SymbolSet) || 1458 1451 (symbol.type == SymbolAlias) || 1459 (symbol.type == SymbolSetupScript)) 1452 (symbol.type == SymbolSetupScript) || 1453 (symbol.type == SymbolPath)) 1460 1454 { 1461 1455 if (symbol.print (mode)) … … 1473 1467 } 1474 1468 } 1469 } 1470 1471 //------------------------------------------------------------- 1472 void Symbol::check_all_paths () 1473 { 1474 static SymbolVector& Symbols = symbols (); 1475 1476 int number; 1477 1478 if (Symbols.size () == 0) return; 1475 1479 1476 1480 for (number = 0; number < Symbol::symbol_number (); number++) … … 1478 1482 Symbol& symbol = Symbol::symbol (number); 1479 1483 1480 if ((symbol.type != SymbolPath)) continue; 1481 1482 if (symbol.print (mode)) 1483 { 1484 if (mode == Bat) 1485 { 1486 cout << endl; 1487 } 1488 else 1489 { 1490 //cout << "; "; 1491 cout << endl; 1492 } 1484 if (symbol.type == SymbolPath) 1485 { 1486 cmt_string temp; 1487 1488 temp = symbol.build_macro_value (); 1489 expand (temp); 1490 1491 Symbol::filter_path_value (symbol.name, temp); 1493 1492 } 1494 1493 } … … 1940 1939 1941 1940 bool first_definition = true; 1942 bool defined = false;1943 1941 1944 1942 for (int i = 0; i < symbol.value_lists.size (); i++) … … 1984 1982 { 1985 1983 temp = CmtSystem::getenv (symbol.name); 1986 }1987 1988 if (!defined)1989 {1990 defined = true;1991 }1992 else1993 {1994 if ((!Cmt::get_quiet ()) &&1995 ((action == action_show_macro) ||1996 (action == action_show_set) ||1997 (action == action_show_action) ||1998 (action == action_show_macros) ||1999 (action == action_show_sets) ||2000 (action == action_show_actions)))2001 {2002 cerr << "#CMT> Warning: Symbol " << symbol.name << " overridden";2003 2004 if (value_list.use != 0)2005 {2006 cerr << " in package " << value_list.use->get_package_name ();2007 }2008 2009 cerr << endl;2010 }2011 1984 } 2012 1985 … … 2146 2119 2147 2120 bool first_definition = true; 2148 bool defined = false;2149 2121 2150 2122 for (int i = 0; i < symbol.value_lists.size (); i++) … … 2182 2154 resolve_value (new_value, symbol.name, temp); 2183 2155 temp = new_value; 2184 2185 if (!defined)2186 {2187 defined = true;2188 }2189 else2190 {2191 if ((!Cmt::get_quiet ()) &&2192 ((action == action_show_macro) ||2193 (action == action_show_set) ||2194 (action == action_show_action) ||2195 (action == action_show_macros) ||2196 (action == action_show_sets) ||2197 (action == action_show_actions)))2198 {2199 cerr << "#CMT> Warning: Symbol " << symbol.name << " overridden";2200 2201 if (value_list.use != 0)2202 {2203 cerr << " in package " << value_list.use->get_package_name ();2204 }2205 2206 cerr << endl;2207 }2208 }2209 2156 } 2210 2157 … … 2495 2442 2496 2443 bool first_definition = true; 2497 bool defined = false;2498 2444 2499 2445 for (i = 0; i < symbol.value_lists.size (); i++) … … 2557 2503 { 2558 2504 temp = value.text; 2559 2560 if (!defined)2561 {2562 defined = true;2563 }2564 else2565 {2566 /*2567 if ((!Cmt::get_quiet ()) &&2568 ((action == action_show_macro) ||2569 (action == action_show_set) ||2570 (action == action_show_action) ||2571 (action == action_show_macros) ||2572 (action == action_show_sets) ||2573 (action == action_show_actions)))2574 {2575 cerr << "#CMT> Warning: Symbol " << symbol.name << " overridden";2576 2577 if (value_list.use != 0)2578 {2579 cerr << " in package " << value_list.use->get_package_name ();2580 }2581 2582 cerr << endl;2583 }2584 */2585 }2586 2505 } 2587 2506 } … … 2739 2658 2740 2659 bool first_definition = true; 2741 bool defined = false;2742 2660 2743 2661 temp = ""; … … 2771 2689 { 2772 2690 temp = value.text; 2773 2774 if (!defined)2775 {2776 defined = true;2777 }2778 else2779 {2780 if ((!Cmt::get_quiet ()) &&2781 ((action == action_show_macro) ||2782 (action == action_show_set) ||2783 (action == action_show_action) ||2784 (action == action_show_macros) ||2785 (action == action_show_sets) ||2786 (action == action_show_actions)))2787 {2788 cerr << "#CMT> Warning: Symbol " << symbol.name << " overridden";2789 2790 if (value_list.use != 0)2791 {2792 cerr << " in package " << value_list.use->get_package_name ();2793 }2794 2795 cerr << endl;2796 }2797 }2798 2691 } 2799 2692 } … … 2892 2785 ActionType action = Cmt::get_action (); 2893 2786 2894 if (value.text == "") return; 2787 switch (command_type) 2788 { 2789 //case CommandSet : 2790 case CommandSetAppend : 2791 case CommandSetPrepend : 2792 case CommandSetRemove : 2793 case CommandSetRemoveRegexp : 2794 //case CommandAlias : 2795 //case CommandPath : 2796 case CommandPathAppend : 2797 case CommandPathPrepend : 2798 case CommandPathRemove : 2799 case CommandPathRemoveRegexp : 2800 case CommandMacroPrepend : 2801 //case CommandMacro : 2802 case CommandMacroAppend : 2803 case CommandMacroRemove : 2804 case CommandMacroRemoveRegexp : 2805 case CommandMacroRemoveAll : 2806 case CommandMacroRemoveAllRegexp : 2807 //case CommandAction : 2808 if (value.text == "") return; 2809 break; 2810 } 2895 2811 2896 2812 if (discarded) discarded_text = " (discarded by override)"; -
CMT/HEAD/source/cmt_symbol.h
r136 r144 89 89 static void all_print (PrintMode mode); 90 90 static void all_print_clean (PrintMode mode); 91 static void check_all_paths (); 91 92 92 93 static int symbol_number (); -
CMT/HEAD/source/cmt_system.cxx
r141 r144 57 57 #include "cmt_system.h" 58 58 #include "cmt_error.h" 59 #include "cmt_map.h" 59 60 60 61 //-------------------------------------------------- … … 94 95 { 95 96 #ifdef USE_PWD 96 new_dir = "PWD="; 97 new_dir += dir; 97 new_dir = dir; 98 98 new_dir += file_separator (); 99 putenv ( new_dir);99 putenv ("PWD", new_dir); 100 100 #endif 101 101 … … 109 109 { 110 110 #ifdef USE_PWD 111 new_dir = "PWD="; 112 new_dir += dir; 113 putenv (new_dir); 111 putenv ("PWD", dir); 114 112 #endif 115 113 … … 1222 1220 } 1223 1221 1224 //---------------------------------------------------------- 1225 bool CmtSystem::putenv (const cmt_string& name_value) 1226 { 1227 int status = ::putenv ((char*) name_value.c_str ()); 1228 1229 if (status == 0) return (true); 1230 else return (false); 1222 /** 1223 Implementation based on a local static map of used environment 1224 variables to ensure a stable character string. The OS requires 1225 that the character string sent via a putenv is kept untouched forever 1226 */ 1227 bool CmtSystem::putenv (const cmt_string& name, const cmt_string& value) 1228 { 1229 static cmt_map <cmt_string, cmt_string> envs; 1230 1231 if (!envs.has (name)) 1232 { 1233 cmt_string& v = *(new cmt_string); 1234 v = name; 1235 v += "="; 1236 v += value; 1237 envs.add (name, v); 1238 } 1239 else 1240 { 1241 cmt_string& v = *(envs.find (name)); 1242 v = name; 1243 v += "="; 1244 v += value; 1245 } 1246 1247 { 1248 const cmt_string& v = *envs.find (name); 1249 //cerr << "#CmtSystem::putenv> name=" << name << " &v=" << &v << endl; 1250 1251 int status = ::putenv ((char*) v.c_str ()); 1252 1253 if (status == 0) return (true); 1254 else return (false); 1255 } 1256 1231 1257 } 1232 1258 … … 1296 1322 } 1297 1323 1298 cerr << "adding npath=[" << npath << "]" << endl;1324 //cerr << "adding npath=[" << npath << "]" << endl; 1299 1325 1300 1326 if (npath != "") 1301 1327 { 1302 if (!CmtSystem::test_directory (npath))1303 {1304 cerr << "#CMT> Warning: path " << npath << " doesn't exist" << endl;1305 CmtError::set (CmtError::path_not_found, npath);1306 return;1307 }1308 1309 1328 cmt_string project_name; 1310 1329 -
CMT/HEAD/source/cmt_system.h
r18 r144 110 110 static bool testenv (const cmt_string& name); 111 111 static cmt_string getenv (const cmt_string& name); 112 static bool putenv (const cmt_string& name _value);112 static bool putenv (const cmt_string& name, const cmt_string& value); 113 113 static void get_cmt_paths (IProjectFactory& factory, 114 114 const cmt_string& init_text,
Note: See TracChangeset
for help on using the changeset viewer.