Changeset 525
- Timestamp:
- Nov 6, 2009, 12:02:54 PM (15 years ago)
- Location:
- CMT/HEAD
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/ChangeLog
r524 r525 1 2009-11-06 <rybkin@lal.in2p3.fr> 412 2 3 * source/cmt_project.h: In class Project, introduce (static) function 4 show_container, functions get_container_name, get_container_path, 5 set_container_name, set_container_path, and drop functions get_container, 6 set_container, add and drop class members accordingly, change 7 container_action function signature to allow for the generic CMT container 8 statement syntax 9 * source/cmt_project.cxx: Implement the introduced and modified functions 10 * source/cmt_syntax.cxx: In class KwdContainer, modify function action to 11 reflect the changes above 12 * source/cmt_commands.cxx: Introduce and implement "cmt show container" 13 command making use of the functions introduced above 14 * source/cmt_parser.h: idem 15 * source/cmt_parser.cxx: idem 16 * source/cmt.h: idem 17 * src/setup.tcsh: Add completion for "cmt show container" command in TCSH 18 * src/setup.zsh: Add completion for "cmt show container" command in Z shell 19 1 20 2009-10-15 <rybkin@lal.in2p3.fr> 411 2 21 -
CMT/HEAD/source/cmt.h
r521 r525 165 165 static void do_show_constituent_names (const ArgParser& ap); 166 166 static void do_show_constituents (const ArgParser& ap); 167 static void do_show_container (const ArgParser& ap); 167 168 static void do_show_cycles (const ArgParser& ap); 168 169 static void do_show_fragment (const ArgParser& ap); -
CMT/HEAD/source/cmt_commands.cxx
r496 r525 1311 1311 { 1312 1312 cmt.m_action = action_show_constituents; 1313 } 1314 else if (arg == "container") 1315 { 1316 cmt.m_action = action_show_container; 1313 1317 } 1314 1318 else if (arg == "cycles") … … 2340 2344 help.add (action_show_constituent_names, help_texts[action_show_constituent_names]); 2341 2345 help.add (action_show_constituents, help_texts[action_show_constituents]); 2346 help.add (action_show_container, help_texts[action_show_container]); 2342 2347 help.add (action_show_cycles, help_texts[action_show_cycles]); 2343 2348 help.add (action_show_fragment, help_texts[action_show_fragment]); -
CMT/HEAD/source/cmt_parser.cxx
r523 r525 3932 3932 3933 3933 //---------------------------------------------------------- 3934 void Cmt::do_show_container (const ArgParser& /*ap*/) 3935 { 3936 Project::show_container (); 3937 } 3938 3939 //---------------------------------------------------------- 3934 3940 void Cmt::do_show_cycles (const ArgParser& /*ap*/) 3935 3941 { … … 5711 5717 case action_show_constituent_names : 5712 5718 case action_show_constituents : 5719 case action_show_container : 5713 5720 case action_show_cycles : 5714 5721 case action_show_fragment : … … 5823 5830 case action_show_constituent_names : 5824 5831 case action_show_constituents : 5832 case action_show_container : 5825 5833 case action_show_cycles : 5826 5834 case action_show_fragment : … … 5927 5935 case action_show_constituent_names : 5928 5936 case action_show_constituents : 5937 case action_show_container : 5929 5938 case action_show_cycles : 5930 5939 case action_show_fragment : … … 6041 6050 // case action_show_cmtpath_patterns : 6042 6051 // case action_show_constituent : 6052 // case action_show_container : 6043 6053 // case action_show_constituent_names : 6044 6054 // case action_show_constituents : … … 6248 6258 case action_show_branches : 6249 6259 do_show_branches (ap); 6260 break; 6261 case action_show_container : 6262 do_show_container (ap); 6250 6263 break; 6251 6264 case action_show_clients : -
CMT/HEAD/source/cmt_parser.h
r272 r525 285 285 action_show_constituent_names, 286 286 action_show_constituents, 287 action_show_container, 287 288 action_show_cycles, 288 289 action_show_fragment, -
CMT/HEAD/source/cmt_project.cxx
r523 r525 1120 1120 1121 1121 /*----------------------------------------------------------*/ 1122 void Project::show_container () 1123 { 1124 Project* p = get_current (); 1125 1126 if (p == 0) return; 1127 Use* use = &(p->m_container); 1128 if (use->get_package_name () == "") return; 1129 1130 if (!use->located ()) 1131 { 1132 CmtMessage::warning ("container " + use->get_package_name () 1133 + " " + use->version + " " + use->path 1134 + " not found"); 1135 /* 1136 if (!Cmt::get_quiet ()) 1137 { 1138 cout << "# package " << use->get_package_name () << 1139 " " << use->version << " " << use->path << 1140 " not found" << 1141 endl; 1142 } 1143 */ 1144 CmtError::set (CmtError::package_not_found, use->get_package_name ()); 1145 } 1146 else 1147 { 1148 static const cmt_string empty; 1149 cmt_string p = use->real_path; 1150 if (use->path != "") 1151 { 1152 int pos = p.find_last_of (use->path); 1153 if (pos != cmt_string::npos) 1154 { 1155 p.erase (pos); 1156 } 1157 } 1158 1159 cout << "container " << use->get_package_name () 1160 << " " << use->version; 1161 1162 if (CmtSystem::absolute_path (use->path)) 1163 { 1164 if (!Cmt::get_quiet ()) 1165 { 1166 cout << " (" << use->path << ")"; 1167 } 1168 } 1169 else 1170 { 1171 cout << " " << use->path; 1172 } 1173 1174 if (!Cmt::get_quiet ()) 1175 { 1176 if (p != "") cout << " (" << p << ")"; 1177 if (use->auto_imports == Off) cout << " (no_auto_imports)"; 1178 } 1179 1180 cout << endl; 1181 } 1182 } 1183 /*----------------------------------------------------------*/ 1122 1184 void Project::show_specified_strategies_for_all () 1123 1185 { … … 1720 1782 1721 1783 //---------------------------------------------------------- 1722 const cmt_string& Project::get_container () const1723 { 1724 return (m_container );1784 const cmt_string& Project::get_container_name () const 1785 { 1786 return (m_container_name); 1725 1787 } 1726 1788 … … 1729 1791 { 1730 1792 return (m_container_version); 1793 } 1794 1795 //---------------------------------------------------------- 1796 const cmt_string& Project::get_container_path () const 1797 { 1798 return (m_container_path); 1731 1799 } 1732 1800 … … 1788 1856 1789 1857 //---------------------------------------------------------- 1790 void Project::set_container (const cmt_string& container)1791 { 1792 m_container = container;1858 void Project::set_container_name (const cmt_string& name) 1859 { 1860 m_container_name = name; 1793 1861 } 1794 1862 … … 1797 1865 { 1798 1866 m_container_version = container_version; 1867 } 1868 1869 //---------------------------------------------------------- 1870 void Project::set_container_path (const cmt_string& container_path) 1871 { 1872 m_container_path = container_path; 1799 1873 } 1800 1874 … … 1954 2028 A container statement is met in the project file 1955 2029 */ 1956 void Project::container_action (const cmt_string& name, const cmt_string& version) 1957 { 1958 //cerr << "Container action " << name << " " << version << endl; 1959 1960 set_container (name); 2030 void Project::container_action (const CmtSystem::cmt_string_vector& words) 2031 //void Project::container_action (const cmt_string& name, const cmt_string& version) 2032 { 2033 // 2034 // complete syntax : "container <package> <version> <path>" 2035 // minimal syntax : "container <package>" 2036 // 2037 // o if <version> is omitted then take any version available 2038 // o <version> can be specified using "v*" or "v<n>r*" or "v<n>r<m>p*" 2039 // 2040 // o the notation "v*" is preferred to omission (particularly since 2041 // omission does not permit <path>) 2042 // 2043 Use* use = &m_container; 2044 use->~Use (); 2045 if (words.size () < 2) return; 2046 2047 CmtSystem::cmt_string_vector ewords; 2048 for (int i = 1; i < words.size (); i++) 2049 { 2050 const cmt_string& w = words[i]; 2051 cmt_string ew = w; 2052 2053 Symbol::expand (ew); 2054 if (ew != w) 2055 { 2056 CmtSystem::cmt_string_vector ws; 2057 CmtSystem::split (ew, " ", ws); 2058 2059 for (int j = 0; j < ws.size (); ++j) 2060 { 2061 ewords.push_back (ws[j]); 2062 } 2063 } 2064 else 2065 { 2066 ewords.push_back (w); 2067 } 2068 } 2069 2070 cmt_string name, version, path; 2071 if (ewords.size () > 0) name = ewords[0]; 2072 if (ewords.size () > 1) version = ewords[1]; 2073 if (ewords.size () > 2) path = ewords[2]; 2074 2075 if (name != "") 2076 { 2077 use->set (name, version, path); 2078 use->get_package ()->remove_use (use); 2079 if (use->move_to ()) 2080 { 2081 cmt_string use_real; 2082 bool ok (false); 2083 if (!CmtSystem::absolute_path (use->path)) 2084 { 2085 ok = CmtSystem::realpath_ (use->real_path, use_real); 2086 } 2087 else 2088 { 2089 ok = CmtSystem::realpath_ (use->path, use_real); 2090 } 2091 if (ok && use_real.find (m_cmtpath_real) != 0) 2092 { 2093 use->~Use (); 2094 } 2095 } 2096 CmtSystem::cd (m_cmtpath_pwd + CmtSystem::file_separator () + "cmt"); 2097 } 2098 // cerr << CmtSystem::pwd () << endl; 2099 2100 set_container_name (name); 1961 2101 set_container_version (version); 2102 set_container_path (path); 1962 2103 } 1963 2104 -
CMT/HEAD/source/cmt_project.h
r515 r525 112 112 static void clear_all (); 113 113 static void show_all (); 114 static void show_container (); 114 115 static void show_specified_strategies_for_all (); 115 116 static void show_paths (const CmtSystem::cmt_string_vector& arguments); … … 136 137 const cmt_string& get_name () const; 137 138 const cmt_string& get_release () const; 138 const cmt_string& get_container () const;139 const cmt_string& get_container_name () const; 139 140 const cmt_string& get_container_version () const; 141 const cmt_string& get_container_path () const; 142 // const Use& get_container () const; 140 143 const cmt_string& get_cmtpath () const; 141 144 const cmt_string& get_cmtpath_real () const; … … 152 155 void set_name (const cmt_string& name); 153 156 void set_release (const cmt_string& release); 154 void set_container (const cmt_string& container); 157 // void set_container (const cmt_string& container); 158 void set_container_name (const cmt_string& name); 155 159 void set_container_version (const cmt_string& version); 160 void set_container_path (const cmt_string& path); 156 161 void set_cmtpath (const cmt_string& path); 157 162 void set_cmtpath_real (const cmt_string& path); … … 166 171 void add_child (Project* p); 167 172 168 void container_action (const cmt_string& name, const cmt_string& version); 173 void container_action (const CmtSystem::cmt_string_vector& words); 174 // void container_action (const cmt_string& name, const cmt_string& version); 169 175 void use_action (const cmt_string& name, const cmt_string& release); 170 176 … … 208 214 cmt_string m_author; 209 215 cmt_string m_release; 210 cmt_string m_container ;216 cmt_string m_container_name; 211 217 cmt_string m_container_version; 218 cmt_string m_container_path; 219 Use m_container; 212 220 213 221 ProjectPtrVector m_parents; -
CMT/HEAD/source/cmt_syntax.cxx
r523 r525 363 363 int line_number) 364 364 { 365 project->container_action (words[1], words[2]); 365 project->container_action (words); 366 //project->container_action (words[1], words[2]); 366 367 } 367 368 }; -
CMT/HEAD/src/setup.tcsh
r272 r525 8 8 complete cmt p/1/'(broadcast build check check_files checkout co cleanup config create expand filter help lock relocate remove run setup show system unlock version cvstags cvsbranches cvssubpackages cvssubprojects)'/ \ 9 9 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)'/ \ 10 n/show/'(action action_names action_value actions all_tags applied_patterns author branches clients cmtpath_patterns constituent constituent_names constituents c ycles fragment fragments groups include_dirs language languages macro macro_names macro_value macros manager packages path pattern patterns projects project_author pwd set set_names set_value sets strategies tags use_paths uses versions)'/ \10 n/show/'(action action_names action_value actions all_tags applied_patterns author branches clients cmtpath_patterns constituent constituent_names constituents container cycles fragment fragments groups include_dirs language languages macro macro_names macro_value macros manager packages path pattern patterns projects project_author pwd set set_names set_value sets strategies tags use_paths uses versions)'/ \ 11 11 n/check/'(configuration files version)'/ \ 12 12 n/expand/'(model)'/ \ -
CMT/HEAD/src/setup.zsh
r272 r525 26 26 'w[1,remove] p[3]' -X '> give version tag' - \ 27 27 'w[1,remove] p[4]' -X '> give a path if not located from the current path ' - \ 28 's[show],c[-1,show]' -k '(action,action_names,action_value,actions,all_tags,applied_patterns,author,branches,clients,cmtpath_patterns,constituent,constituent_names,constituents,c ycles,fragment,fragments,groups,include_dirs,language,languages,macro,macro_names,macro_value,macros,manager,packages,path,pattern,patterns,projects,project_author,pwd,set,set_names,set_value,sets,strategies,tags,use_paths,uses,versions)' - \28 's[show],c[-1,show]' -k '(action,action_names,action_value,actions,all_tags,applied_patterns,author,branches,clients,cmtpath_patterns,constituent,constituent_names,constituents,container,cycles,fragment,fragments,groups,include_dirs,language,languages,macro,macro_names,macro_value,macros,manager,packages,path,pattern,patterns,projects,project_author,pwd,set,set_names,set_value,sets,strategies,tags,use_paths,uses,versions)' - \ 29 29 'w[1,show] c[-1,constituent]' -K cmt_constituents - \ 30 30 'w[1,show] c[-1,fragment]' -K cmt_fragments - \
Note: See TracChangeset
for help on using the changeset viewer.