- Timestamp:
- May 2, 2005, 9:31:23 AM (19 years ago)
- Location:
- CMT/HEAD
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/ChangeLog
r43 r45 1 2005-05-02 Christian Arnault <arnault@lal.in2p3.fr> 272 2 3 * source/cmt_cvs.cxx: Adding CMTPATH internal management 4 Improve broadcast operation after recursive checkouts 5 6 2005-05-01 Christian Arnault <arnault@lal.in2p3.fr> 272 7 8 * mgr/Makefile (pacman): Create the pacman file for that version. 9 10 * mgr/CMT.pacman: Migrate to Pacman3 11 12 * source/cmt_cvs.cxx: Supporting project checkout 13 recursive project checkouts 14 without_version_directory mode 15 container statements in project files. 16 alias version directory 17 Various cleanup and restructuring operations 18 19 * mgr/requirements: Adapt for shared libs on CYGWIN (thanks to Guy Barrand) 20 21 * src/setup.zsh: Add cmt subprojects command 22 23 * src/setup.tcsh: Add cmt subprojects command 24 1 25 2005-04-26 Christian Arnault <arnault@lal.in2p3.fr> 271 2 26 -
CMT/HEAD/mgr/CMT.pacman
r11 r45 5 5 #----------------------------------------------------------- 6 6 7 # 8 # CMT installation and setup. 9 # 10 # (from Saul Youssef himself) 11 # 12 description = 'CMT <version>' 13 url = 'http://www.cmtsite.org' 7 description ('CMT <version>') 8 packageName ('CMT') 9 version ('<version>') 14 10 15 download = {'unix':'CMT<version>.tar.gz'} 16 source = 'http://www.cmtsite.org/<version>/' 11 { 12 platformGE ('Linux') ; downloadUntar ('http://www.cmtsite.org/<version>/CMT<version>Linux-i686.tar.gz', 'CMTBASE') 13 OR 14 platformGE ('Cygwin') ; downloadUntar ('http://www.cmtsite.org/<version>/CMT<version>CYGWIN_NT-5.1-i686', 'CMTBASE') 15 OR 16 downloadUntar ('http://www.cmtsite.org/<version>/CMT<version>.tar.gz', 'CMTBASE') 17 } 17 18 18 inpath = ['gcc','make'] 19 cd ('$CMTBASE/<version>/mgr') 20 shellOutputContains ('INSTALL', 'CMT installation terminated') 21 { 22 shellOutputContains ('. setup.sh; cmt version', '<version>') 23 OR shell ('. setup.sh; gmake') 24 } 25 shellOutputContains ('. setup.sh; cmt version', '<version>') 26 cd () 19 27 20 #paths = [['PATH','$PACMAN_INSTALLATION/CMT/<version>/mgr']]21 enviros = [['CMTROOT',''],['CMTCONFIG','i386_linux24'],['CMTBIN','Linux'],['CLASSPATH','java']]22 localdoc = 'doc/CMT.htm'23 #24 # This turns off using the root directory extracted from tar.25 #26 usePackageRoot = 027 #28 # ...so I cd from the installation area by hand before each shell command.29 #30 install = { '*': ['cd CMT/<version>/mgr; ./INSTALL'] }31 setup = ["source ${PACMAN_INSTALLATION}/CMT/<version>/mgr/setup.SHELL"]32 #33 # since usePackageRoot=0, I have to clean up by hand34 #35 uninstall = ['rm -r -f CMT CMT<version>.tar'] -
CMT/HEAD/mgr/Makefile
r32 r45 209 209 # echo ' <tr><td><a href="CMT-'$${version}'-1.i386.rpm">RPM for redhat 7.2</a></td></tr>' >>doc/CMTDownload.html; 210 210 211 #--------------------------------------------------------- 212 # Construct the pacman file from the generic form 213 #--------------------------------------------------------- 214 pacman :: 215 version=`cmt version`; \ 216 sed -e 's#<version>#'"$${version}"'#g' CMT.pacman >CMT-$${version}.pacman 211 217 212 218 #--------------------------------------------------------- -
CMT/HEAD/mgr/cmt_dependencies.make
r43 r45 17 17 cmt_pattern_cxx_dependencies = ../source/cmt_pattern.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_parser.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_map.h ../source/cmt_pattern.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_branch.h ../source/cmt_fragment.h ../source/cmt_group.h ../source/cmt_constituent.h ../source/cmt_language.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_awk.h ../source/cmt_project.h ../source/cmt_cmtpath_pattern.h ../source/cmt_database.h ../source/cmt_error.h ../source/cmt_syntax.h 18 18 cmt_language_cxx_dependencies = ../source/cmt_language.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_fragment.h ../source/cmt_language.h ../source/cmt_branch.h ../source/cmt_group.h ../source/cmt_constituent.h ../source/cmt_map.h ../source/cmt_pattern.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_awk.h ../source/cmt_project.h ../source/cmt_cmtpath_pattern.h ../source/cmt_database.h 19 cmt_cvs_cxx_dependencies = ../source/cmt_cvs.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_parser.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_cvs.h ../source/cmt_awk.h ../source/cmt_map.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_pattern.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_tag.h ../source/cmt_symbol.h 19 cmt_cvs_cxx_dependencies = ../source/cmt_cvs.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_parser.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_cvs.h ../source/cmt_awk.h ../source/cmt_map.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_pattern.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_project.h 20 20 cmt_group_cxx_dependencies = ../source/cmt_group.cxx ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_vector.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_group.h ../source/cmt_branch.h ../source/cmt_fragment.h ../source/cmt_constituent.h ../source/cmt_language.h ../source/cmt_map.h ../source/cmt_pattern.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_awk.h ../source/cmt_project.h ../source/cmt_cmtpath_pattern.h ../source/cmt_database.h 21 21 cmt_database_cxx_dependencies = ../source/cmt_database.cxx ../source/cmt_vector.h ../source/cmt_std.h ../source/cmt_string.h ../source/cmt_regexp.h ../source/cmt_system.h ../source/cmt.h ../source/cmt_parser.h ../source/cmt_branch.h ../source/cmt_fragment.h ../source/cmt_group.h ../source/cmt_constituent.h ../source/cmt_language.h ../source/cmt_map.h ../source/cmt_pattern.h ../source/cmt_include.h ../source/cmt_script.h ../source/cmt_scope_section.h ../source/cmt_use.h ../source/cmt_tag.h ../source/cmt_symbol.h ../source/cmt_awk.h ../source/cmt_project.h ../source/cmt_cmtpath_pattern.h ../source/cmt_database.h -
CMT/HEAD/mgr/requirements
r43 r45 67 67 tag SunOS Unix 68 68 69 tag CYGWIN_NT-5.1 Unix CYGWIN Linux69 tag CYGWIN_NT-5.1 Unix CYGWIN 70 70 71 71 tag alpha OSF1 … … 365 365 OSF1 "${CMTROOT}/mgr/cmt_make_shlib_common.sh noextract" \ 366 366 Linux "${CMTROOT}/mgr/cmt_make_shlib_common.sh extract" \ 367 CYGWIN "${CMTROOT}/mgr/cmt_make_shlib_common.sh extract" \ 367 368 SunOS "${CMTROOT}/mgr/cmt_make_shlib_common.sh extract" \ 368 369 Darwin "${CMTROOT}/mgr/cmt_make_shlib_common.sh extract" \ … … 374 375 SunOS "so" \ 375 376 Linux "so" \ 377 CYGWIN "dll" \ 376 378 Darwin "dylib" \ 377 379 WIN32 "dll" … … 382 384 SunOS "CC" \ 383 385 Linux "g++" \ 386 CYGWIN "g++" \ 384 387 Darwin "c++" 385 388 … … 388 391 OSF1 "-shared -expect_unresolved '*'" \ 389 392 Linux "-shared" \ 393 CYGWIN "-shared" \ 390 394 SunOS "$(debug_option)" \ 391 395 VisualC "" \ … … 437 441 438 442 macro application_suffix ".exe" 439 macro library_prefix "lib" WIN32 "" 443 macro library_prefix "lib" WIN32 "" CYGWIN "" 440 444 macro library_suffix "" 441 445 -
CMT/HEAD/source/cmt_cvs.cxx
r44 r45 12 12 #include "cmt_awk.h" 13 13 #include "cmt_symbol.h" 14 #include "cmt_project.h" 14 15 15 16 /** … … 69 70 /** 70 71 71 History : maintains the history of checkout packages during a72 History : maintains the history of checkouts during a 72 73 recursive checkout, so as to avoid double checkouts. 73 74 … … 173 174 CvsImplementation () 174 175 { 175 m_recursive = false; 176 m_head = false; 177 m_cmtcvstest = false; 178 m_verbose = false; 176 clear (); 177 } 178 179 void clear () 180 { 181 m_recursive = false; 182 m_head = false; 183 m_verbose = false; 179 184 m_simulation = false; 180 185 181 m_home_dir = "";186 m_home_dir = ""; 182 187 m_checkout_dir = ""; 183 m_ offset= "";184 m_ branch_suffix= "";185 186 m_last_module = "";187 m_last_cvs_infos = "";188 structure_info = "";189 error_info = "";190 tags_top_info = "";191 tags_info = "";188 m_version_dir = ""; 189 m_cvs_offset = ""; 190 191 m_last_module = ""; 192 m_last_cvs_infos = ""; 193 structure_info = ""; 194 error_info = ""; 195 tags_top_info = ""; 196 tags_info = ""; 192 197 cvsversions_top_info = ""; 193 cvsversions_info = "";194 branches_info = "";195 subpackages_info = "";196 subprojects_info = "";197 198 m_protocol_level = "";198 cvsversions_info = ""; 199 branches_info = ""; 200 subpackages_info = ""; 201 subprojects_info = ""; 202 203 m_protocol_level = ""; 199 204 200 205 Symbol* symbol = Symbol::find ("cmt_cvs_protocol_level"); … … 204 209 Symbol::expand (m_protocol_level); 205 210 } 211 } 212 213 CvsImplementation& operator = (const CvsImplementation& other) 214 { 215 m_recursive = other.m_recursive; 216 m_head = other.m_head; 217 m_verbose = other.m_verbose; 218 m_simulation = other.m_simulation; 219 220 m_home_dir = other.m_home_dir; 221 m_checkout_dir = other.m_checkout_dir; 222 m_version_dir = other.m_version_dir; 223 m_cvs_offset = other.m_cvs_offset; 224 m_protocol_level = other.m_protocol_level; 225 m_last_module = other.m_last_module; 226 m_last_cvs_infos = other.m_last_cvs_infos; 227 228 structure_info = other.structure_info; 229 error_info = other.error_info; 230 tags_top_info = other.tags_top_info; 231 tags_info = other.tags_info; 232 cvsversions_top_info = other.cvsversions_top_info; 233 cvsversions_info = other.cvsversions_info; 234 branches_info = other.branches_info; 235 subpackages_info = other.subpackages_info; 236 subprojects_info = other.subprojects_info; 237 238 return (*this); 206 239 } 207 240 … … 229 262 } 230 263 } 264 265 int execute (const cmt_string& command) 266 { 267 int status = 0; 268 269 if (m_verbose || m_simulation) 270 { 271 cout << "#CMT> Executing [" << command << "]" << endl; 272 } 273 274 if (!m_simulation) 275 { 276 status = CmtSystem::execute (command); 277 } 278 279 return (status); 280 } 281 282 void execute_and_retry (const cmt_string& command, const cmt_string& message) 283 { 284 int status; 285 int retry = 0; 286 287 for (;;) 288 { 289 status = execute (command); 290 291 if (status != 0) 292 { 293 retry++; 294 295 cout << "# " << message << ": status=" << status << endl; 296 cout << "#---------------------------------------------------------" << endl; 297 298 if (retry > 5) exit(0); 299 } 300 else 301 { 302 break; 303 } 304 } 305 } 306 307 int execute (const cmt_string& command, cmt_string& out) 308 { 309 int status = 0; 310 311 if (m_verbose || m_simulation) 312 { 313 cout << "#CMT> Executing [" << command << "]" << endl; 314 } 315 316 if (!m_simulation) 317 { 318 status = CmtSystem::execute (command, out); 319 } 320 321 return (status); 322 } 323 231 324 232 325 /** … … 272 365 command += " -Q co -p CVSROOT/loginfo "; 273 366 274 if (m_verbose || m_simulation) 275 { 276 cout << "#CMT> Executing [" << command << "]" << endl; 277 } 278 279 if (!m_simulation) 280 { 281 found = false; 282 283 cmt_string loginfo; 284 285 CmtSystem::execute (command, loginfo); 286 287 cmt_string pattern = ".cmtcvsinfos/"; 288 pattern += m_protocol_level; 289 290 int pos = loginfo.find (pattern); 291 292 if (pos != cmt_string::npos) 293 { 294 found = true; 295 } 367 found = false; 368 369 cmt_string pattern = ".cmtcvsinfos/"; 370 pattern += m_protocol_level; 371 372 cmt_string loginfo; 373 374 if (m_simulation) 375 { 376 loginfo = pattern; 377 } 378 379 execute (command, loginfo); 380 381 int pos = loginfo.find (pattern); 382 383 if (pos != cmt_string::npos) 384 { 385 found = true; 296 386 } 297 387 … … 353 443 if (!CmtSystem::mkdir (tmp_dir)) 354 444 { 355 cout << "#CMT> Cannot create the temporary directory [" 356 << tmp_dir << "]" << endl; 445 cout << "#CMT> Cannot create the temporary directory [" << tmp_dir << "]" << endl; 357 446 return; 358 447 } … … 380 469 } 381 470 382 /* 383 # 384 # The script associated to such entries is supposed to : 385 # 1) extract the set of <infos> from ${module}/cmt/requirements 386 # or ${module}/cmt/project.cmt 387 # 2) build an output of the form : 388 # <infos>=info1 info2 info3 ... 389 # 390 # Currently this script can be found in 391 # 392 # ${CMTROOT}/cmt/cmt_buildcvsinfos2.sh 393 # %CMTROOT%/cmt/cmt_buildcvsinfos.py 394 # There is a C++ implementation as cmtcvs.exe 395 # 471 /** 472 The script associated to such entries is supposed to : 473 1) extract the set of <infos> from ${module}/cmt/requirements 474 or ${module}/cmt/project.cmt 475 2) build an output of the form : 476 <infos>=info1 info2 info3 ... 477 478 Currently this script can be found in 479 480 ${CMTROOT}/cmt/cmt_buildcvsinfos2.sh 481 %CMTROOT%/cmt/cmt_buildcvsinfos.py 482 There is a C++ implementation as cmtcvs.exe 483 396 484 */ 397 485 … … 418 506 419 507 command += cmtcvsinfos; 420 421 if (m_cmtcvstest)422 {423 command += "/cmtcvstest";424 }425 508 426 509 if (m_protocol_level != "") … … 433 516 command += " CMT v1"; 434 517 435 if (m_verbose || m_simulation)436 {437 cout << "#CMT> Executing [" << command << "]" << endl;438 }439 440 518 m_last_cvs_infos = ""; 441 CmtSystem::execute (command, m_last_cvs_infos); 519 520 execute (command, m_last_cvs_infos); 442 521 443 522 if (m_verbose) … … 467 546 all subprojects installed below the module. 468 547 469 In principle, only modules corresponding to true CMT p ackages or projectsare considered.548 In principle, only modules corresponding to true CMT products (packages or projects) are considered. 470 549 o tags are obtained from the requirements or the project file 471 550 o branches are sub-directories which are not themselves packages … … 473 552 (a subdirectory is always either a branch or a subpackage) 474 553 */ 475 void show_cvs_infos(const cmt_string& module)554 void get_cvs_infos_with_offset (const cmt_string& module) 476 555 { 477 556 if (!check_protocol ()) … … 503 582 /** 504 583 Now retrieve all info fields : 505 506 structure=507 error=508 tags_top=509 tags=510 branches=511 subpackages=512 subprojects=513 514 584 */ 515 585 … … 650 720 filter_list (cvsversions_info, exp); 651 721 } 652 653 if (m_cmtcvstest) 654 { 655 cout << "## tags_top_info=" << tags_top_info << endl; 656 cout << "## tags_info=" << tags_info << endl; 657 cout << "## cvsversions_top_info=" << cvsversions_top_info << endl; 658 cout << "## cvsversions_info=" << cvsversions_info << endl; 659 } 660 661 } 662 663 void show_cvs_infos (const cmt_string& offset, 664 const cmt_string& module) 722 } 723 724 void get_cvs_infos (const cmt_string& cvs_offset, const cmt_string& module) 665 725 { 666 726 cmt_string full_name; 667 727 668 if ( offset != "")669 { 670 full_name = offset;728 if (cvs_offset != "") 729 { 730 full_name = cvs_offset; 671 731 full_name += "/"; 672 732 while (full_name.find ("//") != cmt_string::npos) … … 678 738 full_name += module; 679 739 680 show_cvs_infos(full_name);740 get_cvs_infos_with_offset (full_name); 681 741 } 682 742 … … 713 773 } 714 774 715 bool get_version (const cmt_string& prefix,716 const cmt_string& p ackage,775 bool get_version (const cmt_string& offset, 776 const cmt_string& product, 717 777 const cmt_string& version_request, 718 778 cmt_string& module, … … 729 789 module = ""; 730 790 731 if ( prefix!= "")732 { 733 module = prefix;791 if (offset != "") 792 { 793 module = offset; 734 794 module += "/"; // This is for CVS only thus we don't use the real separator. 735 795 while (module.find ("//") != cmt_string::npos) … … 739 799 } 740 800 741 module += p ackage;801 module += product; 742 802 743 803 /** … … 750 810 * the HEAD) or not. The returned at_head flag will show this. 751 811 * 752 * then the requested p ackagemay either be located in the CVS repository753 * under the prefixor not, the returned module will contain the effective812 * then the requested product may either be located in the CVS repository 813 * under the offset or not, the returned module will contain the effective 754 814 * location where the requested version has been found. 755 815 */ … … 760 820 } 761 821 762 show_cvs_infos(module);822 get_cvs_infos_with_offset (module); 763 823 764 824 if (error_info != "") 765 825 { 766 826 versions = ""; 767 cout << "#CMT> P ackage " << package<< " not found in ${CVSROOT}" << endl;827 cout << "#CMT> Product " << product << " not found in ${CVSROOT}" << endl; 768 828 return (false); 769 829 } … … 783 843 } 784 844 785 if (m_cmtcvstest) cout << "## (version expression is " << v << ")" << endl;786 787 845 cmt_regexp version_exp (v); 788 846 789 847 if (!match_version_request (versions, version_exp, version)) 790 848 { 791 if (m_cmtcvstest) cout << "## (no match in " << versions << ")" << endl;792 793 849 // We try on non-top versions 794 850 … … 797 853 if (!match_version_request (versions, version_exp, version)) 798 854 { 799 if (m_cmtcvstest) cout << "## (no match in " << versions << ")" << endl;800 801 855 version = requested_version; 802 856 int pos = 0; … … 838 892 else 839 893 { 840 if (m_cmtcvstest) cout << "## (match in non head " << versions << ")" << endl;841 842 894 at_head = false; 843 895 } … … 845 897 else 846 898 { 847 if (m_cmtcvstest) cout << "## (match in head " << versions << ")" << endl;848 849 899 at_head = true; 850 900 } … … 857 907 } 858 908 859 cmt_string build_version_directory (const cmt_string& prefix, 860 const cmt_string& package, 909 /** 910 Take care of structuring style for packages and of project vs package conventions 911 */ 912 cmt_string build_version_directory (const cmt_string& offset, 913 const cmt_string& product, 861 914 const cmt_string& version) 862 915 { … … 865 918 if (m_checkout_dir != "") 866 919 { 920 // consider the usual -d option 921 867 922 dir += CmtSystem::file_separator (); 868 923 dir += m_checkout_dir; … … 870 925 871 926 dir += CmtSystem::file_separator (); 872 dir += prefix;927 dir += offset; 873 928 dir += CmtSystem::file_separator (); 874 dir += p ackage;875 876 if ( Cmt::get_current_structuring_style () == with_version_directory)929 dir += product; 930 931 if ((structure_info == "project") || (Cmt::get_current_structuring_style () == with_version_directory)) 877 932 { 878 933 dir += CmtSystem::file_separator (); … … 883 938 884 939 return (dir); 940 } 941 942 /** 943 Wrapper to mkdir handling simulation and verbose options. 944 */ 945 bool mkdir (const cmt_string& dir) 946 { 947 if (m_simulation) 948 { 949 cout << "#CMT> Would create the " << dir << " directory" << endl; 950 } 951 else 952 { 953 if (!CmtSystem::cd (dir)) 954 { 955 if (m_verbose) 956 { 957 cout << "#CMT> About to mkdir " << dir << endl; 958 } 959 960 CmtSystem::mkdir (dir); 961 if (!CmtSystem::cd (dir)) 962 { 963 cout << "# Error creating the directory :" << dir << endl; 964 cout << "#---------------------------------------------------------" << endl; 965 return (false); 966 } 967 } 968 } 969 return (true); 970 } 971 972 /** 973 When running cmt cvs commands, we stand by definition outside of any existing 974 package context. Thus it's likely that CMTPATH are not completely defined. 975 This function manually prepends CMTPATH entries to the environment variable. 976 */ 977 void add_cmtpath (const cmt_string& dir) 978 { 979 static cmt_string CMTPATH; 980 981 cmt_string cmtpath = CmtSystem::getenv ("CMTPATH"); 982 983 if (cmtpath.find (dir) == cmt_string::npos) 984 { 985 CMTPATH = "CMTPATH="; 986 CMTPATH += dir; 987 CMTPATH += ":"; 988 CMTPATH += cmtpath; 989 990 CmtSystem::putenv (CMTPATH); 991 } 992 993 if (m_verbose) 994 { 995 cout << "#CMT> CMTPATH=" << CmtSystem::getenv ("CMTPATH") << endl; 996 } 997 } 998 999 /** 1000 Construct CVS management files in the top directory. This is needed 1001 if the top directory of a product is empty. (In this case the 1002 co -l results in nothing) 1003 */ 1004 void make_management_files (const cmt_string& module, 1005 const cmt_string& entries_text) 1006 { 1007 if (!CmtSystem::test_directory ("CVS")) 1008 { 1009 /** 1010 * The CVS repository had not been created (this is generally 1011 * due to the lack of top files) 1012 */ 1013 1014 if (!mkdir ("CVS")) return; 1015 1016 CmtSystem::cd (".."); 1017 1018 cmt_string s; 1019 1020 // Let's create first the CVS/Root file. 1021 1022 CmtSystem::get_cvsroot (s); 1023 s += "\n"; 1024 1025 cmt_string f; 1026 1027 f = "CVS"; 1028 f += CmtSystem::file_separator (); 1029 f += "Root"; 1030 1031 if (m_simulation) 1032 { 1033 cout << "#CMT> Would fill in the CVS/Root file with " << endl; 1034 cout << s << endl; 1035 } 1036 else 1037 { 1038 if (m_verbose) 1039 { 1040 cout << "#CMT> Fill in the CVS/Root file with " << endl; 1041 cout << s << endl; 1042 } 1043 s.write (f); 1044 } 1045 1046 // Now we create the CVS/Repository file 1047 1048 f = "CVS"; 1049 f += CmtSystem::file_separator (); 1050 f += "Repository"; 1051 1052 CmtSystem::get_cvsroot (s); 1053 if (s[0] == ':') 1054 { 1055 int pos = s.find (1, ":"); 1056 s.erase (0, pos+1); 1057 pos = s.find (0, ":"); 1058 s.erase (0, pos+1); 1059 } 1060 s += "/"; 1061 s += module; 1062 s += "\n"; 1063 1064 if (m_simulation) 1065 { 1066 cout << "#CMT> Would fill in the CVS/Repository file with " << endl; 1067 cout << s << endl; 1068 } 1069 else 1070 { 1071 if (m_verbose) 1072 { 1073 cout << "#CMT> Fill in the CVS/Repository file with " << endl; 1074 cout << s << endl; 1075 } 1076 s.write (f); 1077 } 1078 } 1079 1080 if (m_simulation) 1081 { 1082 cout << "#CMT> Would write the top CVS/Entries file with " << endl; 1083 cout << entries_text << endl; 1084 } 1085 else 1086 { 1087 cmt_string entries_file_name; 1088 1089 entries_file_name = "CVS"; 1090 entries_file_name += CmtSystem::file_separator (); 1091 entries_file_name += "Entries"; 1092 1093 cmt_string text; 1094 1095 if (!text.read (entries_file_name)) 1096 { 1097 // This happens when there were no top files 1098 } 1099 1100 text += entries_text; 1101 1102 // Now the CVS/Entries is ready to be created. 1103 if (m_verbose) 1104 { 1105 cout << "#CMT> Fill in the top CVS/Entries file with " << endl; 1106 cout << text << endl; 1107 } 1108 1109 text.write (entries_file_name); 1110 } 1111 885 1112 } 886 1113 … … 888 1115 Specific checkout of one project 889 1116 */ 890 bool really_checkout_project_contents (const cmt_string& prefix,1117 bool really_checkout_project_contents (const cmt_string& offset, 891 1118 const cmt_string& project, 892 1119 const cmt_string& version, 1120 const cmt_string& tag, 893 1121 const cmt_string& module, 894 1122 const cmt_string& basedir, … … 900 1128 cout << " # get project files into " << dir << endl; 901 1129 902 if (m_simulation) 903 { 904 cout << "#CMT> Would mkdir " << version << endl; 905 } 906 else 907 { 908 if (m_verbose) 909 { 910 cout << "#CMT> About to mkdir " << version << endl; 911 } 912 913 CmtSystem::mkdir (version); 914 CmtSystem::cd (version); 915 } 1130 cmt_string version_dir = version; 1131 1132 if (!mkdir (version_dir)) return (false); 916 1133 917 1134 dir += CmtSystem::file_separator (); 918 dir += version; 919 1135 dir += version_dir; 920 1136 921 1137 cmt_string command = "cvs -Q co -P "; … … 923 1139 { 924 1140 command += "-r "; 925 command += version;926 } 927 928 command += " -d cmt ";1141 command += (tag != "") ? tag : version; 1142 } 1143 1144 command += " -d cmt "; 929 1145 930 1146 command += " "; … … 932 1148 command += "/cmt"; 933 1149 934 int status = 0; 935 int retry = 0; 936 937 for (;;) 938 { 939 if (m_verbose || m_simulation) 940 { 941 cout << "#CMT> Executing [" << command << "]" << endl; 942 } 943 944 if (!m_simulation) 945 { 946 //status = CmtSystem::execute (command, out); 947 status = CmtSystem::execute (command); 948 } 949 950 if (status != 0) 951 { 952 retry++; 953 954 cout << "# Error getting project CMT contents: status=" << status << endl; 955 cout << "#---------------------------------------------------------" << endl; 956 957 if (retry > 5) exit(0); 958 } 959 else 960 { 961 break; 962 } 963 } 1150 execute_and_retry (command, "Error getting project CMT contents"); 1151 1152 make_management_files (module, "D/cmt////\n"); 964 1153 965 1154 return (true); … … 974 1163 4) write the CVS management files if CVS did not do it. 975 1164 */ 976 bool really_checkout_package_contents (const cmt_string& prefix,1165 bool really_checkout_package_contents (const cmt_string& offset, 977 1166 const cmt_string& package, 978 1167 const cmt_string& version, … … 1002 1191 command += " -d "; 1003 1192 command += package; 1193 1194 // Must stand just above the package directory 1195 CmtSystem::cd (".."); 1196 CmtSystem::dirname (dir, dir); 1004 1197 } 1005 1198 … … 1007 1200 command += module; 1008 1201 1009 if (m_cmtcvstest) 1010 { 1011 cmt_string cvsroot; 1012 1013 CmtSystem::get_cvsroot (cvsroot); 1014 1015 cout << "## cvsroot=" << cvsroot << " command[" << command << "]" << endl; 1016 } 1017 1018 int status = 0; 1019 int retry = 0; 1020 1021 for (;;) 1022 { 1023 if (m_verbose || m_simulation) 1024 { 1025 cout << "#CMT> Executing [" << command << "]" << endl; 1026 } 1027 1028 if (!m_simulation) 1029 { 1030 //status = CmtSystem::execute (command, out); 1031 status = CmtSystem::execute (command); 1032 } 1033 1034 if (status != 0) 1035 { 1036 retry++; 1037 1038 cout << "# Error getting package CMT contents: status=" << status << endl; 1039 cout << "#---------------------------------------------------------" << endl; 1040 1041 if (retry > 5) exit(0); 1042 1043 } 1044 else 1045 { 1046 break; 1047 } 1048 } 1202 execute_and_retry (command, "Error getting package CMT contents"); 1049 1203 1050 1204 if (Cmt::get_current_structuring_style () == with_version_directory) 1051 1205 { 1052 if (m_simulation) 1053 { 1054 cout << "#CMT> Would mkdir " << version << endl; 1055 } 1056 else 1057 { 1058 if (m_verbose) 1059 { 1060 cout << "#CMT> About to mkdir " << version << endl; 1061 } 1062 1063 if (!CmtSystem::cd (version)) 1064 { 1065 CmtSystem::mkdir (version); 1066 if (!CmtSystem::cd (version)) 1067 { 1068 cout << "# Error creating the version directory :" << version << endl; 1069 cout << "#---------------------------------------------------------" << endl; 1070 return (false); 1071 } 1072 } 1073 1074 /* 1075 if (m_verbose) 1076 { 1077 cout << "#CMT> pwd.2=" << CmtSystem::pwd () << endl; 1078 } 1079 */ 1080 } 1206 if (!mkdir (version)) return (false); 1081 1207 1082 1208 dir += CmtSystem::file_separator (); … … 1085 1211 else 1086 1212 { 1087 if (m_simulation) 1088 { 1089 cout << "#CMT> will mkdir " << package << endl; 1090 } 1091 else 1092 { 1093 if (!CmtSystem::cd (package)) 1094 { 1095 if (m_verbose) 1096 { 1097 cout << "#CMT> About to mkdir " << package << endl; 1098 } 1099 CmtSystem::mkdir (package); 1100 if (!CmtSystem::cd (package)) 1101 { 1102 cout << "# Error creating the package directory :" << package << endl; 1103 cout << "#---------------------------------------------------------" << endl; 1104 return (false); 1105 } 1106 } 1107 1108 /* 1109 if (m_verbose) 1110 { 1111 cout << "#CMT> pwd.3=" << CmtSystem::pwd () << endl; 1112 } 1113 */ 1114 } 1213 if (!mkdir (package)) return (false); 1115 1214 1116 1215 dir += CmtSystem::file_separator (); … … 1118 1217 } 1119 1218 1120 cmt_string entries_file_name; 1121 cmt_string text; 1122 1219 if (m_verbose) 1220 { 1221 cout << "#CMT> Now getting subdirectories pwd=" << CmtSystem::pwd () << " dir=" << dir << endl; 1222 } 1223 1123 1224 cmt_string branches = CmtSystem::getenv ("CMTCVSBRANCHES"); 1124 1225 … … 1132 1233 CmtSystem::split (branches, " \t", branch_vector); 1133 1234 1235 cout << " # get branches " << branches << endl; 1236 1237 cmt_string text = ""; 1238 1239 command = ""; 1240 1134 1241 int i; 1135 1242 1136 cout << " # get branches " << branches << endl;1137 1138 //command = "(";1139 command = "";1140 1141 entries_file_name = "CVS";1142 entries_file_name += CmtSystem::file_separator ();1143 entries_file_name += "Entries";1144 1145 if (!text.read (entries_file_name))1146 {1147 // This happens when there were no top files1148 }1149 1150 1243 for (i = 0; i < branch_vector.size (); i++) 1151 1244 { … … 1157 1250 } 1158 1251 1159 //command += "cvs -Q co -P ";1160 1252 command += "cvs -Q co "; 1161 1253 1162 // if (branch != "cmt")1163 // {1164 1254 if (!at_head) 1165 1255 { … … 1167 1257 command += version; 1168 1258 } 1169 // }1170 1259 1171 1260 command += " -d "; … … 1175 1264 command += "/"; // CVS uses the '/' notation on all platforms!! 1176 1265 command += branch; 1177 //command += "\n";1178 1266 1179 1267 text += "D/"; … … 1182 1270 } 1183 1271 1184 //command += "; echo cmtcvsstatus=$?) 2>&1 "; 1185 1186 if (m_cmtcvstest) 1187 { 1188 cmt_string cvsroot; 1189 1190 CmtSystem::get_cvsroot (cvsroot); 1191 1192 cout << " cvsroot=" << cvsroot << " command[" << command << "]" << endl; 1193 } 1194 1195 status = 0; 1196 retry = 0; 1197 1198 for (;;) 1199 { 1200 if (m_verbose || m_simulation) 1201 { 1202 cout << "#CMT> Executing [" << command << "]" << endl; 1203 } 1204 1205 if (!m_simulation) 1206 { 1207 //status = CmtSystem::execute (command, out); 1208 status = CmtSystem::execute (command); 1209 } 1210 1211 if (status != 0) 1212 { 1213 retry++; 1214 1215 cout << "# Error getting package contents: status=" << status << endl; 1216 cout << "#---------------------------------------------------------" << endl; 1217 1218 if (retry > 5) exit(0); 1219 1220 } 1221 else 1222 { 1223 break; 1224 } 1225 } 1226 1227 if (!CmtSystem::test_directory ("CVS")) 1228 { 1229 /** 1230 * The CVS repository had not been created (this is generally 1231 * due to the lack of top files) 1232 */ 1233 1234 if (m_simulation) 1235 { 1236 cout << "#CMT> Would create the CVS directory" << endl; 1237 } 1238 else 1239 { 1240 if (m_verbose) 1241 { 1242 cout << "#CMT> About to mkdir " << "CVS" << endl; 1243 } 1244 CmtSystem::mkdir ("CVS"); 1245 } 1246 1247 cmt_string s; 1248 1249 // Let's create first the CVS/Root file. 1250 1251 CmtSystem::get_cvsroot (s); 1252 s += "\n"; 1253 1254 cmt_string f; 1255 1256 f = "CVS"; 1257 f += CmtSystem::file_separator (); 1258 f += "Root"; 1259 1260 if (m_simulation) 1261 { 1262 cout << "#CMT> Would fill in the CVS/Root file with " << endl; 1263 cout << s << endl; 1264 } 1265 else 1266 { 1267 if (m_verbose) 1268 { 1269 cout << "#CMT> Fill in the CVS/Root file with " << endl; 1270 cout << s << endl; 1271 } 1272 s.write (f); 1273 } 1274 1275 // Now we create the CVS/Repository file 1276 1277 f = "CVS"; 1278 f += CmtSystem::file_separator (); 1279 f += "Repository"; 1280 1281 CmtSystem::get_cvsroot (s); 1282 if (s[0] == ':') 1283 { 1284 int pos = s.find (1, ":"); 1285 s.erase (0, pos+1); 1286 pos = s.find (0, ":"); 1287 s.erase (0, pos+1); 1288 } 1289 s += "/"; 1290 s += module; 1291 s += "\n"; 1292 1293 if (m_simulation) 1294 { 1295 cout << "#CMT> Would fill in the CVS/Repository file with " << endl; 1296 cout << s << endl; 1297 } 1298 else 1299 { 1300 if (m_verbose) 1301 { 1302 cout << "#CMT> Fill in the CVS/Repository file with " << endl; 1303 cout << s << endl; 1304 } 1305 s.write (f); 1306 } 1307 } 1308 1309 if (m_simulation) 1310 { 1311 cout << "#CMT> Would write the top CVS/Entries file with " << endl; 1312 cout << text << endl; 1313 } 1314 else 1315 { 1316 // Now the CVS/Entries is ready to be created. 1317 if (m_verbose) 1318 { 1319 cout << "#CMT> Fill in the top CVS/Entries file with " << endl; 1320 cout << text << endl; 1321 } 1322 text.write (entries_file_name); 1323 } 1272 execute_and_retry (command, "Error getting package contents"); 1273 1274 make_management_files (module, text); 1324 1275 1325 1276 return (true); … … 1329 1280 Effective checkout of a package or a project 1330 1281 */ 1331 bool really_checkout (const cmt_string& prefix,1332 const cmt_string& p ackage,1282 bool really_checkout (const cmt_string& offset, 1283 const cmt_string& product, 1333 1284 const cmt_string& version, 1285 const cmt_string& tag, 1334 1286 const cmt_string& module, 1335 1287 const cmt_string& basedir, … … 1339 1291 cmt_string out; 1340 1292 1341 cout << "# ================= working on " << structure_info << " " << p ackage1293 cout << "# ================= working on " << structure_info << " " << product 1342 1294 << " version " << version; 1343 1295 1344 1296 if (at_head) cout << " (At head) "; 1345 1297 1346 cmt_string full_ prefix;1347 1348 full_ prefix = m_offset;1349 full_ prefix += prefix;1298 cmt_string full_offset; 1299 1300 full_offset = m_cvs_offset; 1301 full_offset += offset; 1350 1302 1351 1303 cmt_string echo_ppath; 1352 1304 1353 if ( prefix!= "")1305 if (offset != "") 1354 1306 { 1355 1307 echo_ppath = " path "; 1356 echo_ppath += prefix; 1357 } 1358 1359 cout << echo_ppath << endl; 1360 1361 CmtSystem::dirname (dir, dir); 1362 1363 //if (Cmt::get_current_structuring_style () == with_version_directory) 1364 1365 if (m_simulation) 1366 { 1367 cout << "#CMT> Would mkdir " << dir << endl; 1368 } 1369 else 1370 { 1371 if (m_verbose) 1372 { 1373 cout << "#CMT> About to mkdir " << dir << endl; 1374 } 1375 1376 if (!CmtSystem::mkdir (dir)) 1377 { 1378 cout << "# Error creating the base directory :" << dir << endl; 1379 cout << "#---------------------------------------------------------" << endl; 1380 return (false); 1381 } 1382 1383 CmtSystem::cd (dir); 1384 1385 /* 1386 if (m_verbose) 1387 { 1388 cout << "#CMT> pwd.1=" << CmtSystem::pwd () << endl; 1389 } 1390 */ 1391 } 1308 echo_ppath += offset; 1309 } 1310 1311 cout << echo_ppath << " in " << dir << endl; 1312 1313 if ((structure_info == "project") || (Cmt::get_current_structuring_style () == with_version_directory)) 1314 { 1315 // Move back to the product name. 1316 CmtSystem::dirname (dir, dir); 1317 } 1318 1319 if (!mkdir (dir)) return (false); 1392 1320 1393 1321 if (structure_info == "package") 1394 1322 { 1395 really_checkout_package_contents ( prefix,1396 p ackage,1323 really_checkout_package_contents (offset, 1324 product, 1397 1325 version, 1398 1326 module, … … 1403 1331 else if (structure_info == "project") 1404 1332 { 1405 really_checkout_project_contents ( prefix,1406 p ackage,1333 really_checkout_project_contents (offset, 1334 product, 1407 1335 version, 1336 tag, 1408 1337 module, 1409 1338 basedir, … … 1416 1345 1417 1346 cmt_string find_matching_version (const cmt_string& expression) 1418 { 1419 cmt_string result; 1420 1421 // 1422 // Here expression takes the form 1423 // <some path>/<expression with wild-card> 1424 // 1425 1426 cmt_string dir; 1427 CmtSystem::dirname (expression, dir); 1428 dir += CmtSystem::file_separator (); 1429 1430 cmt_string version; 1431 CmtSystem::basename (expression, version); 1432 1433 if (version.find ("*") == cmt_string::npos) 1434 { 1435 // there is no wildcarding here. A simple test is enough. 1436 if (CmtSystem::test_directory (expression)) 1437 { 1438 if (m_cmtcvstest) cout << "## Found direct match with " << version << endl; 1439 result = version; 1440 } 1441 else 1442 { 1443 if (m_cmtcvstest) cout << "## Explicit version " << version 1444 << " has no direct match" << endl; 1445 } 1446 } 1447 else 1448 { 1449 version.replace ("*", ".*"); 1450 1451 cmt_regexp exp (version); 1452 1453 CmtSystem::cmt_string_vector list; 1454 1455 if (m_cmtcvstest) cout << "## Trying scan_dir dir=" << dir 1456 << " exp=" << version << endl; 1457 1458 CmtSystem::scan_dir (dir, exp, list); 1459 1460 if (list.size () > 0) 1461 { 1462 result = list[0]; 1463 1464 if (m_cmtcvstest) cout << "## At least one version is matching " << version 1465 << "(" << list.size () << " matches) " << result << endl; 1466 1467 CmtSystem::basename (result, result); 1468 } 1469 else 1470 { 1471 if (m_cmtcvstest) cout << "## There is no version matching " << version << endl; 1472 } 1473 } 1474 1475 return (result); 1476 } 1477 1347 { 1348 cmt_string result; 1349 1350 // 1351 // Here expression takes the form 1352 // <some path>/<expression with wild-card> 1353 // 1354 1355 cmt_string dir; 1356 CmtSystem::dirname (expression, dir); 1357 dir += CmtSystem::file_separator (); 1358 1359 cmt_string version; 1360 CmtSystem::basename (expression, version); 1361 1362 if (version.find ("*") == cmt_string::npos) 1363 { 1364 // there is no wildcarding here. A simple test is enough. 1365 if (CmtSystem::test_directory (expression)) 1366 { 1367 result = version; 1368 } 1369 } 1370 else 1371 { 1372 version.replace ("*", ".*"); 1373 1374 cmt_regexp exp (version); 1375 1376 CmtSystem::cmt_string_vector list; 1377 1378 CmtSystem::scan_dir (dir, exp, list); 1379 1380 if (list.size () > 0) 1381 { 1382 result = list[0]; 1383 1384 CmtSystem::basename (result, result); 1385 } 1386 } 1387 1388 return (result); 1389 } 1390 1478 1391 /** 1479 1392 * We provide a path to a requirements file. From it we read the use 1480 1393 * statements, and we try to checkout the corresponding packages. 1394 * 1395 * A boolean return tells if any recursion occurred. 1481 1396 */ 1482 voidcheckout_from_requirements (const cmt_string& requirements_path)1397 bool checkout_from_requirements (const cmt_string& requirements_path) 1483 1398 { 1484 1399 static cmt_regexp expression ("^[ \t]*use[ \t]"); … … 1491 1406 p1.run (text, expression); 1492 1407 1408 bool result = (p1.result () != ""); 1493 1409 RecursivePass2 p2 (*this); 1494 1410 p2.run (p1.result ()); 1411 1412 return (result); 1495 1413 } 1496 1414 … … 1507 1425 text.read (file_name); 1508 1426 1427 CvsImplementation& me = *this; 1428 CvsImplementation saved; 1429 saved = me; 1430 cmt_string here = CmtSystem::pwd (); 1431 1509 1432 RecursivePass3 p3; 1510 1433 p3.run (text, expression); … … 1512 1435 RecursivePass4 p4 (*this); 1513 1436 p4.run (p3.result ()); 1437 1438 Grep grep; 1439 1440 grep.run (text, "container"); 1441 cmt_string container = grep.result (); 1442 1443 if (container != "") 1444 { 1445 static cmt_regexp container_expression ("^[ \t]*container[ \t]"); 1446 1447 add_cmtpath (here); 1448 1449 cout << " # --> now getting project packages from the " << container << " " << here << endl; 1450 1451 CmtSystem::cd (here); 1452 1453 RecursivePass1 p1; 1454 p1.run (text, container_expression); 1455 1456 RecursivePass2 p2 (*this); 1457 1458 m_home_dir = CmtSystem::pwd (); 1459 p2.run (p1.result ()); 1460 } 1461 1462 CmtSystem::cd (here); 1463 me = saved; 1514 1464 } 1515 1465 … … 1525 1475 - the CVS tag 1526 1476 */ 1527 void do_checkout (const cmt_string& prefix,1528 const cmt_string& package,1529 1530 1477 void do_checkout_phase2 (const cmt_string& offset, 1478 const cmt_string& product, 1479 const cmt_string& specified_version, 1480 const cmt_string& tag) 1531 1481 { 1532 1482 if (m_verbose) 1533 1483 { 1534 cout << "#CMT> checkout_package> prefix=" << prefix1535 << " " << structure_info << "=" << p ackage1484 cout << "#CMT> do_checkout_phase2> offset=" << offset 1485 << " " << structure_info << "=" << product 1536 1486 << " specified_version=" << specified_version 1487 << " tag=" << tag 1488 << " pwd=" << CmtSystem::pwd () 1537 1489 << endl; 1538 1490 } … … 1540 1492 cmt_string version = specified_version; 1541 1493 cmt_string empty; 1542 cmt_string full_ prefix;1543 1544 full_ prefix = m_offset;1545 full_ prefix += prefix;1494 cmt_string full_offset; 1495 1496 full_offset = m_cvs_offset; 1497 full_offset += offset; 1546 1498 1547 1499 cmt_string echo_ppath; 1548 1500 1549 if ( prefix!= "")1501 if (offset != "") 1550 1502 { 1551 1503 echo_ppath = " path "; 1552 echo_ppath += prefix;1504 echo_ppath += offset; 1553 1505 } 1554 1506 1555 1507 if (version == "") 1556 1508 { 1557 cout << "# ================= No version specified for " << structure_info << " " << p ackage<< endl;1509 cout << "# ================= No version specified for " << structure_info << " " << product << endl; 1558 1510 return; 1559 1511 } … … 1561 1513 // 1562 1514 // First make an attempt to locate the specified version of 1563 // this p ackage"as-it-is" in the work area.1515 // this product "as-it-is" in the work area. 1564 1516 // Since 'version' may contain wild-card, it's likely that 1565 1517 // we should not simply use CmtSystem::test_directory but … … 1569 1521 cmt_string dir; 1570 1522 1571 dir = build_version_directory (prefix, package, version); 1572 1573 if (m_cmtcvstest) 1574 cout << "## (testing dir= " << dir << ")" << endl; 1523 dir = build_version_directory (offset, product, version); 1575 1524 1576 1525 bool recursive = m_recursive; 1577 1526 1578 /*1579 if (m_cmtcvstest)1580 {1581 cmt_string v = find_matching_version (dir);1582 1583 cout << "---> v=" << v << endl;1584 }1585 */1586 1587 1527 cmt_string effective_version = find_matching_version (dir); 1588 1528 … … 1591 1531 version = effective_version; 1592 1532 1593 dir = build_version_directory ( prefix, package, version);1594 1595 cout << "# ================= " << structure_info << " " << p ackage1533 dir = build_version_directory (offset, product, version); 1534 1535 cout << "# ================= " << structure_info << " " << product 1596 1536 << " version " << version << echo_ppath 1597 1537 << " already installed in " << dir << endl; … … 1603 1543 bool at_head = false; 1604 1544 cmt_string module; 1545 cmt_string cvs_tag = (tag != "") ? tag : version; 1605 1546 1606 1547 // … … 1612 1553 // 1613 1554 1614 if ( version.find ("*") != cmt_string::npos)1615 { 1616 cout << "# ================= " << structure_info << " " << p ackage1617 << " version " << version<< echo_ppath1555 if (cvs_tag.find ("*") != cmt_string::npos) 1556 { 1557 cout << "# ================= " << structure_info << " " << product 1558 << " version " << cvs_tag << echo_ppath 1618 1559 << " has wild cards and will not be considered." << endl; 1619 1560 return; 1620 1561 } 1621 1562 1622 if (!get_version (full_ prefix, package, version,1623 module, version, at_head))1563 if (!get_version (full_offset, product, cvs_tag, 1564 module, cvs_tag, at_head)) 1624 1565 { 1625 1566 return; 1626 1567 } 1627 1628 //cout << " full_prefix=[" << full_prefix << "] module=[" << module << "]" << endl;1629 1630 if (m_cmtcvstest) cout << "## after get_version at_head=" << at_head << " m_head=" << m_head << endl;1631 1568 1632 1569 if (m_head) … … 1642 1579 1643 1580 // 1644 // Make a second try after having selected a versionfrom all the1645 // available versions compatible with the specified version1581 // Make a second try after having selected a CVS tag from all the 1582 // available tags compatible with the specified version 1646 1583 // 1647 1648 dir = build_version_directory (prefix, package, version); 1649 1584 1585 if (tag == "") 1586 { 1587 // If tag was not specified, then the version directory has to match the CVS tag 1588 // Otherwise the original version specification is kept for the directory. 1589 1590 version = cvs_tag; 1591 dir = build_version_directory (offset, product, version); 1592 } 1593 1650 1594 if (CmtSystem::test_directory (dir)) 1651 1595 { 1652 cout << "# ================= " << structure_info << " " << p ackage1596 cout << "# ================= " << structure_info << " " << product 1653 1597 << " version " << version << echo_ppath 1654 1598 << " already installed." << endl; … … 1662 1606 // 1663 1607 1664 if (!really_checkout ( prefix, package, version, module, dir, at_head))1608 if (!really_checkout (offset, product, version, cvs_tag, module, dir, at_head)) 1665 1609 { 1666 cout << "# bad return from really_checkout_p ackage" << endl;1610 cout << "# bad return from really_checkout_product" << endl; 1667 1611 return; 1668 1612 } … … 1670 1614 } 1671 1615 1672 /*1673 if (m_verbose)1674 {1675 cout << "#CMT> pwd.4=" << CmtSystem::pwd () << " structure=" << structure_info << endl;1676 }1677 */1678 1679 1616 // 1680 // Now reach the newly checked out p ackage.1617 // Now reach the newly checked out product. 1681 1618 // 1682 1619 … … 1690 1627 { 1691 1628 cout << "#CMT> Package directory not created " << dir << endl; 1692 } 1693 1694 1695 /* 1696 if (m_verbose) 1697 { 1698 cout << "#CMT> pwd.4=" << CmtSystem::pwd () << endl; 1699 } 1700 */ 1629 return; 1630 } 1701 1631 1702 1632 // Check if it is a true CMT package. … … 1713 1643 dir += "cmt"; 1714 1644 CmtSystem::cd ("cmt"); 1715 1716 /*1717 if (m_verbose)1718 {1719 cout << "#CMT> pwd.5=" << CmtSystem::pwd () << endl;1720 }1721 */1722 1645 1723 1646 if (Cmt::get_current_structuring_style () == without_version_directory) … … 1739 1662 dir += "mgr"; 1740 1663 CmtSystem::cd ("mgr"); 1741 1742 /*1743 if (m_verbose)1744 {1745 cout << "#CMT> pwd.6=" << CmtSystem::pwd () << endl;1746 }1747 */1748 1664 } 1749 1665 else 1750 1666 { 1751 cout << "# " << p ackage<< " not a CMT package" << endl;1667 cout << "# " << product << " not a CMT package" << endl; 1752 1668 return; 1753 1669 } 1754 1670 } 1755 1671 1756 //cout << "# (recursive is " << recursive << ")" << endl;1757 1758 1672 if (recursive) 1759 1673 { 1760 checkout_from_requirements ("requirements"); 1674 cmt_string here = CmtSystem::pwd (); 1675 1676 bool did_recurse = checkout_from_requirements ("requirements"); 1677 1678 CmtSystem::cd (here); 1679 1680 if (did_recurse) execute ("cmt -quiet broadcast cmt -quiet config"); 1761 1681 } 1762 1682 } … … 1772 1692 { 1773 1693 cout << "#CMT> Project directory not created " << dir << endl; 1694 return; 1774 1695 } 1775 1696 … … 1782 1703 if (!CmtSystem::test_file (file_name)) 1783 1704 { 1784 cout << "# " << p ackage<< " not a CMT project" << endl;1705 cout << "# " << product << " not a CMT project" << endl; 1785 1706 return; 1786 1707 } … … 1790 1711 checkout_from_project_file (file_name); 1791 1712 } 1713 1714 cout << "# ================= Project " << product << " completed" << endl; 1715 1792 1716 } 1793 1717 } … … 1803 1727 1804 1728 */ 1805 void do_checkout (const cmt_string& module, const cmt_string& version_tag) 1806 { 1807 //CMTPATH=${CMTPATH}:${m_home_dir}; export CMTPATH 1729 void do_checkout_phase1 (const cmt_string& module, 1730 const cmt_string& version_dir, 1731 const cmt_string& version_tag) 1732 { 1733 add_cmtpath (m_home_dir); 1808 1734 1809 1735 History& h = History::instance (); … … 1820 1746 } 1821 1747 1822 cmt_string prefix;1823 cmt_string p ackage;1748 cmt_string offset; 1749 cmt_string product; 1824 1750 cmt_string version; 1751 cmt_string tag; 1825 1752 1826 1753 if (version_tag == "") … … 1829 1756 1830 1757 cmt_string m; 1831 m = m_ offset;1758 m = m_cvs_offset; 1832 1759 m += module; 1833 1760 1834 show_cvs_infos(m);1761 get_cvs_infos_with_offset (m); 1835 1762 1836 1763 if (error_info != "") … … 1840 1767 } 1841 1768 1842 if (tags_top_info != "") version= tags_top_info;1843 else version= tags_info;1769 if (tags_top_info != "") tag = tags_top_info; 1770 else tag = tags_info; 1844 1771 1845 //if (CmtSystem::testenv ("CMTTESTAWK")) cout << "version=" << version << endl; 1846 1847 cut.run (version); 1772 cut.run (tag); 1848 1773 1849 version = cut.result (); 1850 1851 //if (CmtSystem::testenv ("CMTTESTAWK")) cout << "version=" << version << endl; 1774 tag = cut.result (); 1852 1775 } 1853 1776 else 1854 1777 { 1855 version = version_tag; 1856 } 1857 1858 CmtSystem::dirname (module, prefix); 1859 CmtSystem::basename (module, package); 1778 tag = version_tag; 1779 } 1780 1781 version = (version_dir == "") ? tag : version_dir; 1782 1783 CmtSystem::dirname (module, offset); 1784 CmtSystem::basename (module, product); 1860 1785 1861 1786 cmt_string top_dir; … … 1865 1790 top_dir += m_checkout_dir; 1866 1791 top_dir += CmtSystem::file_separator (); 1867 top_dir += prefix;1792 top_dir += offset; 1868 1793 top_dir += CmtSystem::file_separator (); 1869 top_dir += p ackage;1794 top_dir += product; 1870 1795 top_dir += CmtSystem::file_separator (); 1871 1796 top_dir += version; … … 1876 1801 { 1877 1802 cout << "#CMT> about to checkout " << structure_info 1878 << " " << package << " version " << version << " into " << top_dir << endl; 1879 } 1880 1881 do_checkout (prefix, package, version, ""); 1882 1883 /* 1884 if (m_verbose) 1885 { 1886 cout << "#CMT> after do_checkout pwd.7=" << CmtSystem::pwd () << " top_dir=" << top_dir << endl; 1887 } 1888 */ 1803 << " " << product << " version " << version << " into " << top_dir << endl; 1804 } 1805 1806 static const cmt_string empty; 1807 do_checkout_phase2 (offset, product, version, tag); 1889 1808 1890 1809 if (m_simulation) return; 1891 1810 1892 1811 if (!CmtSystem::cd (top_dir)) return; 1893 1894 /*1895 if (m_verbose)1896 {1897 cout << "#CMT> pwd.8=" << CmtSystem::pwd () << endl;1898 }1899 */1900 1812 1901 1813 if (structure_info == "project") … … 1907 1819 file_name += "project.cmt"; 1908 1820 1909 if (CmtSystem::test_file (file_name)) 1910 { 1911 cout << "#CMT> project " << package << " has been checked out" << endl; 1912 } 1913 else 1914 { 1915 cout << "# " << package << " was not properly checked out and is missing its cmt/project.cmt file" << endl; 1821 if (!CmtSystem::test_file (file_name)) 1822 { 1823 cout << "# " << product << " was not properly checked out and is missing its cmt/project.cmt file" << endl; 1916 1824 return; 1917 1825 } … … 1930 1838 top_dir += "cmt"; 1931 1839 CmtSystem::cd ("cmt"); 1932 1933 /*1934 if (m_verbose)1935 {1936 cout << "#CMT> pwd.9=" << CmtSystem::pwd () << endl;1937 }1938 */1939 1840 } 1940 1841 else … … 1949 1850 top_dir += "mgr"; 1950 1851 CmtSystem::cd ("mgr"); 1951 1952 /*1953 if (m_verbose)1954 {1955 cout << "#CMT> pwd.10=" << CmtSystem::pwd () << endl;1956 }1957 */1958 1852 } 1959 1853 else 1960 1854 { 1961 cout << "# " << p ackage<< " was not properly checked out and is missing its cmt/requirements file" << endl;1855 cout << "# " << product << " was not properly checked out and is missing its cmt/requirements file" << endl; 1962 1856 return; 1963 1857 } … … 1966 1860 if (m_verbose) 1967 1861 { 1968 cout << "#CMT> package " << package << " has been checked out" << endl; 1969 } 1970 1971 if (m_recursive) 1972 { 1973 if (m_verbose || m_simulation) 1974 { 1975 cout << "#CMT> Executing [" << "cmt -quiet broadcast cmt -quiet config" << "]" << endl; 1976 } 1977 1978 if (!m_simulation) 1979 { 1980 CmtSystem::execute ("cmt -quiet broadcast cmt -quiet config"); 1981 } 1982 } 1983 else 1984 { 1985 if (m_verbose || m_simulation) 1986 { 1987 cout << "#CMT> Executing [" << "cmt -quiet config" << "]" << endl; 1988 } 1989 1990 if (!m_simulation) 1991 { 1992 CmtSystem::execute ("cmt -quiet config"); 1993 } 1862 cout << "#CMT> product " << product << " has been checked out" << endl; 1863 } 1864 1865 if (!m_recursive) 1866 { 1867 execute ("cmt -quiet config"); 1994 1868 } 1995 1869 } … … 2003 1877 cout << " modifier :" << endl; 2004 1878 cout << " -l Do not process used packages (default)." << endl; 2005 cout << " -R Process used p ackages recursively." << endl;1879 cout << " -R Process used products recursively." << endl; 2006 1880 cout << " -r rev Check out version tag. (is sticky)" << endl; 1881 cout << " -vd dir Use this version directory instead of CVS tag." << endl; 2007 1882 cout << " -d dir Check out into dir instead of module name." << endl; 2008 1883 cout << " -o offset Offset in the CVS repository" << endl; … … 2036 1911 } 2037 1912 2038 if (CmtSystem::getenv ("CMTCVSTEST") != "") 2039 { 2040 m_cmtcvstest = true; 2041 } 2042 else 2043 { 2044 m_cmtcvstest = false; 2045 } 2046 2047 m_offset = CmtSystem::getenv ("CMTCVSOFFSET"); 2048 if (m_offset != "") 2049 { 2050 m_offset += "/"; 2051 m_offset.replace_all ("//", "/"); 1913 m_cvs_offset = CmtSystem::getenv ("CMTCVSOFFSET"); 1914 if (m_cvs_offset != "") 1915 { 1916 m_cvs_offset += "/"; 1917 m_cvs_offset.replace_all ("//", "/"); 2052 1918 } 2053 1919 … … 2064 1930 else 2065 1931 { 2066 show_cvs_infos (CmtSystem::getenv ("CMTCVSOFFSET"), option);1932 get_cvs_infos (CmtSystem::getenv ("CMTCVSOFFSET"), option); 2067 1933 2068 1934 if (error_info != "") … … 2108 1974 cmt_string out; 2109 1975 2110 show_cvs_infos (CmtSystem::getenv ("CMTCVSOFFSET"), module);1976 get_cvs_infos (CmtSystem::getenv ("CMTCVSOFFSET"), module); 2111 1977 2112 1978 if (error_info != "") … … 2128 1994 cmt_string out; 2129 1995 2130 show_cvs_infos (CmtSystem::getenv ("CMTCVSOFFSET"), (module == "") ? "." : module);1996 get_cvs_infos (CmtSystem::getenv ("CMTCVSOFFSET"), (module == "") ? "." : module); 2131 1997 2132 1998 if (error_info != "") … … 2148 2014 cmt_string out; 2149 2015 2150 show_cvs_infos (CmtSystem::getenv ("CMTCVSOFFSET"), (module == "") ? "." : module);2016 get_cvs_infos (CmtSystem::getenv ("CMTCVSOFFSET"), (module == "") ? "." : module); 2151 2017 2152 2018 if (error_info != "") … … 2179 2045 } 2180 2046 2181 if (CmtSystem::getenv ("CMTCVSTEST") != "")2182 {2183 m_cmtcvstest = true;2184 }2185 else2186 {2187 m_cmtcvstest = false;2188 }2189 2190 2047 m_home_dir = CmtSystem::pwd (); 2191 2048 m_checkout_dir = ""; 2192 m_ offset= "";2193 m_ branch_suffix= "";2194 2049 m_version_dir = ""; 2050 m_cvs_offset = ""; 2051 2195 2052 cmt_string module; 2196 2053 … … 2201 2058 2202 2059 bool need_checkout_dir = false; 2203 bool need_ offset = false;2060 bool need_cvs_offset = false; 2204 2061 bool need_requirements_file = false; 2062 bool need_version_dir = false; 2205 2063 2206 2064 m_simulation = false; … … 2208 2066 m_verbose = false; 2209 2067 2210 bool need_branch_suffix = false;2211 2212 2068 m_head = true; 2213 2069 2214 m_ offset = CmtSystem::getenv ("CMTCVSOFFSET");2215 if (m_ offset != "")2216 { 2217 m_ offset += "/";2218 m_ offset.replace_all ("//", "/");2070 m_cvs_offset = CmtSystem::getenv ("CMTCVSOFFSET"); 2071 if (m_cvs_offset != "") 2072 { 2073 m_cvs_offset += "/"; 2074 m_cvs_offset.replace_all ("//", "/"); 2219 2075 } 2220 2076 … … 2241 2097 m_checkout_dir = option; 2242 2098 } 2243 else if (need_offset) 2244 { 2245 need_offset = false; 2246 m_offset = option; 2247 m_offset += '/'; 2248 m_offset.replace_all ("//", "/"); 2249 } 2250 else if (need_branch_suffix) 2251 { 2252 need_branch_suffix = false; 2253 m_branch_suffix = "-"; 2254 m_branch_suffix += option; 2099 else if (need_version_dir) 2100 { 2101 need_version_dir = false; 2102 m_version_dir = option; 2103 } 2104 else if (need_cvs_offset) 2105 { 2106 need_cvs_offset = false; 2107 m_cvs_offset = option; 2108 m_cvs_offset += '/'; 2109 m_cvs_offset.replace_all ("//", "/"); 2255 2110 } 2256 2111 else if (need_requirements_file) … … 2281 2136 else if (option == "-o") 2282 2137 { 2283 need_ offset = true;2138 need_cvs_offset = true; 2284 2139 } 2285 2140 else if (option == "-n") … … 2291 2146 m_verbose = true; 2292 2147 } 2293 else if (option == "- branch")2148 else if (option == "-vd") 2294 2149 { 2295 need_ branch_suffix= true;2150 need_version_dir = true; 2296 2151 } 2297 2152 else if (option == "-requirements") … … 2311 2166 else 2312 2167 { 2313 do_checkout (option, version_tag);2168 do_checkout_phase1 (option, m_version_dir, version_tag); 2314 2169 } 2315 2170 } … … 2321 2176 bool m_recursive; 2322 2177 bool m_head; 2323 bool m_cmtcvstest;2324 2178 bool m_verbose; 2325 2179 bool m_simulation; … … 2327 2181 cmt_string m_home_dir; 2328 2182 cmt_string m_checkout_dir; 2329 cmt_string m_ offset;2330 cmt_string m_ branch_suffix;2183 cmt_string m_version_dir; 2184 cmt_string m_cvs_offset; 2331 2185 2332 2186 cmt_string m_protocol_level; … … 2599 2453 else 2600 2454 { 2601 m_cvs.do_checkout (path, package, version, ""); 2455 static const cmt_string empty; 2456 m_cvs.do_checkout_phase2 (path, package, version, empty); 2602 2457 } 2603 2458 } … … 2678 2533 } 2679 2534 2680 cout << " # " << project << " " << version << endl;2535 cout << " # " << project << " " << version << " " << tag << endl; 2681 2536 } 2682 2537 … … 2760 2615 else 2761 2616 { 2762 m_cvs.do_checkout ("", project, version, tag); 2617 static const cmt_string empty; 2618 m_cvs.do_checkout_phase2 (empty, project, version, tag); 2763 2619 } 2764 2620 } -
CMT/HEAD/src/setup.tcsh
r11 r45 5 5 #----------------------------------------------------------- 6 6 7 complete cmt p/1/'(broadcast build check check_files checkout co cleanup config create expand filter help lock remove run setup show system unlock version cvstags cvsbranches cvssubpackages )'/ \7 complete cmt p/1/'(broadcast build check check_files checkout co cleanup config create expand filter help lock remove run setup show system unlock version cvstags cvsbranches cvssubpackages cvssubprojects)'/ \ 8 8 n/build/'(CMT_pacman constituent_makefile constituents_makefile dependencies library_links make_setup msdev os9_makefile prototype readme tag_makefile temporary_name triggers win_makefile)'/ \ 9 9 n/show/'(action action_names action_value actions all_tags applied_patterns author branches clients cmtpath_patterns constituent constituent_names constituents cycles fragment fragments groups include_dirs language languages macro macro_names macro_value macros manager packages path pattern patterns projects pwd set set_names set_value sets strategies tags use_paths uses versions)'/ \ -
CMT/HEAD/src/setup.zsh
r11 r45 12 12 function cmt_default_path { d=`dirname ${CMTROOT}`; reply=(`dirname ${d}`) }; \ 13 13 function cmt_patterns { reply=(`cmt -quiet show pattern_names`) }; \ 14 compctl -k '(broadcast,build,check,check_files,checkout,co,cleanup,config,create,create_project,expand,filter,help,lock,remove,run,setup,show,system,unlock,version,cvstags,cvsbranches,cvssubpackages )' -x \14 compctl -k '(broadcast,build,check,check_files,checkout,co,cleanup,config,create,create_project,expand,filter,help,lock,remove,run,setup,show,system,unlock,version,cvstags,cvsbranches,cvssubpackages,cvssubprojects)' -x \ 15 15 'c[-1,broadcast]' -k '(-begin=,-select=,-exclude=,-local,-global,-depth=)' - \ 16 16 's[build],c[-1,build]' -k '(CMT_pacman, constituent_makefile,constituents_makefile,dependencies,library_links,make_setup,msdev,os9_makefile,prototype,readme,tag_makefile,temporary_name,triggers,win_makefile)' - \
Note: See TracChangeset
for help on using the changeset viewer.