- Timestamp:
- Jan 8, 2010, 4:25:58 PM (14 years ago)
- Location:
- CMT/HEAD
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/ChangeLog
r530 r531 1 2010-01-08 <rybkin@lal.in2p3.fr> 418 2 3 * source/cmt_use.cxx: In function compare_versions, introduce optional 4 argument "match" and implement mode in which versions are compared 5 literally (with * matching any string), in function Use::reach_package, 6 make use of compare_versions in "match" mode when structuring style is 7 "without_version_directory", make use of 2 use class members - style and 8 structuring_style, do not consider version == "" where it is not possible, 9 in functions Use::get_full_path, Use::fill_standard_macros, install_library, 10 Use::build_library_links, Use::show_sub_uses do not use "no_version_style" 11 as value of style member, use also structuring_style instead, allow for 12 standalone package case, introduce helper class PackageReader to deduce 13 package name from requirements file and implement Package::get_name function 14 making use of the class 15 * source/cmt_use.h: Introduce Use class member structuring_style, function 16 Package::get_name 17 * source/cmt_parser.h: Exclude "no_version_style" value from CmtDirStyle 18 enum 19 * source/cmt_parser.cxx: In function Cmt::configure_current_package, use 20 directory structure and package statement in requirements to determine 21 structuring style, in function Cmt::do_create, do not use "no_version_style" 22 as value of CmtContext m_current_style, in function Cmt::do_run, for 23 "cmt run" command, check exit status and set execution_failed error, when 24 appropriate, in function dos_script_prefix, do not use "no_version_style" 25 value no_version_style, in function Cmt::load do not use "no_version_style" 26 as value of CmtContext m_current_style, in StandardMacroBuilder 27 fill_for_use_requirements function, allow for standalone package case 28 * source/cmt_symbol.cxx: In function Symbol::action, allow for standalone 29 package case, do not use "no_version_style" as value of Use style member 30 1 31 2009-11-28 <rybkin@lal.in2p3.fr> 417 2 32 -
CMT/HEAD/source/cmt_parser.cxx
r530 r531 567 567 568 568 use.style = Me.m_current_style; 569 use.structuring_style = Me.m_current_structuring_style; 569 570 570 571 use.change_path (Me.m_current_path); … … 840 841 CmtSystem::basename (up_dir, up_branch); 841 842 842 cmt_string version_file= "..";843 version_file+= CmtSystem::file_separator ();843 cmt_string cmt_dir = ".."; 844 cmt_dir += CmtSystem::file_separator (); 844 845 switch (Me.m_current_style) 845 846 { 846 847 case cmt_style: 847 version_file+= "cmt";848 cmt_dir += "cmt"; 848 849 break; 849 850 case mgr_style: 850 version_file+= "mgr";851 cmt_dir += "mgr"; 851 852 break; 852 853 default: … … 857 858 858 859 // if (CmtSystem::test_file (version_file)) 859 if (CmtSystem::test_file ( version_file860 if (CmtSystem::test_file (cmt_dir 860 861 + CmtSystem::file_separator () 861 862 + Package::get_version_file_name ()) … … 888 889 */ 889 890 cmt_string v; 890 if (Package::get_version (v, version_file)) 891 // if (Package::get_version (v, version_file)) 892 if (Package::get_version (v, cmt_dir)) 891 893 { 892 894 Me.m_current_version = v; … … 896 898 Me.m_current_version = "v*"; 897 899 CmtMessage::warning ("Structuring style used `without_version_directory'." 898 " Could not determine version in `" + version_file+ "'."900 " Could not determine version in `" + cmt_dir + "'." 899 901 " Default version `" + Me.m_current_version + "'"); 900 902 } … … 910 912 } 911 913 912 Me.m_current_style = no_version_style; 914 Me.m_current_structuring_style = without_version_directory; 915 // Me.m_current_style = no_version_style; 913 916 } 914 917 else 915 918 { 919 // Try to use directory structure and 920 // package statement in requirements, if available 921 cmt_string up_up_dir; 922 cmt_string up_up_branch; 923 CmtSystem::dirname (up_dir, up_up_dir); 924 CmtSystem::basename (up_up_dir, up_up_branch); 925 926 cmt_string n; 927 bool done (false); 928 if (Package::get_name (n, cmt_dir)) 929 { 930 if (n == up_branch) 931 { 932 Me.m_current_package = up_branch; 933 Me.m_current_path = up_up_dir; 934 Me.m_current_structuring_style = without_version_directory; 935 cmt_string v; 936 if (Package::get_version (v, cmt_dir)) 937 { 938 Me.m_current_version = v; 939 } 940 else 941 { 942 // No version descriptor 943 // No version directory. The version is defaulted to v* 944 Me.m_current_version = "v*"; 945 CmtMessage::warning ("Structuring style used `without_version_directory'." 946 " Could not determine version in `" + cmt_dir + "'." 947 " Default version `" + Me.m_current_version + "'"); 948 } 949 done =true; 950 } 951 else if (n == up_up_branch) 952 { 953 // The up branch IS a version directory. 954 Me.m_current_version = up_branch; 955 Me.m_current_package = up_up_branch; 956 CmtSystem::dirname (up_up_dir, Me.m_current_path); 957 Me.m_current_structuring_style = with_version_directory; 958 done =true; 959 } 960 else 961 { 962 CmtMessage::warning ("Package name `" + n + "' in `" + cmt_dir + 963 "' does not correspond to directory" 964 " structure"); 965 } 966 } 967 968 if (!done) 969 { 916 970 // Try to determine the structuring style from: 917 971 // … … 955 1009 { 956 1010 // The up branch IS a version directory. 957 958 1011 Me.m_current_version = up_branch; 1012 Me.m_current_package = up_up_branch; 1013 CmtSystem::dirname (up_up_dir, Me.m_current_path); 1014 /* 959 1015 CmtSystem::dirname (up_dir, up_dir); 960 1016 CmtSystem::basename (up_dir, Me.m_current_package); 961 1017 CmtSystem::dirname (up_dir, Me.m_current_path); 1018 */ 1019 Me.m_current_structuring_style = with_version_directory; 962 1020 } 963 1021 else … … 969 1027 } 970 1028 Me.m_current_package = up_branch; 971 CmtSystem::dirname (up_dir, Me.m_current_path); 972 1029 Me.m_current_path = up_up_dir; 1030 // CmtSystem::dirname (up_dir, Me.m_current_path); 1031 Me.m_current_structuring_style = without_version_directory; 973 1032 cmt_string v; 974 if (Package::get_version (v, version_file))1033 if (Package::get_version (v, cmt_dir)) 975 1034 { 976 1035 Me.m_current_version = v; … … 980 1039 // No version descriptor 981 1040 // No version directory. The version is defaulted to v* 982 983 1041 Me.m_current_version = "v*"; 984 1042 CmtMessage::warning ("Structuring style used `without_version_directory'." 985 " Could not determine version in `" + version_file+ "'."1043 " Could not determine version in `" + cmt_dir + "'." 986 1044 " Default version `" + Me.m_current_version + "'"); 987 1045 } 988 1046 989 Me.m_current_style = no_version_style; 1047 // Me.m_current_style = no_version_style; 1048 } 990 1049 } 991 1050 } … … 996 1055 { 997 1056 Me.m_current_package = "cmt_standalone"; 998 Me.m_current_version = " ";1057 Me.m_current_version = "v0"; 999 1058 Me.m_current_path = Me.m_current_dir; 1059 Me.m_current_structuring_style = without_version_directory; 1060 // Me.m_current_style = none_style; 1000 1061 build_prefix (Me.m_current_package, Me.m_current_prefix); 1001 1062 build_config (Me.m_current_prefix, Me.m_current_config); 1002 Me.m_current_style = none_style;1003 1063 } 1004 1064 } … … 2568 2628 use.change_path (Me.m_current_path); 2569 2629 use.style = Me.m_current_style; 2630 use.structuring_style = Me.m_current_structuring_style; 2570 2631 2571 2632 Me.m_quiet = true; … … 2702 2763 use.change_path (Me.m_current_path); 2703 2764 use.style = Me.m_current_style; 2765 use.structuring_style = Me.m_current_structuring_style; 2704 2766 2705 2767 Me.m_quiet = true; … … 2906 2968 else 2907 2969 { 2970 Me.m_current_style = cmt_style; 2908 2971 if (with_version_dir) 2909 2972 { 2910 Me.m_current_style = cmt_style;2973 Me.m_current_structuring_style = with_version_directory; 2911 2974 } 2912 2975 else 2913 2976 { 2914 Me.m_current_style = no_version_style; 2977 Me.m_current_structuring_style = without_version_directory; 2978 // Me.m_current_style = no_version_style; 2915 2979 } 2916 2980 … … 2921 2985 else 2922 2986 { 2987 Me.m_current_style = mgr_style; 2923 2988 if (with_version_dir) 2924 2989 { 2925 Me.m_current_style = mgr_style; 2990 Me.m_current_structuring_style = with_version_directory; 2991 // Me.m_current_style = mgr_style; 2926 2992 } 2927 2993 else 2928 2994 { 2929 Me.m_current_style = no_version_style; 2995 Me.m_current_structuring_style = without_version_directory; 2996 // Me.m_current_style = no_version_style; 2930 2997 } 2931 2998 … … 2936 3003 else 2937 3004 { 3005 Me.m_current_style = cmt_style; 2938 3006 if (with_version_dir) 2939 3007 { 2940 Me.m_current_style = cmt_style; 3008 Me.m_current_structuring_style = with_version_directory; 3009 // Me.m_current_style = cmt_style; 2941 3010 } 2942 3011 else 2943 3012 { 2944 Me.m_current_style = no_version_style; 3013 Me.m_current_structuring_style = without_version_directory; 3014 // Me.m_current_style = no_version_style; 2945 3015 } 2946 3016 … … 2972 3042 { 2973 3043 case cmt_style: 2974 case no_version_style:3044 // case no_version_style: 2975 3045 CmtSystem::cd ("cmt"); 2976 3046 break; … … 3590 3660 } 3591 3661 3592 CmtSystem::execute (cmd); 3662 int status = CmtSystem::execute (cmd); 3663 if (status != 0) 3664 { 3665 CmtError::set (CmtError::execution_failed, ap.arguments[0], status); 3666 } 3667 // CmtSystem::execute (cmd); 3593 3668 } 3594 3669 } … … 4746 4821 { 4747 4822 no_device = "..\\..\\.."; 4748 if (Cmt::get_current_style () == no_version_style) 4823 if (Cmt::get_current_structuring_style () == without_version_directory) 4824 // if (Cmt::get_current_style () == no_version_style) 4749 4825 { 4750 4826 no_device = "..\\.."; … … 5547 5623 5548 5624 Me.m_current_style = none_style; 5625 Me.m_current_structuring_style = without_version_directory; 5549 5626 5550 5627 if (!CmtSystem::cd (Me.m_current_version)) … … 5567 5644 else 5568 5645 { 5569 Me.m_current_style = no_version_style; 5646 Me.m_current_style = cmt_style; 5647 Me.m_current_structuring_style = without_version_directory; 5648 // Me.m_current_style = no_version_style; 5570 5649 } 5571 5650 } … … 5575 5654 dir += CmtSystem::file_separator (); 5576 5655 dir += "cmt"; 5577 if (Me.m_current_style == none_style) Me.m_current_style = cmt_style; 5656 if (Me.m_current_style == none_style) 5657 { 5658 Me.m_current_style = cmt_style; 5659 Me.m_current_structuring_style = with_version_directory; 5660 } 5578 5661 } 5579 5662 else … … 5590 5673 dir += CmtSystem::file_separator (); 5591 5674 dir += "mgr"; 5592 if (Me.m_current_style == none_style) Me.m_current_style = mgr_style; 5675 if (Me.m_current_style == none_style) 5676 { 5677 Me.m_current_style = mgr_style; 5678 Me.m_current_structuring_style = with_version_directory; 5679 } 5593 5680 } 5594 5681 else … … 5655 5742 use->done = false; 5656 5743 use->style = Me.m_current_style; 5744 use->structuring_style = Me.m_current_structuring_style; 5657 5745 5658 5746 /* … … 7058 7146 } 7059 7147 } 7148 else 7149 Me.m_current_style = none_style; 7060 7150 7061 7151 dir = CmtSystem::pwd (); … … 7069 7159 CmtSystem::basename (Me.m_current_path, Me.m_current_package); 7070 7160 CmtSystem::dirname (Me.m_current_path, Me.m_current_path); 7161 Me.m_current_structuring_style = with_version_directory; 7071 7162 } 7072 7163 else … … 7075 7166 Me.m_current_version = ""; 7076 7167 CmtSystem::dirname (Me.m_current_path, Me.m_current_path); 7077 7078 Me.m_current_style = no_version_style;7168 Me.m_current_structuring_style = without_version_directory; 7169 // Me.m_current_style = no_version_style; 7079 7170 } 7080 7171 … … 7083 7174 use.path = Me.m_current_path; 7084 7175 use.style = Me.m_current_style; 7176 use.structuring_style = Me.m_current_structuring_style; 7085 7177 } 7086 7178 … … 7603 7695 // buffer += use->prefix; 7604 7696 // buffer += "ROOT)"; 7605 buffer += fs;7606 7697 7607 if (use->style == mgr_style) buffer += "mgr"; 7608 else buffer += "cmt"; 7698 if (use->style == cmt_style) 7699 { 7700 buffer += fs; 7701 buffer += "cmt"; 7702 } 7703 else if (use->style == mgr_style) 7704 { 7705 buffer += fs; 7706 buffer += "mgr"; 7707 } 7708 // else buffer += "cmt"; 7609 7709 7610 7710 buffer += fs; -
CMT/HEAD/source/cmt_parser.h
r525 r531 25 25 mgr_style, 26 26 cmt_style, 27 no_version_style,27 // no_version_style, 28 28 none_style 29 29 } CmtDirStyle; -
CMT/HEAD/source/cmt_symbol.cxx
r530 r531 992 992 full_name = use->get_full_path (); 993 993 } 994 full_name += CmtSystem::file_separator (); 995 if (use->style == cmt_style) full_name += "cmt"; 996 else if (use->style == no_version_style) full_name += "cmt"; 997 else full_name += "mgr"; 994 if (use->style == cmt_style) 995 { 996 full_name += CmtSystem::file_separator (); 997 full_name += "cmt"; 998 } 999 else if (use->style == mgr_style) 1000 { 1001 full_name += CmtSystem::file_separator (); 1002 full_name += "mgr"; 1003 } 1004 // else if (use->style == no_version_style) full_name += "cmt"; 1005 // else full_name += "mgr"; 998 1006 full_name += CmtSystem::file_separator (); 999 1007 full_name += name; -
CMT/HEAD/source/cmt_use.cxx
r528 r531 133 133 } CompareStatus; 134 134 135 static CompareStatus compare_versions (const cmt_string& ref_version, const cmt_string& new_version )135 static CompareStatus compare_versions (const cmt_string& ref_version, const cmt_string& new_version, bool match = false) 136 136 { 137 137 CompareStatus result = IdenticalIds; 138 139 if (match) 140 { 141 if (ref_version == "" || 142 ref_version == "*" || 143 ref_version == "v*") 144 return IdenticalIds; 145 146 int wild_card = ref_version.find ('*'); 147 if (wild_card != cmt_string::npos) 148 { 149 cmt_string ref_ver (ref_version.substr (0, wild_card)); 150 if (ref_ver.size () > new_version.size ()) 151 return IncompatibleMajorIds; 152 else if (strncmp (ref_ver.c_str (), new_version.c_str (), wild_card) == 0) 153 return IdenticalIds; 154 else 155 return IncompatibleMajorIds; 156 } 157 else if (ref_version == new_version) 158 return IdenticalIds; 159 else 160 return IncompatibleMajorIds; 161 } 138 162 139 163 int old_v = -1; … … 664 688 665 689 cout << "use::action1> current=" << parent->get_package_name () << 666 " package=" << package << " ";690 " package=" << package << "(" << version << ")" << " "; 667 691 668 692 for (i = 0; i < uses.size (); i++) … … 1436 1460 if (Cmt::get_debug ()) 1437 1461 { 1438 cout << "Use::reach_package> (" << get_package_name () << " "1439 << version << ")from " << from_path << endl;1462 cout << "Use::reach_package> " << get_package_name () 1463 << "(" << version << ") from " << from_path << endl; 1440 1464 cout << "Use::reach_package> native_version required "<<n_version<<endl; 1441 1465 } … … 1536 1560 if (CmtSystem::test_file ("cmt/requirements")) 1537 1561 { 1538 CmtSystem::cd ("cmt");1539 1540 style = no_version_style;1562 // CmtSystem::cd ("cmt"); 1563 1564 // style = no_version_style; 1541 1565 1542 1566 cmt_string v; 1543 if (Package::get_version (v)) 1544 { 1545 CompareStatus s = compare_versions (version, v); 1567 // if (Package::get_version (v)) 1568 if (Package::get_version (v, "cmt")) 1569 { 1570 CompareStatus s = compare_versions (version, v, true); 1546 1571 if (Cmt::get_debug ()) 1547 1572 { … … 1574 1599 version = "v0"; 1575 1600 } 1601 CmtSystem::cd ("cmt"); 1602 style = cmt_style; 1603 structuring_style = without_version_directory; 1576 1604 return (1); 1577 1605 } … … 1582 1610 // There are alternate possibilities when it contains wild cards 1583 1611 // 1584 if ((version == "") || (version.find ("*") != cmt_string::npos)) 1612 // if ((version == "") || (version.find ("*") != cmt_string::npos)) 1613 if (version.find ("*") != cmt_string::npos) 1585 1614 { 1586 1615 static CmtSystem::cmt_string_vector versions; … … 1589 1618 name = "."; 1590 1619 name += CmtSystem::file_separator (); 1620 name += version; 1621 /* 1591 1622 if (version == "") name += "*"; 1592 1623 else name += version; 1624 */ 1593 1625 1594 1626 CmtSystem::scan_dir (name, versions); … … 1691 1723 } 1692 1724 1725 /* 1693 1726 if (!found) 1694 1727 { … … 1700 1733 } 1701 1734 } 1735 */ 1702 1736 } 1703 1737 … … 1733 1767 CmtSystem::cd ("mgr"); 1734 1768 style = mgr_style; 1769 structuring_style = with_version_directory; 1735 1770 } 1736 1771 } … … 1739 1774 CmtSystem::cd ("cmt"); 1740 1775 style = cmt_style; 1776 structuring_style = with_version_directory; 1741 1777 } 1742 1778 … … 2839 2875 else s = real_path; 2840 2876 2841 s += CmtSystem::file_separator (); 2842 s += get_package_name (); 2877 if (style != none_style) 2878 { 2879 s += CmtSystem::file_separator (); 2880 s += get_package_name (); 2881 } 2843 2882 2844 if (style != no_version_style) 2883 // if (style != no_version_style) 2884 if (structuring_style == with_version_directory) 2845 2885 { 2846 2886 s += CmtSystem::file_separator (); … … 3039 3079 buffer += " \""; 3040 3080 buffer += real_path; 3041 buffer += fs; 3042 buffer += package_name; 3043 if (style != no_version_style) 3081 if (style != none_style) 3082 { 3083 buffer += fs; 3084 buffer += package_name; 3085 } 3086 // if (style != no_version_style) 3087 if (structuring_style == with_version_directory) 3044 3088 { 3045 3089 buffer += fs; … … 3169 3213 else 3170 3214 { 3171 s = "../$("; 3172 s += current_use.get_package_name (); 3173 s += "_tag)/"; 3215 if (current_use.style != none_style) 3216 { 3217 s = "../$("; 3218 s += current_use.get_package_name (); 3219 s += "_tag)/"; 3220 } 3221 else 3222 { 3223 s = "./"; 3224 } 3174 3225 s += name; 3175 3226 } … … 3298 3349 */ 3299 3350 3351 if (style != none_style) 3352 { 3300 3353 libname = "${"; 3301 3354 libname += prefix; … … 3303 3356 libname += get_package_name (); 3304 3357 libname += "_tag}/"; 3358 } 3359 else 3360 { 3361 libname = "${"; 3362 libname += prefix; 3363 libname += "ROOT}/"; 3364 } 3305 3365 libname += "$(library_prefix)"; 3306 3366 libname += library; … … 3324 3384 if (!is_absolute) 3325 3385 { 3386 if (style != none_style) 3387 { 3326 3388 libname = "${"; 3327 3389 libname += prefix; … … 3329 3391 libname += get_package_name (); 3330 3392 libname += "_tag}/"; 3393 } 3394 else 3395 { 3396 libname = "${"; 3397 libname += prefix; 3398 libname += "ROOT}/"; 3399 } 3331 3400 libname += library; 3332 3401 libname += ".bundle"; … … 3846 3915 if (auto_imports == Off) cout << " (no_auto_imports)"; 3847 3916 3848 if (style == no_version_style) cout << " (no_version_directory)"; 3917 if (structuring_style == without_version_directory) cout << " (no_version_directory)"; 3918 // if (style == no_version_style) cout << " (no_version_directory)"; 3849 3919 3850 3920 if (m_has_native_version) … … 4294 4364 4295 4365 //---------------------------------------------------------- 4366 class PackageReader : public Awk 4367 { 4368 public: 4369 4370 PackageReader () 4371 { 4372 } 4373 4374 const cmt_string& get_package () const 4375 { 4376 return (m_package); 4377 } 4378 4379 void filter (const cmt_string& line) 4380 { 4381 CmtSystem::cmt_string_vector words; 4382 CmtSystem::split (line, " \t", words); 4383 if (words[0] == "package") 4384 { 4385 m_package = words[1]; 4386 } 4387 } 4388 4389 private: 4390 cmt_string m_package; 4391 }; 4392 4393 //---------------------------------------------------------- 4296 4394 Package* Package::find (const cmt_string& name) 4297 4395 { … … 4384 4482 pos = v.find ('\r'); 4385 4483 if (pos != cmt_string::npos) v.erase (pos); 4386 version = v; 4387 return true; 4484 if (v != "") 4485 { 4486 version = v; 4487 return true; 4488 } 4388 4489 } 4389 4490 else … … 4422 4523 4423 4524 return (name); 4525 } 4526 4527 //---------------------------------------------------------- 4528 bool Package::get_name (cmt_string& name, const cmt_string& path) 4529 { 4530 cmt_string name_file = path; 4531 name_file += CmtSystem::file_separator (); 4532 name_file += "requirements"; 4533 cmt_string text; 4534 if (text.read (name_file)) 4535 { 4536 PackageReader reader; 4537 reader.run (text); 4538 cmt_string v = reader.get_package (); 4539 if (v != "") 4540 { 4541 name = v; 4542 return true; 4543 } 4544 } 4545 else 4546 { 4547 CmtMessage::warning ("Could not read `" + name_file + "'."); 4548 } 4549 4550 return false; 4424 4551 } 4425 4552 -
CMT/HEAD/source/cmt_use.h
r461 r531 148 148 cmt_string real_path; 149 149 cmt_string native_version; /* idem */ 150 CmtDirStyle style; /* May be cmt or mgr */ 150 CmtDirStyle style; /* May be cmt, or mgr, or none_style */ 151 CmtStructuringStyle structuring_style; /* with or without version directory */ 151 152 152 153 cmt_string prefix; /* upper case copy of package */ … … 237 238 static bool get_version (cmt_string& version, const cmt_string& path = "."); 238 239 static const cmt_string& get_version_file_name (); 240 static bool get_name (cmt_string& name, const cmt_string& path = "."); 239 241 240 242 public:
Note: See TracChangeset
for help on using the changeset viewer.