#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cmt_use.h"
#include "cmt_system.h"
#include "cmt_symbol.h"
#include "cmt_error.h"
#include "cmt_database.h"
#include "cmt_syntax.h"
Include dependency graph for cmt_use.cxx:
Go to the source code of this file.
|
Definition at line 114 of file cmt_use.cxx. Referenced by compare_versions(), and Use::reach_package().
00115 { 00116 IdenticalIds, 00117 00118 IncompatibleMajorIds, 00119 NewMajorIdGreaterThanOld, 00120 OldMajorIdGreaterThanNew, 00121 ExplicitOldMajorIdWinsAgainstWildarded, 00122 ExplicitNewMajorIdWinsAgainstWildarded, 00123 00124 ExplicitOldMinorIdWinsAgainstWildarded, 00125 ExplicitNewMinorIdWinsAgainstWildarded, 00126 NewMinorIdGreaterThanOld, 00127 00128 ExplicitOldPatchIdWinsAgainstWildarded, 00129 ExplicitNewPatchIdWinsAgainstWildarded, 00130 NewPatchIdGreaterThanOld 00131 } CompareStatus; |
|
Definition at line 35 of file cmt_use.cxx. References cmt_map< K, T >::add(), and cmt_map< K, T >::has(). Referenced by Use::need_new().
00038 { 00039 static cmt_map <cmt_string, bool> requests; 00040 00041 cmt_string request = package_name; 00042 request += " "; 00043 request += version; 00044 request += " "; 00045 request += path; 00046 static bool b = true; 00047 00048 bool new_request = false; 00049 00050 if (!requests.has ((const cmt_string&) request)) 00051 { 00052 new_request = true; 00053 requests.add ((const cmt_string&) request, b); 00054 } 00055 00056 return (new_request); 00057 } |
|
Definition at line 133 of file cmt_use.cxx. References CompareStatus, ExplicitNewMajorIdWinsAgainstWildarded, ExplicitNewMinorIdWinsAgainstWildarded, ExplicitNewPatchIdWinsAgainstWildarded, ExplicitOldMajorIdWinsAgainstWildarded, ExplicitOldMinorIdWinsAgainstWildarded, ExplicitOldPatchIdWinsAgainstWildarded, IdenticalIds, CmtSystem::is_version_directory(), NewMajorIdGreaterThanOld, NewMinorIdGreaterThanOld, NewPatchIdGreaterThanOld, and OldMajorIdGreaterThanNew. Referenced by Use::reach_package().
00134 { 00135 CompareStatus result = IdenticalIds; 00136 00137 int old_v = -1; 00138 int old_r = -1; 00139 int old_p = -1; 00140 00141 int new_v = -1; 00142 int new_r = -1; 00143 int new_p = -1; 00144 00145 CmtSystem::is_version_directory (ref_version, old_v, old_r, old_p); 00146 00147 CmtSystem::is_version_directory (new_version, new_v, new_r, new_p); 00148 00149 if ((new_v != -1) && (old_v != -1) && (new_v != old_v)) 00150 { 00151 /* 00152 if (!Cmt::get_quiet ()) 00153 { 00154 cout << "#1 Required version " << new_version << 00155 " incompatible with selected version " << ref_version << 00156 endl; 00157 } 00158 */ 00159 00160 if (new_v > old_v) 00161 { 00162 result = NewMajorIdGreaterThanOld; 00163 } 00164 else 00165 { 00166 result = OldMajorIdGreaterThanNew; 00167 } 00168 //result = IncompatibleMajorIds; 00169 } 00170 else if ((new_v == -1) || (old_v == -1)) 00171 { 00172 // 00173 // we plan to discard new_use, but if it was specified as explicit 00174 // and ref_use was wildcarded then new_use will win !! 00175 // 00176 // So then we'll have to understand where are the wild 00177 // cards... If they are on v or r, then we consider them. 00178 // 00179 // 00180 00181 00182 if ((old_v == -1) && (new_v != -1)) 00183 { 00184 /* 00185 if (!Cmt::get_quiet ()) 00186 { 00187 cout << "#2 Select version " << new_version << 00188 " instead of existing " << ref_version << 00189 endl; 00190 } 00191 */ 00192 00193 result = ExplicitNewMajorIdWinsAgainstWildarded; 00194 } 00195 else 00196 { 00197 /* 00198 if (!Cmt::get_quiet ()) 00199 cout << "#3 keep version " << ref_version << 00200 " (ignore version " << new_version << ")" << 00201 endl; 00202 */ 00203 00204 result = ExplicitOldMajorIdWinsAgainstWildarded; 00205 } 00206 } 00207 else if ((new_r == -1) || (old_r == -1) || (new_r < old_r)) 00208 { 00209 // 00210 // we plan to discard new_use, but if it was specified as explicit 00211 // and ref_use was wildcarded then new_use will win !! 00212 // 00213 // So then we'll have to understand where are the wild 00214 // cards... If they are on v or r, then we consider them. 00215 // 00216 // 00217 00218 00219 if ((old_r == -1) && (new_r != -1)) 00220 { 00221 // old has wild card and new has not => new wins 00222 00223 /* 00224 if (!Cmt::get_quiet ()) 00225 { 00226 cout << "#4 Select release " << new_version 00227 << " instead of existing " << ref_version 00228 << endl; 00229 } 00230 */ 00231 00232 result = ExplicitNewMinorIdWinsAgainstWildarded; 00233 } 00234 else 00235 { 00236 /* 00237 if (!Cmt::get_quiet ()) 00238 cout << "#5 keep release " << ref_version << 00239 " (ignore release " << new_version << ")" << 00240 endl; 00241 */ 00242 00243 result = ExplicitOldMinorIdWinsAgainstWildarded; 00244 } 00245 } 00246 else if (new_r > old_r) 00247 { 00248 /* 00249 if (!Cmt::get_quiet ()) 00250 { 00251 cout << "#6 Select release " << new_version << 00252 " instead of existing " << ref_version << 00253 endl; 00254 } 00255 */ 00256 00257 result = NewMinorIdGreaterThanOld; 00258 } 00259 else if ((new_p == -1) || (old_p == -1) || (new_p < old_p)) 00260 { 00261 // 00262 // we plan to discard new_use, but if it was specified as explicit 00263 // and ref_use was wildcarded then new_use will win !! 00264 // 00265 00266 00267 if ((old_p == -1) && (new_p != -1)) 00268 { 00269 /* 00270 if (!Cmt::get_quiet ()) 00271 { 00272 cout << "#7 Select patch " << new_version << 00273 " instead of existing " << ref_version << 00274 endl; 00275 } 00276 */ 00277 00278 result = ExplicitNewPatchIdWinsAgainstWildarded; 00279 } 00280 else 00281 { 00282 /* 00283 if (!Cmt::get_quiet ()) 00284 cout << "#8 keep patch " << ref_version << 00285 " (ignore version " << new_version << ")" << 00286 endl; 00287 */ 00288 00289 result = ExplicitOldPatchIdWinsAgainstWildarded; 00290 } 00291 } 00292 else if (new_p > old_p) 00293 { 00294 /* 00295 if (!Cmt::get_quiet ()) 00296 { 00297 cout << "#9 Select patch " << new_version << 00298 " instead of existing " << ref_version << 00299 endl; 00300 } 00301 */ 00302 00303 result = NewPatchIdGreaterThanOld; 00304 } 00305 00306 return (result); 00307 } |
|
Definition at line 3033 of file cmt_use.cxx. References CmtSystem::create_symlink(), Use::current(), CmtSystem::dirname(), CmtSystem::execute(), Symbol::expand(), CmtSystem::file_separator(), Use::get_package_name(), Cmt::get_quiet(), same_dirs(), and cmt_string::write(). Referenced by Use::build_library_links().
03038 { 03039 cmt_string libname = source_library_name; 03040 cmt_string name = dest_library_name; 03041 cmt_string s; 03042 Use& current_use = Use::current (); 03043 03044 Symbol::expand (name); 03045 Symbol::expand (libname); 03046 03047 if (cmtinstallarea != "") 03048 { 03049 s = cmtinstallarea; 03050 s += CmtSystem::file_separator (); 03051 s += tag; 03052 s += CmtSystem::file_separator (); 03053 s += "lib"; 03054 s += CmtSystem::file_separator (); 03055 s += name; 03056 03057 // Now creating the reference file 03058 03059 cmt_string ref_file = s; 03060 ref_file += ".cmtref"; 03061 03062 cmt_string text = libname; 03063 text += "\n"; 03064 03065 Symbol::expand (ref_file); 03066 Symbol::expand (text); 03067 03068 if (!Cmt::get_quiet ()) cout << " Creating the reference file " << ref_file << endl; 03069 text.write (ref_file); 03070 } 03071 else 03072 { 03073 s = "../$("; 03074 s += current_use.get_package_name (); 03075 s += "_tag)/"; 03076 s += name; 03077 } 03078 03079 Symbol::expand (s); 03080 03081 cmt_string source; 03082 cmt_string dest; 03083 03084 CmtSystem::dirname (libname, source); 03085 CmtSystem::dirname (s, dest); 03086 03087 if (same_dirs (source, dest)) 03088 { 03089 return (false); 03090 } 03091 03092 //if (!Cmt::get_quiet ()) 03093 cout << " Symlinking " << libname << " to " << s << endl; 03094 03095 if (symlinkcmd == "") 03096 { 03097 if (!CmtSystem::create_symlink (libname, s)) 03098 { 03099 cerr << "#CMT> Cannot create a symbolic link to " << libname << endl; 03100 return (false); 03101 } 03102 } 03103 else 03104 { 03105 cmt_string cmd = symlinkcmd; 03106 cmd += " "; 03107 cmd += libname; 03108 cmd += " "; 03109 cmd += s; 03110 03111 int status = CmtSystem::execute (cmd); 03112 03113 if (status != 0) 03114 { 03115 cerr << "#CMT> Cannot create a symbolic link to " << libname << endl; 03116 return (false); 03117 } 03118 } 03119 03120 return (true); 03121 } |
|
Definition at line 3011 of file cmt_use.cxx. References CmtSystem::cd(), and CmtSystem::pwd(). Referenced by install_library().
03012 { 03013 bool result = false; 03014 03015 cmt_string here = CmtSystem::pwd (); 03016 03017 cmt_string h1; 03018 if (CmtSystem::cd (d1)) h1 = CmtSystem::pwd (); 03019 03020 CmtSystem::cd (here); 03021 03022 cmt_string h2; 03023 if (CmtSystem::cd (d2)) h2 = CmtSystem::pwd (); 03024 03025 result = (h1 == h2); 03026 03027 CmtSystem::cd (here); 03028 03029 return (result); 03030 } |
|
Definition at line 4299 of file cmt_use.cxx. References Package::get_name(), Use::get_ordered_uses(), Use::get_package_name(), Package::get_uses(), Package::packages(), Package::PackageVector, cmt_vector< T >::size(), and Use::UsePtrVector. Referenced by Use::add(), and use_action_iterator::get_use().
04300 { 04301 Package::PackageVector& vector = Package::packages (); 04302 04303 int i; 04304 int j; 04305 04306 cout << "### Packages: "; 04307 for (i = 0; i < vector.size (); i++) 04308 { 04309 Package& p = vector[i]; 04310 cout << p.get_name () << "["; 04311 Use::UsePtrVector& uses = p.get_uses (); 04312 for (j = 0; j < uses.size (); j++) 04313 { 04314 Use* u = uses[j]; 04315 cout << u << ","; 04316 } 04317 04318 cout << "] "; 04319 } 04320 cout << endl; 04321 04322 { 04323 static Use::UsePtrVector& uses = Use::get_ordered_uses (); 04324 04325 cout << "### Uses: "; 04326 for (i = 0; i < uses.size (); i++) 04327 { 04328 Use* u = uses[i]; 04329 cout << "[" << u << "]" << u->get_package_name () << " "; 04330 } 04331 } 04332 04333 cout << endl; 04334 } |