Changeset 664 for CMT/v1r25-branch
- Timestamp:
- Jan 13, 2014, 4:09:37 PM (10 years ago)
- Location:
- CMT/v1r25-branch
- Files:
-
- 83 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
CMT/v1r25-branch
-
CMT/v1r25-branch/ChangeLog
- Property svn:mergeinfo changed
/CMT/HEAD/ChangeLog merged: 647-663
r646 r664 1 2014-01-10 <rybkin@lal.in2p3.fr> 522 2 3 * source/cmt_tag.cxx: Update authorship info 4 * source/cmt_std.h: idem 5 * source/cmt_awk.cxx: idem 6 * source/cmt_system.cxx: idem 7 * source/cmt_symbol.h: idem 8 * source/cmt_project.h: idem 9 * source/cmt_use.cxx: idem 10 * source/cmt_install_area.cxx: idem 11 * source/cmt_tag.h: idem 12 * source/cmt_deps_builder.cxx: idem 13 * source/cmt_fragment.cxx: idem 14 * source/cmt_generators.cxx: idem 15 * source/cmt_constituent.cxx: idem 16 * source/cmt.cxx: idem 17 * source/cmt_deps_builder.h: idem 18 * source/cmt_syntax.cxx: idem 19 * source/cmt_triggers.cxx: idem 20 * source/cmt_fragment.h: idem 21 * source/cmt_database.h: idem 22 * source/cmt_error.cxx: idem 23 * source/cmt_generators.h: idem 24 * source/cmt_model.cxx: idem 25 * source/cmt_commands.cxx: idem 26 * source/cmt_constituent.h: idem 27 * source/cmt_project.cxx: idem 28 * source/cmt_generator.h: idem 29 * source/cmt_pattern.cxx: idem 30 * source/cmt_error.h: idem 31 * source/cmt_regexp.h: idem 32 * source/cmt_parser.h: idem 33 * source/cmt_language.cxx: idem 34 * source/cmt_commands.h: idem 35 * source/cmt_lock.cxx: idem 36 * source/cmt_string.h: idem 37 * source/cmt_vcs.cxx: idem 38 * source/cmt_cmtpath_pattern.cxx: idem 39 * source/cmt_map.h: idem 40 * source/cmt_database.cxx: idem 41 * source/cmt_log.h: idem 42 * source/cmt_language.h: idem 43 * source/cmt_system.h: idem 44 * source/cmt_vcs.h: idem 45 * source/cmt_use.h: idem 46 * source/cmt_cmtpath_pattern.h: idem 47 * source/cmt_generator.cxx: idem 48 * source/cmt_regexp.cxx: idem 49 * source/cmt_cvs.cxx: idem 50 * source/cmt_parser.cxx: idem 51 * source/cmt_symbol.cxx: idem 52 * source/cmt.h: idem 53 * source/cmt_string.cxx: idem 54 * mgr/fragments/nmake/packages_header: idem 55 * mgr/fragments/packages_header: idem 56 * src/NMakefile.core: idem 57 * src/NMakefile.header: idem 58 * src/setup.tcsh: idem 59 * src/setup.zsh: idem 60 * src/Makefile.core: idem 61 * src/Makefile.header: idem 62 63 2014-01-06 <rybkin@lal.in2p3.fr> 521 64 65 * source/cmt_tag.h: In class Tag, introduce static function apply_tag to 66 return map of tags and uses in which apply_tag statement appears for tag 67 * source/cmt_tag.cxx: In class Tag, in function action_apply update map of 68 tags and uses returned by function apply_tag, in function check_tag_used 69 return true if tag appears in apply_tag statement, in function 70 show_definition print uses in which apply_tag statement appears for tag 71 * source/cmt_map.h: In templated class cmt_vnode, remove const modifiers 72 for function find to allow for cmt_vnode value to be modified, in templated 73 class cmt_vmap, in function find remove const modifier for return value 74 to allow for cmt_vmap values to be modified 75 * source/cmt_parser.cxx: Implement helper function parse_cmt_flags to parse 76 -with(out)_cmt, -with(out)_projects, -(no)_strip_path flags from 77 requirements file, in class Cmt, modify function configure_current_package 78 to return location of requirements file if found, in function configure 79 make use of function parse_cmt_flags, do not read user requirements file(s) 80 for action_none 81 * source/cmt_symbol.cxx: In class PathBuilder, introduce static function 82 get_path_builder to return unique class instance, make assignment operator 83 and copy constructor private to forbid copying, make other constructors 84 private, in class Symbol functions create and set_strip_path make use of 85 function get_path_builder 86 * source/cmt.h: In class Cmt, modify function configure_current_package 87 signature 88 * mgr/requirements: Associate CMTv1 tag with with HEAD 89 90 2013-12-13 <rybkin@lal.in2p3.fr> 520 91 92 * mgr/CMT.dtd: Correct CMT site URL 93 94 2013-12-13 <rybkin@lal.in2p3.fr> 519 95 96 * source/cmt_symbol.cxx: In class Symbol function action, fully resolve 97 setup, cleanup script path except for setup, cleanup shell script 98 generation, in function print_clean, use unalias command to remove alias 99 with Bourne syntax shell, in function print, fully resolve set value, do 100 not mangle set, path name in Xml mode 101 * source/cmt_parser.cxx: In class Cmt function print_context, do not mangle 102 use prefix in Xml mode 103 104 2013-12-11 <rybkin@lal.in2p3.fr> 518 105 106 * source/cmt_commands.cxx: In class ArgParser, functions 107 option(_no)_path_strip renamed option(_no)_strip_path, command line options 108 -(no_)path_strip renamed -(no_)strip_path 109 * source/cmt_commands.h: idem 110 * source/cmt_symbol.h: In class class Symbol, function set_path_strip 111 renamed set_strip_path 112 * source/cmt_symbol.cxx: In class PathBuilder, functions get/set_path_strip 113 renamed get/set_strip_path, member m_path_strip renamed m_strip_path 114 * source/cmt.h: In class CmtContext, member m_path_strip renamed 115 m_strip_path, in class Cmt, function get_path_strip renamed get_strip_path 116 * source/cmt_parser.cxx: In class Cmt function do_setup, use 117 -no_strip_path, -strip_path option names, function get_strip_path, class 118 Symbol function set_strip_path 119 120 2013-12-06 <rybkin@lal.in2p3.fr> 517 121 122 * source/cmt_deps_builder.cxx: In helper function in_line_action, fix 123 parsing in case neither quotes or comments are found 124 125 2013-12-05 <rybkin@lal.in2p3.fr> 516 126 127 * source/cmt_deps_builder.cxx: In helper function at_start_action, fix 128 parsing Fortran INCLUDE statement, optimise in_line_action helper function, 129 in helper function build_deps_text, fix parsing C++ style comments in case 130 without other characters 131 * source/cmt_parser.cxx: In class Cmt function do_broadcast, add package, 132 version, offset info to printout of "cmt broadcast" command, similar to 133 printout in CMTBCAST mode 134 135 2013-12-03 <rybkin@lal.in2p3.fr> 515 136 137 * source/cmt_symbol.h: In class SymbolValueList function print, class 138 Symbol functions all_print, print introduce optional argument of type 139 ostream reference, in class Symbol, declare static functions std_env_vars, 140 set_path_strip 141 * source/cmt_symbol.cxx: In class PathBuilder, introduce and implement 142 functions filter_path_value, get/set_path_strip, constructor with 143 path_strip argument and member m_path_strip to indicate whether to strip 144 paths of non-existent directories, in unnamed namespace, introduce cache 145 of command outputs for use in functions resolve_value, 146 resolve_value_for_macros, suppress_OS_delimiters, in class Symbol function 147 create, create PathBuilder instance with configured value of path_strip, 148 in class Symbol, implement static functions std_env_vars, set_path_strip, 149 control access to environment in functions resolve_value, class Symbol 150 functions all_set, get_env_value, class SetBuilder function build, class 151 PathBuilder function build, systematically use class PathBuilder function 152 filter_path_value in class Symbol functions all_set, check_all_paths, 153 print, in class PathBuilder function build, in class SymbolValueList 154 function print, modify helper function find_path_entry so as not to access 155 file system and return index of entry found, in class PathBuilder function 156 build, make use of signature to enhance implementation of path_append / 157 prepend commands, drop redundant cleaning of repeating path separators, in 158 class SymbolValueList function print, implement enhanced cached 159 requirements file generation, i.e., resolve sets for macros if possible, 160 resolve paths fully if possible, so as to strip path of non-existent 161 directories, implement use of argument of type ostream reference 162 * source/cmt_use.cxx: In class Use function fill_standard_macros, generate 163 CONFIG macros, if CONFIG environment variables are relevant, in setup 164 Requirements mode 165 * source/cmt_error.cxx: Cosmetic modifications to error messages 166 * source/cmt_commands.h: In class ArgParser, declare functions 167 option_with(out)_projects, option(_no)_path_strip 168 * source/cmt_commands.cxx: In class ArgParser, implement introduced 169 functions 170 * source/cmt.h: In class CmtContext, introduce member m_use_projects to 171 indicate whether to parse project files, member m_env_access to indicate 172 whether symbols values can be taken from environment, member m_print_mode 173 to hold corresponding value from class ArgParser instance, member 174 m_path_strip to indicate whether to strip paths of non-existent 175 directories, in class Cmt functions print, print_context introduce optional 176 argument of type ostream reference, declare and implement inline functions 177 get/set_env_access, get/set_print_mode, get_path_strip 178 * source/cmt_parser.cxx: In class Cmt function configure_cmt_path, do not 179 create projects if m_use_projects is false, in function do_broadcast, set 180 cmtpath for all uses so as to fill in templates correctly, in function 181 do_check_configuration, do not run class Symbol function check_all_paths 182 for setup unless in Requirements mode (since paths checks are done in class 183 Symbol function print), in function do_setup, implement procedure of cached 184 requirements file generation, i.e., do not access environment to set 185 symbols values and, by default, strip paths of non-existent directories if 186 possible, in function guess_current_project, return if projects are not 187 used, do not change m_autoconfigure_cmtpath value, in functions print, 188 print_context, implement use of argument of type ostream reference, in 189 function print_context, in Requirements mode, generate CONFIG sets if 190 CONFIG environment variables are relevant, in function 191 use_special_requirements, handle case when projects are not used 192 * mgr/requirements: Associate CMTr25 tag with HEAD, append CMT to PATH as 193 in CMT setup scripts 194 195 2013-11-13 <rybkin@lal.in2p3.fr> 514 196 197 * source/cmt_use.cxx: In class Use get_strategy function, make use of now 198 fast get_project function rather than compute, in fill_standard_macros, 199 get_package_name, get_project functions, simplify code 200 * source/cmt_parser.cxx: In class Cmt install_scripts functions, make 201 generated setup and cleanup scrips call CMT executable directly rather than 202 via shell script wrapper 203 * src/setup.sh: Reduce usage of external shell utilities by using POSIX 204 shell features instead 205 * src/cleanup.sh: idem, unset everything set by setup.sh 206 * src/setup.csh: Reduce usage of external shell utilities by using C shell 207 features instead 208 * src/cleanup.csh: idem, unset everything set by setup.csh 209 * src/cleanup.tcsh: Add script to unset TCSH specific environment setup 210 * src/cleanup.zsh: Add script to unset Z shell specific environment setup 211 * src/cleanup.bash: Add script to unset BASH specific environment setup 212 213 2013-11-08 <rybkin@lal.in2p3.fr> 513 214 215 * source/cmt.h: In class CmtContext, make assignment operator and copy 216 constructor private to forbid copying, in class Cmt, inline simple member 217 functions for speed-up, add static member to hold reference to CmtContext 218 instance 219 * source/cmt_parser.cxx: Initialize static class Cmt member, comment out 220 inlined class Cmt methods implementation 221 222 2013-11-07 <rybkin@lal.in2p3.fr> 512 223 224 * source/cmt_tag.cxx: In class Tag mark function, do not activate tag if 225 in list of tags to remove, making -tag_remove=<tag-list> option functional 226 on any tags (rather than only those specified on the command line or in 227 CMTEXTRATAGS environment variable) 228 * source/cmt_syntax.cxx: In classes KwdBuildStrategy, KwdSetupStrategy, 229 KwdStructureStrategy action project function, make error description 230 detailed, in class SyntaxParser do_parse_words project function, print 231 error message in case of syntax error encountered in value 232 * source/cmt_parser.cxx: In class CmtContext, factor out processing of 233 CMTEXTRATAGS environment variable value into separate initialize function, 234 in class Cmt, move restore_all_tags call into configure function before all 235 system tags handling to make all initially known tags available while 236 reading project files, implement get_tags_remove function, in parser 237 function initialise static CmtContext instance at very beginning 238 * source/cmt.h: In class Cmt, declare get_tags_remove function 239 240 2013-11-05 <rybkin@lal.in2p3.fr> 511 241 242 * source/cmt_project.h: In class Project, change fill_selection function 243 signature to return projects (pointers), introduce function fill_exclusion 244 * source/cmt_project.cxx: In class ProjectFactory create_project function, 245 use change_path function on project use object, in class Project implement 246 fill_selection function for enhanced handling of special CMTHOME, 247 CMTUSERCONTEXT projects (selected if current project only) and special 248 depth values (0: CMTUSERCONTEXT project only, -1: CMTHOME project only), 249 implement fill_exclusion function to exclude special CMTHOME, 250 CMTUSERCONTEXT projects unless current project, in find_in_cmt_paths 251 function fix search condition and comment out never used code, in 252 container_action function issue warning or set error if container package 253 cannot be located 254 * source/cmt_use.h: In class Use, add member to hold project (pointer) 255 package found in, add optional argument project (pointer) to change_path, 256 select_alternate functions, add set_project function, inline located 257 function, make m_located member private 258 * source/cmt_use.cxx: In class Use, assign use project in function 259 change_path, in class UseProjectAction run and class Use select_alternate 260 functions, in particular, in functions get_cmtpath_and_offset, 261 fill_standard_macros, get_project make use of added class member (project) 262 for optimisation 263 * source/cmt_generators.h: In class PackagesMakefileGenerator, add member 264 m_ISINCLUDED 265 * source/cmt_generators.cxx: In class PackagesMakefileGenerator 266 constructor, reset function handle added member m_ISINCLUDED, in build 267 function make use of class Project fill_exclusion function and added 268 member to ensure packages from special CMTHOME, CMTUSERCONTEXT projects 269 are only visited, if in current project 270 * source/cmt_syntax.cxx: In class KwdBuildStrategy, KwdSetupStrategy, 271 KwdStructureStrategy action functions use class Use get_project function 272 for optimisation 273 * source/cmt_commands.cxx: In class ArgParser option_disable_warnings, 274 option_quiet, option_warnings functions, do not set CmtMessage level, add 275 option value to CMTFLAGS, in option_use, option_pack, option_version, 276 option_path functions only record option value, in option_tag, 277 option_tag_add, option_tag_remove functions, only record option values, in 278 option_with_version_directory, option_without_version_directory functions 279 do not change strategy, add option value to CMTFLAGS, in class CommandHelp 280 show_all function, add message for -home, -user_context options 281 * source/cmt_pattern.cxx: In class Pattern expand function, use class Use 282 get_project function for optimisation 283 * source/cmt_parser.cxx: In class CmtContext constructor, process 284 CMTEXTRATAGS environment variable value, in clear function, reset all 285 members, in class Cmt configure function, attempt to locate current use 286 or package if at least name is available from command line options before 287 configure_current_package for optimisation, in configure_current_cmtpath 288 function make use of class Use get_cmtpath_and_offset function, 289 return from configure_current_package if current use is located, in 290 configure_current_structuring_style function, do not parse command line 291 arguments, make use of value from command line or parse CMTFLAGS to set 292 strategy accordingly, in configure_home, configure_user_context functions, 293 use value from command line if any, in restore_all_tags function, add tags 294 from CmtContext m_extra_tags, m_tags, m_tags_add vectors, in 295 configure_cmt_message function do not parse command line arguments, parse 296 CMTFLAGS, in do_broadcast function, set error if depth option value cannot 297 be parsed or is out of range (< -1), make use of class Project 298 fill_selection, fill_exclusion functions to implement enhanced handling of 299 special CMTHOME, CMTUSERCONTEXT projects packages (visited if in current 300 project only) and and special depth values (0: CMTUSERCONTEXT project 301 packages only, -1: CMTHOME project packages only), in 302 do_check_configuration function, check tags from CmtContext m_extra_tags, 303 m_tags, m_tags_add vectors, in do_show_clients function do not re-run 304 configure, in guess_current_project function, do not use CmtSystem cd or 305 pwd functions for optimisation, in parse_arguments function do not call 306 restore_all_tags function, in parser function call parse_arguments first 307 and then configure, restore_all_tags to make configuration process cleaner, 308 do not call configure for action_build_temporary_name, in print function do 309 not check tags or change m_extra_tags since that change affects nothing, in 310 use_current_package, use_extra_file functions do not attempt to locate 311 current package if current use located already, factor out 312 Pattern::apply_all_globalsize and Tag::restore_tree calls into separate 313 apply_globals function called after all requirements are read, in 314 use_special_requirements function set special use style, structuring_style, 315 project members if located, otherwise discard, in particular, that means 316 that requirements file in special CMTHOME, CMTUSERCONTEXT projects is not 317 mandatory 318 * source/cmt_symbol.cxx: In class Symbol action function, make 319 constituentsclean symbol private (like constituents) 320 * source/cmt.h: In class CmtContext, add string vector members 321 m_extra_tags, m_tags, m_tags_add, m_tags_remove instead of string 322 m_extra_tags, in class Cmt, function reach_current_package renamed 323 use_current_package, introduce apply_globals function 324 * mgr/fragments/nmake/package: Ensure that not included packages are 325 not visited 326 * mgr/fragments/package: idem 327 * src/Makefile.header: Update help messages for BCAST mode in presence of 328 special CMTHOME, CMTUSERCONTEXT packages/projects 329 330 2013-10-04 <rybkin@lal.in2p3.fr> 510 331 332 * mgr/cmt-make-time-sub-mem-io.awk: Add script to profile CMT commands 333 utilisation in the Makefiles 334 335 2013-07-31 <rybkin@lal.in2p3.fr> 509 336 337 * mgr/cmt_svn_checkout.py: Add support for devbranches directory - 338 additional branches location - in Subversion repository. 339 340 2013-07-10 <rybkin@lal.in2p3.fr> 508 341 342 * source/cmt_commands.cxx: In class ArgParser function option_use, make 343 -use=<package>:<version>:<path> option fully functional with standard use 344 statement syntax, in function option_path, make -path=<path> option 345 functional for relative <path> as with standard use statement syntax 346 * source/cmt_parser.cxx: In class Cmt functions reach_current_package, 347 use_extra_file make diagnostic message more informative 348 349 2013-07-09 <rybkin@lal.in2p3.fr> 507 350 351 * mgr/cmt_svn_checkout.py: Use a different algorithm in the class Checkout 352 function trunk_tag in order to optimise the performance, suggested by 353 Wim Lavrijsen. Add --debug command line option and SVNDEBUG environment 354 variable to facilitate debugging 355 356 2013-06-25 <rybkin@lal.in2p3.fr> 506 357 358 * mgr/fragments/application: Test use_stamps variable for a non-empty value 359 since POSIX requires a non-null list of targets in rules 360 1 361 2013-06-24 <rybkin@lal.in2p3.fr> 505 2 362 - Property svn:mergeinfo changed
-
CMT/v1r25-branch/mgr/CMT.dtd
r550 r664 1 <!ENTITY % cmtns "xmlns CDATA #FIXED 'http://www.cmtsite. org/cmt'">1 <!ENTITY % cmtns "xmlns CDATA #FIXED 'http://www.cmtsite.net/cmt'"> 2 2 <!ATTLIST setup %cmtns;> 3 3 <!ATTLIST projects %cmtns;> -
CMT/v1r25-branch/mgr/cmt_dcc_version.sh
- Property svn:mergeinfo changed (with no actual effect on merging)
-
CMT/v1r25-branch/mgr/cmt_svn_checkout.py
r605 r664 15 15 --with_version_directory create version directory upon PATH checkout (default) 16 16 --url=URL checkout PATH from repository URL 17 --debug print lots of debugging information 17 18 -h, --help display this help and exit 18 19 --version output version information and exit 19 20 20 The SVNROOT, SVNTRUNK, SVNTAGS, and SVNBRANCHES environment variables specify repository URL of PATH, location of PATH trunk, tags, and branches(relatively to PATH) respectively.21 The SVNROOT, SVNTRUNK, SVNTAGS, and SVNBRANCHES (also SVNDEVBRANCHES) environment variables specify repository URL of PATH, location of PATH trunk, tags, and branches (also devbranches) (relatively to PATH) respectively. 21 22 22 23 Report bugs to <CMT-L@IN2P3.FR>. 23 24 """ 24 25 25 __version__ = '0. 6.0'26 __date__ = ' Fri Mar 09 2012'26 __version__ = '0.8.0' 27 __date__ = 'Wed Jul 31 2013' 27 28 __author__ = 'Grigory Rybkin' 28 29 … … 40 41 import tempfile 41 42 import re 43 44 import logging 42 45 43 46 self = 'cmt_svn_checkout.py' … … 298 301 tags = None, 299 302 branches = None, 303 devbranches = None, 300 304 version = None, 301 305 version_dir = None, … … 307 311 self.tags = tags 308 312 self.branches = branches 313 self.devbranches = devbranches 309 314 self.version = version 310 315 self.version_dir = version_dir … … 327 332 if self.branches is None: 328 333 self.branches = os.getenv('SVNBRANCHES', 'branches') 334 if self.devbranches is None: 335 self.devbranches = os.getenv('SVNDEVBRANCHES', 'devbranches') 329 336 330 337 def cmtRepos(self): … … 333 340 self.tags= '.' 334 341 self.branches = '.' 342 self.devbranches = '.' 335 343 336 344 def add(self, module): … … 378 386 """Attempt to determine the tag of the module's trunk. 379 387 380 Return the tag if its contents are the same as those of the trunk,and381 its last_changed_rev is greater than the trunk created_rev, None otherwise.388 Return the tag if its files are copied from the trunk and 389 their last_changed_rev numbers are the same as those of the trunk files. 382 390 """ 383 391 trunk = posixpath.join(module.url, self.trunk) 384 392 # trunk = posixpath.normpath(posixpath.join(module.url, self.trunk)) 393 cmd = 'svn ls -vR %s' % trunk 394 sc, out = Utils.getstatusoutput(cmd) 395 logger.debug('%s\n%s' % (cmd, out)) 396 if sc != 0: 397 return None 398 trunk_dirent = [line.split() for line in out.splitlines()] 399 trunk_revs = dict([(line[-1], int(line[0])) for line in trunk_dirent if not line[-1].endswith(posixpath.sep)]) 400 logger.debug('%s' % trunk_revs) 401 402 curdir = posixpath.curdir + posixpath.sep 403 for line in trunk_dirent: 404 if line[-1] == curdir: 405 class info(object): pass 406 info.last_changed_rev = int(line[0]) 407 self.info_receiver(trunk, info, module) 408 logger.debug('last_changed_rev: %d' % info.last_changed_rev) 409 break 410 411 # cmd = 'svn info %s' % trunk 412 # p = r'last\s+changed\s+rev:\s+(?P<rev>\d+)' 413 # m = re.search(p, out, re.I) 414 # if m: 415 # class info(object): pass 416 # info.last_changed_rev = int(m.group('rev')) 417 # self.info_receiver(trunk, info, module) 418 # # self.info_receiver(trunk, info, None) 419 # # print >>sys.stderr, '%s: last_changed_rev %i' % \ 420 # # (trunk, self.info.last_changed_rev) 421 # # last_changed_rev = int(m.group('rev')) 422 # else: 423 # return None 424 425 tags = posixpath.join(module.url, self.tags) 426 # tags = posixpath.normpath(posixpath.join(module.url, self.tags)) 427 cmd = 'svn ls -vR %s' % tags 428 # cmd = 'svn ls -v %s' % tags 429 sc, out = Utils.getstatusoutput(cmd) 430 logger.debug('%s\n%s' % (cmd, out)) 431 if sc != 0: 432 return None 433 tags_dirent = [line.split() for line in out.splitlines()] 434 tags_revs = dict() 435 for ent in tags_dirent: 436 try: 437 tag, path = ent[-1].split(posixpath.sep, 1) 438 except ValueError: 439 continue 440 if tag not in tags_revs: 441 tags_revs[tag] = dict() 442 if path and not path.endswith(posixpath.sep): 443 # assume there are no empty directories in the tag 444 tags_revs[tag][path] = int(ent[0]) 445 logger.debug('%s' % tags_revs) 446 385 447 cmd = 'svn info %s' % trunk 386 448 sc, out = Utils.getstatusoutput(cmd) 449 logger.debug('%s\n%s' % (cmd, out)) 387 450 if sc != 0: 388 451 return None 389 p = r'last\s+changed\s+rev:\s+(?P<rev>\d+)' 452 p = r'repository\s+root:\s+(?P<root>%s://\S+)' % \ 453 ('(?:' + '|'.join(map(re.escape, client_context.schemes)) + ')') 390 454 m = re.search(p, out, re.I) 455 logger.debug('pattern: %r' % (p)) 391 456 if m: 392 class info(object): pass 393 info.last_changed_rev = int(m.group('rev')) 394 self.info_receiver(trunk, info, module) 395 # self.info_receiver(trunk, info, None) 396 # print >>sys.stderr, '%s: last_changed_rev %i' % \ 397 # (trunk, self.info.last_changed_rev) 398 # last_changed_rev = int(m.group('rev')) 457 root = m.group('root') 399 458 else: 400 459 return None 401 402 tags = posixpath.join(module.url, self.tags) 403 # tags = posixpath.normpath(posixpath.join(module.url, self.tags)) 404 cmd = 'svn ls -v %s' % tags 460 logger.debug('root: %s' % root) 461 trunk_path = trunk[len(root):] 462 tags_path = tags[len(root):] 463 logger.debug('trunk_path: %s' % trunk_path) 464 logger.debug('tags_path: %s' % tags_path) 465 offset = len(trunk) - len(root) + len(posixpath.sep) 466 467 # Usually, a tag is created as a server-side copy. 468 # Sometimes, a tag is created as a copy of WC (working copy) 469 # after commit. 470 # Below, we try to take into account the latter case. 471 cmd = 'svn log -v -q %s' % tags 405 472 sc, out = Utils.getstatusoutput(cmd) 473 logger.debug('%s\n%s' % (cmd, out)) 406 474 if sc != 0: 407 475 return None 408 409 tags_dirent = [line.split() for line in out.splitlines()] 410 rev_tag = dict([(int(line[0]), line[-1].rstrip(posixpath.sep)) for line in tags_dirent if line[-1].endswith(posixpath.sep)]) 411 revs = rev_tag.keys() 412 revs.sort() 413 revs.reverse() 414 415 for rev in revs: 416 if rev < self.info.last_changed_rev: break 417 # if rev < last_changed_rev: break 418 tag = posixpath.join(tags, rev_tag[rev]) 419 # tag = posixpath.normpath(posixpath.join(tags, rev_tag[rev])) 420 if 0 == self.cmp(trunk, tag, client_context): 421 return rev_tag[rev] 476 p = re.compile( 477 r'^-{5,}$\s^r\d+.+$\s^Changed paths:$\s^\s+A\s+%s%s(?P<tag>[^%s]+)\s+\(from %s:\d+\)$(?P<replaced>(?:\s^\s+(?:R|A|D)\s+%s%s(?P=tag)%s(?P<path>.+)(?:\s+\(from %s%s(?P=path):\d+\))?$)*)' % (re.escape(tags_path), posixpath.sep, posixpath.sep, re.escape(trunk_path), re.escape(tags_path), posixpath.sep, posixpath.sep, re.escape(trunk_path), posixpath.sep) 478 , re.M 479 ) 480 tags_copied = list() 481 tags_replaced_revs = dict() 482 for m in p.finditer(out): 483 logger.debug('tag: %s replaced: %r' % (m.group('tag'), m.group('replaced'))) 484 tags_copied.append(m.group('tag')) 485 for line in m.group('replaced').strip().splitlines(): 486 l = line.split() 487 if len(l) == 2: continue # action code D - deleted paths 488 repl = l[3].rstrip(')') 489 i = repl.rindex(':') 490 path = repl[offset:i] 491 rev = int(repl[i + 1:]) 492 logger.debug('path: %s rev: %d' % (path, rev)) 493 494 if m.group('tag') not in tags_replaced_revs: 495 tags_replaced_revs[m.group('tag')] = dict() 496 if path and not path.endswith(posixpath.sep): 497 # assume there are no empty directories in the tag 498 tags_replaced_revs[m.group('tag')][path] = rev 499 500 logger.debug('copied: %s' % tags_copied) 501 logger.debug('replaced: %s' % tags_replaced_revs) 502 503 for t in tags_revs.keys(): 504 if t not in tags_copied: 505 del tags_revs[t] 506 logger.debug('%s: Not a trunk copy' % t) 507 508 for t in tags_replaced_revs: 509 if t in tags_revs: 510 tags_revs[t].update(tags_replaced_revs[t]) 511 512 for tag in tags_revs: 513 logger.debug('Compare: %s -> %s' % (tag, tags_revs[tag])) 514 if trunk_revs == tags_revs[tag]: 515 return tag 422 516 423 517 return None 518 519 # tags_dirent = [line.split() for line in out.splitlines()] 520 # rev_tag = dict([(int(line[0]), line[-1].rstrip(posixpath.sep)) for line in tags_dirent if line[-1].endswith(posixpath.sep)]) 521 # revs = rev_tag.keys() 522 # revs.sort() 523 # revs.reverse() 524 525 # for rev in revs: 526 # logger.debug('rev: %s' % rev) 527 # if rev < self.info.last_changed_rev: break 528 # # if rev < last_changed_rev: break 529 # tag = posixpath.join(tags, rev_tag[rev]) 530 # # tag = posixpath.normpath(posixpath.join(tags, rev_tag[rev])) 531 # logger.debug('comparing: %s %s(%d)' % (trunk, tag, rev)) 532 # if 0 == self.cmp(trunk, tag, client_context): 533 # return rev_tag[rev] 534 535 # return None 424 536 425 537 # try: … … 496 608 else: 497 609 m.URL = [posixpath.join(m.url, p, m.version) 498 for p in (self.tags, self.branches )]610 for p in (self.tags, self.branches, self.devbranches)] 499 611 m.URL = [client_context.svn_path_canonicalize(url) for url in m.URL] 500 612 # m.URL = [core.svn_path_canonicalize(url) for url in m.URL] … … 572 684 "offset=", "no_config", 573 685 "with_version_directory", 574 "without_version_directory", "url=" ])686 "without_version_directory", "url=", "debug"]) 575 687 except getopt.error, e: 576 688 print >>sys.stderr, '%s: %s' % (self, str(e)) 577 689 print >>sys.stderr, "Try '%s --help' for more information." % self 578 690 return 1 691 692 global logger 693 logging.basicConfig() 694 logger = logging.getLogger(self) 695 logger.setLevel(logging.INFO) 696 if os.getenv('SVNDEBUG'): 697 logger.setLevel(logging.DEBUG) 579 698 580 699 cmt_context = CmtContext() … … 605 724 elif o in ("--url",): 606 725 checkout.url = v 726 elif o in ("--debug",): 727 logger.setLevel(logging.DEBUG) 607 728 608 729 if not args: -
CMT/v1r25-branch/mgr/fragments/application
r646 r664 5 5 $(link_silent) ${LINKMACRO} -o $(@).new ${OBJS} $(cmt_installarea_linkopts) $(${CONSTITUENT}_use_linkopts) $(${CONSTITUENT}linkopts) && mv -f $(@).new $(@) 6 6 7 if def use_stamps7 ifneq ($(strip $(use_stamps)),) 8 8 # Work around Make errors if stamps files do not exist 9 9 $(use_stamps) : -
CMT/v1r25-branch/mgr/fragments/constituent
- Property svn:mergeinfo changed (with no actual effect on merging)
-
CMT/v1r25-branch/mgr/fragments/constituent_lock
- Property svn:mergeinfo changed (with no actual effect on merging)
-
CMT/v1r25-branch/mgr/fragments/jar
- Property svn:mergeinfo changed (with no actual effect on merging)
-
CMT/v1r25-branch/mgr/fragments/java
- Property svn:mergeinfo changed (with no actual effect on merging)
-
CMT/v1r25-branch/mgr/fragments/nmake/check_application
- Property svn:mergeinfo changed (with no actual effect on merging)
-
CMT/v1r25-branch/mgr/fragments/nmake/constituent
- Property svn:mergeinfo changed (with no actual effect on merging)
-
CMT/v1r25-branch/mgr/fragments/nmake/constituent_lock
- Property svn:mergeinfo changed (with no actual effect on merging)
-
CMT/v1r25-branch/mgr/fragments/nmake/jar
- Property svn:mergeinfo changed (with no actual effect on merging)
-
CMT/v1r25-branch/mgr/fragments/nmake/java
- Property svn:mergeinfo changed (with no actual effect on merging)
-
CMT/v1r25-branch/mgr/fragments/nmake/library
- Property svn:mergeinfo changed (with no actual effect on merging)
-
CMT/v1r25-branch/mgr/fragments/nmake/library_no_static
- Property svn:mergeinfo changed (with no actual effect on merging)
-
CMT/v1r25-branch/mgr/fragments/nmake/package
r600 r664 1 1 2 cmt_${PACKAGE}_${ISINCLUDED} = 1 2 3 cmt_${PACKAGE}_${ISLOCAL} = 1 3 4 … … 6 7 7 8 !if "$(LOG_LOCATION)" != "" 9 !if "$(cmt_${PACKAGE}_is_included)" != "" 8 10 !if "$(cmt_${PACKAGE}_is_local)" != "" 9 11 ${PACKAGE}OutErr = >>$(LOG_LOCATION)\$(${PACKAGE}FullName)$(LOG_SUFFIX) 2>&1 … … 11 13 !if "$(BCAST_GLOBAL)" != "" 12 14 ${PACKAGE}OutErr = >>$(LOG_LOCATION)\$(${PACKAGE}FullName)$(LOG_SUFFIX) 2>&1 15 !endif 13 16 !endif 14 17 !endif … … 20 23 ${PACKAGE} : $(${PACKAGE}MgrPath)\NMake 21 24 !endif 25 !if "$(cmt_${PACKAGE}_is_included)" != "" 22 26 !if "$(cmt_${PACKAGE}_is_local)" != "" 23 27 @echo "#--------------------------------------------------------------" \ … … 73 77 !endif 74 78 !endif 79 !else 80 81 !endif 75 82 76 83 $(${PACKAGE}MgrPath)\NMake : 84 !if "$(cmt_${PACKAGE}_is_included)" != "" 77 85 !if "$(cmt_${PACKAGE}_is_local)" != "" 78 86 $(echo) configuring ${PACKAGE} … … 85 93 86 94 !endif 95 !endif 96 !else 97 87 98 !endif 88 99 … … 96 107 97 108 ${PACKAGE}clean : $(${PACKAGE}MgrPath)\NMake 109 !if "$(cmt_${PACKAGE}_is_included)" != "" 98 110 !if "$(cmt_${PACKAGE}_is_local)" != "" 99 111 @echo "#--------------------------------------------------------------" \ … … 125 137 !endif 126 138 !endif 139 !else 140 141 !endif 127 142 128 143 ${PACKAGE}binclean : $(${PACKAGE}MgrPath)\NMake 144 !if "$(cmt_${PACKAGE}_is_included)" != "" 129 145 !if "$(cmt_${PACKAGE}_is_local)" != "" 130 146 @echo "#--------------------------------------------------------------" \ … … 156 172 !endif 157 173 !endif 174 !else 175 176 !endif 158 177 159 178 ${PACKAGE}uninstall : $(${PACKAGE}MgrPath)\NMake 179 !if "$(cmt_${PACKAGE}_is_included)" != "" 160 180 !if "$(cmt_${PACKAGE}_is_local)" != "" 161 181 @echo "#--------------------------------------------------------------" \ … … 187 207 !endif 188 208 !endif 209 !else 210 211 !endif 189 212 190 213 ${PACKAGE}check : $(${PACKAGE}MgrPath)\NMake 214 !if "$(cmt_${PACKAGE}_is_included)" != "" 191 215 !if "$(cmt_${PACKAGE}_is_local)" != "" 192 216 @echo "#--------------------------------------------------------------" \ … … 218 242 !endif 219 243 !endif 244 !else 245 246 !endif 220 247 221 248 ${PACKAGE} ${PACKAGE}clean ${PACKAGE}binclean ${PACKAGE}uninstall ${PACKAGE}check : FORCE -
CMT/v1r25-branch/mgr/fragments/nmake/packages_header
r600 r664 27 27 # ignore: try all the groups even if one fails before going to the next package 28 28 # (may result in duplicated errors within a package) 29 # Unix version taken from https://svnweb.cern.ch/trac/gaudi/browser/Gaudi/trunk/Makefile.cmt (Modified )29 # Unix version taken from https://svnweb.cern.ch/trac/gaudi/browser/Gaudi/trunk/Makefile.cmt (Modified by Grigory Rybkin) 30 30 Package_failure_handler = || exit 31 31 !if "$(PACKAGE_FAILURE_POLICY)" != "" -
CMT/v1r25-branch/mgr/fragments/package
r600 r664 1 1 2 cmt_${PACKAGE}_${ISINCLUDED} = 1 2 3 cmt_${PACKAGE}_${ISLOCAL} = 1 3 4 … … 6 7 7 8 ifdef LOG_LOCATION 9 ifdef cmt_${PACKAGE}_is_included 8 10 ifdef cmt_${PACKAGE}_is_local 9 11 ${PACKAGE}OutErr = >>$(LOG_LOCATION)/$(${PACKAGE}FullName)$(LOG_SUFFIX) 2>&1 … … 11 13 ifdef BCAST_GLOBAL 12 14 ${PACKAGE}OutErr = >>$(LOG_LOCATION)/$(${PACKAGE}FullName)$(LOG_SUFFIX) 2>&1 15 endif 13 16 endif 14 17 endif … … 20 23 ${PACKAGE} : $(${PACKAGE}MgrPath)/Makefile 21 24 endif 25 ifdef cmt_${PACKAGE}_is_included 22 26 ifdef cmt_${PACKAGE}_is_local 23 27 @echo "#--------------------------------------------------------------" \ … … 67 71 endif 68 72 endif 73 else 74 75 endif 69 76 70 77 $(${PACKAGE}MgrPath)/Makefile : 78 ifdef cmt_${PACKAGE}_is_included 71 79 ifdef cmt_${PACKAGE}_is_local 72 80 $(echo) configuring ${PACKAGE} … … 80 88 endif 81 89 endif 90 else 91 92 endif 82 93 83 94 ifndef BCAST_ONLY … … 90 101 91 102 ${PACKAGE}clean ${PACKAGE}binclean ${PACKAGE}uninstall ${PACKAGE}check : $(${PACKAGE}MgrPath)/Makefile 103 ifdef cmt_${PACKAGE}_is_included 92 104 ifdef cmt_${PACKAGE}_is_local 93 105 @echo "#--------------------------------------------------------------" \ … … 119 131 endif 120 132 endif 133 else 134 135 endif 121 136 122 137 ${PACKAGE} ${PACKAGE}clean ${PACKAGE}binclean ${PACKAGE}uninstall ${PACKAGE}check : FORCE -
CMT/v1r25-branch/mgr/fragments/packages_header
r600 r664 42 42 # ignore: try all the groups even if one fails before going to the next package 43 43 # (may result in duplicated errors within a package) 44 # Taken from https://svnweb.cern.ch/trac/gaudi/browser/Gaudi/trunk/Makefile.cmt (Modified )44 # Taken from https://svnweb.cern.ch/trac/gaudi/browser/Gaudi/trunk/Makefile.cmt (Modified by Grigory Rybkin) 45 45 Package_failure_handler = || exit 46 46 ifdef PACKAGE_FAILURE_POLICY -
CMT/v1r25-branch/mgr/requirements
r618 r664 6 6 tag CMTr16 CMTr14 7 7 tag CMTr18 CMTr16 8 tag CMTr0 CMTr18 9 8 tag CMTr0 CMTr25 9 10 tag CMTv0 CMTv1 10 11 # 11 12 # Automatic detection of some system features. … … 125 126 WIN32 "CMT\v" 126 127 127 path_ prependPATH "${CMTROOT}/${CMTBIN}" \128 path_append PATH "${CMTROOT}/${CMTBIN}" \ 128 129 WIN32 "%CMTROOT%\%CMTBIN%" 129 130 -
CMT/v1r25-branch/source/cmt.cxx
r527 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 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt.h
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 //----------------------------------------------------------- … … 24 25 25 26 void clear (); 27 int initialize (); 26 28 27 29 ActionType m_action; … … 34 36 cmt_string m_cmt_version; 35 37 bool m_use_cmt; 38 bool m_use_projects; 36 39 37 40 cmt_string m_current_dir; … … 52 55 cmt_string m_current_version; 53 56 54 cmt_string m_extra_tags; 57 // cmt_string m_extra_tags; 58 CmtSystem::cmt_string_vector m_extra_tags; 59 CmtSystem::cmt_string_vector m_tags; 60 CmtSystem::cmt_string_vector m_tags_add; 61 CmtSystem::cmt_string_vector m_tags_remove; 62 55 63 cmt_string m_configure_error; 56 64 … … 68 76 69 77 bool m_autoconfigure_cmtpath; 78 79 bool m_env_access; 80 PrintMode m_print_mode; 81 bool m_strip_path; 82 83 private: 84 85 CmtContext& operator = (const CmtContext& other); 86 CmtContext (const CmtContext& other); 70 87 }; 71 88 … … 79 96 static void build_vsnet_file (const cmt_string& target); 80 97 81 static bool build_nmake ();98 static inline bool build_nmake (); 82 99 static void build_OS9_makefile (const cmt_string& target); 83 100 static void build_prefix (const cmt_string& package, cmt_string& prefix); … … 90 107 static void configure_current_cmtpath (); 91 108 static void configure_current_dir (); 92 static void configure_current_package (); 109 static cmt_string configure_current_package (); 110 // static void configure_current_package (); 93 111 // static void configure_current_structuring_style (); 94 112 static void configure_current_structuring_style (const ArgParser& ap); … … 212 230 static const cmt_string& filter_dir (const cmt_string& dir); 213 231 214 static ActionType get_action ();215 216 static const cmt_string& get_cmt_home ();217 static const cmt_string& get_cmt_user_context ();218 static const cmt_string& get_cmt_version ();219 static const cmt_string& get_current_dir ();232 static inline ActionType get_action (); 233 234 static inline const cmt_string& get_cmt_home (); 235 static inline const cmt_string& get_cmt_user_context (); 236 static inline const cmt_string& get_cmt_version (); 237 static inline const cmt_string& get_current_dir (); 220 238 static const cmt_string get_current_dir_real (); 221 static const cmt_string& get_current_package ();239 static inline const cmt_string& get_current_package (); 222 240 static const cmt_string& get_current_path (); 223 241 static const cmt_string& get_current_cmtpath (); 224 242 static const cmt_string& get_current_offset (); 225 static AccessMode get_current_access ();226 static CmtStructuringStyle get_current_structuring_style ();227 static CmtDirStyle get_current_style ();243 static inline AccessMode get_current_access (); 244 static inline CmtStructuringStyle get_current_structuring_style (); 245 static inline CmtDirStyle get_current_style (); 228 246 static const cmt_string& get_current_version (); 229 static const cmt_string& get_current_target (); 230 static bool get_debug (); 231 static bool get_disable_warnings (); 232 static bool get_quiet (); 233 static bool get_warnings (); 234 static bool get_recursive (); 247 static inline const cmt_string& get_current_target (); 248 static inline const CmtSystem::cmt_string_vector& get_tags_remove (); 249 static inline bool get_debug (); 250 static inline bool get_disable_warnings (); 251 static inline bool get_quiet (); 252 static inline bool get_warnings (); 253 static inline bool get_recursive (); 235 254 static CmtScopeFilteringMode get_scope_filtering_mode (); 236 static bool get_all_sets_done ();255 static inline bool get_all_sets_done (); 237 256 238 257 static void get_cmt_flags (CmtSystem::cmt_string_vector& flags); … … 259 278 static int parser (const cmt_string& command_line); 260 279 static int parser (int argc, char* argv[]); 261 static void print (PrintMode mode); 280 static void print (PrintMode mode, ostream& out = cout); 281 //static void print (PrintMode mode); 262 282 static void print_clean (PrintMode mode); 263 static void print_context (Use& use, PrintMode mode, const cmt_string& tag); 283 static void print_context (Use& use, PrintMode mode, const cmt_string& tag, ostream& out = cout); 284 //static void print_context (Use& use, PrintMode mode, const cmt_string& tag); 264 285 static void print_macros (PrintMode mode, const cmt_string& pattern = "", 265 286 ostream& out = cout); … … 268 289 static void print_tabs (int tabs); 269 290 static void print_xml_prolog (const cmt_string& root = "cmt", ostream& out = cout); 270 static int reach_current_package (); 291 // static int reach_current_package (); 292 static int use_current_package (); 271 293 static int use_extra_file (const cmt_string& file); 294 static int apply_globals (); 272 295 static void restore_all_tags (Use* use); 273 static void set_current_access (AccessMode mode);274 static void set_recursive (bool mode);275 static void set_scope_filtering_mode (CmtScopeFilteringMode mode);296 static inline void set_current_access (AccessMode mode); 297 static inline void set_recursive (bool mode); 298 static inline void set_scope_filtering_mode (CmtScopeFilteringMode mode); 276 299 static void set_standard_macros (); 277 static void set_all_sets_done ();278 static void reset_all_sets_done ();300 static inline void set_all_sets_done (); 301 static inline void reset_all_sets_done (); 279 302 static void use_cmt (); 280 303 static void use_home_requirements (); … … 287 310 const cmt_string& separator, 288 311 cmt_string& result); 312 313 static inline const bool& get_env_access (); 314 static inline void set_env_access (const bool& access); 315 static inline const PrintMode& get_print_mode (); 316 static inline void set_print_mode (const PrintMode& mode); 317 static inline const bool& get_strip_path (); 318 319 private: 320 static CmtContext& m_cmt_context; 321 // static CmtContext * m_cmt_context; 289 322 }; 290 323 324 //---------------------------------------------------------- 325 inline bool Cmt::build_nmake () 326 { 327 return (m_cmt_context.m_build_nmake); 328 } 329 330 inline ActionType Cmt::get_action () 331 { 332 return (m_cmt_context.m_action); 333 } 334 335 inline const cmt_string& Cmt::get_cmt_home () 336 { 337 return (m_cmt_context.m_cmt_home); 338 } 339 340 inline const cmt_string& Cmt::get_cmt_user_context () 341 { 342 return (m_cmt_context.m_cmt_user_context); 343 } 344 345 inline const cmt_string& Cmt::get_cmt_version () 346 { 347 return (m_cmt_context.m_cmt_version); 348 } 349 350 inline const cmt_string& Cmt::get_current_dir () 351 { 352 return (m_cmt_context.m_current_dir); 353 } 354 355 inline const cmt_string& Cmt::get_current_package () 356 { 357 return (m_cmt_context.m_current_package); 358 } 359 360 inline AccessMode Cmt::get_current_access () 361 { 362 return (m_cmt_context.m_current_access); 363 } 364 365 inline CmtStructuringStyle Cmt::get_current_structuring_style () 366 { 367 return (m_cmt_context.m_current_structuring_style); 368 } 369 370 inline CmtDirStyle Cmt::get_current_style () 371 { 372 return (m_cmt_context.m_current_style); 373 } 374 375 inline const cmt_string& Cmt::get_current_target () 376 { 377 return (m_cmt_context.m_current_target); 378 } 379 380 inline const CmtSystem::cmt_string_vector& Cmt::get_tags_remove () 381 { 382 return m_cmt_context.m_tags_remove; 383 } 384 385 inline bool Cmt::get_debug () 386 { 387 return (m_cmt_context.m_debug); 388 } 389 390 inline bool Cmt::get_quiet () 391 { 392 return (m_cmt_context.m_quiet); 393 } 394 395 inline bool Cmt::get_disable_warnings () 396 { 397 return (m_cmt_context.m_disable_warnings); 398 } 399 400 inline bool Cmt::get_warnings () 401 { 402 return (m_cmt_context.m_warnings); 403 } 404 405 inline bool Cmt::get_recursive () 406 { 407 return (m_cmt_context.m_recursive); 408 } 409 410 inline bool Cmt::get_all_sets_done () 411 { 412 return (m_cmt_context.m_all_sets_done); 413 } 414 415 inline void Cmt::set_current_access (AccessMode mode) 416 { 417 m_cmt_context.m_current_access = mode; 418 } 419 420 //---------------------------------------------------------- 421 inline void Cmt::set_recursive (bool mode) 422 { 423 m_cmt_context.m_recursive = mode; 424 } 425 426 //---------------------------------------------------------- 427 inline void Cmt::set_scope_filtering_mode (CmtScopeFilteringMode mode) 428 { 429 m_cmt_context.m_scope_filtering_mode = mode; 430 } 431 432 inline void Cmt::set_all_sets_done () 433 { 434 m_cmt_context.m_all_sets_done = true; 435 } 436 437 inline void Cmt::reset_all_sets_done () 438 { 439 m_cmt_context.m_all_sets_done = false; 440 } 441 442 inline const bool& Cmt::get_env_access () 443 { 444 return m_cmt_context.m_env_access; 445 } 446 447 inline void Cmt::set_env_access (const bool& access) 448 { 449 m_cmt_context.m_env_access = access; 450 } 451 452 inline const PrintMode& Cmt::get_print_mode () 453 { 454 return m_cmt_context.m_print_mode; 455 } 456 457 inline void Cmt::set_print_mode (const PrintMode& mode) 458 { 459 m_cmt_context.m_print_mode = mode; 460 } 461 462 inline const bool& Cmt::get_strip_path () 463 { 464 return m_cmt_context.m_strip_path; 465 } 466 //---------------------------------------------------------- 467 291 468 #endif -
CMT/v1r25-branch/source/cmt_awk.cxx
r607 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_cmtpath_pattern.cxx
r588 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_cmtpath_pattern.h
r588 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
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 -
CMT/v1r25-branch/source/cmt_commands.h
r561 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 //----------------------------------------------------------- … … 83 84 void option_with_cmt (); 84 85 void option_without_cmt (); 86 void option_with_projects (); 87 void option_without_projects (); 85 88 void option_with_version_directory (); 86 89 void option_without_version_directory (); 87 90 void option_no_cleanup (); 91 void option_no_strip_path (); 92 void option_strip_path (); 88 93 void option_private (); 89 94 void option_public (); -
CMT/v1r25-branch/source/cmt_constituent.cxx
r637 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 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_constituent.h
r588 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_cvs.cxx
r461 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 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_database.cxx
r535 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_database.h
r535 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_deps_builder.cxx
r606 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- … … 226 227 } 227 228 } 228 else if (!strncmp (ptr, " include", 13)) 229 else if (!strncmp (ptr, "include", 7) || 230 !strncmp (ptr, "INCLUDE", 7)) 231 // else if (!strncmp (ptr, " include", 13)) 229 232 { 230 233 // fortran include statement 231 234 232 ptr += 13; 235 ptr += 7; 236 //ptr += 13; 233 237 234 238 while ((*ptr == ' ') || (*ptr == '\t')) ptr++; … … 239 243 ptr++; 240 244 } 245 else if (*ptr == '(') 246 { 247 term = ')'; 248 ptr++; 249 } 241 250 else 242 251 { … … 245 254 } 246 255 } 256 /* 247 257 else if (!strncmp (ptr, "\tinclude", 8)) 248 258 { … … 264 274 } 265 275 } 276 */ 266 277 else 267 278 { … … 308 319 static char* in_line_action (char* ptr, state_def& state) 309 320 { 310 char* pattern = ptr + strlen (ptr);311 int length = 0;321 // char* pattern = ptr + strlen (ptr);\ 322 // int length = 0; 312 323 313 324 /* … … 318 329 */ 319 330 331 char* beg = ptr; 332 while (char* p = strpbrk (beg, "\"\'/")) 333 if (*p == '"') 334 { 335 if (p == ptr || (p > ptr && *(p - 1) != '\\')) 336 { 337 state = in_string; 338 return p + 1; 339 } 340 else 341 { // '"' is escaped 342 beg = p + 1; 343 } 344 } 345 else if (*p == '\'') 346 { 347 if (p == ptr || (p > ptr && *(p - 1) != '\\')) 348 { 349 state = in_char; 350 return p + 1; 351 } 352 else 353 { // '\'' is escaped 354 beg = p + 1; 355 } 356 } 357 else 358 { // we have '/' 359 if (*(p + 1) == '*') 360 { 361 state = in_comment; 362 return p + 2; 363 } 364 else if (*(p + 1) == '/') 365 { 366 state = in_line_comment; 367 return p + 2; 368 } 369 else 370 { 371 beg = p + 1; 372 } 373 } 374 /* 320 375 char* pos = strchr (ptr, '"'); 321 376 if ((pos != 0) && (pos < pattern) && (pos > ptr) && (*(pos-1) != '\\')) … … 334 389 } 335 390 336 pos = strstr (ptr, "/*"); //*/391 pos = strstr (ptr, "/*"); 337 392 if ((pos != 0) && (pos < pattern)) 338 393 { … … 351 406 352 407 ptr = pattern + length; 353 354 408 return (ptr); 409 */ 410 return ptr + strlen (ptr); 355 411 } 356 412 … … 650 706 } // while (strlen (ptr) > 0) 651 707 652 if (state == in_line) state = at_start; 708 //if (state == in_line) state = at_start; 709 switch (state) 710 { 711 case in_line: 712 case in_line_comment: 713 state = at_start; 714 break; 715 } 653 716 line_number++; 654 717 -
CMT/v1r25-branch/source/cmt_deps_builder.h
r588 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_error.cxx
r598 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 //----------------------------------------------------------- … … 18 19 { 19 20 error_names.add() = "ok"; 20 error_names.add() = " Warning";21 error_names.add() = "warning"; 21 22 error_names.add() = "symbol not found"; 22 23 error_names.add() = "pattern not found"; … … 159 160 160 161 result = get_error_name (e.get_code ()); 161 result += " 162 result += ": "; 162 163 result += e.get_text (); 163 164 -
CMT/v1r25-branch/source/cmt_error.h
r598 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 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_fragment.cxx
r595 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_fragment.h
r561 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_generator.cxx
r637 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_generator.h
r637 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_generators.cxx
r637 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- … … 2809 2810 m_PACKAGEFULLNAME.set ("PACKAGEFULLNAME"); 2810 2811 m_ISLOCAL.set ("ISLOCAL"); 2812 m_ISINCLUDED.set ("ISINCLUDED"); 2811 2813 2812 2814 packages_header_fragment.set ("packages_header"); … … 2822 2824 m_PACKAGEFULLNAME = ""; 2823 2825 m_ISLOCAL = ""; 2826 m_ISINCLUDED = ""; 2824 2827 2825 2828 packages_header_fragment.reset (); … … 2867 2870 if (!packages_header_fragment.copy (m_output_file, 1, &m_PACKAGE)) return; 2868 2871 2869 Project* cur = Project::get_current ();2872 const Project* p_cur (Project::get_current ()); 2870 2873 Use::UsePtrVector uses (Use::get_ordered_uses ()); 2871 2874 uses.push_back (&Use::current ()); 2875 2876 Project::ConstProjectPtrVector path_exclusions; 2877 Project::fill_exclusion (path_exclusions); 2878 2872 2879 cmt_string temp; 2873 2880 for (int i = uses.size () - 1; i >= 0; i--) 2874 2881 { 2875 2882 Use* use = uses[i]; 2883 2876 2884 if (use->discarded) continue; 2877 2885 if (use->m_hidden) continue; … … 2879 2887 if (use->get_package ()->is_cmt ()) continue; 2880 2888 2881 if (use->get_project () == cur) 2882 m_ISLOCAL = "is_local"; 2883 else 2884 m_ISLOCAL = "is_not_local"; 2889 const Project* up = use->get_project (); 2890 2891 m_ISLOCAL = "is_not_local"; 2892 if (p_cur) 2893 { 2894 if (up) 2895 { 2896 if (up == p_cur) 2897 { 2898 m_ISLOCAL = "is_local"; 2899 } 2900 } 2901 else 2902 { 2903 if (use->get_realpath ().find (p_cur->get_cmtpath_real ()) == 0) 2904 { 2905 m_ISLOCAL = "is_local"; 2906 } 2907 } 2908 } 2909 else if (use == &Use::current ()) 2910 { 2911 m_ISLOCAL = "is_local"; 2912 } 2913 2914 m_ISINCLUDED = "is_included"; 2915 for (int j = 0; j < path_exclusions.size (); j++) 2916 { 2917 const Project* sp = path_exclusions[j]; 2918 if (up) 2919 { 2920 if (up == sp) 2921 { 2922 m_ISINCLUDED = "is_not_included"; 2923 } 2924 } 2925 else 2926 { 2927 if (use->get_realpath ().find (sp->get_cmtpath_real ()) == 0) 2928 { 2929 m_ISINCLUDED = "is_not_included"; 2930 } 2931 } 2932 } 2885 2933 2886 2934 temp = use->get_full_path (); … … 2895 2943 temp += "mgr"; 2896 2944 break; 2945 default: 2946 break; 2897 2947 } 2898 2948 #ifdef WIN32 … … 2900 2950 #endif 2901 2951 m_PACKAGEMGRPATH = temp; 2902 // fprintf (m_output_file, "%s\n", temp.c_str());2903 2952 2904 2953 temp = ""; … … 2924 2973 #endif 2925 2974 m_PACKAGEFULLNAME = temp; 2926 // fprintf (m_output_file, "%s\n", temp.c_str());2927 2975 2928 2976 m_PACKAGE = use->get_package_name (); … … 2959 3007 } 2960 3008 2961 if (!package_fragment.copy (m_output_file, 6,3009 if (!package_fragment.copy (m_output_file, 7, 2962 3010 &m_PACKAGE, &m_PACKAGEPREFIX, 2963 3011 &m_DEPENDENCIES, 2964 3012 &m_PACKAGEMGRPATH, &m_PACKAGEFULLNAME, 2965 &m_ISLOCAL )) return;3013 &m_ISLOCAL, &m_ISINCLUDED)) return; 2966 3014 } 2967 3015 … … 2984 3032 2985 3033 CmtSystem::close_ostream (m_output_file, new_file_name); 2986 // fclose (m_output_file);2987 3034 2988 3035 commit (new_file_name); -
CMT/v1r25-branch/source/cmt_generators.h
r588 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- … … 238 239 Variable m_PACKAGEFULLNAME; 239 240 Variable m_ISLOCAL; 241 Variable m_ISINCLUDED; 240 242 241 243 FragmentHandle packages_header_fragment; -
CMT/v1r25-branch/source/cmt_install_area.cxx
r565 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_language.cxx
r561 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_language.h
r561 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_lock.cxx
r459 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_log.h
r535 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_map.h
r11 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- … … 276 277 * Return 0 if not found 277 278 */ 278 const T* find (const K& key) const 279 T* find (const K& key) 280 // const T* find (const K& key) const 279 281 { 280 282 if (key < m_key) … … 504 506 * Returns 0 if not found 505 507 */ 506 const T* find (const K& key) const 508 T* find (const K& key) const 509 // const T* find (const K& key) const 507 510 { 508 511 if (m_top != 0) -
CMT/v1r25-branch/source/cmt_model.cxx
r459 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_parser.cxx
r642 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 //----------------------------------------------------------- … … 10 11 #include <string.h> 11 12 #include <ctype.h> 13 #include <errno.h> 12 14 13 15 //---------------------------------------------------------- … … 50 52 } 51 53 54 //---------------------------------------------------------- 52 55 CmtContext::~CmtContext () 53 56 { 54 57 } 55 58 59 //---------------------------------------------------------- 56 60 void CmtContext::clear () 57 61 { … … 59 63 m_build_nmake = false; 60 64 m_cmt_config = ""; 61 //m_cmt_path.clear ();62 //m_cmt_path_pwds.clear ();63 //m_cmt_path_sources.clear ();64 65 m_cmt_root = ""; 66 m_cmt_home = ""; 67 m_cmt_user_context = ""; 68 m_cmt_site = ""; 65 69 m_cmt_version = ""; 66 70 m_use_cmt = true; 71 m_use_projects = true; 72 67 73 m_current_dir = ""; 68 74 m_current_file_path = ""; … … 74 80 m_current_offset = ""; 75 81 76 m_current_access = DeveloperMode; 82 m_current_access = UserMode; 83 m_current_style = cmt_style; 84 m_current_structuring_style = default_structuring_style; 77 85 78 86 m_current_tag = ""; 79 87 m_current_target = ""; 80 88 m_current_version = ""; 89 90 // m_extra_tags = ""; 91 m_extra_tags.clear (); 92 m_tags.clear (); 93 m_tags_add.clear (); 94 m_tags_remove.clear (); 95 96 m_configure_error = ""; 97 98 m_debug = (::getenv ("CMTDEBUG") != 0) ? true : false; 99 81 100 m_default_path = ""; 82 83 //m_quiet = false; 84 101 m_quiet = false; 85 102 m_disable_warnings = false; 86 103 m_warnings = false; … … 91 108 92 109 m_standard_macros_done = false; 93 m_current_access = UserMode;94 m_current_style = cmt_style;95 m_current_structuring_style = default_structuring_style;96 110 m_all_sets_done = false; 111 97 112 m_autoconfigure_cmtpath = false; 98 m_debug = false; 99 if (getenv ("CMTDEBUG") != 0) m_debug = true; 100 } 101 113 114 m_env_access = true; 115 m_print_mode = Csh; 116 m_strip_path = false; 117 } 118 //---------------------------------------------------------- 119 120 int CmtContext::initialize () 121 { 122 int errors (0); 123 124 cmt_string tags = CmtSystem::getenv ("CMTEXTRATAGS"); 125 CmtSystem::cmt_string_vector words; 126 CmtSystem::split (tags, " \t,", words); 127 for (int i = 0; i < words.size (); i++) 128 { 129 bool has (false); 130 for (int j = 0; j < m_extra_tags.size (); j++) 131 { 132 if (m_extra_tags[j] == words[i]) 133 { 134 has = true; 135 break; 136 } 137 } 138 if (!has) 139 m_extra_tags.push_back (words[i]); 140 } 141 142 return - errors; 143 } 102 144 //---------------------------------------------------------- 103 145 … … 357 399 358 400 401 //---------------------------------------------------------- 402 // 403 // The static Cmt member 404 // 405 //---------------------------------------------------------- 406 407 CmtContext& Cmt::m_cmt_context = Me; 408 //CmtContext * Cmt::m_cmt_context = &Me; 359 409 360 410 //---------------------------------------------------------- … … 462 512 463 513 //---------------------------------------------------------- 514 /* 464 515 bool Cmt::build_nmake () 465 516 { 466 517 return (Me.m_build_nmake); 467 518 } 468 519 */ 469 520 //---------------------------------------------------------- 470 521 void Cmt::build_OS9_makefile (const cmt_string& target) … … 497 548 void Cmt::clear () 498 549 { 499 Me.m_quiet = false;500 550 Me.clear (); 551 //Me.m_quiet = false; 501 552 502 553 Database::clear (); … … 507 558 508 559 //---------------------------------------------------------- 560 namespace { 561 562 bool parse_cmt_flags (const cmt_string& file_name, CmtContext& cmt) 563 { 564 cmt_string Flags (Cmt::get_cmt_flags (file_name)); 565 if (CmtError::get_last_error_code () == CmtError::file_access_error) 566 return false; 567 if (Flags.size () == 0) 568 return true; 569 570 cmt_string CmtFlags (Cmt::get_cmt_flags ()); 571 if (CmtFlags.size () != 0) 572 Flags += " " + CmtFlags; 573 574 CmtSystem::cmt_string_vector flags; 575 CmtSystem::split (Flags, " \t", flags); 576 for (int i = 0; i < flags.size (); i++) 577 { 578 if (flags[i] == "-without_cmt" && 579 cmt.m_use_cmt) 580 cmt.m_use_cmt = false; 581 else if (flags[i] == "-with_cmt" && 582 !cmt.m_use_cmt) 583 cmt.m_use_cmt = true; 584 else if (flags[i] == "-without_projects" && 585 cmt.m_use_projects) 586 cmt.m_use_projects = false; 587 else if (flags[i] == "-with_projects" && 588 !cmt.m_use_projects) 589 cmt.m_use_projects = true; 590 else if (flags[i] == "-no_strip_path" && 591 cmt.m_strip_path) 592 { 593 cmt.m_strip_path = false; 594 Symbol::set_strip_path (false); 595 } 596 else if (flags[i] == "-strip_path" && 597 !cmt.m_strip_path) 598 { 599 cmt.m_strip_path = true; 600 Symbol::set_strip_path (true); 601 } 602 } 603 604 return true; 605 } 606 607 } 608 609 //---------------------------------------------------------- 509 610 //void Cmt::configure () 510 611 void Cmt::configure (const ArgParser& ap) … … 515 616 if (configured) return; 516 617 517 Me.clear ();618 // Me.clear (); 518 619 519 620 log << "configure_cmt_message" << log_endl; … … 523 624 log << "configure_default_path" << log_endl; 524 625 configure_default_path (); 626 627 log << "restore_all_tags" << log_endl; 628 restore_all_tags (0); 525 629 log << "configure_version_tag" << log_endl; 526 630 configure_version_tag (); … … 533 637 log << "configure_site_tag" << log_endl; 534 638 configure_site_tag (0); 639 640 cmt_string requirements; 641 642 if (Me.m_current_package.size () != 0 && 643 Me.m_current_package != "cmt_standalone") 644 { 645 // we have a package name (not "cmt_standalone") 646 Use& use = Use::current(); 647 use.set (Me.m_current_package, 648 Me.m_current_version, 649 Me.m_current_path); 650 if (CmtSystem::absolute_path (Me.m_current_path)) 651 { 652 if (!use.move_to ()) 653 { 654 CmtError::set (CmtError::package_not_found, use.get_info ()); 655 return; 656 } 657 } 658 else 659 { 660 if (!use.move_to ("", true)) 661 { 662 // will try again later from CMTPATH entries 663 } 664 } 665 666 if (use.located ()) 667 { 668 // parse additional options 669 parse_cmt_flags ("requirements", m_cmt_context); 670 } 671 } 672 else 673 { 674 if (Me.m_current_path.size () != 0 && 675 !CmtSystem::cd (Me.m_current_path)) 676 { 677 CmtError::set (CmtError::path_not_found, Me.m_current_path); 678 return; 679 } 680 681 configure_current_dir (); 682 configure_current_structuring_style (ap); 683 cmt_string current_package_saved (Me.m_current_package); 684 requirements = configure_current_package (); 685 Me.m_current_package = current_package_saved; 686 if (requirements.size () != 0) 687 { 688 // parse additional options 689 parse_cmt_flags (requirements, m_cmt_context); 690 } 691 } 692 535 693 log << "configure_current_dir" << log_endl; 536 694 configure_current_dir (); … … 540 698 // log << "configure_current_dir" << log_endl; 541 699 542 543 700 bool save_quiet = Me.m_quiet; 544 701 Me.m_quiet = true; … … 546 703 Me.m_autoconfigure_cmtpath = true; 547 704 configure_cmt_path (0); 548 Me.m_autoconfigure_cmtpath = false;705 // Me.m_autoconfigure_cmtpath = false; 549 706 550 707 Me.m_quiet = save_quiet; … … 553 710 554 711 guess_current_project (); 712 713 if (Me.m_current_package.size () != 0 && 714 Me.m_current_package != "cmt_standalone") 715 { 716 Use& use = Use::current(); 717 if (!use.located ()) 718 { 719 if (!use.move_to ()) 720 { 721 CmtError::set (CmtError::package_not_found, use.get_info ()); 722 return; 723 } 724 else 725 { 726 use.get_full_path (Me.m_current_dir); 727 switch (use.style) 728 { 729 case cmt_style: 730 Me.m_current_dir += CmtSystem::file_separator (); 731 Me.m_current_dir += "cmt"; 732 break; 733 case mgr_style: 734 Me.m_current_dir += CmtSystem::file_separator (); 735 Me.m_current_dir += "mgr"; 736 break; 737 default: 738 break; 739 } 740 Me.m_current_file_path = Me.m_current_dir; 741 742 Project::order_all (); 743 Cmt::guess_current_project (); 744 } 745 } 746 } 555 747 556 748 log << "configure_current_structuring_style" << log_endl; … … 558 750 configure_current_structuring_style (ap); 559 751 752 // if (requirements.size () == 0) 753 // { 560 754 log << "configure_current_package" << log_endl; 561 755 configure_current_package (); 756 // } 562 757 563 758 Use& use = Use::current(); 564 565 use.set (Me.m_current_package, 566 Me.m_current_version, 567 Me.m_current_path, 568 "", 569 ""); 570 571 use.style = Me.m_current_style; 572 use.structuring_style = Me.m_current_structuring_style; 573 574 use.change_path (Me.m_current_path); 759 if (!use.located ()) 760 { 761 use.set (Me.m_current_package, 762 Me.m_current_version, 763 Me.m_current_path); 764 use.style = Me.m_current_style; 765 766 if (use.style != none_style) 767 { 768 use.structuring_style = Me.m_current_structuring_style; 769 use.change_path (Me.m_current_path, Project::get_current ()); 770 } 771 else 772 { 773 use.real_path = Me.m_current_path; 774 } 775 } 776 else if (const Project * p = Project::get_current ()) 777 { 778 use.set_project (p); 779 } 575 780 576 781 if (CmtError::has_pending_error ()) … … 584 789 { 585 790 if (!Me.m_autoconfigure_cmtpath) return; 791 792 if (!m_cmt_context.m_use_projects) return; 586 793 587 794 cmt_string s; … … 621 828 { 622 829 Use& current_use = Use::current (); 623 830 current_use.get_cmtpath_and_offset (Me.m_current_cmtpath, Me.m_current_offset); 831 /* 624 832 Me.m_current_cmtpath = ""; 625 833 Me.m_current_offset = ""; … … 633 841 634 842 Me.m_current_offset = current_use.path; 635 843 */ 636 844 /** 637 845 try to remove this current CMTPATH entry from path. This … … 639 847 absolute path. 640 848 */ 641 849 /* 642 850 Me.m_current_offset.replace (Me.m_current_cmtpath, empty_string); 643 851 if (Me.m_current_offset[0] == CmtSystem::file_separator ()) … … 648 856 } 649 857 } 858 */ 650 859 } 651 860 … … 731 940 void Cmt::configure_current_dir () 732 941 { 942 if (Me.m_current_dir.size () != 0) return; 943 733 944 cmt_string file_name; 734 945 … … 788 999 Me.m_current_file_path = mount_filter.get_current_dir (); 789 1000 790 cmt_string t = Me.m_current_file_path; 791 } 792 793 //---------------------------------------------------------- 794 void Cmt::configure_current_package () 1001 // cmt_string t = Me.m_current_file_path; 1002 } 1003 1004 //---------------------------------------------------------- 1005 cmt_string Cmt::configure_current_package () 1006 //void Cmt::configure_current_package () 795 1007 { 796 1008 /* … … 800 1012 standard directory tree (i.e. <package>/<version>/cmt or mgr) 801 1013 */ 1014 Use& use = Use::current(); 1015 if (use.located ()) 1016 { 1017 Me.m_current_style = use.style; 1018 build_prefix (Me.m_current_package, Me.m_current_prefix); 1019 build_config (Me.m_current_prefix, Me.m_current_config); 1020 1021 cmt_string req; 1022 use.get_full_path (req); 1023 switch (use.style) 1024 { 1025 case cmt_style: 1026 req += CmtSystem::file_separator (); 1027 req += "cmt"; 1028 break; 1029 case mgr_style: 1030 req += CmtSystem::file_separator (); 1031 req += "mgr"; 1032 break; 1033 default: 1034 break; 1035 } 1036 req += CmtSystem::file_separator (); 1037 req += "requirements"; 1038 return req; 1039 } 802 1040 803 1041 cmt_string req = ".."; … … 813 1051 else 814 1052 { 815 cmt_string req = ".."; 1053 req = ".."; 1054 // cmt_string req = ".."; 816 1055 req += CmtSystem::file_separator (); 817 1056 req += "mgr"; … … 827 1066 // This package is probably a standalone one 828 1067 Me.m_current_style = none_style; 1068 req = "requirements"; 1069 if (!CmtSystem::test_file (req)) 1070 { 1071 req = ""; 1072 } 829 1073 } 830 1074 } … … 1062 1306 // Do NOT (re)set m_current_structuring_style yet 1063 1307 // (as requirements may NOT exist, so this is not a package) 1064 // rather do it in reach_current_package (if/when requirements is read)1308 // rather do it in use_current_package (if/when requirements is read) 1065 1309 //Me.m_current_structuring_style = without_version_directory; 1066 1310 build_prefix (Me.m_current_package, Me.m_current_prefix); 1067 1311 build_config (Me.m_current_prefix, Me.m_current_config); 1068 1312 } 1313 1314 return req; 1069 1315 } 1070 1316 … … 1074 1320 { 1075 1321 cmt_string s; 1076 s = CmtSystem::getenv ("CMTSTRUCTURINGSTYLE"); 1077 if (s == "without_version_directory") 1078 { 1079 Me.m_current_structuring_style = without_version_directory; 1080 } 1081 else if (s == "with_version_directory") 1082 { 1083 Me.m_current_structuring_style = with_version_directory; 1084 } 1085 1086 CmtSystem::cmt_string_vector flags; 1087 Cmt::get_cmt_flags (flags); 1088 for (int i = 0; i < flags.size (); i++) 1089 { 1090 const cmt_string& flag = flags[i]; 1091 if (flag == "-without_version_directory") 1322 if (Me.m_current_structuring_style == default_structuring_style) 1323 { 1324 s = CmtSystem::getenv ("CMTSTRUCTURINGSTYLE"); 1325 if (s == "without_version_directory") 1092 1326 { 1093 1327 Me.m_current_structuring_style = without_version_directory; 1094 1328 } 1095 else if ( flag == "-with_version_directory")1329 else if (s == "with_version_directory") 1096 1330 { 1097 1331 Me.m_current_structuring_style = with_version_directory; 1098 } 1099 } 1100 1101 for (int i = 1; i < ap.argc; i++) 1102 { 1103 const cmt_string& arg = ap.argv[i]; 1104 if (arg[0] != '-') break; 1105 if (arg == "-without_v" || 1106 arg == "-without_ve" || 1107 arg == "-without_ver" || 1108 arg == "-without_vers" || 1109 arg == "-without_versi" || 1110 arg == "-without_versio" || 1111 arg == "-without_version" || 1112 arg == "-without_version_" || 1113 arg == "-without_version_d" || 1114 arg == "-without_version_di" || 1115 arg == "-without_version_dir" || 1116 arg == "-without_version_dire" || 1117 arg == "-without_version_direc" || 1118 arg == "-without_version_direct" || 1119 arg == "-without_version_directo" || 1120 arg == "-without_version_director" || 1121 arg == "-without_version_directory") 1122 { 1123 Me.m_current_structuring_style = without_version_directory; 1124 // if (!CmtSystem::putenv ("CMTSTRUCTURINGSTYLE", "without_version_directory")) 1125 // CmtMessage::error ("Cannot set `CMTSTRUCTURINGSTYLE' to" 1126 // " `without_version_directory' in the environment"); 1127 if (!Cmt::add_cmt_flag ("-without_version_directory")) 1128 CmtMessage::error ("Cannot add flag `-without_version_directory'"); 1129 } 1130 else if (arg == "-with_v" || 1131 arg == "-with_ve" || 1132 arg == "-with_ver" || 1133 arg == "-with_vers" || 1134 arg == "-with_versi" || 1135 arg == "-with_versio" || 1136 arg == "-with_version" || 1137 arg == "-with_version_" || 1138 arg == "-with_version_d" || 1139 arg == "-with_version_di" || 1140 arg == "-with_version_dir" || 1141 arg == "-with_version_dire" || 1142 arg == "-with_version_direc" || 1143 arg == "-with_version_direct" || 1144 arg == "-with_version_directo" || 1145 arg == "-with_version_director" || 1146 arg == "-with_version_directory") 1147 { 1148 Me.m_current_structuring_style = with_version_directory; 1149 // if (!CmtSystem::putenv ("CMTSTRUCTURINGSTYLE", "with_version_directory")) 1150 // CmtMessage::error ("Cannot set `CMTSTRUCTURINGSTYLE' to" 1151 // " `with_version_directory' in the environment"); 1152 if (!Cmt::add_cmt_flag ("-with_version_directory")) 1153 CmtMessage::error ("Cannot add flag `-with_version_directory'"); 1332 } 1333 1334 CmtSystem::cmt_string_vector flags; 1335 Cmt::get_cmt_flags (flags); 1336 for (int i = 0; i < flags.size (); i++) 1337 { 1338 const cmt_string& flag = flags[i]; 1339 if (flag == "-without_version_directory") 1340 { 1341 Me.m_current_structuring_style = without_version_directory; 1342 } 1343 else if (flag == "-with_version_directory") 1344 { 1345 Me.m_current_structuring_style = with_version_directory; 1346 } 1347 } 1348 } 1349 1350 if (Me.m_current_structuring_style != default_structuring_style) 1351 { 1352 StrategyDef* def = StrategyMgr::find_strategy ("VersionDirectory"); 1353 if (def != 0) 1354 { 1355 def->m_default_value = 1356 Me.m_current_structuring_style == with_version_directory; 1357 def->m_priority_value = 1358 Me.m_current_structuring_style == without_version_directory; 1154 1359 } 1155 1360 } … … 1171 1376 void Cmt::configure_home (Use* use) 1172 1377 { 1173 Me.m_cmt_home = ""; 1174 1175 Symbol* symbol = Symbol::find ("CMTHOME"); 1176 if (symbol != 0) 1177 { 1178 Me.m_cmt_home = symbol->build_macro_value (); 1179 Symbol::expand (Me.m_cmt_home); 1180 } 1181 else if (CmtSystem::testenv ("CMTHOME")) 1182 { 1183 Me.m_cmt_home = CmtSystem::getenv ("CMTHOME"); 1378 if (Me.m_cmt_home.size () == 0) 1379 { 1380 // if not passed on the command line 1381 if (const Symbol* symbol = Symbol::find ("CMTHOME")) 1382 { 1383 Me.m_cmt_home = symbol->build_macro_value (); 1384 Symbol::expand (Me.m_cmt_home); 1385 } 1386 else if (CmtSystem::testenv ("CMTHOME")) 1387 { 1388 Me.m_cmt_home = CmtSystem::getenv ("CMTHOME"); 1389 } 1184 1390 } 1185 1391 … … 1195 1401 void Cmt::configure_user_context (Use* use) 1196 1402 { 1197 Me.m_cmt_user_context = ""; 1198 1199 Symbol* symbol = Symbol::find ("CMTUSERCONTEXT"); 1200 if (symbol != 0) 1201 { 1202 Me.m_cmt_user_context = symbol->build_macro_value (); 1203 Symbol::expand (Me.m_cmt_user_context); 1204 } 1205 else if (CmtSystem::testenv ("CMTUSERCONTEXT")) 1206 { 1207 Me.m_cmt_user_context = CmtSystem::getenv ("CMTUSERCONTEXT"); 1403 if (Me.m_cmt_user_context.size () == 0) 1404 { 1405 // if not passed on the command line 1406 if (const Symbol* symbol = Symbol::find ("CMTUSERCONTEXT")) 1407 { 1408 Me.m_cmt_user_context = symbol->build_macro_value (); 1409 Symbol::expand (Me.m_cmt_user_context); 1410 } 1411 else if (CmtSystem::testenv ("CMTUSERCONTEXT")) 1412 { 1413 Me.m_cmt_user_context = CmtSystem::getenv ("CMTUSERCONTEXT"); 1414 } 1208 1415 } 1209 1416 … … 1272 1479 1273 1480 Cmt::configure_tags (use); 1481 1482 cmt_string s, t; 1483 if (0 < Me.m_extra_tags.size ()) 1484 { 1485 s = "CMTEXTRATAGS"; 1486 t = use != 0 ? use->get_package_name () : s; 1487 } 1488 for (int i = 0; i < Me.m_extra_tags.size (); i++) 1489 { 1490 Tag* tag = Tag::add (Me.m_extra_tags[i], PriorityUserTag, s, use); 1491 tag->mark (t); 1492 } 1493 1494 for (int i = 0; i < Me.m_tags.size (); i++) 1495 { 1496 const cmt_string& a = Me.m_tags[i]; 1497 if (i == 0) 1498 { 1499 Me.m_current_tag = a; 1500 } 1501 // // Then restore uname if the specified tag is CMTCONFIG 1502 // if (a == CmtSystem::get_cmt_config ()) 1503 // { 1504 // Cmt::configure_uname_tag (); 1505 // } 1506 Tag* tag = Tag::add (a, PriorityArgument, "arguments", 0); 1507 tag->mark ("arguments"); 1508 } 1509 1510 for (int i = 0; i < Me.m_tags_add.size (); i++) 1511 { 1512 const cmt_string& a = Me.m_tags_add[i]; 1513 // // Then restore uname if the specified tag is CMTCONFIG 1514 // if (a == CmtSystem::get_cmt_config ()) 1515 // { 1516 // Cmt::configure_uname_tag (); 1517 // } 1518 Tag* tag = Tag::add (a, PriorityUserTag, "arguments", 0); 1519 tag->mark ("arguments"); 1520 } 1274 1521 1275 1522 /* … … 1277 1524 */ 1278 1525 1526 /* 1279 1527 if (CmtSystem::testenv ("CMTEXTRATAGS")) 1280 1528 { … … 1309 1557 } 1310 1558 } 1559 */ 1311 1560 } 1312 1561 … … 1319 1568 1320 1569 log << "current_tag=" << Me.m_current_tag << log_endl; 1570 1571 cmt_string s = "CMTCONFIG"; 1321 1572 1322 1573 Symbol* symbol = Symbol::find ("CMTCONFIG"); … … 1347 1598 { 1348 1599 config_tag = CmtSystem::getenv ("CMTBIN"); 1600 s = "CMTBIN"; 1349 1601 } 1350 1602 … … 1352 1604 { 1353 1605 CmtSystem::get_uname (config_tag); 1606 s = "uname"; 1354 1607 } 1355 1608 1356 1609 log << "current_tag=" << Me.m_current_tag << log_endl; 1357 1610 1358 cmt_string s = "CMTCONFIG";1611 // cmt_string s = "CMTCONFIG"; 1359 1612 cmt_string t = s; 1360 1613 … … 1552 1805 if (CmtMessage::level () != Warning) 1553 1806 CmtMessage::set_level (Warning); 1554 // if (CmtMessage::level () > Warning)1555 }1556 }1557 1558 for (int i = 1; i < ap.argc; i++)1559 {1560 const cmt_string& arg = ap.argv[i];1561 if (arg[0] != '-') break;1562 if (arg == "-d" ||1563 arg == "-di" ||1564 arg == "-dis" ||1565 arg == "-disa" ||1566 arg == "-disab" ||1567 arg == "-disabl" ||1568 arg == "-disable" ||1569 arg == "-disable_" ||1570 arg == "-disable_w" ||1571 arg == "-disable_wa" ||1572 arg == "-disable_war" ||1573 arg == "-disable_warn" ||1574 arg == "-disable_warni" ||1575 arg == "-disable_warnin" ||1576 arg == "-disable_warning" ||1577 arg == "-disable_warnings")1578 {1579 Me.m_disable_warnings = true;1580 if (CmtMessage::level () <= Warning)1581 {1582 CmtMessage::set_level (Error);1583 // if (!CmtSystem::putenv ("CMTERROR", "1"))1584 // CmtMessage::error ("Cannot set `CMTERROR' in the environment");1585 }1586 if (!Cmt::add_cmt_flag ("-disable_warnings"))1587 CmtMessage::error ("Cannot add flag `-disable_warnings'");1588 }1589 else if (arg == "-q" ||1590 arg == "-qu" ||1591 arg == "-qui" ||1592 arg == "-quie" ||1593 arg == "-quiet")1594 {1595 Me.m_quiet = true;1596 if (CmtMessage::level () <= Error)1597 {1598 CmtMessage::set_level (Fatal);1599 // if (!CmtSystem::putenv ("CMTFATAL", "1"))1600 // CmtMessage::error ("Cannot set `CMTFATAL' in the environment");1601 }1602 if (!Cmt::add_cmt_flag ("-quiet"))1603 CmtMessage::error ("Cannot add flag `-quiet'");1604 }1605 else if (arg == "-warn" ||1606 arg == "-warni" ||1607 arg == "-warnin" ||1608 arg == "-warning" ||1609 arg == "-warnings")1610 {1611 Me.m_warnings = true;1612 // if (CmtMessage::level () > Warning)1613 if (CmtMessage::level () != Warning)1614 {1615 CmtMessage::set_level (Warning);1616 // if (!CmtSystem::putenv ("CMTWARNING", "1"))1617 // CmtMessage::error ("Cannot set `CMTWARNING' in the environment");1618 }1619 if (!Cmt::add_cmt_flag ("-warnings"))1620 CmtMessage::error ("Cannot add flag `-warnings'");1621 1807 } 1622 1808 } … … 1668 1854 1669 1855 CmtSystem::cmt_string_vector uses; 1856 cmt_vector<int> use_indexes; 1670 1857 CmtSystem::cmt_string_vector packages; 1671 1858 CmtSystem::cmt_string_vector versions; 1672 CmtSystem::cmt_string_vector path_selections; 1859 Project::ConstProjectPtrVector path_selections; 1860 // CmtSystem::cmt_string_vector path_selections; 1861 Project::ConstProjectPtrVector path_exclusions; 1673 1862 CmtSystem::cmt_string_vector selections; 1674 1863 CmtSystem::cmt_string_vector exclusions; … … 1677 1866 bool is_cmt = false; 1678 1867 int first = 0; 1679 int i;1680 1868 bool ignore_errors = false; 1681 1869 bool all_packages = false; 1682 1870 int depth (1); 1683 1871 bool local = true; 1684 1685 for (i = 0; i < ap.arguments.size (); i++) 1872 bool global (false); 1873 1874 for (int i = 0; i < ap.arguments.size (); i++) 1686 1875 { 1687 1876 const cmt_string& w = ap.arguments[i]; … … 1699 1888 { 1700 1889 local = false; 1890 global = false; 1701 1891 1702 1892 cmt_string depth_str; 1703 int depth_value = 0;1893 int depth_value; 1704 1894 1705 1895 w.substr (7, depth_str); 1706 if ((sscanf (depth_str.c_str (), "%d", &depth_value) < 1) || 1707 (depth_value < 1)) 1708 { 1896 int n = sscanf (depth_str.c_str (), "%d", &depth_value); 1897 cmt_string msg; 1898 switch (n) 1899 { 1900 case EOF: 1901 msg = "Cannot read `depth' value `"; 1902 msg += depth_str; 1903 msg += cmt_string ("'"); 1904 if (errno) 1905 msg += cmt_string (strerror (errno)); 1906 CmtError::set (CmtError::system_error, msg); 1907 return; 1908 break; 1909 case 0: 1910 msg = "Invalid `depth' value `"; 1911 msg += depth_str; 1912 msg += cmt_string ("'"); 1913 CmtError::set (CmtError::syntax_error, msg); 1914 return; 1915 break; 1916 case 1: 1917 if (depth_value < -1) 1918 { 1919 char num[32]; sprintf (num, "%lu", -depth_value); 1920 msg = "Invalid `depth' value `-"; 1921 msg += num; 1922 msg += cmt_string ("'"); 1923 CmtError::set (CmtError::syntax_error, msg); 1924 return; 1925 } 1926 depth = depth_value; 1927 //cerr << "depth: " << depth << endl; 1928 break; 1929 default: 1930 break; 1931 } 1932 // if ((sscanf (depth_str.c_str (), "%d", &depth_value) < 1) || 1933 // (depth_value < 1)) 1934 // { 1709 1935 // Syntax error 1710 1936 // We shall restrict to packages found within … … 1712 1938 // If CMTPATH is empty, nothing is selected. 1713 1939 // depth=1 is equivalent to local 1714 }1715 1716 Project::fill_selection (depth_value, path_selections);1940 // } 1941 1942 // Project::fill_selection (depth_value, path_selections); 1717 1943 } 1718 1944 else if (w.substr (0, 9) == "-exclude=") … … 1738 1964 else if (w.substr (0, 7) == "-global") 1739 1965 { 1740 path_selections.clear ();1741 1966 //path_selections.clear (); 1967 global = true; 1742 1968 local = false; 1743 1969 } … … 1745 1971 { 1746 1972 local = true; 1973 global = false; 1747 1974 } 1748 1975 else if (w.substr (0, 8) == "-select=") … … 1787 2014 } 1788 2015 1789 if (local) 1790 { 1791 Project::fill_selection (1, path_selections); 2016 const Project* p_cur (Project::get_current ()); 2017 if (global) 2018 { 2019 Project::fill_exclusion (path_exclusions); 2020 } 2021 else if (local) 2022 { 2023 if (p_cur) 2024 Project::fill_selection (1, path_selections); 2025 else 2026 path_selections.push_back (0); // means that we want Use::current () 2027 // path_selections.push_back ((Use::current ()).get_realpath ()); 2028 } 2029 else 2030 { 2031 if (!p_cur 2032 && depth != 0 2033 && depth != -1) 2034 path_selections.push_back (0); // means that we want Use::current () 2035 // path_selections.push_back ((Use::current ()).get_realpath ()); 2036 Project::fill_selection (depth, path_selections); 2037 /* 2038 cerr << "depth: " << depth << endl; 2039 for (int j = 0; j < path_selections.size (); j++) 2040 { 2041 const Project* sp = path_selections[j]; 2042 cerr << "path_selections: " << (sp ? sp->get_cmtpath () : "current use") << endl; 2043 } 2044 */ 1792 2045 } 1793 2046 … … 1800 2053 //if (command.substr (0, 3) == "cmt") is_cmt = true; 1801 2054 1802 cmt_string curuse = CmtSystem::pwd ();2055 //cmt_string curuse = CmtSystem::pwd (); 1803 2056 if (all_packages) 1804 2057 { … … 1806 2059 PathScanner scanner; 1807 2060 Project::scan_paths (scanner, selector); 2061 return; 1808 2062 } 1809 2063 else 1810 2064 { 1811 for (i = Uses.size () - 1; i >= 0; i--)2065 for (int i = Uses.size () - 1; i >= 0; i--) 1812 2066 { 1813 2067 Use* use = Uses[i]; … … 1815 2069 if (use->discarded) continue; 1816 2070 if (use->m_hidden) continue; 1817 1818 2071 if (!use->located ()) 1819 2072 { 1820 CmtMessage::warning ("package " + use->get_package_name () 1821 + " " + use->version + " " + use->path 1822 + " not found"); 1823 /* 1824 if (!Me.m_quiet) 1825 { 1826 cerr << "#CMT> package " << use->get_package_name () << 1827 " " << use->version << " " << use->path << 1828 " not found" << 1829 endl; 1830 } 1831 */ 2073 CmtMessage::warning 2074 (CmtError::get_error_name (CmtError::package_not_found) 2075 + ": " + use->get_info ()); 2076 continue; 1832 2077 } 1833 else 1834 { 1835 if (use->get_package_name () != "CMT") 1836 { 1837 cmt_string& s = uses.add (); 1838 1839 use->get_full_path (s); 1840 1841 s += CmtSystem::file_separator (); 1842 if (use->style == mgr_style) s += "mgr"; 1843 else s += "cmt"; 1844 1845 cmt_string& v = versions.add (); 1846 v = use->version; 1847 1848 cmt_string& p = packages.add (); 1849 p = use->get_package_name (); 1850 } 1851 } 1852 } 2078 if (use->get_package_name () == "CMT") continue; 2079 2080 cmt_string& s = uses.add (); 2081 use->get_full_path (s); 2082 switch (use->style) 2083 { 2084 case cmt_style: 2085 s += CmtSystem::file_separator (); 2086 s += "cmt"; 2087 break; 2088 case mgr_style: 2089 s += CmtSystem::file_separator (); 2090 s += "mgr"; 2091 break; 2092 default: 2093 break; 2094 } 2095 // if (use->style == mgr_style) s += "mgr"; 2096 // else s += "cmt"; 2097 2098 cmt_string& v = versions.add (); 2099 v = use->version; 2100 2101 cmt_string& p = packages.add (); 2102 p = use->get_package_name (); 2103 2104 int& use_index = use_indexes.add (); 2105 use_index = i; 2106 } 1853 2107 1854 2108 { 2109 Use* use = &(Use::current ()); 2110 1855 2111 cmt_string& s = uses.add (); 2112 use->get_full_path (s); 2113 switch (use->style) 2114 { 2115 case cmt_style: 2116 s += CmtSystem::file_separator (); 2117 s += "cmt"; 2118 break; 2119 case mgr_style: 2120 s += CmtSystem::file_separator (); 2121 s += "mgr"; 2122 break; 2123 default: 2124 break; 2125 } 2126 // if (use->get_package_name ().find ("cmt_standalone") != cmt_string::npos) 2127 // { 2128 // s = CmtSystem::pwd (); 2129 // } 2130 // else 2131 // { 2132 // use->get_full_path (s); 2133 2134 // s += CmtSystem::file_separator (); 1856 2135 1857 Use* use = &(Use::current ()); 1858 1859 if (use->get_package_name ().find ("cmt_standalone") != cmt_string::npos) 1860 { 1861 s = CmtSystem::pwd (); 1862 } 1863 else 1864 { 1865 use->get_full_path (s); 1866 1867 s += CmtSystem::file_separator (); 1868 1869 if (use->style == mgr_style) s += "mgr"; 1870 else s += "cmt"; 1871 } 1872 1873 curuse = s; 2136 // if (use->style == mgr_style) s += "mgr"; 2137 // else s += "cmt"; 2138 // } 2139 //curuse = s; 1874 2140 1875 2141 cmt_string& v = versions.add (); … … 1878 2144 cmt_string& p = packages.add (); 1879 2145 p = use->get_package_name (); 2146 2147 int& use_index = use_indexes.add (); 2148 use_index = -1; 1880 2149 } 1881 2150 } … … 1891 2160 CmtSystem::putenv ("CMTBCAST", ""); 1892 2161 1893 for (i = 0; i < uses.size (); i++)2162 for (int i = 0; i < uses.size (); i++) 1894 2163 { 1895 2164 const cmt_string& s = uses[i]; 1896 2165 const cmt_string& v = versions[i]; 1897 2166 const cmt_string& p = packages[i]; 2167 const int use_index = use_indexes[i]; 2168 2169 const Use* use = use_index >= 0 ? Uses[use_index] : &(Use::current ()); 2170 const Project* up = use->get_project (); 2171 1898 2172 cmt_string cmtpath; 1899 2173 1900 2174 bool ok = true; 1901 bool selected = true;2175 bool selected = global ? true : false; 1902 2176 bool excluded = false; 1903 2177 1904 /** 1905 Ensure that the current package is not skipped 1906 due to symlinks in the paths 1907 */ 1908 // if (path_selections.size () > 0) 1909 if (path_selections.size () > 0 && s != curuse) 2178 ok = selected; 2179 if (path_selections.size () > 0) 1910 2180 { 1911 2181 selected = false; 1912 1913 2182 for (int j = 0; j < path_selections.size (); j++) 1914 2183 { 1915 const cmt_string& sel = path_selections[j]; 1916 1917 if (s.find (sel) != cmt_string::npos) 1918 { 1919 cmtpath = sel; 1920 selected = true; 1921 break; 1922 } 1923 } 1924 2184 const Project* sp = path_selections[j]; 2185 if (sp) 2186 { 2187 if (up) 2188 { 2189 if (up == sp) 2190 { 2191 cmtpath = sp->get_cmtpath (); 2192 selected = true; 2193 break; 2194 } 2195 } 2196 else 2197 { 2198 if (use->get_realpath ().find (sp->get_cmtpath_real ()) == 0) 2199 { 2200 cmtpath = sp->get_cmtpath (); 2201 selected = true; 2202 break; 2203 } 2204 } 2205 } 2206 else if (use == &(Use::current ())) 2207 { 2208 // means that we want Use::current () 2209 // cmtpath = sp->get_cmtpath (); 2210 if (up) 2211 cmtpath = up->get_cmtpath (); 2212 else 2213 cmtpath = ""; 2214 selected = true; 2215 break; 2216 } 2217 // const cmt_string& sel = path_selections[j]; 2218 // if (s.find (sel) != cmt_string::npos) 2219 // { 2220 // cmtpath = sel; 2221 // selected = true; 2222 // break; 2223 // } 2224 } 1925 2225 ok = selected; 1926 2226 } 2227 else if (up) 2228 cmtpath = up->get_cmtpath (); 1927 2229 1928 2230 if (ok) … … 1960 2262 } 1961 2263 1962 1963 2264 if (ok) 1964 2265 { … … 1974 2275 break; 1975 2276 } 2277 } 2278 2279 if (excluded) ok = false; 2280 } 2281 2282 if (ok) 2283 { 2284 excluded = false; 2285 for (int j = 0; j < path_exclusions.size (); j++) 2286 { 2287 const Project* sp = path_exclusions[j]; 2288 if (up) 2289 { 2290 if (up == sp) 2291 { 2292 excluded = true; 2293 break; 2294 } 2295 } 2296 else 2297 { 2298 if (use->get_realpath ().find (sp->get_cmtpath_real ()) == 0) 2299 { 2300 excluded = true; 2301 break; 2302 } 2303 } 1976 2304 } 1977 2305 … … 2021 2349 } 2022 2350 2351 /* 2023 2352 if (cmtpath == "") 2024 2353 { … … 2026 2355 cmtpath = Project::find_in_cmt_paths (sel); 2027 2356 } 2357 */ 2028 2358 2029 2359 cmt_string cmd = command; … … 2041 2371 static const cmt_string empty_string; 2042 2372 static const cmt_string fs = CmtSystem::file_separator (); 2043 cmt_string offset = s; 2044 offset.replace (cmtpath, empty_string); 2045 if (offset[0] == CmtSystem::file_separator ()) 2046 { 2047 offset.replace (fs, empty_string); 2048 } 2049 CmtSystem::dirname (offset, offset); 2050 2051 cmt_string n; 2052 CmtSystem::basename (offset, n); 2053 if (n == p) 2054 { 2373 cmt_string offset; 2374 if (cmtpath.size ()) 2375 { 2376 offset = s; 2377 offset.replace (cmtpath, empty_string); 2378 if (offset[0] == CmtSystem::file_separator ()) 2379 { 2380 offset.replace (fs, empty_string); 2381 } 2055 2382 CmtSystem::dirname (offset, offset); 2383 2384 cmt_string n; 2385 CmtSystem::basename (offset, n); 2386 if (n == p) 2387 { 2388 CmtSystem::dirname (offset, offset); 2389 } 2390 else 2391 { 2392 CmtSystem::dirname (offset, offset); 2393 CmtSystem::dirname (offset, offset); 2394 } 2056 2395 } 2057 2396 else 2058 2397 { 2059 CmtSystem::dirname (offset, offset); 2060 CmtSystem::dirname (offset, offset); 2061 } 2062 2398 offset = use->real_path; 2399 } 2063 2400 cmd.replace_all (offset_template, offset); 2064 2401 … … 2067 2404 { 2068 2405 cout << "#--------------------------------------------------------------" << endl; 2069 cout << "# Now trying [" << cmd << "] in " << s << " (" << i+1 << "/" << uses.size ()2406 cout << "# " << p << " " << v << " " << offset << ": Now trying [" << cmd << "] in " << s << " (" << i+1 << "/" << uses.size () 2070 2407 << ")" << endl; 2071 2408 cout << "#--------------------------------------------------------------" << endl; … … 2904 3241 } 2905 3242 2906 static CmtSystem::cmt_string_vector tags;3243 // static CmtSystem::cmt_string_vector tags; 2907 3244 2908 3245 if (action_build_constituents_config != get_action ()) 2909 CmtSystem::split (Me.m_extra_tags, " \t,", tags); 2910 2911 for (int i = 0; i < tags.size (); i++) 2912 { 2913 const cmt_string& t = tags[i]; 2914 2915 tag = Tag::find (t); 2916 if (tag == 0) continue; 2917 2918 if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag)) 2919 { 2920 CmtMessage::warning ("The tag " + t + " is not used in any tag expression. Please check spelling"); 2921 // cerr << "#CMT> The tag " << t << " is not used in any tag expression. Please check spelling" << endl; 2922 } 2923 } 2924 2925 Symbol::check_all_paths (); 3246 { 3247 // CmtSystem::split (Me.m_extra_tags, " \t,", tags); 3248 3249 // for (int i = 0; i < tags.size (); i++) 3250 // { 3251 // const cmt_string& t = tags[i]; 3252 for (int i = 0; i < Me.m_extra_tags.size (); i++) 3253 { 3254 const cmt_string& t = Me.m_extra_tags[i]; 3255 tag = Tag::find (t); 3256 if (tag == 0) continue; 3257 if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag)) 3258 { 3259 CmtMessage::warning ("The tag " + t + " is not used in any tag expression. Please check spelling"); 3260 } 3261 } 3262 for (int i = 0; i < Me.m_tags.size (); i++) 3263 { 3264 const cmt_string& t = Me.m_tags[i]; 3265 tag = Tag::find (t); 3266 if (tag == 0) continue; 3267 if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag)) 3268 { 3269 CmtMessage::warning ("The tag " + t + " is not used in any tag expression. Please check spelling"); 3270 } 3271 } 3272 for (int i = 0; i < Me.m_tags_add.size (); i++) 3273 { 3274 const cmt_string& t = Me.m_tags_add[i]; 3275 tag = Tag::find (t); 3276 if (tag == 0) continue; 3277 if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag)) 3278 { 3279 CmtMessage::warning ("The tag " + t + " is not used in any tag expression. Please check spelling"); 3280 } 3281 } 3282 } 3283 3284 if (action_setup != get_action () || 3285 Requirements == ap.mode) 3286 // PathBuilder::filter_path_value is called 3287 // for each path in Symbol::print 3288 Symbol::check_all_paths (); 2926 3289 2927 3290 env = CmtSystem::getenv ("CMTSITE"); … … 2940 3303 { 2941 3304 CmtMessage::warning ("The CMTSITE value " + env + " is not used in any tag expression. Please check spelling"); 2942 // cerr << "#CMT> The CMTSITE value " << env << " is not used in any tag expression. Please check spelling" << endl;2943 3305 } 2944 3306 … … 4323 4685 break; 4324 4686 case Requirements : 4687 /* 4325 4688 CmtSystem::cmt_string_vector flags; 4326 4689 get_cmt_flags (flags); 4327 4690 cout << "\n# CMTFLAGS: -without_cmt"; 4691 cout << " -without_projects" ; 4328 4692 for (int i = 0; i < flags.size (); i++) 4329 4693 { … … 4332 4696 else if (flags[i] == "-with_cmt") 4333 4697 cout << " -without_cmt"; 4698 else if (flags[i] == "-without_projects") 4699 cout << " -with_projects"; 4700 else if (flags[i] == "-with_projects") 4701 cout << " -without_projects"; 4334 4702 else 4335 4703 cout << " " << flags[i]; 4336 4704 } 4337 4705 cout << endl; 4706 */ 4338 4707 break; 4339 } 4340 print (ap.mode); 4708 default: 4709 break; 4710 } 4711 4712 ostringstream os; 4713 ostringstream oh; 4714 bool reset (false); 4715 CmtSystem::cmt_string_vector flags; 4716 cmt_string strip_path_flag; 4717 bool strip_path (false); 4718 4719 bool strip_saved (get_strip_path ()); 4720 bool access_saved (Cmt::get_env_access ()); 4721 4722 switch (ap.mode) 4723 { 4724 case Requirements : 4725 4726 get_cmt_flags (flags); 4727 for (int i = 0; i < flags.size (); i++) 4728 { 4729 if (flags[i] == "-no_strip_path") 4730 strip_path_flag = "-no_strip_path"; 4731 else if (flags[i] == "-strip_path") 4732 strip_path_flag = "-strip_path"; 4733 } 4734 if (strip_path_flag != "-no_strip_path" && 4735 !get_strip_path ()) 4736 reset = Symbol::set_strip_path (true); 4737 4738 if (get_strip_path () || reset) 4739 strip_path = true; 4740 else 4741 strip_path = false; 4742 4743 Cmt::set_env_access (false); 4744 4745 print (ap.mode, os); 4746 4747 if (CmtError::get_last_error_code () == CmtError::warning && 4748 (get_strip_path () || reset)) 4749 { 4750 reset = Symbol::set_strip_path (false); 4751 if (reset) 4752 { 4753 strip_path = false; 4754 4755 CmtError::print (); 4756 CmtError::clear (); 4757 4758 if (Cmt::get_debug ()) 4759 { 4760 cerr << "|Cmt::do_setup> Failure with:\n" << os.str () 4761 << "|Cmt::do_setup> Trying again." << endl; 4762 } 4763 4764 // Try again 4765 os.str (""); 4766 print (ap.mode, os); 4767 } 4768 } 4769 4770 if (reset) Symbol::set_strip_path (strip_saved); 4771 Cmt::set_env_access (access_saved); 4772 4773 //get_cmt_flags (flags); 4774 oh << "\n# CMTFLAGS:" 4775 " -without_cmt" 4776 " -without_projects" 4777 //" -strip_path" 4778 ; 4779 for (int i = 0; i < flags.size (); i++) 4780 { 4781 if (flags[i] == "-without_cmt") 4782 oh << " -with_cmt"; 4783 else if (flags[i] == "-with_cmt") 4784 oh << " -without_cmt"; 4785 else if (flags[i] == "-without_projects") 4786 oh << " -with_projects"; 4787 else if (flags[i] == "-with_projects") 4788 oh << " -without_projects"; 4789 /* 4790 else if (flags[i] == "-no_strip_path") 4791 oh << " -strip_path"; 4792 else if (flags[i] == "-strip_path") 4793 oh << " -no_strip_path"; 4794 */ 4795 else if (flags[i] == "-no_strip_path" || 4796 flags[i] == "-strip_path") 4797 continue; 4798 else 4799 oh << " " << flags[i]; 4800 } 4801 //if (reset) oh << " -strip_path"; 4802 if (strip_path) 4803 oh << " -no_strip_path"; 4804 else 4805 oh << " -strip_path"; 4806 oh << endl; 4807 4808 cout << oh.str (); 4809 cout << os.str (); 4810 4811 break; 4812 4813 default: 4814 4815 print (ap.mode); 4816 4817 break; 4818 } 4819 4341 4820 switch (ap.mode) 4342 4821 { … … 4476 4955 4477 4956 Use& use = Use::current(); 4957 /* 4478 4958 use.get_cmtpath_and_offset (cmtpath, offset); 4479 4959 4480 4960 Project* p = Project::find_by_cmtpath (cmtpath); 4481 4482 cout << p->get_author () << endl; 4961 */ 4962 if (const Project* p = use.get_project ()) 4963 cout << p->get_author () << endl; 4483 4964 } 4484 4965 … … 4503 4984 ClientCollector collector (package, version); 4504 4985 4986 /* 4505 4987 clear (); 4506 4988 // configure (); 4507 4989 configure (ap); 4990 */ 4508 4991 4509 4992 cout << "# ----------- Clients of " << package … … 5164 5647 5165 5648 //---------------------------------------------------------- 5649 /* 5166 5650 ActionType Cmt::get_action () 5167 5651 { 5168 5652 return (Me.m_action); 5169 5653 } 5170 5654 */ 5171 5655 /* 5172 5656 const CmtSystem::cmt_string_vector& Cmt::get_cmt_path () … … 5185 5669 } 5186 5670 */ 5187 5671 /* 5188 5672 const cmt_string& Cmt::get_cmt_home () 5189 5673 { … … 5205 5689 return (Me.m_current_dir); 5206 5690 } 5207 5691 */ 5208 5692 const cmt_string Cmt::get_current_dir_real () 5209 5693 { … … 5213 5697 return (Me.m_current_dir); 5214 5698 } 5215 5699 /* 5216 5700 const cmt_string& Cmt::get_current_package () 5217 5701 { 5218 5702 return (Me.m_current_package); 5219 5703 } 5220 5704 */ 5221 5705 const cmt_string& Cmt::get_current_path () 5222 5706 { … … 5233 5717 return (Me.m_current_offset); 5234 5718 } 5235 5719 /* 5236 5720 AccessMode Cmt::get_current_access () 5237 5721 { … … 5248 5732 return (Me.m_current_style); 5249 5733 } 5250 5734 */ 5251 5735 const cmt_string& Cmt::get_current_version () 5252 5736 { 5253 5737 return (Me.m_current_version); 5254 5738 } 5255 5739 /* 5256 5740 const cmt_string& Cmt::get_current_target () 5257 5741 { 5258 5742 return (Me.m_current_target); 5259 5743 } 5260 5744 */ 5745 /* 5746 const CmtSystem::cmt_string_vector& Cmt::get_tags_remove () 5747 { 5748 return (Me.m_tags_remove); 5749 } 5750 */ 5751 /* 5261 5752 bool Cmt::get_debug () 5262 5753 { … … 5283 5774 return (Me.m_recursive); 5284 5775 } 5285 5776 */ 5286 5777 CmtScopeFilteringMode Cmt::get_scope_filtering_mode () 5287 5778 { … … 5297 5788 5298 5789 //---------------------------------------------------------- 5790 /* 5299 5791 bool Cmt::get_all_sets_done () 5300 5792 { 5301 5793 return (Me.m_all_sets_done); 5302 5794 } 5303 5795 */ 5304 5796 //---------------------------------------------------------- 5305 5797 void Cmt::get_cmt_flags (CmtSystem::cmt_string_vector& flags) … … 5421 5913 void Cmt::guess_current_project () 5422 5914 { 5915 if (!m_cmt_context.m_use_projects) return; 5916 5423 5917 Log; 5424 5918 5425 5919 log << "guess_current_project" << log_endl; 5426 5920 5427 cmt_string here = CmtSystem::pwd ();5921 // cmt_string here = CmtSystem::pwd (); 5428 5922 5429 5923 Use& use = Use::current(); … … 5438 5932 // if (Project::find_in_cmt_paths (Me.m_current_dir) == "") 5439 5933 { 5934 /* 5440 5935 if (!CmtSystem::cd (current_path)) 5441 5936 { … … 5444 5939 return; 5445 5940 } 5941 */ 5446 5942 cmt_string project_file = "cmt"; 5447 5943 project_file += CmtSystem::file_separator (); 5448 5944 project_file += Project::get_project_file_name (); 5449 5945 5450 cmt_string pwd; 5946 /* 5947 cmt_string pwd (CmtSystem::pwd ()); 5948 cmt_string pwd_prev; 5949 */ 5950 cmt_string dir_cur (current_path); 5951 cmt_string dir_par; 5952 5953 cmt_string proj_file_cur; 5451 5954 5452 5955 for (;;) 5453 5956 { 5454 pwd = CmtSystem::pwd (); 5957 /* 5958 // pwd = CmtSystem::pwd (); 5455 5959 if (CmtSystem::test_file (project_file)) 5456 5960 { … … 5462 5966 break; 5463 5967 } 5464 5465 log << "pwd=" << CmtSystem::pwd () << log_endl; 5968 */ 5969 proj_file_cur = dir_cur; 5970 proj_file_cur += CmtSystem::file_separator (); 5971 proj_file_cur += project_file; 5972 if (CmtSystem::test_file (proj_file_cur)) 5973 { 5974 //this directory should become the first entry of the CMTPATH 5975 5976 IProjectFactory& factory = ProjectFactory::instance (); 5977 factory.create_project ("", dir_cur, "CurrentProject", 0); 5978 5979 break; 5980 } 5981 5982 /* 5983 log << "pwd=" << pwd << log_endl; 5466 5984 5467 5985 if (!CmtSystem::cd ("..")) … … 5471 5989 } 5472 5990 5473 if (CmtSystem::pwd () == pwd) 5991 pwd_prev = pwd; 5992 pwd = CmtSystem::pwd (); 5993 if (pwd == pwd_prev) 5994 // if (CmtSystem::pwd () == pwd) 5474 5995 { 5475 5996 log << "Looks the same pwd..." << log_endl; 5476 5997 break; 5477 5998 } 5478 } 5479 5480 CmtSystem::cd (Me.m_current_dir); 5481 } 5999 */ 6000 log << "dir_cur=`" << dir_cur << "'" << log_endl; 6001 CmtSystem::dirname (dir_cur, dir_par); 6002 if (dir_par == dir_cur) 6003 { 6004 log << "Looks the same dir_cur..." << log_endl; 6005 break; 6006 } 6007 dir_cur = dir_par; 6008 } 6009 6010 // CmtSystem::cd (Me.m_current_dir); 6011 } // if (Project::find_in_cmt_paths (current_path) == "") 5482 6012 5483 6013 //cmt_string buffer = "path CMTPATH \n"; … … 5487 6017 // Use& use = Use::current(); 5488 6018 6019 bool autoconfigure_cmtpath_saved (Me.m_autoconfigure_cmtpath); 6020 Me.m_autoconfigure_cmtpath = false; 5489 6021 bool save_quiet = Me.m_quiet; 5490 6022 Me.m_quiet = true; … … 5493 6025 5494 6026 Me.m_quiet = save_quiet; 5495 5496 Me.m_autoconfigure_cmtpath = true; 5497 5498 CmtSystem::cd (here); 6027 Me.m_autoconfigure_cmtpath = autoconfigure_cmtpath_saved; 6028 // Me.m_autoconfigure_cmtpath = true; 6029 6030 // CmtSystem::cd (Me.m_current_dir); 6031 //CmtSystem::cd (here); 5499 6032 } 5500 6033 … … 5966 6499 fprintf (f, "endif\n"); 5967 6500 fprintf (f, "source ${CMTROOT}/mgr/setup.csh\n"); 5968 fprintf (f, "set cmt%stempfile=`${CMTROOT}/ mgr/cmt-quiet build temporary_name`\n", mangled_package.c_str ());6501 fprintf (f, "set cmt%stempfile=`${CMTROOT}/${CMTBIN}/cmt.exe -quiet build temporary_name`\n", mangled_package.c_str ()); 5969 6502 fprintf (f, "if $status != 0 then\n set cmt%stempfile=/tmp/cmt.$$\nendif\n", mangled_package.c_str ()); 5970 //fprintf (f, "${CMTROOT}/mgr/cmt setup -%s " 5971 fprintf (f, "${CMTROOT}/mgr/cmt %s -%s " 6503 fprintf (f, "${CMTROOT}/${CMTBIN}/cmt.exe %s -%s " 5972 6504 "-pack=%s -version=%s -path=%s %s $* >${cmt%stempfile}\n", 5973 6505 action.c_str (), … … 5980 6512 fprintf (f, 5981 6513 "if ( $status != 0 ) then\n" 5982 " echo \"${CMTROOT}/ mgr/cmt%s -%s "6514 " echo \"${CMTROOT}/${CMTBIN}/cmt.exe %s -%s " 5983 6515 "-pack=%s -version=%s -path=%s %s $* >${cmt%stempfile}\"\n" 5984 6516 " set cmt%sstatus=2\n" … … 6026 6558 fprintf (f, "fi\n"); 6027 6559 fprintf (f, ". ${CMTROOT}/mgr/setup.sh\n"); 6028 fprintf (f, "cmt%stempfile=`${CMTROOT}/ mgr/cmt-quiet build temporary_name`\n", mangled_package.c_str ());6560 fprintf (f, "cmt%stempfile=`${CMTROOT}/${CMTBIN}/cmt.exe -quiet build temporary_name`\n", mangled_package.c_str ()); 6029 6561 fprintf (f, "if test ! $? = 0 ; then cmt%stempfile=/tmp/cmt.$$; fi\n", mangled_package.c_str ()); 6030 //fprintf (f, "${CMTROOT}/mgr/cmt setup -%s " 6031 fprintf (f, "${CMTROOT}/mgr/cmt %s -%s " 6562 fprintf (f, "${CMTROOT}/${CMTBIN}/cmt.exe %s -%s " 6032 6563 "-pack=%s -version=%s -path=%s %s $* >${cmt%stempfile}\n", 6033 6564 action.c_str (), … … 6040 6571 fprintf (f, 6041 6572 "if test $? != 0 ; then\n" 6042 " echo >&2 \"${CMTROOT}/ mgr/cmt%s -%s "6573 " echo >&2 \"${CMTROOT}/${CMTBIN}/cmt.exe %s -%s " 6043 6574 "-pack=%s -version=%s -path=%s %s $* >${cmt%stempfile}\"\n" 6044 6575 " cmt%sstatus=2\n" … … 6074 6605 else if (mode[i] == Bat) 6075 6606 { 6076 //fprintf (f, "rem Setting %s %s in %%~d0%%~p0\n",6077 6607 fprintf (f, "rem %s %s %s in %%~d0%%~p0\n", 6078 6608 action.c_str (), … … 6409 6939 6410 6940 /** 6411 * See reach_current_packagefor an explanation of this call6941 * See apply_globals for an explanation of this call 6412 6942 */ 6413 6943 Pattern::apply_all_globals (); … … 6444 6974 Me.m_action = action_none; 6445 6975 6446 restore_all_tags (0);6976 // restore_all_tags (0); 6447 6977 6448 6978 #ifdef WIN32 … … 6481 7011 int Cmt::parser (int argc, char* argv[]) 6482 7012 { 7013 // save CMTFLAGS 7014 cmt_string cmtflags (get_cmt_flags ()); 7015 7016 clear (); 7017 Me.initialize (); 7018 6483 7019 ArgParser ap (Me); 6484 7020 … … 6493 7029 } 6494 7030 6495 // save CMTFLAGS 6496 cmt_string cmtflags (get_cmt_flags ()); 6497 6498 clear (); 7031 // clear (); 7032 7033 // Me.clear (); 7034 7035 parse_arguments (ap); 7036 // Copy ap.mode into cmt_context member/instance 7037 set_print_mode (ap.mode); 6499 7038 6500 7039 // configure (); 6501 configure (ap); 6502 6503 CmtError::clear (); 7040 switch (Me.m_action) 7041 { 7042 case action_none : 7043 case action_build_temporary_name : 7044 case action_help : 7045 break; 7046 default: 7047 configure (ap); 7048 break; 7049 } 7050 7051 // CmtError::clear (); 6504 7052 6505 7053 /* 6506 Set private if positioned inside the package7054 Set DeveloperMode if positioned inside the package 6507 7055 (which is detected since we were able to retreive the 6508 7056 Version, Package and Path) 6509 7057 */ 6510 7058 7059 if (!Use::current().located ()) 7060 /* 6511 7061 if ((Me.m_current_path.size () == 0) || 6512 7062 (Me.m_current_package.size () == 0) || 6513 7063 (Me.m_current_version.size () == 0)) 7064 */ 6514 7065 { 6515 7066 Me.m_current_access = UserMode; … … 6520 7071 } 6521 7072 6522 parse_arguments (ap);7073 // parse_arguments (ap); 6523 7074 6524 7075 if (ap.help_action == action_help) … … 6826 7377 switch (Me.m_action) 6827 7378 { 6828 case action_none :7379 //case action_none : 6829 7380 case action_awk : 6830 7381 case action_broadcast : … … 6929 7480 Me.m_warnings = false; 6930 7481 if (strlen (ap.extra_file.c_str ()) == 0) 6931 reach_current_package (); 7482 use_current_package (); 7483 // reach_current_package (); 6932 7484 else 6933 7485 use_extra_file (ap.extra_file); … … 6935 7487 if (strlen (ap.extra_line.c_str ()) > 0) 6936 7488 SyntaxParser::parse_requirements_text (ap.extra_line, "extra statement(s)", (Use*) 0); 7489 apply_globals (); 6937 7490 Me.m_warnings = w; 6938 //if (strlen (ap.extra_line.c_str ()) > 0) SyntaxParser::parse_requirements_line (ap.extra_line, &(Use::current ()));6939 7491 } 6940 7492 break; … … 6952 7504 if (use != 0 && !use->discarded && !use->m_hidden && use->located ()) 6953 7505 uses.push_back (use); 6954 uses.push_back (&(Use::current())); 7506 use = &(Use::current()); 7507 if (use != 0 && !use->discarded && !use->m_hidden && use->located ()) 7508 uses.push_back (use); 7509 // uses.push_back (&(Use::current())); 6955 7510 use = Use::find (CmtSystem::get_user_context_package ()); 6956 7511 if (use != 0 && !use->discarded && !use->m_hidden && use->located ()) … … 7424 7979 * joined with semi-colons to form one shell command. 7425 7980 */ 7426 void Cmt::print (PrintMode mode )7981 void Cmt::print (PrintMode mode, ostream& out) 7427 7982 { 7428 7983 Use::UsePtrVector& Uses = Use::get_ordered_uses (); … … 7452 8007 // 7453 8008 8009 /* 7454 8010 { 7455 8011 CmtSystem::cmt_string_vector words; … … 7477 8033 } 7478 8034 } 7479 8035 */ 7480 8036 if (mode == Requirements) 7481 8037 { … … 7487 8043 if (tag != 0) 7488 8044 { 7489 tag->show (true, cout, "apply_tag ");8045 tag->show (true, out, "apply_tag "); 7490 8046 } 7491 8047 } … … 7508 8064 if (use.m_hidden) continue; 7509 8065 7510 print_context (use, mode, tag );7511 } 7512 } 7513 7514 print_context (Use::current (), mode, tag );8066 print_context (use, mode, tag, out); 8067 } 8068 } 8069 8070 print_context (Use::current (), mode, tag, out); 7515 8071 7516 8072 if (Me.m_debug) … … 7519 8075 } 7520 8076 7521 Symbol::all_print (mode );8077 Symbol::all_print (mode, out); 7522 8078 // Script::all_print (mode); 7523 8079 … … 7532 8088 break; 7533 8089 default : 7534 cout << endl;8090 out << endl; 7535 8091 break; 7536 8092 } … … 7638 8194 7639 8195 //---------------------------------------------------------- 7640 void Cmt::print_context (Use& use, PrintMode mode, const cmt_string& tag )8196 void Cmt::print_context (Use& use, PrintMode mode, const cmt_string& tag, ostream& out) 7641 8197 { 7642 8198 if (use.get_package_name () == "cmt_standalone") return; … … 7654 8210 switch (mode) 7655 8211 { 8212 case Xml : 7656 8213 case Requirements : 7657 8214 break; … … 7670 8227 if (do_root) 7671 8228 { 7672 cout << "setenv " << prefix << "ROOT \"" <<8229 out << "setenv " << prefix << "ROOT \"" << 7673 8230 use.get_full_path () << "\"" << endl; 7674 8231 } … … 7676 8233 if (use.get_package_name () == "CMT") 7677 8234 { 7678 cout << "setenv CMTCONFIG " << system << endl;8235 out << "setenv CMTCONFIG " << system << endl; 7679 8236 } 7680 8237 else … … 7682 8239 if (do_config) 7683 8240 { 7684 cout << "setenv " << prefix << "CONFIG \"" << tag << "\"" << endl;8241 out << "setenv " << prefix << "CONFIG \"" << tag << "\"" << endl; 7685 8242 } 7686 8243 } … … 7690 8247 if (do_root) 7691 8248 { 7692 cout << prefix << "ROOT=\"" <<8249 out << prefix << "ROOT=\"" << 7693 8250 use.get_full_path () << "\"; export " << 7694 8251 prefix << "ROOT" << endl; … … 7697 8254 if (use.get_package_name () == "CMT") 7698 8255 { 7699 cout << "CMTCONFIG=" << system << "; export CMTCONFIG" << endl;8256 out << "CMTCONFIG=" << system << "; export CMTCONFIG" << endl; 7700 8257 } 7701 8258 else … … 7703 8260 if (do_config) 7704 8261 { 7705 cout << prefix << "CONFIG=\"" <<8262 out << prefix << "CONFIG=\"" << 7706 8263 tag << "\"; export " << 7707 8264 prefix << "CONFIG" << endl; … … 7713 8270 if (do_root) 7714 8271 { 7715 cout << "set " << prefix << "ROOT=" <<8272 out << "set " << prefix << "ROOT=" << 7716 8273 CmtSystem::quote (use.get_full_path (), " \t") << endl; 7717 8274 } … … 7719 8276 if (use.get_package_name () == "CMT") 7720 8277 { 7721 cout << "set CMTCONFIG=" << system << endl;8278 out << "set CMTCONFIG=" << system << endl; 7722 8279 } 7723 8280 else … … 7725 8282 if (do_config) 7726 8283 { 7727 cout << "set " << prefix << "CONFIG=" << CmtSystem::quote (tag, " \t") << endl;8284 out << "set " << prefix << "CONFIG=" << CmtSystem::quote (tag, " \t") << endl; 7728 8285 } 7729 8286 } … … 7733 8290 if (do_root) 7734 8291 { 7735 cout << "<variable><name>" << prefix << "ROOT</name>"7736 8292 out << "<variable><name>" << prefix << "ROOT</name>" 8293 << "<value>" << use.get_full_path () << "</value></variable>"; 7737 8294 } 7738 8295 7739 8296 if (use.get_package_name () == "CMT") 7740 8297 { 7741 cout << "<variable><name>CMTCONFIG</name>"7742 8298 out << "<variable><name>CMTCONFIG</name>" 8299 << "<value>" << system << "</value></variable>"; 7743 8300 } 7744 8301 else … … 7746 8303 if (do_config) 7747 8304 { 7748 cout << "<variable><name>" << prefix << "CONFIG</name>"7749 8305 out << "<variable><name>" << prefix << "CONFIG</name>" 8306 << "<value>" << tag << "</value></variable>"; 7750 8307 } 7751 8308 } … … 7756 8313 use.get_package_name () != "CMT") 7757 8314 { 7758 cout << "set " << use.prefix << "ROOT " <<8315 out << "set " << use.prefix << "ROOT " << 7759 8316 CmtSystem::quote (use.get_full_path (), " \t") << endl; 7760 8317 … … 7775 8332 if (use.get_package_name () == "CMT") 7776 8333 { 7777 cout << "set CMTCONFIG " << system << endl;8334 out << "set CMTCONFIG " << system << endl; 7778 8335 } 7779 8336 else … … 7781 8338 if (do_config) 7782 8339 { 7783 cout << "set " << use.prefix << "CONFIG " << CmtSystem::quote (tag, " \t") << endl; 8340 out << "set " << use.prefix << "CONFIG " << CmtSystem::quote (tag, " \t") << endl; 8341 8342 cmt_string name (use.prefix + "CONFIG"); 8343 Symbol* symbol = Symbol::find (name); 8344 if (symbol != 0) 8345 { 8346 symbol->printed = true; 8347 } 8348 if (symbol == 0 || symbol->type != Symbol::SymbolMacro) 8349 { 8350 CmtMessage::warning 8351 (CmtError::get_error_name (CmtError::symbol_not_found) 8352 + ": macro " + name); 8353 } 7784 8354 } 7785 8355 } … … 7939 8509 7940 8510 //---------------------------------------------------------- 7941 int Cmt:: reach_current_package ()8511 int Cmt::use_current_package () 7942 8512 { 7943 8513 Use& use = Use::current (); … … 7946 8516 if (Me.m_debug) 7947 8517 { 7948 cout << "Cmt:: reach_current_package> pwd = "8518 cout << "Cmt::use_current_package> pwd = " 7949 8519 << CmtSystem::pwd () 7950 8520 << " path=" << Me.m_current_path … … 7959 8529 if (Me.m_current_package == "cmt_standalone") 7960 8530 { 7961 if ((Me.m_current_path != "") && (Me.m_current_path != CmtSystem::pwd ())) 8531 if ((Me.m_current_path != "") && (Me.m_current_path != Me.m_current_dir)) 8532 // if ((Me.m_current_path != "") && (Me.m_current_path != CmtSystem::pwd ())) 7962 8533 { 7963 8534 if (!CmtSystem::cd (Me.m_current_path)) 7964 8535 { 7965 8536 CmtError::set (CmtError::package_not_found, 7966 "ReachCurrentPackage> Cannot reach the path directory"); 8537 "Cannot reach the path directory: " 8538 + Me.m_current_path); 7967 8539 return (0); 7968 8540 } … … 7975 8547 7976 8548 Me.m_current_structuring_style = without_version_directory; 8549 use.structuring_style = Me.m_current_structuring_style; 8550 use.change_path (Me.m_current_path, Project::get_current ()); 8551 Me.m_current_access = DeveloperMode; 7977 8552 } 7978 8553 else if (Me.m_current_package != "") 7979 8554 { 7980 if (!use.move_to () && !use.move_to ("", true)) 7981 // if (!use.move_to ()) 7982 { 7983 CmtError::set (CmtError::package_not_found, 7984 "ReachCurrentPackage> Cannot reach the path directory"); 7985 return (0); 7986 } 7987 7988 Me.m_current_path = use.real_path; 8555 if (!use.located ()) 8556 { 8557 // if (!use.move_to () && !use.move_to ("", true)) 8558 // if (!use.move_to ()) 8559 if (!use.move_to ()) 8560 { 8561 if (!CmtSystem::cd (Cmt::get_current_dir ())) 8562 { 8563 CmtError::set (CmtError::file_access_error, 8564 Cmt::get_current_dir () 8565 + " (use_current_package)"); 8566 return 0; 8567 } 8568 if (!use.move_to ("", true)) 8569 { 8570 CmtError::set (CmtError::package_not_found, use.get_info ()); 8571 return 0; 8572 } 8573 } 8574 8575 Me.m_current_path = use.real_path; 8576 Me.m_current_access = DeveloperMode; 8577 } 7989 8578 } 7990 8579 else … … 8024 8613 8025 8614 CmtError::set (CmtError::package_not_found, 8026 "ReachCurrentPackage> Cannot reach the mgr/cmt directory"); 8615 "Cannot reach the mgr/cmt directory: " 8616 + use.get_info ()); 8027 8617 return (0); 8028 8618 } … … 8030 8620 else 8031 8621 Me.m_current_style = none_style; 8622 8623 Me.m_current_access = DeveloperMode; 8032 8624 8033 8625 dir = CmtSystem::pwd (); … … 8057 8649 use.style = Me.m_current_style; 8058 8650 use.structuring_style = Me.m_current_structuring_style; 8059 } 8060 8651 8652 configure_current_dir (); 8653 build_prefix (Me.m_current_package, Me.m_current_prefix); 8654 build_config (Me.m_current_prefix, Me.m_current_config); 8655 } 8656 8657 /* 8061 8658 configure_current_dir (); 8062 8659 build_prefix (Me.m_current_package, Me.m_current_prefix); 8063 8660 build_config (Me.m_current_prefix, Me.m_current_config); 8661 */ 8064 8662 8065 8663 /* … … 8067 8665 */ 8068 8666 8069 if (Me.m_debug) cout << " reach_current_package0> current_tag=" << Me.m_current_tag << endl;8667 if (Me.m_debug) cout << "use_current_package0> current_tag=" << Me.m_current_tag << endl; 8070 8668 8071 8669 if (Me.m_current_tag == "") … … 8078 8676 Tag* tag; 8079 8677 8080 tag = Tag::add (env, PriorityConfig, " reachcurrent package", 0);8678 tag = Tag::add (env, PriorityConfig, "current package", 0); 8081 8679 tag->mark (use.get_package_name ()); 8082 8680 //Me.m_current_tag = env; 8083 8681 8084 //if (!Me.m_quiet) cerr << " reach_current_package1> current_tag=" << Me.m_current_tag << endl;8682 //if (!Me.m_quiet) cerr << "use_current_package1> current_tag=" << Me.m_current_tag << endl; 8085 8683 8086 8684 } … … 8100 8698 SyntaxParser::parse_requirements (dir, &use); 8101 8699 8102 if (Me.m_debug) cout << "reach_current_package2> current_tag=" << Me.m_current_tag << endl; 8700 if (CmtError::has_pending_error ()) return 0; 8701 8702 if (Me.m_debug) cout << "use_current_package2> current_tag=" << Me.m_current_tag << endl; 8703 8704 return 1; 8705 } 8706 8707 //---------------------------------------------------------- 8708 int Cmt::use_extra_file (const cmt_string& file) 8709 { 8710 if (!CmtSystem::test_file (file)) 8711 { 8712 CmtError::set (CmtError::path_not_found, file); 8713 return 0; 8714 } 8715 8716 // (almost) Cmt::use_current_package () 8717 Use& use = Use::current (); 8718 /* 8719 Try to access the package. 8720 */ 8721 8722 if (Me.m_current_package == "cmt_standalone") 8723 { 8724 if ((Me.m_current_path != "") && (Me.m_current_path != Me.m_current_dir)) 8725 // if ((Me.m_current_path != "") && (Me.m_current_path != CmtSystem::pwd ())) 8726 { 8727 if (!CmtSystem::cd (Me.m_current_path)) 8728 { 8729 CmtError::set (CmtError::package_not_found, 8730 "Cannot reach the path directory: " 8731 + Me.m_current_path); 8732 return (0); 8733 } 8734 } 8735 /* 8736 if (!CmtSystem::test_file ("requirements")) 8737 { 8738 return (0); 8739 } 8740 */ 8741 Me.m_current_structuring_style = without_version_directory; 8742 use.structuring_style = Me.m_current_structuring_style; 8743 use.change_path (Me.m_current_path, Project::get_current ()); 8744 Me.m_current_access = DeveloperMode; 8745 } 8746 else if (Me.m_current_package != "") 8747 { 8748 if (!use.located ()) 8749 { 8750 // if (!use.move_to () && !use.move_to ("", true)) 8751 // if (!use.move_to ()) 8752 if (!use.move_to ()) 8753 { 8754 if (!CmtSystem::cd (Cmt::get_current_dir ())) 8755 { 8756 CmtError::set (CmtError::file_access_error, 8757 Cmt::get_current_dir () 8758 + " (use_extra_file)"); 8759 return 0; 8760 } 8761 if (!use.move_to ("", true)) 8762 { 8763 CmtError::set (CmtError::package_not_found, use.get_info ()); 8764 return 0; 8765 } 8766 } 8767 8768 Me.m_current_path = use.real_path; 8769 Me.m_current_access = DeveloperMode; 8770 } 8771 } 8772 else 8773 { 8774 // 8775 // The cmt command has been given without explicit search for 8776 // a package. Thus it is expected that we are in the context of a 8777 // true package. 8778 // 8779 // This means that there should be a requirements file visible. 8780 // 8781 // If this is not true, we'll make a try into ../cmt and then 8782 // a last try into ../mgr 8783 // 8784 8785 Me.m_current_access = DeveloperMode; 8786 //... 8787 configure_current_dir (); 8788 build_prefix (Me.m_current_package, Me.m_current_prefix); 8789 build_config (Me.m_current_prefix, Me.m_current_config); 8790 } 8791 8792 /* 8793 configure_current_dir (); 8794 build_prefix (Me.m_current_package, Me.m_current_prefix); 8795 build_config (Me.m_current_prefix, Me.m_current_config); 8796 */ 8797 8798 /* 8799 Check Tag is always set up 8800 */ 8801 8802 if (Me.m_debug) cout << "use_extra_file0> current_tag=" << Me.m_current_tag << endl; 8803 8804 if (Me.m_current_tag == "") 8805 { 8806 cmt_string env; 8807 8808 env = CmtSystem::getenv (Me.m_current_config); 8809 if (env != "") 8810 { 8811 Tag* tag; 8812 8813 tag = Tag::add (env, PriorityConfig, "current package", 0); 8814 tag->mark (use.get_package_name ()); 8815 //Me.m_current_tag = env; 8816 8817 //if (!Me.m_quiet) cerr << "use_extra_file1> current_tag=" << Me.m_current_tag << endl; 8818 8819 } 8820 } 8821 8822 if (Me.m_debug) 8823 { 8824 cout << "pwd = " << CmtSystem::pwd () << endl; 8825 } 8826 8827 /* 8828 Work on the requirements file. 8829 */ 8830 8831 SyntaxParser::parse_requirements (file, &use); 8832 8833 if (CmtError::has_pending_error ()) return 0; 8834 8835 if (Me.m_debug) cout << "use_extra_file2> current_tag=" << Me.m_current_tag << endl; 8836 return 1; 8837 } 8838 8839 //---------------------------------------------------------- 8840 int Cmt::apply_globals () 8841 { 8103 8842 8104 8843 /** … … 8131 8870 Tag::restore_tree (); 8132 8871 8133 return (1); 8134 } 8135 8136 //---------------------------------------------------------- 8137 int Cmt::use_extra_file (const cmt_string& file) 8138 { 8139 if (!CmtSystem::test_file (file)) 8140 { 8141 CmtError::set (CmtError::path_not_found, file); 8142 return 0; 8143 } 8144 8145 // (almost) Cmt::reach_current_package () 8146 Use& use = Use::current (); 8147 /* 8148 Try to access the package. 8149 */ 8150 8151 if (Me.m_current_package == "cmt_standalone") 8152 { 8153 if ((Me.m_current_path != "") && (Me.m_current_path != CmtSystem::pwd ())) 8154 { 8155 if (!CmtSystem::cd (Me.m_current_path)) 8156 { 8157 CmtError::set (CmtError::package_not_found, 8158 "ReachCurrentPackage> Cannot reach the path directory"); 8159 return (0); 8160 } 8161 } 8162 /* 8163 if (!CmtSystem::test_file ("requirements")) 8164 { 8165 return (0); 8166 } 8167 */ 8168 Me.m_current_structuring_style = without_version_directory; 8169 } 8170 else if (Me.m_current_package != "") 8171 { 8172 if (!use.move_to () && !use.move_to ("", true)) 8173 // if (!use.move_to ()) 8174 { 8175 CmtError::set (CmtError::package_not_found, 8176 "ReachCurrentPackage> Cannot reach the path directory"); 8177 // return -1; 8178 return (0); 8179 } 8180 8181 Me.m_current_path = use.real_path; 8182 } 8183 else 8184 { 8185 // 8186 // The cmt command has been given without explicit search for 8187 // a package. Thus it is expected that we are in the context of a 8188 // true package. 8189 // 8190 // This means that there should be a requirements file visible. 8191 // 8192 // If this is not true, we'll make a try into ../cmt and then 8193 // a last try into ../mgr 8194 // 8195 8196 //... 8197 } 8198 8199 configure_current_dir (); 8200 build_prefix (Me.m_current_package, Me.m_current_prefix); 8201 build_config (Me.m_current_prefix, Me.m_current_config); 8202 8203 /* 8204 Check Tag is always set up 8205 */ 8206 8207 if (Me.m_debug) cout << "use_extra_file0> current_tag=" << Me.m_current_tag << endl; 8208 8209 if (Me.m_current_tag == "") 8210 { 8211 cmt_string env; 8212 8213 env = CmtSystem::getenv (Me.m_current_config); 8214 if (env != "") 8215 { 8216 Tag* tag; 8217 8218 tag = Tag::add (env, PriorityConfig, "reach current package", 0); 8219 tag->mark (use.get_package_name ()); 8220 //Me.m_current_tag = env; 8221 8222 //if (!Me.m_quiet) cerr << "use_extra_file1> current_tag=" << Me.m_current_tag << endl; 8223 8224 } 8225 } 8226 8227 if (Me.m_debug) 8228 { 8229 cout << "pwd = " << CmtSystem::pwd () << endl; 8230 } 8231 8232 /* 8233 Work on the requirements file. 8234 */ 8235 8236 SyntaxParser::parse_requirements (file, &use); 8237 8238 if (Me.m_debug) cout << "use_extra_file2> current_tag=" << Me.m_current_tag << endl; 8239 8240 /** 8241 * It would be useful to change this mechanism. Instead of 8242 * applying all global patterns at once to all use contexts, it 8243 * would be much better to apply it at the end of each 8244 * requirements file parsing, and only in the context the 8245 * appropriate Use. 8246 * 8247 * This would avoid the current flaw which is that when a global 8248 * pattern specifies a "private" definition, it is actually 8249 * applied in the scope context of the Current Use and not in 8250 * each individual Use. Therefore the private is lost. 8251 * 8252 * However, this induces problems since some pattern definitions 8253 * are done AFTER the use statements, which will NOT receive the 8254 * pattern aplications. 8255 * 8256 * Therefore it is decided to leave this "bad" mechanism until 8257 * everybody is aware of this constraint. 8258 * 8259 * 8260 */ 8261 Pattern::apply_all_globals (); 8262 8263 /* 8264 Select all possible tags 8265 */ 8266 8267 Tag::restore_tree (); 8268 8269 return (1); 8872 if (CmtError::has_pending_error ()) return 0; 8873 8874 return 1; 8270 8875 } 8271 8876 … … 9676 10281 9677 10282 //---------------------------------------------------------- 10283 /* 9678 10284 void Cmt::set_current_access (AccessMode mode) 9679 10285 { … … 9692 10298 Me.m_scope_filtering_mode = mode; 9693 10299 } 9694 10300 */ 9695 10301 //---------------------------------------------------------- 9696 10302 void Cmt::set_standard_macros () … … 9836 10442 builder.fill_for_constituent_macros (); 9837 10443 } 9838 10444 /* 9839 10445 void Cmt::set_all_sets_done () 9840 10446 { … … 9846 10452 Me.m_all_sets_done = false; 9847 10453 } 9848 10454 */ 9849 10455 //---------------------------------------------------------- 9850 10456 void Cmt::use_cmt () … … 9905 10511 if (CmtSystem::test_file (f)) 9906 10512 { 9907 use->m_located = true; 9908 } 9909 SyntaxParser::parse_requirements (f, use); 10513 use->style = none_style; 10514 use->structuring_style = without_version_directory; 10515 10516 if (name == CmtSystem::get_home_package () || 10517 name == CmtSystem::get_user_context_package ()) 10518 { 10519 const Project::ProjectPtrVector& Ordered = Project::ordered_projects (); 10520 if (0 == Ordered.size ()) 10521 { 10522 if (m_cmt_context.m_use_projects) 10523 { 10524 CmtError::set(CmtError::configuration_error, 10525 "No such ordered project: " + use->get_info ()); 10526 return; 10527 } 10528 else 10529 { 10530 use->change_path (path); 10531 } 10532 } 10533 else 10534 { 10535 if (name == CmtSystem::get_home_package ()) 10536 use->change_path (path, Ordered[Ordered.size () - 1]); 10537 else if (name == CmtSystem::get_user_context_package ()) 10538 use->change_path (path, Ordered[0]); 10539 } 10540 } 10541 else 10542 { 10543 CmtMessage::verbose 10544 (CmtError::get_error_name (CmtError::configuration_error) 10545 + ": Unknown special use: " + use->get_info ()); 10546 use->change_path (path); 10547 } 10548 // use->m_located = true; 10549 SyntaxParser::parse_requirements (f, use); 10550 } 10551 else 10552 { 10553 use->discard (); 10554 } 9910 10555 9911 10556 Me.m_recursive = recursive_copy; … … 9922 10567 { 9923 10568 const cmt_string& s = v[i]; 9924 if (s == "") continue;10569 if (s.size () == 0) continue; 9925 10570 9926 10571 if (result.size () != 0) result += separator; 9927 10572 //if (i > 0) result += separator; 9928 result += v[i];10573 result += s; 9929 10574 } 9930 10575 } -
CMT/v1r25-branch/source/cmt_parser.h
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 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_pattern.cxx
r607 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- … … 771 772 replacement.replace_all ("<version>", context_use->version.c_str ()); 772 773 replacement.replace_all ("<path>", context_use->real_path.c_str ()); 773 774 /* 774 775 cmt_string cmtpath = ""; 775 776 cmt_string offset = ""; … … 779 780 Project* p = Project::find_by_cmtpath (cmtpath); 780 781 if (p != 0) 782 */ 783 if (const Project* p = context_use->get_project ()) 781 784 { 782 const cmt_string& n = p->get_name ();783 replacement.replace_all ("<project>", n.c_str ());785 // const cmt_string& n = p->get_name (); 786 replacement.replace_all ("<project>", p->get_name ().c_str ()); 784 787 } 785 788 -
CMT/v1r25-branch/source/cmt_project.cxx
- Property svn:mergeinfo changed
/CMT/HEAD/source/cmt_project.cxx merged: 652,663
r646 r664 1 2 1 //----------------------------------------------------------- 3 2 // Copyright Christian Arnault LAL-Orsay CNRS 4 3 // arnault@lal.in2p3.fr 5 4 // Modified by garonne@lal.in2p3.fr 5 // Modified by Grigory Rybkin 6 6 // See the complete license in cmt_license.txt "http://www.cecill.info". 7 7 //----------------------------------------------------------- … … 646 646 project_use->m_hidden = true; 647 647 project_use->selected = true; 648 project_use->m_located = true; 648 project_use->change_path (project->get_cmtpath(), project); 649 // project_use->m_located = true; 649 650 cmt_map <Use*, bool> visited; 650 651 project_use->set_auto_imports(Unspecified, Off, visited); … … 864 865 static ProjectVector& Projects = projects (); 865 866 866 Project* result = 0;867 868 867 for (int i = (Projects.size () - 1); i >= 0; i--) 869 868 { … … 879 878 // if (here_real.find (p.m_cmtpath_real) == 0) 880 879 { 881 re sult =&p;882 } 883 } 884 885 return (result);880 return &p; 881 } 882 } 883 884 return 0; 886 885 } 887 886 … … 1523 1522 1524 1523 //---------------------------------------------------------- 1525 void Project::fill_selection (int depth, CmtSystem::cmt_string_vector& path_selections) 1524 /** 1525 * Fill with projects (pointers) for CMTPATH entries >=1 and <= depth 1526 * except for CMTUSERCONTEXT project or CMTHOME project 1527 * unless either is current project. 1528 * Special values of depth: 1529 * 0: CMTUSERCONTEXT project only 1530 * -1: CMTHOME project only 1531 * 1532 * @param depth in CMTPATH up to which fill 1533 * @param path_selections vector to fill 1534 */ 1535 void Project::fill_selection (int depth, ConstProjectPtrVector& path_selections) 1536 { 1537 static ProjectPtrVector& Ordered = Project::ordered_projects (); 1538 int curdepth = depth; 1539 for (int i = 0; i < Ordered.size (); i++) 1540 { 1541 const Project* project = Ordered[i]; 1542 const cmt_string& src = project->get_cmtpath_source (); 1543 1544 if (src == "default path") continue; 1545 1546 if (depth > 0) 1547 { 1548 // project for CMTPATH entries >=1 and <= depth 1549 // except for CMTUSERCONTEXT path or CMTHOME path 1550 // OR 1551 // CMTUSERCONTEXT path if it's current project 1552 // CMTHOME path if it's current project 1553 if (i == 0 1554 && !project->is_current () 1555 && src == "CMTUSERCONTEXT") continue; 1556 // this is CMTUSERCONTEXT 1557 if (i == Ordered.size () - 1 1558 && !project->is_current () 1559 && src == "CMTHOME") continue; 1560 // this is CMTHOME 1561 path_selections.push_back (project); 1562 //cerr << "fill: " << i << ": " << project->get_cmtpath () << ": " << curdepth << endl; 1563 if (--curdepth == 0) break; 1564 } 1565 else if (depth == 0) 1566 { 1567 // CMTUSERCONTEXT path only 1568 if (i == 0 1569 && src == "CMTUSERCONTEXT") 1570 { 1571 path_selections.push_back (project); 1572 break; 1573 } 1574 } 1575 else if (depth == -1) 1576 { 1577 // CMTHOME path only 1578 if (i == Ordered.size () - 1 1579 && src == "CMTHOME") 1580 { 1581 path_selections.push_back (project); 1582 break; 1583 } 1584 } 1585 } 1586 } 1587 1588 //---------------------------------------------------------- 1589 // void Project::fill_selection (int depth, CmtSystem::cmt_string_vector& path_selections) 1590 // { 1591 // static ProjectPtrVector& Ordered = Project::ordered_projects (); 1592 // int curdepth = depth; 1593 // for (int i = 0; i < Ordered.size (); i++) 1594 // { 1595 // const Project* project = Ordered[i]; 1596 1597 // const cmt_string& p = project->get_cmtpath (); 1598 // const cmt_string& pwd = project->get_cmtpath_pwd (); 1599 // const cmt_string& p_real = project->get_cmtpath_real (); 1600 // const cmt_string& src = project->get_cmtpath_source (); 1601 1602 // if (src == "default path") continue; 1603 1604 // if (depth > 0) 1605 // { 1606 // // packages from CMTPATH entries >=1 and <= depth 1607 // // except for CMTUSERCONTEXT path or CMTHOME path 1608 // // OR 1609 // // CMTUSERCONTEXT path if it's current project 1610 // // CMTHOME path if it's current project 1611 // if (i == 0 1612 // && !project->is_current () 1613 // && src == "CMTUSERCONTEXT") continue; 1614 // // this is CMTUSERCONTEXT 1615 // if (i = Ordered.size () - 1 1616 // && !project->is_current () 1617 // && src == "CMTHOME") continue; 1618 // // this is CMTHOME 1619 // cmt_string& s1 = path_selections.add (); 1620 // s1 = p; 1621 // if (pwd != p) 1622 // { 1623 // cmt_string& s2 = path_selections.add (); 1624 // s2 = pwd; 1625 // } 1626 // if (p_real != p && p_real != pwd) 1627 // { 1628 // cmt_string& s3 = path_selections.add (); 1629 // s3 = p_real; 1630 // } 1631 // if (--curdepth == 0) break; 1632 // } 1633 // else if (depth == 0) 1634 // { 1635 // // CMTUSERCONTEXT path only 1636 // if (i == 0 1637 // && src == "CMTUSERCONTEXT") 1638 // { 1639 // cmt_string& s1 = path_selections.add (); 1640 // s1 = p; 1641 // if (pwd != p) 1642 // { 1643 // cmt_string& s2 = path_selections.add (); 1644 // s2 = pwd; 1645 // } 1646 // if (p_real != p && p_real != pwd) 1647 // { 1648 // cmt_string& s3 = path_selections.add (); 1649 // s3 = p_real; 1650 // } 1651 // break; 1652 // } 1653 // } 1654 // else if (depth == -1) 1655 // { 1656 // // CMTHOME path only 1657 // if (i = Ordered.size () - 1 1658 // && src == "CMTHOME") 1659 // { 1660 // cmt_string& s1 = path_selections.add (); 1661 // s1 = p; 1662 // if (pwd != p) 1663 // { 1664 // cmt_string& s2 = path_selections.add (); 1665 // s2 = pwd; 1666 // } 1667 // if (p_real != p && p_real != pwd) 1668 // { 1669 // cmt_string& s3 = path_selections.add (); 1670 // s3 = p_real; 1671 // } 1672 // break; 1673 // } 1674 // } 1675 // // if (depth > 0) 1676 // // { 1677 // // cmt_string& s1 = path_selections.add (); 1678 // // s1 = p; 1679 // // if (pwd != p) 1680 // // { 1681 // // cmt_string& s2 = path_selections.add (); 1682 // // s2 = pwd; 1683 // // } 1684 // // if (p_real != p && p_real != pwd) 1685 // // { 1686 // // cmt_string& s3 = path_selections.add (); 1687 // // s3 = p_real; 1688 // // } 1689 // // if (src != "CMTHOME" && src != "CMTUSERCONTEXT") 1690 // // depth--; 1691 1692 // // if (depth == 0) break; 1693 // // } 1694 1695 // } 1696 // } 1697 1698 //---------------------------------------------------------- 1699 /** 1700 * Fill with projects (pointers) for CMTUSERCONTEXT and CMTHOME projects 1701 * (if any exists) 1702 * unless either is current project. 1703 * 1704 * @param path_exclusions vector to fill 1705 */ 1706 void Project::fill_exclusion (ConstProjectPtrVector& path_exclusions) 1526 1707 { 1527 1708 static ProjectPtrVector& Ordered = Project::ordered_projects (); … … 1529 1710 { 1530 1711 const Project* project = Ordered[i]; 1531 1532 const cmt_string& p = project->get_cmtpath ();1533 const cmt_string& pwd = project->get_cmtpath_pwd ();1534 const cmt_string& p_real = project->get_cmtpath_real ();1535 1712 const cmt_string& src = project->get_cmtpath_source (); 1536 /* 1537 static ProjectVector& Projects = projects (); 1538 1539 for (int i = 0; i < Projects.size (); i++) 1540 { 1541 Project& project = Projects[i]; 1542 1543 const cmt_string& p = project.get_cmtpath (); 1544 const cmt_string& pwd = project.get_cmtpath_pwd (); 1545 const cmt_string& p_real = project.get_cmtpath_real (); 1546 const cmt_string& src = project.get_cmtpath_source (); 1547 */ 1548 if (src != "default path") 1549 { 1550 if (depth > 0) 1551 { 1552 cmt_string& s1 = path_selections.add (); 1553 s1 = p; 1554 if (pwd != p) 1555 { 1556 cmt_string& s2 = path_selections.add (); 1557 s2 = pwd; 1558 } 1559 if (p_real != p && p_real != pwd) 1560 { 1561 cmt_string& s3 = path_selections.add (); 1562 s3 = p_real; 1563 } 1564 if (src != "CMTHOME" && src != "CMTUSERCONTEXT") 1565 depth--; 1566 1567 if (depth == 0) break; 1568 } 1569 } 1713 1714 if (!project->is_current () 1715 && (src == "CMTUSERCONTEXT" || src == "CMTHOME")) 1716 path_exclusions.push_back (project); 1570 1717 } 1571 1718 } … … 1694 1841 // } 1695 1842 1696 if (path_real.find (p_real) != cmt_string::npos)1843 if (path_real.find (p_real) == 0) //!= cmt_string::npos) 1697 1844 { 1698 1845 return (p); … … 1700 1847 1701 1848 // To become the current area, a path must correspond to the current package 1702 if (path.find (w) != cmt_string::npos)1849 if (path.find (w) == 0)// != cmt_string::npos) 1703 1850 { 1704 1851 return (p); … … 1706 1853 } 1707 1854 1855 /* This code is never used since p is returned above 1708 1856 if (p == w) continue; 1709 1857 … … 1711 1859 // if (CmtSystem::test_directory (w)) 1712 1860 { 1713 if (path.find (w) != cmt_string::npos)1861 if (path.find (w) == 0)// != cmt_string::npos) 1714 1862 { 1715 1863 return (w); 1716 1864 } 1717 1865 } 1866 */ 1718 1867 } 1719 1868 … … 2362 2511 use->get_package ()->remove_use (use); 2363 2512 CmtSystem::cd (m_cmtpath_pwd); 2364 if (use->move_to ("", true) && 2365 !CmtSystem::absolute_path (use->real_path)) 2366 { 2367 use->change_path (m_cmtpath_pwd); 2368 } 2513 if (use->move_to ("", true)) 2514 { 2515 if (use->get_realpath ().find (this->get_cmtpath_real ()) == 0) 2516 use->set_project (this); 2517 } 2518 else 2519 if (0 == CmtSystem::getenv ("CMTPEDANTIC").size () && 2520 0 == CmtSystem::getenv ("PEDANTIC").size ()) 2521 CmtMessage::warning 2522 (CmtError::get_error_name (CmtError::configuration_error) 2523 + ": Cannot locate container: " + use->get_info ()); 2524 else 2525 CmtError::set(CmtError::configuration_error, 2526 "Cannot locate container: " + use->get_info ()); 2527 2369 2528 CmtSystem::cd (m_cmtpath_pwd + CmtSystem::file_separator () + "cmt"); 2529 2530 if (CmtError::get_last_error_code () == CmtError::configuration_error) 2531 return; 2370 2532 2371 2533 set_container_name (name); - Property svn:mergeinfo changed
-
CMT/v1r25-branch/source/cmt_project.h
r608 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 //----------------------------------------------------------- … … 97 98 typedef cmt_vector<Project> ProjectVector; 98 99 typedef cmt_vector<Project*> ProjectPtrVector; 100 typedef cmt_vector<const Project*> ConstProjectPtrVector; 99 101 100 102 static bool create (const cmt_string& name, … … 120 122 static const cmt_string& get_project_file_name (); 121 123 122 static void fill_selection (int depth, CmtSystem::cmt_string_vector& path_selections); 124 static void fill_selection (int depth, ConstProjectPtrVector& path_selections); 125 // static void fill_selection (int depth, CmtSystem::cmt_string_vector& path_selections); 126 static void fill_exclusion (ConstProjectPtrVector& path_exclusions); 123 127 124 128 static void broadcast (IProjectAction& action); -
CMT/v1r25-branch/source/cmt_regexp.cxx
r607 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_regexp.h
r581 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_std.h
r637 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 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_string.cxx
r610 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_string.h
r610 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_symbol.cxx
r637 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- … … 15 16 #include "cmt_database.h" 16 17 #include "cmt_log.h" 18 #include "cmt_error.h" 17 19 18 20 // Global inhibitor of any display … … 42 44 const cmt_string clean (const Symbol& symbol, 43 45 const cmt_string& tag_name = ""); 46 47 void filter_path_value (const Symbol& symbol, 48 cmt_string& value, 49 const cmt_string& tag_name = "") const; 50 void filter_path_value (const Symbol& symbol, 51 CmtSystem::cmt_string_vector& value, 52 const cmt_string& tag_name = "") const; 53 inline const bool& get_strip_path () const; 54 inline void set_strip_path (const bool& strip_path); 55 56 static PathBuilder* get_path_builder (); 57 58 private: 59 PathBuilder (); 60 PathBuilder (bool strip_path); 61 PathBuilder (const PathBuilder& other); 62 PathBuilder& operator = (const PathBuilder& other); 63 64 bool m_strip_path; 44 65 }; 45 66 //------------------------------------------------------------- … … 248 269 } 249 270 271 // 272 // Global cache 273 // 274 namespace 275 { 276 cmt_vmap <cmt_string, cmt_string> cmdoutputs; 277 } 250 278 /** 251 279 … … 285 313 int start = 0; 286 314 315 // static cmt_vmap <cmt_string, cmt_string> cmdoutputs; 316 287 317 for (;;) 288 318 { … … 337 367 // to be applied. The output of the command is then substituted 338 368 369 Symbol::all_set (); 370 339 371 cmt_string result; 340 341 Symbol::all_set (); 342 CmtSystem::execute (command, result); 343 344 /* 345 int pos; 346 pos = result.find ('\n'); 347 if (pos != cmt_string::npos) result.erase (pos); 348 pos = result.find ('\r'); 349 if (pos != cmt_string::npos) result.erase (pos); 350 */ 351 process_cmd_output (result); 352 353 if (Cmt::get_debug ()) 354 { 355 cout << "resolve_value: Executing [" << command << "] to expand a symbol value =>[" 356 << result << "]" << endl; 357 } 358 372 const cmt_string * presult; 373 if (!(presult = cmdoutputs.find (command))) 374 { 375 CmtSystem::execute (command, result); 376 377 process_cmd_output (result); 378 cmdoutputs.add (command, result); 379 if (Cmt::get_debug ()) 380 { 381 cout << "resolve_value: Executing [" << command << "] to expand a symbol value =>[" 382 << result << "]" << endl; 383 } 384 } 385 else 386 { 387 result = *presult; 388 if (Cmt::get_debug ()) 389 { 390 cout << "resolve_value: Found in cache [" << command << "] to expand a symbol value =>[" 391 << result << "]" << endl; 392 } 393 } 394 359 395 text.replace_all (pattern, result); 360 396 … … 378 414 else 379 415 { 416 if (Cmt::get_env_access () || 417 Symbol::std_env_vars ().has (symbol_name)) 418 { 380 419 // Symbol not found. Look for env. variable 381 420 cmt_string value = CmtSystem::getenv (symbol_name); 382 383 421 // When the env. variable is not defined, the replacement is empty 384 422 // thus all $(xxx) ${xxx} %xxx% patterns are always filtered away. 385 423 text.replace_all (pattern, value); 386 424 425 if (Cmt::get_debug ()) 426 { 427 cerr << "resolve_value: getenv (" << symbol_name 428 << ") => " << value << endl; 429 } 387 430 // The substitution will restart from the same place 388 431 // allowing for recursive replacements 389 432 start = begin; 433 } 434 else 435 { 436 if (Cmt::get_debug ()) 437 { 438 cerr << "resolve_value: getenv (" << symbol_name 439 << ") denied" << endl; 440 } 441 CmtError::set (CmtError::warning, 442 "getenv (" + symbol_name + ") denied"); 443 return; 444 } 390 445 } 391 446 } … … 484 539 // to be applied. The output of the command is substituted 485 540 541 Symbol::all_set (); 542 486 543 cmt_string result; 487 488 Symbol::all_set (); 489 CmtSystem::execute (command, result); 490 491 /* 492 int pos; 493 pos = result.find ('\n'); 494 if (pos != cmt_string::npos) result.erase (pos); 495 pos = result.find ('\r'); 496 if (pos != cmt_string::npos) result.erase (pos); 497 */ 498 process_cmd_output (result); 499 500 if (Cmt::get_debug ()) 501 { 502 cout << " Executing [" << command << "] to expand a macro value =>[" 503 << result << "]" << endl; 504 } 505 544 const cmt_string * presult; 545 if (!(presult = cmdoutputs.find (command))) 546 { 547 CmtSystem::execute (command, result); 548 549 process_cmd_output (result); 550 cmdoutputs.add (command, result); 551 if (Cmt::get_debug ()) 552 { 553 cout << "resolve_value_for_macros: Executing [" << command << "] to expand a symbol value =>[" 554 << result << "]" << endl; 555 } 556 } 557 else 558 { 559 result = *presult; 560 if (Cmt::get_debug ()) 561 { 562 cout << "resolve_value_for_macros: Found in cache [" << command << "] to expand a symbol value =>[" 563 << result << "]" << endl; 564 } 565 } 566 506 567 text.replace_all (pattern, result); 507 568 … … 621 682 // to be applied. The output of the command is substituted 622 683 684 Symbol::all_set (); 685 623 686 cmt_string result; 624 625 Symbol::all_set (); 626 CmtSystem::execute (command, result); 627 628 /* 629 int pos; 630 pos = result.find ('\n'); 631 if (pos != cmt_string::npos) result.erase (pos); 632 pos = result.find ('\r'); 633 if (pos != cmt_string::npos) result.erase (pos); 634 */ 635 process_cmd_output (result); 636 637 if (Cmt::get_debug ()) 638 { 639 cout << " Executing [" << command << "] to expand a macro value =>[" 640 << result << "]" << endl; 641 } 642 687 const cmt_string * presult; 688 if (!(presult = cmdoutputs.find (command))) 689 { 690 CmtSystem::execute (command, result); 691 692 process_cmd_output (result); 693 cmdoutputs.add (command, result); 694 if (Cmt::get_debug ()) 695 { 696 cout << "suppress_OS_delimiters: Executing [" << command << "] to expand a symbol value =>[" 697 << result << "]" << endl; 698 } 699 } 700 else 701 { 702 result = *presult; 703 if (Cmt::get_debug ()) 704 { 705 cout << "suppress_OS_delimiters: Found in cache [" << command << "] to expand a symbol value =>[" 706 << result << "]" << endl; 707 } 708 } 709 643 710 text.replace_all (pattern, result); 644 711 … … 692 759 { 693 760 static SetBuilder Set; 694 static PathBuilder Path; 761 static PathBuilder* PathPtr (PathBuilder::get_path_builder ()); 762 //static PathBuilder Path (Cmt::get_strip_path ()); 763 //static PathBuilder Path; 695 764 static MacroBuilder Macro; 696 765 static ScriptBuilder Script; … … 852 921 break; 853 922 case SymbolPath: 854 symbol.builder = &Path; 923 symbol.builder = PathPtr; 924 //symbol.builder = &Path; 855 925 break; 856 926 case SymbolAlias: … … 911 981 912 982 return (SymbolMap); 983 } 984 985 //------------------------------------------------------------- 986 Symbol::SymbolMap& Symbol::std_env_vars () 987 { 988 static SymbolMap env_vars; 989 static Symbol std_sym; 990 static bool initialized (false); 991 if (!initialized) 992 { 993 env_vars.add ("SITEROOT", std_sym); 994 env_vars.add ("CMTCONFIG", std_sym); 995 env_vars.add ("CMTBIN", std_sym); 996 env_vars.add ("CMTPATH", std_sym); 997 env_vars.add ("CMTHEADVERSION", std_sym); 998 env_vars.add ("CMTPROJECTPATH", std_sym); 999 env_vars.add ("CMTSITE", std_sym); 1000 env_vars.add ("CMTEXTRATAGS", std_sym); 1001 env_vars.add ("CMTSTRUCTURINGSTYLE", std_sym); 1002 env_vars.add ("CMTHOME", std_sym); 1003 env_vars.add ("CMTUSERCONTEXT", std_sym); 1004 initialized = true; 1005 } 1006 return env_vars; 913 1007 } 914 1008 … … 1021 1115 { 1022 1116 if (use->get_strategy ("SetupRoot") && 1023 use->get_package_name () != "cmt_standalone") 1117 use->get_package_name () != "cmt_standalone" && 1118 (action_setup == Cmt::get_action () || 1119 action_cleanup == Cmt::get_action ()) && 1120 Requirements != Cmt::get_print_mode () && 1121 Xml != Cmt::get_print_mode ()) 1024 1122 { 1025 1123 #ifdef WIN32 … … 1084 1182 */ 1085 1183 if (name == "constituents") return; 1086 if (name == "constituentsc clean") return;1184 if (name == "constituentsclean") return; 1087 1185 1088 1186 if (use->get_current_scope () == ScopePrivate) return; … … 1165 1263 } 1166 1264 } 1265 } 1266 1267 //------------------------------------------------------------- 1268 bool Symbol::set_strip_path (const bool& strip_path) 1269 { 1270 PathBuilder::get_path_builder ()->set_strip_path (strip_path); 1271 return true; 1272 /* 1273 // searching for a path symbol 1274 for (int number = 0; number < Symbol::symbol_number (); number++) 1275 { 1276 Symbol& symbol = Symbol::symbol (number); 1277 1278 if (symbol.type == Symbol::SymbolPath) 1279 { 1280 static_cast<PathBuilder*> (symbol.builder)->set_strip_path (strip_path); 1281 return true; 1282 } 1283 } 1284 1285 return false; 1286 */ 1167 1287 } 1168 1288 … … 1422 1542 cmt_string value; 1423 1543 1544 if (Cmt::get_env_access ()) 1545 { 1424 1546 for (number = 0; number < Symbol::symbol_number (); number++) 1425 1547 { … … 1433 1555 Symbol::expand (value); 1434 1556 1557 if (Cmt::get_debug ()) 1558 { 1559 cerr << "Symbol::all_set (set)> " << symbol.name << " = " << value << endl; 1560 } 1561 1435 1562 CmtSystem::putenv (symbol.name, value); 1436 1563 } 1564 } 1437 1565 } 1438 1566 … … 1500 1628 } 1501 1629 1630 static PathBuilder* pb (0); 1631 1632 if (Cmt::get_env_access ()) 1633 { 1502 1634 for (number = 0; number < Symbol::symbol_number (); number++) 1503 1635 { … … 1510 1642 { 1511 1643 Symbol::expand (value); 1512 filter_path_value (symbol.name, value); 1644 if (!pb) 1645 pb = static_cast<PathBuilder*> (symbol.builder); 1646 pb->filter_path_value (symbol, value); 1647 //filter_path_value (symbol.name, value); 1513 1648 1514 1649 #ifdef WIN32 … … 1518 1653 if (Cmt::get_debug ()) 1519 1654 { 1520 cerr << "Symbol::all_set -2> " << symbol.name << " = " << value << endl;1655 cerr << "Symbol::all_set (path)> " << symbol.name << " = " << value << endl; 1521 1656 } 1522 1657 … … 1524 1659 } 1525 1660 } 1661 } 1526 1662 1527 1663 running = false; … … 1529 1665 1530 1666 //------------------------------------------------------------- 1531 void Symbol::all_print (PrintMode mode) 1667 void Symbol::all_print (PrintMode mode, ostream& out) 1668 //void Symbol::all_print (PrintMode mode) 1532 1669 { 1533 1670 static SymbolVector& Symbols = symbols (); … … 1550 1687 (symbol.type == SymbolMacro)) 1551 1688 { 1552 if (symbol.print_macro (mode ))1689 if (symbol.print_macro (mode, out)) 1553 1690 { 1554 1691 // cout << endl; … … 1567 1704 (symbol.type == SymbolPath)) 1568 1705 { 1569 if (symbol.print (mode ))1706 if (symbol.print (mode, out)) 1570 1707 { 1571 1708 if (mode == Bat) 1572 1709 { 1573 cout << endl;1710 out << endl; 1574 1711 } 1575 1712 else if (mode == Xml) … … 1579 1716 else 1580 1717 { 1581 cout << endl;1718 out << endl; 1582 1719 } 1583 1720 } … … 1593 1730 static SymbolVector& Symbols = symbols (); 1594 1731 1732 static PathBuilder* pb (0); 1733 1595 1734 int number; 1596 1735 … … 1608 1747 expand (temp); 1609 1748 1610 Symbol::filter_path_value (symbol.name, temp); 1749 if (!pb) 1750 pb = static_cast<PathBuilder*> (symbol.builder); 1751 pb->filter_path_value (symbol, temp); 1752 //Symbol::filter_path_value (symbol.name, temp); 1611 1753 } 1612 1754 } … … 1696 1838 break; 1697 1839 case Sh : 1698 cout << "[ -z ${" << name << "+CMT} ] || unset " << name; 1699 // cout << "unset " << name; 1840 cout << "alias " << name << " >/dev/null 2>&1 && unalias " << name; 1700 1841 result = 1; 1701 1842 break; … … 1762 1903 1763 1904 //------------------------------------------------------------- 1764 int Symbol::print (PrintMode mode) 1765 { 1905 int Symbol::print (PrintMode mode, ostream& out) 1906 { 1907 static PathBuilder* pb (0); 1908 1766 1909 int result = 0; 1767 1910 … … 1769 1912 bool empty = (temp.size () == 0) ? true : false; 1770 1913 1914 cmt_string _name (name); 1915 switch (type) 1916 { 1917 case SymbolSet : 1918 case SymbolPath : 1919 expand (temp); 1920 if (type == SymbolPath) 1921 { 1922 if (!pb) 1923 pb = static_cast<PathBuilder*> (builder); 1924 pb->filter_path_value (*this, temp); 1925 } 1926 switch (mode) 1927 { 1928 case Xml : 1929 break; 1930 default: 1931 if (0 != CmtSystem::mangle (name, _name)) 1932 CmtMessage::info ("Replace " + name + " with " + _name); 1933 break; 1934 } 1935 break; 1936 default: 1937 break; 1938 } 1939 1940 /* 1771 1941 if (type == SymbolPath) 1772 1942 { 1773 1943 expand (temp); 1774 Symbol::filter_path_value (name, temp); 1775 } 1776 1777 cmt_string _name; 1944 //Symbol::filter_path_value (name, temp); 1945 if (!pb) 1946 pb = static_cast<PathBuilder*> (builder); 1947 pb->filter_path_value (*this, temp); 1948 } 1949 */ 1778 1950 switch (type) 1779 1951 { 1780 1952 case SymbolSet : 1781 1953 case SymbolPath : 1782 if (0 != CmtSystem::mangle (name, _name))1783 CmtMessage::info ("Replace " + name + " with " + _name);1784 1954 switch (mode) 1785 1955 { 1786 1956 case Csh : 1787 if (empty) cout << "unsetenv " << _name;1788 else cout << "setenv " << _name << " \"" << temp << "\"";1789 //else cout << "setenv " << name << " " << CmtSystem::quote (temp, " \t");1957 if (empty) out << "unsetenv " << _name; 1958 else out << "setenv " << _name << " \"" << temp << "\""; 1959 //else out << "setenv " << name << " " << CmtSystem::quote (temp, " \t"); 1790 1960 1791 1961 result = 1; 1792 1962 break; 1793 1963 case Sh : 1794 if (empty) cout << "[ -z ${" << _name << "+CMT} ] || unset " << _name;1795 // if (empty) cout << "unset " << _name;1796 else cout << _name << "=\"" << temp << "\"; export " << _name;1797 //else cout << name << "=" << CmtSystem::quote (temp, " \t") << "; export " << name;1964 if (empty) out << "[ -z ${" << _name << "+CMT} ] || unset " << _name; 1965 // if (empty) out << "unset " << _name; 1966 else out << _name << "=\"" << temp << "\"; export " << _name; 1967 //else out << name << "=" << CmtSystem::quote (temp, " \t") << "; export " << name; 1798 1968 1799 1969 result = 1; … … 1801 1971 case Bat : 1802 1972 temp.replace_all ("/", "\\"); 1803 cout << "set " << _name << "=" << CmtSystem::quote (temp, " \t");1804 // cout << "set " << name << "=" << temp;1973 out << "set " << _name << "=" << CmtSystem::quote (temp, " \t"); 1974 //out << "set " << name << "=" << temp; 1805 1975 result = 1; 1806 1976 break; 1807 1977 case Xml : 1808 cout << "<variable><name>" << _name << "</name>"1978 out << "<variable><name>" << _name << "</name>" 1809 1979 << "<value>" << temp << "</value></variable>"; 1810 1980 result = 1; … … 1816 1986 { 1817 1987 case Csh : 1818 cout << "alias " << name <<1988 out << "alias " << name << 1819 1989 " \"" << temp << "\""; 1820 1990 //CmtSystem::quote (temp, " \t"); … … 1822 1992 break; 1823 1993 case Sh : 1824 cout << "alias " << name <<1994 out << "alias " << name << 1825 1995 "=\"" << temp << "\""; 1826 1996 //"=" << CmtSystem::quote (temp, " \t"); … … 1828 1998 break; 1829 1999 case Bat : 1830 cout << "set " << name <<2000 out << "set " << name << 1831 2001 "=" << CmtSystem::quote (temp, " \t"); 1832 2002 //"=" << temp; … … 1834 2004 break; 1835 2005 case Xml : 1836 cout << "<alias><name>" << name << "</name>"2006 out << "<alias><name>" << name << "</name>" 1837 2007 << "<value>" << temp << "</value></alias>"; 1838 2008 result = 1; … … 1852 2022 { 1853 2023 case Csh : 1854 cout << "if ( -f " << CmtSystem::quote (name, " \t") << ".csh ) then" << endl;1855 cout << " source " << CmtSystem::quote (name, " \t") << ".csh" << endl;1856 cout <<2024 out << "if ( -f " << CmtSystem::quote (name, " \t") << ".csh ) then" << endl; 2025 out << " source " << CmtSystem::quote (name, " \t") << ".csh" << endl; 2026 out << 1857 2027 "if ( $status != 0 ) then\n" 1858 2028 " set cmtsetupstatus=1\n" 1859 2029 "endif\n"; 1860 cout << "endif" << endl;2030 out << "endif" << endl; 1861 2031 result = 1; 1862 2032 break; 1863 2033 case Sh : 1864 cout << "if test -f " << CmtSystem::quote (name, " \t") << ".sh; then" << endl;1865 cout << " . " << CmtSystem::quote (name, " \t") << ".sh" << endl;1866 cout <<2034 out << "if test -f " << CmtSystem::quote (name, " \t") << ".sh; then" << endl; 2035 out << " . " << CmtSystem::quote (name, " \t") << ".sh" << endl; 2036 out << 1867 2037 "if test $? != 0; then\n" 1868 2038 " cmtsetupstatus=1\n" 1869 2039 "fi\n"; 1870 cout << "fi" << endl;2040 out << "fi" << endl; 1871 2041 result = 1; 1872 2042 break; 1873 2043 case Bat : 1874 cout << "call " << CmtSystem::quote (name, " \t");2044 out << "call " << CmtSystem::quote (name, " \t"); 1875 2045 result = 1; 1876 2046 break; 1877 2047 case Xml : 1878 cout << "<script>" << name << "</script>";2048 out << "<script>" << name << "</script>"; 1879 2049 result = 1; 1880 2050 break; … … 2124 2294 SymbolValue& value = value_list.values[selected]; 2125 2295 2126 result += value_list.print (symbol, value, first_definition );2296 result += value_list.print (symbol, value, first_definition, out); 2127 2297 } 2128 2298 … … 2202 2372 else if (temp == "") 2203 2373 { 2204 temp = CmtSystem::getenv (symbol.name); 2374 if (Cmt::get_env_access () || 2375 Symbol::std_env_vars ().has (symbol.name)) 2376 { 2377 temp = CmtSystem::getenv (symbol.name); 2378 if (Cmt::get_debug ()) 2379 { 2380 cerr << "SetBuilder::build> getenv (" << symbol.name 2381 << ") => " << temp << endl; 2382 } 2383 } 2384 else 2385 { 2386 if (Cmt::get_debug ()) 2387 { 2388 cerr << "SetBuilder::build> getenv (" << symbol.name 2389 << ") denied" << endl; 2390 } 2391 CmtError::set (CmtError::warning, 2392 "getenv (" + symbol.name + ") denied"); 2393 return ""; 2394 } 2205 2395 } 2206 2396 … … 2263 2453 } 2264 2454 2455 namespace 2456 { 2457 int find_path_entry (const CmtSystem::cmt_string_vector& items, const cmt_string& value) 2458 { 2459 // if (value.size () == 0) return true; 2460 2461 static cmt_vmap <cmt_string, cmt_string> realpaths; 2462 2463 cmt_string rvalue; 2464 const cmt_string * prvalue; 2465 2466 if (!(prvalue = realpaths.find (value))) 2467 { 2468 // if (!CmtSystem::realpath_ (value, rvalue)) 2469 //{ 2470 rvalue = value; 2471 CmtSystem::compress_path (rvalue); 2472 //} 2473 prvalue = &rvalue; 2474 realpaths.add (value, rvalue); 2475 // cerr << "realpaths.add: " << value << " , " << rvalue << endl; 2476 } 2477 2478 for (int i = 0; i < items.size (); i++) 2479 { 2480 const cmt_string& item = items[i]; 2481 if (item.size () == 0) continue; 2482 cmt_string ritem; 2483 const cmt_string * pritem; 2484 2485 if (!(pritem = realpaths.find (item))) 2486 { 2487 //if (!CmtSystem::realpath_ (item, ritem)) 2488 //{ 2489 ritem = item; 2490 CmtSystem::compress_path (ritem); 2491 //} 2492 pritem = &ritem; 2493 realpaths.add (item, ritem); 2494 // cerr << "realpaths.add: " << item << " , " << ritem << endl; 2495 } 2496 if (*pritem == *prvalue) 2497 { 2498 return i; 2499 } 2500 } 2501 2502 return -1; 2503 } 2504 2505 } 2506 /* 2265 2507 static bool find_path_entry (const CmtSystem::cmt_string_vector& items, const cmt_string& value) 2508 { 2509 if (value.size () == 0) return true; 2510 2511 static cmt_vmap <cmt_string, cmt_string> realpaths; 2512 2513 cmt_string rvalue; 2514 const cmt_string * prvalue; 2515 2516 if (!(prvalue = realpaths.find (value))) 2517 { 2518 // if (!CmtSystem::realpath_ (value, rvalue)) 2519 //{ 2520 rvalue = value; 2521 CmtSystem::compress_path (rvalue); 2522 //} 2523 prvalue = &rvalue; 2524 realpaths.add (value, rvalue); 2525 // cerr << "realpaths.add: " << value << " , " << rvalue << endl; 2526 } 2527 2528 for (int i = 0; i < items.size (); i++) 2529 { 2530 const cmt_string& item = items[i]; 2531 if (item.size () == 0) continue; 2532 cmt_string ritem; 2533 const cmt_string * pritem; 2534 2535 if (!(pritem = realpaths.find (item))) 2536 { 2537 //if (!CmtSystem::realpath_ (item, ritem)) 2538 //{ 2539 ritem = item; 2540 CmtSystem::compress_path (ritem); 2541 //} 2542 pritem = &ritem; 2543 realpaths.add (item, ritem); 2544 // cerr << "realpaths.add: " << item << " , " << ritem << endl; 2545 } 2546 if (*pritem == *prvalue) 2547 { 2548 return true; 2549 } 2550 } 2551 2552 return false; 2553 } 2554 */ 2555 /* 2556 static bool find_path_entry (const cmt_string& paths, const cmt_string& value) 2266 2557 { 2267 2558 static const cmt_string path_separator = CmtSystem::path_separator (); 2268 2559 static cmt_vmap <cmt_string, cmt_string> realpaths; 2269 2270 if (value.size () == 0) return true;2271 2560 2272 2561 cmt_string rvalue; … … 2285 2574 } 2286 2575 2287 //CmtSystem::cmt_string_vector items;2288 //CmtSystem::split (paths, path_separator, items);2576 CmtSystem::cmt_string_vector items; 2577 CmtSystem::split (paths, path_separator, items); 2289 2578 2290 2579 bool found = false; … … 2293 2582 { 2294 2583 const cmt_string& item = items[i]; 2295 if (item.size () == 0) continue;2296 2584 cmt_string ritem; 2297 2585 const cmt_string * pritem; … … 2317 2605 return (found); 2318 2606 } 2319 2320 static bool find_path_entry (const cmt_string& paths, const cmt_string& value) 2321 { 2322 static const cmt_string path_separator = CmtSystem::path_separator (); 2323 static cmt_vmap <cmt_string, cmt_string> realpaths; 2324 2325 cmt_string rvalue; 2326 const cmt_string * prvalue; 2327 2328 if (!(prvalue = realpaths.find (value))) 2329 { 2330 if (!CmtSystem::realpath_ (value, rvalue)) 2331 { 2332 rvalue = value; 2333 CmtSystem::compress_path (rvalue); 2334 } 2335 prvalue = &rvalue; 2336 realpaths.add (value, rvalue); 2337 // cerr << "realpaths.add: " << value << " , " << rvalue << endl; 2338 } 2339 2340 CmtSystem::cmt_string_vector items; 2341 CmtSystem::split (paths, path_separator, items); 2342 2343 bool found = false; 2344 2345 for (int i = 0; i < items.size (); i++) 2346 { 2347 const cmt_string& item = items[i]; 2348 cmt_string ritem; 2349 const cmt_string * pritem; 2350 2351 if (!(pritem = realpaths.find (item))) 2352 { 2353 if (!CmtSystem::realpath_ (item, ritem)) 2354 { 2355 ritem = item; 2356 CmtSystem::compress_path (ritem); 2357 } 2358 pritem = &ritem; 2359 realpaths.add (item, ritem); 2360 // cerr << "realpaths.add: " << item << " , " << ritem << endl; 2361 } 2362 if (*pritem == *prvalue) 2363 { 2364 found = true; 2365 break; 2366 } 2367 } 2368 2369 return (found); 2607 */ 2608 //------------------------------------------------------------- 2609 PathBuilder* PathBuilder::get_path_builder () 2610 { 2611 static PathBuilder Path (Cmt::get_strip_path ()); 2612 return &Path; 2613 } 2614 2615 //------------------------------------------------------------- 2616 PathBuilder::PathBuilder () 2617 : m_strip_path (false) 2618 { 2619 } 2620 2621 //------------------------------------------------------------- 2622 PathBuilder::PathBuilder (bool strip_path) 2623 { 2624 PathBuilder (); 2625 m_strip_path = strip_path; 2370 2626 } 2371 2627 … … 2401 2657 level++; 2402 2658 2659 if (Cmt::get_env_access () || 2660 Symbol::std_env_vars ().has (symbol.name)) 2661 { 2662 //temp = CmtSystem::getenv (symbol.name); 2403 2663 CmtSystem::split (CmtSystem::getenv (symbol.name), path_separator, temp_vector); 2404 //temp = CmtSystem::getenv (symbol.name); 2664 filter_path_value (symbol, temp_vector); 2665 if (Cmt::get_debug ()) 2666 { 2667 cmt_string temp_txt; 2668 Cmt::vector_to_string (temp_vector, path_separator, temp_txt); 2669 cerr << "PathBuilder::build> getenv (" << symbol.name 2670 << ") => " << temp_txt << endl; 2671 } 2672 } 2673 else 2674 { 2675 if (Cmt::get_debug ()) 2676 { 2677 cerr << "PathBuilder::build> getenv (" << symbol.name 2678 << ") denied" << endl; 2679 } 2680 CmtError::set (CmtError::warning, 2681 "getenv (" + symbol.name + ") denied"); 2682 return ""; 2683 } 2405 2684 2406 2685 bool first_definition = true; … … 2442 2721 CmtSystem::split (new_value, path_separator, temp_vector); 2443 2722 //temp = new_value; 2723 filter_path_value (symbol, temp_vector); 2444 2724 } 2445 2725 … … 2451 2731 CmtSystem::split (new_value, path_separator, new_value_vector); 2452 2732 for (int i = 0; i < new_value_vector.size (); i++) 2453 if (!find_path_entry (temp_vector, new_value_vector[i])) 2454 //if (!find_path_entry (temp, new_value)) 2455 { 2456 temp_vector.push_back (new_value_vector[i]); 2457 /* 2458 if (temp != "") temp += path_separator; 2459 2460 temp += new_value; 2461 */ 2462 } 2733 { 2734 if (new_value_vector[i].size () == 0) continue; 2735 int j = find_path_entry (temp_vector, new_value_vector[i]); 2736 if (j < 0) 2737 { 2738 temp_vector.push_back (new_value_vector[i]); 2739 } 2740 else if (j < temp_vector.size () - 1) 2741 { 2742 temp_vector [j] = ""; 2743 temp_vector.push_back (new_value_vector[i]); 2744 } 2745 } 2463 2746 } 2464 2747 … … 2473 2756 for (int i = temp_vector.size () - 1; i > n - 1; i--) 2474 2757 temp_vector [i] = temp_vector [i - n]; 2758 for (int i = 0; i < n; i++) 2759 temp_vector [i] = ""; 2475 2760 for (int i = 0; i < new_value_vector.size (); i++) 2476 if (!find_path_entry (temp_vector, new_value_vector[i]))2477 //if (!find_path_entry (temp, new_value))2478 {2479 temp_vector [i] = new_value_vector[i];2480 /*2481 previous_temp = temp;2482 temp = new_value;2483 if (previous_temp != "") temp += path_separator;2484 temp += previous_temp;2485 */2486 }2487 else2488 temp_vector [i] = "";2761 { 2762 if (new_value_vector[i].size () == 0) continue; 2763 int j = find_path_entry (temp_vector, new_value_vector[i]); 2764 if (j < 0) 2765 { 2766 temp_vector [i] = new_value_vector[i]; 2767 } 2768 else if (j >= n) 2769 { 2770 temp_vector [i] = new_value_vector[i]; 2771 temp_vector [j] = ""; 2772 } 2773 } 2489 2774 } 2490 2775 … … 2614 2899 2615 2900 level--; 2616 2901 /* 2617 2902 for (;;) 2618 2903 { … … 2637 2922 temp.replace_all ("::", ":"); 2638 2923 temp.replace_all (";;", ";"); 2639 2924 */ 2640 2925 return (temp); 2641 2926 } … … 2767 3052 2768 3053 return (temp); 3054 } 3055 3056 //------------------------------------------------------------- 3057 void PathBuilder::filter_path_value (const Symbol& symbol, 3058 CmtSystem::cmt_string_vector& value, 3059 const cmt_string& /* tag_name */) const 3060 { 3061 static cmt_regexp reg ("[$%`]"); 3062 3063 cmt_vector<int> path (value.size ()); 3064 int n (0); 3065 3066 for (int j = 0; j < value.size (); j++) 3067 { 3068 const cmt_string& v = value[j]; 3069 bool exists (false); 3070 for (int i = 0; i < j; i++) 3071 { 3072 if (value[i] == v) 3073 { 3074 exists = true; 3075 break; 3076 } 3077 } 3078 if (!exists) 3079 { 3080 if (m_strip_path) 3081 { 3082 if (!reg.match (v)) 3083 { 3084 if (!CmtSystem::test_directory (v)) 3085 { 3086 CmtMessage::verbose ("Non-existent directory " + v + " in " + symbol.name + " skipped"); 3087 continue; 3088 } 3089 } 3090 else 3091 { 3092 if (CmtMessage::active (Verbose)) 3093 { 3094 CmtMessage::warning ("Unresolved directory name " + v + " in " + symbol.name); 3095 } 3096 } 3097 } 3098 else 3099 { 3100 if (CmtMessage::active (Verbose)) 3101 if (!reg.match (v) && 3102 !CmtSystem::test_directory (v)) 3103 { 3104 CmtMessage::warning ("Non-existent directory " + v + " in " + symbol.name); 3105 } 3106 } 3107 path[n++] = j; 3108 } 3109 } 3110 3111 for (int i = 0; i < n; i++) 3112 if (i != path[i]) value[i] = value[path[i]]; 3113 3114 value.resize (n); 3115 } 3116 3117 //------------------------------------------------------------- 3118 void PathBuilder::filter_path_value (const Symbol& symbol, 3119 cmt_string& value, 3120 const cmt_string& tag_name) const 3121 { 3122 static cmt_string ps (CmtSystem::path_separator ()); 3123 CmtSystem::cmt_string_vector paths; 3124 3125 CmtSystem::split (value, ps, paths); 3126 filter_path_value (symbol, paths, tag_name); 3127 Cmt::vector_to_string (paths, ps, value); 3128 } 3129 3130 //------------------------------------------------------------- 3131 inline const bool& PathBuilder::get_strip_path () const 3132 { 3133 return m_strip_path; 3134 } 3135 3136 //------------------------------------------------------------- 3137 inline void PathBuilder::set_strip_path (const bool& strip_path) 3138 { 3139 m_strip_path = strip_path; 2769 3140 } 2770 3141 … … 3275 3646 int SymbolValueList::print (const Symbol& symbol, 3276 3647 const SymbolValue& value, 3277 bool& first_definition) const 3648 bool& first_definition, 3649 ostream& out) const 3278 3650 { 3279 3651 int result (0); 3280 3281 //if (use->get_package_name () == "CMT") return result;3282 3652 3283 3653 cmt_string discarded_text; 3284 3654 cmt_string define_text; 3285 3655 ActionType action = Cmt::get_action (); 3656 3657 static PathBuilder* pb (0); 3658 cmt_string rvalue (value.text); 3286 3659 3287 3660 switch (command_type) … … 3306 3679 case CommandMacroRemoveAllRegexp : 3307 3680 //case CommandAction : 3308 if (value.text == "") return result; 3681 if (value.text.size () == 0) return result; 3682 break; 3683 } 3684 3685 CmtError::code code (CmtError::ok); 3686 cmt_string msg, n; 3687 int exec_err (0); 3688 3689 switch (command_type) 3690 { 3691 case CommandSet : 3692 case CommandSetAppend : 3693 case CommandSetPrepend : 3694 case CommandSetRemove : 3695 case CommandSetRemoveRegexp : 3696 3697 if (CmtError::has_pending_error ()) 3698 { 3699 code = CmtError::get_last_error_code (); 3700 msg = CmtError::get_last_error (); 3701 exec_err = CmtError::get_last_execution_error (); 3702 n = CmtError::get_error_name (code); 3703 CmtError::clear (); 3704 } 3705 resolve_value_for_macros (rvalue); 3706 if (CmtError::get_last_error_code () != CmtError::warning) 3707 { 3708 if (CmtError::has_pending_error ()) 3709 { 3710 CmtError::print (); 3711 CmtError::clear (); 3712 } 3713 if (CmtError::ok != code) 3714 { 3715 // restore error occurred before value expansion 3716 CmtError::set (code, 3717 (msg.replace (n + ": ", cmt_string ("")), msg), 3718 exec_err); 3719 } 3720 if (CommandSet != command_type && 3721 rvalue.size () == 0) 3722 return result; 3723 } 3724 else 3725 { 3726 if (CmtMessage::active (Verbose)) 3727 CmtError::print (); 3728 CmtError::clear (); 3729 if (CmtError::ok != code) 3730 { 3731 // restore error occurred before value expansion 3732 CmtError::set (code, 3733 (msg.replace (n + ": ", cmt_string ("")), msg), 3734 exec_err); 3735 } 3736 // Ignore the error, keep the value unresolved 3737 rvalue = value.text; 3738 } 3739 3740 break; 3741 3742 //case CommandAlias : 3743 case CommandPath : 3744 case CommandPathAppend : 3745 case CommandPathPrepend : 3746 case CommandPathRemove : 3747 case CommandPathRemoveRegexp : 3748 //case CommandMacroPrepend : 3749 //case CommandMacro : 3750 //case CommandMacroAppend : 3751 //case CommandMacroRemove : 3752 //case CommandMacroRemoveRegexp : 3753 //case CommandMacroRemoveAll : 3754 //case CommandMacroRemoveAllRegexp : 3755 //case CommandAction : 3756 3757 if (!pb) 3758 pb = static_cast<PathBuilder*> (symbol.builder); 3759 if (pb->get_strip_path ()) 3760 { 3761 /* 3762 CmtError::code code (CmtError::ok); 3763 cmt_string msg, n; 3764 int exec_err (0); 3765 */ 3766 if (CmtError::has_pending_error ()) 3767 { 3768 code = CmtError::get_last_error_code (); 3769 msg = CmtError::get_last_error (); 3770 exec_err = CmtError::get_last_execution_error (); 3771 n = CmtError::get_error_name (code); 3772 CmtError::clear (); 3773 } 3774 resolve_value (rvalue); 3775 if (CmtError::get_last_error_code () != CmtError::warning) 3776 { 3777 if (CmtError::has_pending_error ()) 3778 { 3779 CmtError::print (); 3780 CmtError::clear (); 3781 } 3782 if (CmtError::ok != code) 3783 { 3784 // restore error occurred before value expansion 3785 CmtError::set (code, 3786 (msg.replace (n + ": ", cmt_string ("")), msg), 3787 exec_err); 3788 } 3789 if (CommandPath != command_type && 3790 rvalue.size () == 0) 3791 return result; 3792 } 3793 else 3794 { 3795 if (CommandPathRemove == command_type || 3796 CommandPathRemoveRegexp == command_type) 3797 { 3798 // This means that the value is not resolved via symbols 3799 // and, possibly, standard environment variables and 3800 // * either has no effect on the path at all, 3801 // or 3802 // * there should be similar contribution from 3803 // and, hence, we should get the same error with 3804 // CommandPath, CommandPathAppend, or CommandPathPrepend 3805 // Either way, we can ignore this error. 3806 3807 if (CmtMessage::active (Verbose)) 3808 CmtError::print (); 3809 CmtError::clear (); 3810 if (CmtError::ok != code) 3811 { 3812 // restore error occurred before value expansion 3813 CmtError::set (code, 3814 (msg.replace (n + ": ", cmt_string ("")), msg), 3815 exec_err); 3816 } 3817 } 3818 else if (CmtError::ok != code) 3819 { 3820 // print error occurred before value expansion 3821 CmtMessage::error (msg); 3822 } 3823 // We keep CmtError::warning to indicate that 3824 // we could not resolve path 3825 // (without referencing the environment) 3826 // and strip path of non-existent directories 3827 // 3828 rvalue = value.text; 3829 } 3830 } 3831 else // (!pb->get_strip_path ()) 3832 { 3833 if (CmtError::has_pending_error ()) 3834 { 3835 code = CmtError::get_last_error_code (); 3836 msg = CmtError::get_last_error (); 3837 exec_err = CmtError::get_last_execution_error (); 3838 n = CmtError::get_error_name (code); 3839 CmtError::clear (); 3840 } 3841 resolve_value_for_macros (rvalue); 3842 if (CmtError::get_last_error_code () != CmtError::warning) 3843 { 3844 if (CmtError::has_pending_error ()) 3845 { 3846 CmtError::print (); 3847 CmtError::clear (); 3848 } 3849 if (CmtError::ok != code) 3850 { 3851 // restore error occurred before value expansion 3852 CmtError::set (code, 3853 (msg.replace (n + ": ", cmt_string ("")), msg), 3854 exec_err); 3855 } 3856 if (CommandPath != command_type && 3857 rvalue.size () == 0) 3858 return result; 3859 } 3860 else 3861 { 3862 if (CmtMessage::active (Verbose)) 3863 CmtError::print (); 3864 CmtError::clear (); 3865 if (CmtError::ok != code) 3866 { 3867 // restore error occurred before value expansion 3868 CmtError::set (code, 3869 (msg.replace (n + ": ", cmt_string ("")), msg), 3870 exec_err); 3871 } 3872 // Ignore the error, keep the value unresolved 3873 rvalue = value.text; 3874 } 3875 } 3876 3309 3877 break; 3310 3878 } … … 3317 3885 3318 3886 if (CmtMessage::active (Verbose)) 3319 cout << "# Package " << (use != 0 ? use->get_package_name () + " " + use->version : ""); 3320 /* 3321 if (use != 0) 3322 { 3323 cout << use->get_package_name () << " " << use->version; 3324 } 3325 */ 3887 out << "# Package " << (use ? use->get_package_name () + " " + use->version : ""); 3326 3888 3327 3889 switch (command_type) … … 3329 3891 case CommandSet : 3330 3892 if (CmtMessage::active (Verbose)) 3331 cout << " " << define_text << " set " << symbol.name << " as " << endl;3332 // cout << " " << define_text << " set " << symbol.name << " as ";3333 cout << "set " << symbol.name;3893 out << " " << define_text << " set " << symbol.name << " as " << endl; 3894 // out << " " << define_text << " set " << symbol.name << " as "; 3895 out << "set " << symbol.name; 3334 3896 first_definition = false; 3335 3897 result = 1; … … 3337 3899 case CommandSetAppend : 3338 3900 if (CmtMessage::active (Verbose)) 3339 cout << " appends to set " << symbol.name << " : " << endl;3340 // cout << " appends to set " << symbol.name << " : ";3341 cout << "set_append " << symbol.name;3901 out << " appends to set " << symbol.name << " : " << endl; 3902 // out << " appends to set " << symbol.name << " : "; 3903 out << "set_append " << symbol.name; 3342 3904 result = 1; 3343 3905 break; 3344 3906 case CommandSetPrepend : 3345 3907 if (CmtMessage::active (Verbose)) 3346 cout << " prepends to set " << symbol.name << " : " << endl;3347 // cout << " prepends to set " << symbol.name << " : ";3348 cout << "set_prepend " << symbol.name;3908 out << " prepends to set " << symbol.name << " : " << endl; 3909 // out << " prepends to set " << symbol.name << " : "; 3910 out << "set_prepend " << symbol.name; 3349 3911 result = 1; 3350 3912 break; 3351 3913 case CommandSetRemove : 3352 3914 if (CmtMessage::active (Verbose)) 3353 cout << " removes from set " << symbol.name << " : " << endl;3354 // cout << " removes from set " << symbol.name << " : ";3355 cout << "set_remove " << symbol.name;3915 out << " removes from set " << symbol.name << " : " << endl; 3916 // out << " removes from set " << symbol.name << " : "; 3917 out << "set_remove " << symbol.name; 3356 3918 result = 1; 3357 3919 break; 3358 3920 case CommandSetRemoveRegexp : 3359 3921 if (CmtMessage::active (Verbose)) 3360 cout << " removes RE from set " << symbol.name << " : " << endl;3361 // cout << " removes RE from set " << symbol.name << " : ";3362 cout << "set_remove_regexp " << symbol.name;3922 out << " removes RE from set " << symbol.name << " : " << endl; 3923 // out << " removes RE from set " << symbol.name << " : "; 3924 out << "set_remove_regexp " << symbol.name; 3363 3925 result = 1; 3364 3926 break; 3365 3927 case CommandAlias : 3366 3928 if (CmtMessage::active (Verbose)) 3367 cout << " " << define_text << " alias " << symbol.name << endl;3368 // cout << " " << define_text << " alias " << symbol.name << " as ";3369 cout << "alias " << symbol.name;3929 out << " " << define_text << " alias " << symbol.name << endl; 3930 // out << " " << define_text << " alias " << symbol.name << " as "; 3931 out << "alias " << symbol.name; 3370 3932 first_definition = false; 3371 3933 result = 1; 3372 3934 break; 3373 3935 case CommandPath : 3374 3936 if (CmtMessage::active (Verbose)) 3375 cout << " " << define_text << " path " << symbol.name << endl; 3376 // cout << " " << define_text << " path " << symbol.name << " as "; 3377 cout << "path " << symbol.name; 3937 out << " " << define_text << " path " << symbol.name << endl; 3938 // out << " " << define_text << " path " << symbol.name << " as "; 3939 pb->filter_path_value (symbol, rvalue); 3940 3941 if (Cmt::get_debug ()) 3942 { 3943 cerr << "|SymbolValueList::print> path " << symbol.name 3944 << " " << value.text << " => " << rvalue << endl; 3945 } 3946 3947 out << "path " << symbol.name; 3378 3948 first_definition = false; 3379 3949 result = 1; … … 3381 3951 case CommandPathAppend : 3382 3952 if (CmtMessage::active (Verbose)) 3383 cout << " appends to path " << symbol.name << endl; 3384 // cout << " appends to path " << symbol.name << " : "; 3385 cout << "path_append " << symbol.name; 3953 out << " appends to path " << symbol.name << endl; 3954 // out << " appends to path " << symbol.name << " : "; 3955 pb->filter_path_value (symbol, rvalue); 3956 3957 if (Cmt::get_debug ()) 3958 { 3959 cerr << "|SymbolValueList::print> path_append " << symbol.name 3960 << " " << value.text << " => " << rvalue << endl; 3961 } 3962 3963 if (rvalue.size () == 0) return result; 3964 out << "path_append " << symbol.name; 3386 3965 result = 1; 3387 3966 break; 3388 3967 case CommandPathPrepend : 3389 3968 if (CmtMessage::active (Verbose)) 3390 cout << " prepends to path " << symbol.name << " : " << endl; 3391 // cout << " prepends to path " << symbol.name << " : "; 3392 cout << "path_prepend " << symbol.name; 3969 out << " prepends to path " << symbol.name << " : " << endl; 3970 // out << " prepends to path " << symbol.name << " : "; 3971 pb->filter_path_value (symbol, rvalue); 3972 3973 if (Cmt::get_debug ()) 3974 { 3975 cerr << "|SymbolValueList::print> path_prepend " << symbol.name 3976 << " " << value.text << " => " << rvalue << endl; 3977 } 3978 3979 if (rvalue.size () == 0) return result; 3980 out << "path_prepend " << symbol.name; 3393 3981 result = 1; 3394 3982 break; 3395 3983 case CommandPathRemove : 3396 3984 if (CmtMessage::active (Verbose)) 3397 cout << " removes from path " << symbol.name << " : " << endl; 3398 // cout << " removes from path " << symbol.name << " : "; 3399 cout << "path_remove " << symbol.name; 3985 out << " removes from path " << symbol.name << " : " << endl; 3986 // out << " removes from path " << symbol.name << " : "; 3987 3988 if (Cmt::get_debug ()) 3989 { 3990 cerr << "|SymbolValueList::print> path_remove " << symbol.name 3991 << " " << value.text << " => " << rvalue << endl; 3992 } 3993 3994 out << "path_remove " << symbol.name; 3400 3995 result = 1; 3401 3996 break; 3402 3997 case CommandPathRemoveRegexp : 3403 3998 if (CmtMessage::active (Verbose)) 3404 cout << " removes RE from path " << symbol.name << " : " << endl; 3405 // cout << " removes RE from path " << symbol.name << " : "; 3406 cout << "path_remove_regexp " << symbol.name; 3999 out << " removes RE from path " << symbol.name << " : " << endl; 4000 // out << " removes RE from path " << symbol.name << " : "; 4001 4002 if (Cmt::get_debug ()) 4003 { 4004 cerr << "|SymbolValueList::print> path_remove_regexp " << symbol.name 4005 << " " << value.text << " => " << rvalue << endl; 4006 } 4007 4008 out << "path_remove_regexp " << symbol.name; 3407 4009 result = 1; 3408 4010 break; 3409 4011 case CommandMacro : 3410 4012 if (CmtMessage::active (Verbose)) 3411 cout << " " << define_text << " macro " << symbol.name << " as " << endl;3412 // cout << " " << define_text << " macro " << symbol.name << " as ";3413 cout << "macro " << symbol.name;4013 out << " " << define_text << " macro " << symbol.name << " as " << endl; 4014 // out << " " << define_text << " macro " << symbol.name << " as "; 4015 out << "macro " << symbol.name; 3414 4016 result = 1; 3415 4017 break; 3416 4018 case CommandMacroPrepend : 3417 4019 if (CmtMessage::active (Verbose)) 3418 cout << " prepends to macro " << symbol.name << " : " << endl;3419 // cout << " prepends to macro " << symbol.name << " : ";3420 cout << "macro_prepend " << symbol.name;4020 out << " prepends to macro " << symbol.name << " : " << endl; 4021 // out << " prepends to macro " << symbol.name << " : "; 4022 out << "macro_prepend " << symbol.name; 3421 4023 result = 1; 3422 4024 break; 3423 4025 case CommandMacroAppend : 3424 4026 if (CmtMessage::active (Verbose)) 3425 cout << " appends to macro " << symbol.name << " : " << endl;3426 // cout << " appends to macro " << symbol.name << " : ";3427 cout << "macro_append " << symbol.name;4027 out << " appends to macro " << symbol.name << " : " << endl; 4028 // out << " appends to macro " << symbol.name << " : "; 4029 out << "macro_append " << symbol.name; 3428 4030 result = 1; 3429 4031 break; 3430 4032 case CommandMacroRemove : 3431 4033 if (CmtMessage::active (Verbose)) 3432 cout << " remove from macro " << symbol.name << " : " << endl;3433 // cout << " remove from macro " << symbol.name << " : ";3434 cout << "macro_remove " << symbol.name;4034 out << " remove from macro " << symbol.name << " : " << endl; 4035 // out << " remove from macro " << symbol.name << " : "; 4036 out << "macro_remove " << symbol.name; 3435 4037 result = 1; 3436 4038 break; 3437 4039 case CommandMacroRemoveRegexp : 3438 4040 if (CmtMessage::active (Verbose)) 3439 cout << " remove RE from macro " << symbol.name << " : " << endl;3440 // cout << " remove RE from macro " << symbol.name << " : ";3441 cout << "macro_remove_regexp " << symbol.name;4041 out << " remove RE from macro " << symbol.name << " : " << endl; 4042 // out << " remove RE from macro " << symbol.name << " : "; 4043 out << "macro_remove_regexp " << symbol.name; 3442 4044 result = 1; 3443 4045 break; 3444 4046 case CommandMacroRemoveAll : 3445 4047 if (CmtMessage::active (Verbose)) 3446 cout << " remove all from macro " << symbol.name << " : " << endl;3447 // cout << " remove all from macro " << symbol.name << " : ";3448 cout << "macro_remove_all " << symbol.name;4048 out << " remove all from macro " << symbol.name << " : " << endl; 4049 // out << " remove all from macro " << symbol.name << " : "; 4050 out << "macro_remove_all " << symbol.name; 3449 4051 result = 1; 3450 4052 break; 3451 4053 case CommandMacroRemoveAllRegexp : 3452 4054 if (CmtMessage::active (Verbose)) 3453 cout << " remove all RE from macro " << symbol.name << " : " << endl;3454 // cout << " remove all RE from macro " << symbol.name << " : ";3455 cout << "macro_remove_all_regexp " << symbol.name;4055 out << " remove all RE from macro " << symbol.name << " : " << endl; 4056 // out << " remove all RE from macro " << symbol.name << " : "; 4057 out << "macro_remove_all_regexp " << symbol.name; 3456 4058 result = 1; 3457 4059 break; 3458 4060 case CommandSetupScript : 3459 4061 if (CmtMessage::active (Verbose)) 3460 cout << " " << define_text << " setup script " << symbol.name << endl;3461 // cout << " " << define_text << " action " << symbol.name << " as ";3462 cout << "setup_script" /* << symbol.name */;4062 out << " " << define_text << " setup script " << symbol.name << endl; 4063 // out << " " << define_text << " action " << symbol.name << " as "; 4064 out << "setup_script" /* << symbol.name */; 3463 4065 first_definition = false; 3464 4066 result = 1; … … 3466 4068 /* 3467 4069 case CommandAction : 3468 cout << " " << define_text << " action " << symbol.name << " as ";4070 out << " " << define_text << " action " << symbol.name << " as "; 3469 4071 first_definition = false; 3470 4072 break; … … 3472 4074 } 3473 4075 3474 cout << " " << CmtSystem::quote (value.text, " \t"); 3475 // cout << "'" << value.text << "'"; 4076 out << " " << CmtSystem::quote (rvalue, " \t"); 4077 // out << " " << CmtSystem::quote (value.text, " \t"); 4078 // out << "'" << value.text << "'"; 3476 4079 3477 4080 /* … … 3481 4084 (selected_tag == Tag::get_default ())) 3482 4085 { 3483 cout << " for default tag";4086 out << " for default tag"; 3484 4087 } 3485 4088 else 3486 4089 { 3487 cout << " for tag '" << selected_tag->get_name () << "'";4090 out << " for tag '" << selected_tag->get_name () << "'"; 3488 4091 } 3489 4092 */ 3490 4093 3491 cout << endl;3492 // cout << discarded_text << endl;4094 out << endl; 4095 // out << discarded_text << endl; 3493 4096 return result; 3494 4097 } … … 3547 4150 else 3548 4151 { 4152 if (Cmt::get_env_access () || 4153 Symbol::std_env_vars ().has (name)) 4154 { 3549 4155 s = CmtSystem::getenv (name); 4156 if (Cmt::get_debug ()) 4157 { 4158 cerr << "Symbol::get_env_value> getenv (" << name 4159 << ") => " << s << endl; 4160 } 4161 } 4162 else 4163 { 4164 if (Cmt::get_debug ()) 4165 { 4166 cerr << "Symbol::get_env_value> getenv (" << name 4167 << ") denied" << endl; 4168 } 4169 CmtError::set (CmtError::warning, 4170 "getenv (" + name + ") denied"); 4171 return (s); 4172 } 3550 4173 } 3551 4174 -
CMT/v1r25-branch/source/cmt_symbol.h
r588 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- … … 34 35 int select_last () const; 35 36 void show (const Symbol& symbol, const SymbolValue& value, bool& first_definition) const; 36 int print (const Symbol& symbol, const SymbolValue& value, bool& first_definition ) const;37 int print (const Symbol& symbol, const SymbolValue& value, bool& first_definition, ostream& out = cout) const; 37 38 38 39 CommandType command_type; … … 89 90 90 91 static void all_set (); 91 static void all_print (PrintMode mode); 92 static void all_print (PrintMode mode, ostream& out = cout); 93 //static void all_print (PrintMode mode); 92 94 static void all_print_clean (PrintMode mode); 93 95 static void check_all_paths (); … … 96 98 static SymbolVector& symbols (); 97 99 static SymbolMap& symbol_map (); 100 static SymbolMap& std_env_vars (); 98 101 static Symbol& symbol (int index); 99 102 static void clear_all (); … … 107 110 108 111 static bool get_inhibit_display (); 112 static bool set_strip_path (const bool& strip_path); 109 113 110 114 public: … … 118 122 119 123 int print_clean (PrintMode mode); 120 int print (PrintMode mode); 124 int print (PrintMode mode, ostream& out = cout); 125 //int print (PrintMode mode); 121 126 cmt_string build_macro_value (bool display_it = false) const; 122 127 int print_macro (PrintMode mode, ostream& out = cout) const; -
CMT/v1r25-branch/source/cmt_syntax.cxx
r607 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 //----------------------------------------------------------- … … 212 213 int line_number) 213 214 { 214 215 /* 215 216 cmt_string cmtpath; 216 217 cmt_string offset; … … 219 220 220 221 Project* p = Project::find_by_cmtpath (cmtpath); 222 */ 223 Project* p = const_cast<Project*>(use->get_project ()); 224 // const Project* p = use->get_project (); 221 225 222 226 for (int i = 1; i < words.size (); i++) … … 287 291 { 288 292 in_error = true; 289 290 CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword"); 293 char num[32]; sprintf (num, "%d", line_number); 294 CmtError::set (CmtError::syntax_error, 295 project->get_name () 296 + " project file: " + file_name 297 + ": line: " + num 298 + ": " + value + ": Bad strategy value"); 299 //CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword"); 291 300 } 292 301 } … … 1060 1069 int line_number) 1061 1070 { 1071 /* 1062 1072 cmt_string cmtpath; 1063 1073 cmt_string offset; … … 1066 1076 1067 1077 Project* p = Project::find_by_cmtpath (cmtpath); 1078 */ 1079 Project* p = const_cast<Project*>(use->get_project ()); 1080 // const Project* p = use->get_project (); 1068 1081 1069 1082 for (int i = 1; i < words.size (); i++) … … 1126 1139 { 1127 1140 in_error = true; 1128 1129 CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword"); 1141 char num[32]; sprintf (num, "%d", line_number); 1142 CmtError::set (CmtError::syntax_error, 1143 project->get_name () 1144 + " project file: " + file_name 1145 + ": line: " + num 1146 + ": " + value + ": Bad strategy value"); 1147 //CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword"); 1130 1148 } 1131 1149 } … … 1164 1182 int line_number) 1165 1183 { 1184 /* 1166 1185 cmt_string cmtpath; 1167 1186 cmt_string offset; … … 1170 1189 1171 1190 Project* p = Project::find_by_cmtpath (cmtpath); 1191 */ 1192 Project* p = const_cast<Project*>(use->get_project ()); 1193 // const Project* p = use->get_project (); 1172 1194 1173 1195 for (int i = 1; i < words.size (); i++) … … 1231 1253 { 1232 1254 in_error = true; 1233 1234 CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword"); 1255 char num[32]; sprintf (num, "%d", line_number); 1256 CmtError::set (CmtError::syntax_error, 1257 project->get_name () 1258 + " project file: " + file_name 1259 + ": line: " + num 1260 + ": " + value + ": Bad strategy value"); 1261 //CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword"); 1235 1262 } 1236 1263 } … … 1403 1430 // 1404 1431 1405 Project* p = use->get_project ();1432 const Project* p = use->get_project (); 1406 1433 if (p != 0) 1407 1434 { … … 2054 2081 2055 2082 keyword->action (words, project, file_name, line_number); 2083 2084 if (CmtError::get_last_error_code () == CmtError::syntax_error) 2085 CmtError::print (); 2056 2086 } -
CMT/v1r25-branch/source/cmt_system.cxx
r610 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_system.h
r610 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_tag.cxx
r568 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- … … 99 100 100 101 Log; 102 103 const CmtSystem::cmt_string_vector& tags_remove = Cmt::get_tags_remove (); 104 for (int i = tags_remove.size () - 1; i >= 0; i--) 105 if (tags_remove[i] == m_name) return; 101 106 102 107 if (m_tag_excludes.size () > 0) … … 231 236 232 237 tag->mark (use ? use->get_package_name () : ""); 238 239 Use::UsePtrVector * puses; 240 if (!(puses = apply_tag ().find (tag))) 241 { 242 Use::UsePtrVector uses; 243 uses.push_back (use); 244 apply_tag ().add (tag, uses); 245 } 246 else 247 { 248 bool have (false); 249 for (int i = 0; i < puses->size (); i++) 250 { 251 if ((*puses)[i] == use) 252 { 253 have = true; 254 break; 255 } 256 } 257 if (!have) 258 puses->push_back (use); 259 } 260 233 261 } 234 262 } … … 603 631 if (tag->m_tag_refs.size () > 0) return (true); 604 632 if (tag->m_tag_excludes.size () > 0) return (true); 633 if (apply_tag ().has (tag)) return (true); 605 634 606 635 return (false); 636 } 637 638 /*----------------------------------------------------------*/ 639 Tag::TagUses& Tag::apply_tag () 640 { 641 static TagUses tag_uses; 642 return tag_uses; 607 643 } 608 644 … … 823 859 out << "]"; 824 860 } 861 862 if (Use::UsePtrVector * puses = apply_tag ().find (this)) 863 { 864 out << " applied ["; 865 for (int i = 0; i < puses->size (); i++) 866 { 867 if (i > 0) out << " "; 868 Use * use = (*puses)[i]; 869 if (use) 870 { 871 out << use->get_package_name (); 872 } 873 else 874 { 875 out << "current"; 876 } 877 } 878 out << "]"; 879 } 880 825 881 if (m_act_context.size () != 0 && 826 882 (m_def_use != 0 && -
CMT/v1r25-branch/source/cmt_tag.h
r568 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- … … 19 20 typedef cmt_vector<Tag> TagVector; 20 21 typedef cmt_vector<Tag*> TagPtrVector; 22 23 typedef cmt_vmap<const Tag*, Use::UsePtrVector> TagUses; 21 24 22 25 static void action (const CmtSystem::cmt_string_vector& words, Use* use); … … 40 43 41 44 static bool check_tag_used (const Tag* tag); 45 46 static TagUses& apply_tag (); 42 47 43 48 public: -
CMT/v1r25-branch/source/cmt_triggers.cxx
r459 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
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 -
CMT/v1r25-branch/source/cmt_use.h
r608 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 //----------------------------------------------------------- … … 128 129 bool get_paths (Use* to, UsePtrVector& list); 129 130 130 bool located () const;131 132 void change_path (const cmt_string& path );131 inline bool located () const { return m_located; } 132 133 void change_path (const cmt_string& path, const Project* project = 0); 133 134 void set_auto_imports (State context_state, State specified_state, 134 135 cmt_map <Use*, bool>& visited); … … 153 154 ScopeType get_current_scope () const; 154 155 155 Project* get_project (); 156 const Project* get_project () const; 157 inline void set_project (const Project* project) { m_project = project; } 156 158 cmt_string get_info () const; 157 159 bool is_head_version (const cmt_string& version); … … 182 184 bool discarded; /* discarded by version strategy */ 183 185 bool selected; /* used for recursive access */ 184 bool m_located;186 // bool m_located; 185 187 bool m_hidden; 186 188 ScopeType initial_scope; … … 213 215 bool skip_discarded = false, ostream& out = cout); 214 216 // void show_sub_uses (const cmt_string& request, bool skip_discarded = false); 215 bool select_alternate ( );217 bool select_alternate (const Project* project = 0); 216 218 Use* get_selected_version (); 217 219 Use* set_selected_version (Use* selected_use); … … 235 237 //cmt_string m_package_name; /* directly read from requirements */ 236 238 239 // Project* m_project; /* the project the use is found in */ 240 const Project* m_project; /* the project the use is found in */ 241 242 bool m_located; 243 237 244 bool m_has_native_version; 238 245 -
CMT/v1r25-branch/source/cmt_vcs.cxx
r590 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 //----------------------------------------------------------- -
CMT/v1r25-branch/source/cmt_vcs.h
r535 r664 2 2 // Copyright Christian Arnault LAL-Orsay CNRS 3 3 // arnault@lal.in2p3.fr 4 // Modified by Grigory Rybkin 4 5 // See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 //----------------------------------------------------------- -
CMT/v1r25-branch/src/Makefile.core
r616 r664 2 2 # Copyright Christian Arnault LAL-Orsay CNRS 3 3 # arnault@lal.in2p3.fr 4 # Modified by Grigory Rybkin 4 5 # See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 #----------------------------------------------------------- -
CMT/v1r25-branch/src/Makefile.header
r616 r664 2 2 # Copyright Christian Arnault LAL-Orsay CNRS 3 3 # arnault@lal.in2p3.fr 4 # Modified by Grigory Rybkin 4 5 # See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 #----------------------------------------------------------- … … 198 199 @echo 199 200 ifndef BCAST_GLOBAL 200 @uses=`$(cmtexe) -private show macros '_project$$|package$$ ' -tag=$(tags)| \201 awk -F = '{if ($$1 ~ /_project$$/) { uses[substr($$1,1,length($$1)-8)]=$$2}else if ($$1 == "package") {cur = $$2;gsub("'\''","",cur)}}END{for (u in uses){if (uses[u]==uses[cur]) print u}}'`; \201 @uses=`$(cmtexe) -private show macros '_project$$|package$$|_offset$$' -tag=$(tags)| \ 202 awk -F = '{if ($$1 ~ /_project$$/) {p = $$2;gsub("'\''","",p);uses[substr($$1,1,length($$1)-8)]=p} else if ($$1 == "package") {cur = $$2;gsub("'\''","",cur)}else if ($$1 ~ /_offset$$/) {u = substr($$1,1,length($$1)-7);if (!(u in uses))uses[u]=""}}END{for (u in uses){if ((uses[cur] != "" && uses[u] == uses[cur] || u == cur) && u != "CMT" && u != "CMTHOME" && u != "CMTUSERCONTEXT") print u}}'`; \ 202 203 for u in $${uses}; do \ 203 204 echo "$${u} : (re)build package $${u} ($(_groups))"; \ … … 208 209 done 209 210 else 210 @uses=`$(cmtexe) -private show macros '_ root$$' -tag=$(tags)| \211 awk -F = '{ u=substr($$1,1,length($$1)-5);if (u != "CMT" && u != "CMTHOME" && u != "CMTUSERCONTEXT") print u}'`; \211 @uses=`$(cmtexe) -private show macros '_project$$|package$$|_offset$$' -tag=$(tags)| \ 212 awk -F = '{if ($$1 ~ /_project$$/) {p = $$2;gsub("'\''","",p);uses[substr($$1,1,length($$1)-8)]=p} else if ($$1 == "package") {cur = $$2;gsub("'\''","",cur)}else if ($$1 ~ /_offset$$/) {u = substr($$1,1,length($$1)-7);if (!(u in uses))uses[u]=""}}END{for (u in uses){if (uses[u] != uses[cur] && (uses[u] == "CMTHOME" || uses[u] == "CMTUSERCONTEXT")) {continue} else if (u != "CMT" && u != "CMTHOME" && u != "CMTUSERCONTEXT") print u}}'`; \ 212 213 for u in $${uses}; do \ 213 214 echo "$${u} : (re)build package $${u} ($(_groups))"; \ -
CMT/v1r25-branch/src/NMakefile.core
r595 r664 2 2 # Copyright Christian Arnault LAL-Orsay CNRS 3 3 # arnault@lal.in2p3.fr 4 # Modified by Grigory Rybkin 4 5 # See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 #----------------------------------------------------------- -
CMT/v1r25-branch/src/NMakefile.header
r595 r664 2 2 # Copyright Christian Arnault LAL-Orsay CNRS 3 3 # arnault@lal.in2p3.fr 4 # Modified by Grigory Rybkin 4 5 # See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 #----------------------------------------------------------- -
CMT/v1r25-branch/src/cleanup.csh
r11 r664 2 2 # Copyright Christian Arnault LAL-Orsay CNRS 3 3 # arnault@lal.in2p3.fr 4 # Modified by Grigory Rybkin 4 5 # See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 #----------------------------------------------------------- 6 7 7 set newpath= 8 unsetenv CMTBIN 9 unsetenv CMTCONFIG 8 10 9 foreach p ( `echo ${PATH} | sed 's#:# #g'` ) 10 echo ${p} | egrep '/CMT/' >& /dev/null 11 set s=${status} 12 if ( "${s}" != 0 ) then 13 if ( ${newpath} == "" ) then 14 set newpath=${p} 11 if ( $?CMTROOT == 1 ) then 12 if ( $?0 == 0 ) then 13 if ( $?tcsh == 1 ) then 14 source ${CMTROOT}/src/cleanup.tcsh 15 else if ( "${shell:t}" == "tcsh" ) then 16 source ${CMTROOT}/src/cleanup.tcsh 17 endif 18 endif 19 endif 20 21 unsetenv CMTROOT 22 23 # Remove CMT entries, if any 24 set newpath=() 25 foreach p (${path:q}) 26 if ( "${p}" !~ "*/CMT/*" ) then 27 if ( ${#newpath} != 0 ) then 28 set newpath=(${newpath:q} ${p:q}) 15 29 else 16 set newpath= ${newpath}:${p}30 set newpath=(${p:q}) 17 31 endif 18 32 endif 19 33 end 20 34 21 setenv PATH ${newpath} 22 unsetenv CMTCONFIG 23 unsetenv CMTROOT 35 set path=(${newpath:q}) 36 unset newpath 24 37 38 unalias cmt 39 40 if ( $?CLASSPATH == 1 ) then 41 if ( "${CLASSPATH}" =~ "*/CMT/*" ) then 42 # Remove CMT entries 43 set _p="${CLASSPATH}" 44 while ( "$_p" =~ "*:*" ) 45 set _p="${_p:s/:/ /}" 46 end 47 48 set newpath= 49 foreach p (${_p}) 50 if ( "${p}" !~ "*/CMT/*" ) then 51 if ( "${newpath}" != "" ) then 52 set newpath=${newpath}:${p} 53 else 54 set newpath=${p} 55 endif 56 endif 57 end 58 59 if ( "${newpath}" != "" ) then 60 setenv CLASSPATH ${newpath} 61 else 62 unsetenv CLASSPATH 63 endif 64 unset _p newpath 65 endif 66 endif 67 68 unalias jcmt 69 70 # Unset MAKEFLAGS, if looks set by CMT 71 if ( $?MAKEFLAGS == 1 ) then 72 if ( "$MAKEFLAGS" =~ "*QUICK=1" ) then 73 unsetenv MAKEFLAGS 74 endif 75 endif -
CMT/v1r25-branch/src/cleanup.sh
r11 r664 2 2 # Copyright Christian Arnault LAL-Orsay CNRS 3 3 # arnault@lal.in2p3.fr 4 # Modified by Grigory Rybkin 4 5 # See the complete license in cmt_license.txt "http://www.cecill.info". 5 6 #----------------------------------------------------------- 6 7 7 newpath="" 8 for p in `echo ${PATH} | sed 's/:/ /g'`; do 9 if test ! "`echo ${p} | egrep CMT`" ; then 10 if test "${newpath}" = "" ; then 11 newpath=${p} 12 else 13 newpath=${newpath}:${p} 8 [ -z ${CMTBIN+CMT} ] || unset CMTBIN 9 [ -z ${CMTCONFIG+CMT} ] || unset CMTCONFIG 10 11 if [ "${CMTROOT+CMT}" = CMT ]; then 12 if [ -n "$-" ] && [ "${-#*i}" != "$-" ]; then 13 if [ -n "${ZSH_NAME-}" ]; then 14 . ${CMTROOT}/src/cleanup.zsh 15 elif [ -n "${BASH-}" ]; then 16 . ${CMTROOT}/src/cleanup.bash 17 fi 18 fi 19 fi 20 21 [ -z ${CMTROOT+CMT} ] || unset CMTROOT 22 23 cmt_clean_path() 24 { 25 # Remove CMT entries, if any 26 _np= 27 _p="$1" 28 while [ -n "$_p" ]; do 29 __p="${_p#:}" 30 while [ "$__p" != "$_p" ]; do 31 _p="${__p}" 32 __p="${_p#:}" 33 done 34 _e="${_p%%:*}" 35 _p="${_p#${_e}}" 36 if [ "${_e%/CMT/*}" = "${_e}" ] && [ -n "${_e}" ]; then 37 if [ -n "${_np}" ]; then 38 _np="${_np}:${_e}" 39 else 40 _np="${_e}" 41 fi 14 42 fi 43 done 44 echo "$_np" 45 unset _np _p __p _e 46 } 47 48 if [ "${PATH%/CMT/*}" != "${PATH}" ]; then 49 newpath=`cmt_clean_path "${PATH}"` 50 PATH=${newpath} 51 unset newpath 52 fi 53 54 if alias cmt >/dev/null 2>&1; then 55 unalias cmt 56 fi 57 58 if [ -n "${CLASSPATH-}" ]; then 59 if [ "${CLASSPATH%/CMT/*}" != "${CLASSPATH}" ]; then 60 newpath=`cmt_clean_path "${CLASSPATH}"` 61 if [ -n "${newpath}" ]; then 62 CLASSPATH=${newpath} 63 else 64 unset CLASSPATH 15 65 fi 16 done 66 unset newpath 67 fi 68 fi 17 69 18 PATH=${newpath}; export PATH 70 if alias jcmt >/dev/null 2>&1; then 71 unalias jcmt 72 fi 19 73 20 CMTCONFIG=; export CMTCONFIG 21 CMTROOT=; export CMTROOT 74 unset -f cmt_clean_path 75 76 # Unset MAKEFLAGS, if looks set by CMT 77 if [ "${MAKEFLAGS+CMT}" = CMT ]; then 78 if [ "${MAKEFLAGS%QUICK=1}" != "${MAKEFLAGS}" ]; then 79 unset MAKEFLAGS 80 fi 81 fi -
CMT/v1r25-branch/src/setup.csh
r612 r664 6 6 #----------------------------------------------------------- 7 7 8 setenv CMTBIN `uname`-`uname -m | tr -d ' '` 8 # Remove spaces, if any 9 set _m="`uname -m`" 10 while ( "$_m" =~ "* *" ) 11 set _m="${_m:s/ //}" 12 end 13 setenv CMTBIN `uname`-"$_m" 14 unset _m 9 15 10 16 if ( $?CMTCONFIG == 0 ) then … … 15 21 if ( $?tcsh == 1 ) then 16 22 source ${CMTROOT}/src/setup.tcsh 17 else if ( `basename "$shell"`== "tcsh" ) then23 else if ( "${shell:t}" == "tcsh" ) then 18 24 source ${CMTROOT}/src/setup.tcsh 19 25 endif 20 26 endif 21 27 28 # Remove CMT entries, if any 22 29 set newpath=() 23 foreach p (${path })30 foreach p (${path:q}) 24 31 if ( "${p}" !~ "*/CMT/*" ) then 25 32 if ( ${#newpath} != 0 ) then 26 set newpath=(${newpath } ${p})33 set newpath=(${newpath:q} ${p:q}) 27 34 else 28 set newpath=(${p })35 set newpath=(${p:q}) 29 36 endif 30 37 endif 31 38 end 32 39 33 set path=(${newpath} "${CMTROOT}/${CMTBIN}") 40 set path=(${newpath:q} "${CMTROOT}/${CMTBIN}") 41 unset newpath 42 34 43 alias cmt '${CMTROOT}/${CMTBIN}/cmt.exe' 35 unset newpath36 44 37 45 if ( $?CLASSPATH == 0 ) then … … 42 50 setenv CLASSPATH ${CLASSPATH}:${CMTROOT}/java/cmt.jar 43 51 else 52 # Remove CMT entries 53 set _p="${CLASSPATH}" 54 while ( "$_p" =~ "*:*" ) 55 set _p="${_p:s/:/ /}" 56 end 57 44 58 set newpath= 45 foreach p ( `echo ${CLASSPATH} | tr ':' ' '`)59 foreach p (${_p}) 46 60 if ( "${p}" !~ "*/CMT/*" ) then 47 61 if ( "${newpath}" != "" ) then … … 58 72 setenv CLASSPATH ${CMTROOT}/java/cmt.jar 59 73 endif 60 unset newpath74 unset _p newpath 61 75 endif 62 76 -
CMT/v1r25-branch/src/setup.sh
r611 r664 6 6 #----------------------------------------------------------- 7 7 8 CMTBIN=`uname`-`uname -m | tr -d ' '`; export CMTBIN 8 # Remove spaces, if any 9 _m="`uname -m`" 10 _nm= 11 while [ -n "$_m" ]; do 12 _t="${_m#?}" 13 _a="${_m%${_t}}" 14 if [ "${_a}" != " " ]; then 15 _nm="${_nm}${_a}" 16 fi 17 _m="$_t" 18 done 19 CMTBIN=`uname`-"$_nm"; export CMTBIN 20 unset _m _nm _t _a 9 21 10 22 if test "${CMTCONFIG}" = "" ; then … … 20 32 fi 21 33 34 cmt_clean_path() 35 { 36 # Remove CMT entries, if any 37 _np= 38 _p="$1" 39 while [ -n "$_p" ]; do 40 __p="${_p#:}" 41 while [ "$__p" != "$_p" ]; do 42 _p="${__p}" 43 __p="${_p#:}" 44 done 45 _e="${_p%%:*}" 46 _p="${_p#${_e}}" 47 if [ "${_e%/CMT/*}" = "${_e}" ] && [ -n "${_e}" ]; then 48 if [ -n "${_np}" ]; then 49 _np="${_np}:${_e}" 50 else 51 _np="${_e}" 52 fi 53 fi 54 done 55 echo "$_np" 56 unset _np _p __p _e 57 } 58 22 59 if [ "${PATH%/CMT/*}" = "${PATH}" ]; then 23 60 PATH=${PATH}:${CMTROOT}/${CMTBIN}; export PATH 24 61 else 25 newpath= 26 for p in `echo ${PATH} | tr ':' ' '`; do 27 if [ "${p%/CMT/*}" = "${p}" ]; then 28 if [ -n "${newpath}" ]; then 29 newpath=${newpath}:${p} 30 else 31 newpath=${p} 32 fi 33 fi 34 done 35 62 newpath=`cmt_clean_path "${PATH}"` 36 63 PATH=${newpath}:${CMTROOT}/${CMTBIN}; export PATH 37 64 unset newpath 38 65 fi 39 66 40 alias cmt='${CMTROOT}/${CMTBIN}/cmt.exe' ; export cmt67 alias cmt='${CMTROOT}/${CMTBIN}/cmt.exe' 41 68 42 69 if [ -z "${CLASSPATH-}" ]; then … … 45 72 CLASSPATH=${CLASSPATH}:${CMTROOT}/java/cmt.jar; export CLASSPATH 46 73 else 47 newpath= 48 for p in `echo ${CLASSPATH-} | tr ':' ' '`; do 49 if [ "${p%/CMT/*}" = "${p}" ]; then 50 if [ -n "${newpath}" ]; then 51 newpath=${newpath}:${p} 52 else 53 newpath=${p} 54 fi 55 fi 56 done 57 74 newpath=`cmt_clean_path "${CLASSPATH}"` 58 75 if [ -n "${newpath}" ]; then 59 76 CLASSPATH=${newpath}:${CMTROOT}/java/cmt.jar; export CLASSPATH … … 64 81 fi 65 82 66 alias jcmt='(java cmt_parser)'; export jcmt 83 alias jcmt='(java cmt_parser)' 84 85 unset -f cmt_clean_path 67 86 68 87 # Set MAKEFLAGS, if unset (similar to NPROC with Plan 9 mk utility) -
CMT/v1r25-branch/src/setup.tcsh
r612 r664 2 2 # Copyright Christian Arnault LAL-Orsay CNRS 3 3 # arnault@lal.in2p3.fr 4 # Modified by garonne@lal.in2p3.fr, Grigory Rybkin 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 #----------------------------------------------------------- -
CMT/v1r25-branch/src/setup.zsh
r612 r664 2 2 # Copyright Christian Arnault LAL-Orsay CNRS 3 3 # arnault@lal.in2p3.fr 4 # Modified by garonne@lal.in2p3.fr, Grigory Rybkin 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 #-----------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.