#include <cmt_install_area.h>
Collaboration diagram for CmtInstallAreaMgr:
Public Member Functions | |
void | setup_current_installarea () |
void | setup () |
void | config () const |
const cmt_string & | get_installarea () const |
Static Public Member Functions | |
CmtInstallAreaMgr & | instance () |
Private Member Functions | |
cmt_string | build_current_installarea () const |
Private Attributes | |
cmt_vector< CmtInstallPathPattern > | m_patterns |
cmt_string | m_installarea |
|
Definition at line 189 of file cmt_install_area.cxx. References Project::find_in_cmt_paths(), and CmtSystem::pwd(). Referenced by config(), setup(), and setup_current_installarea().
00190 { 00191 cmt_string installarea; 00192 00193 const cmt_string pwd = CmtSystem::pwd (); 00194 00195 installarea = Project::find_in_cmt_paths (pwd); 00196 00197 return (installarea); 00198 } |
|
Definition at line 80 of file cmt_install_area.cxx. References CmtPathPattern::apply_all(), CmtSystem::basename(), build_current_installarea(), Symbol::build_macro_value(), CmtSystem::cmt_string_vector, CmtSystem::dirname(), cmt_string::erase(), Symbol::expand(), CmtSystem::file_separator(), cmt_string::find(), Symbol::find(), Cmt::get_debug(), Cmt::get_quiet(), cmt_string::read(), CmtSystem::remove_file(), cmt_string::replace_all(), CmtSystem::scan_dir(), cmt_vector< T >::size(), CmtSystem::split(), and CmtSystem::test_file().
00081 { 00082 cmt_string installarea = build_current_installarea (); 00083 00084 CmtPathPattern::apply_all (); 00085 00086 if (installarea == "") return; 00087 00088 // cout << "InstallArea installed in " << installarea << endl; 00089 00090 if (!Cmt::get_quiet ()) 00091 { 00092 cerr << "#CMT> Warning: Doing cleanup in the installation area " << installarea << endl; 00093 } 00094 00095 Symbol* macro = Symbol::find ("cmt_installarea_paths"); 00096 if (macro == 0) return; 00097 cmt_string installarea_paths = macro->build_macro_value (); 00098 00099 CmtSystem::cmt_string_vector areapaths; 00100 CmtSystem::split (installarea_paths, " \t", areapaths); 00101 00102 // Try a cleanup only in this selected install area 00103 00104 for (int i = 0; i < areapaths.size (); i++) 00105 { 00106 const cmt_string& p = areapaths[i]; 00107 00108 cmt_string path = installarea; 00109 path += CmtSystem::file_separator (); 00110 path += p; 00111 00112 Symbol::expand (path); 00113 00114 path.replace_all ("/", CmtSystem::file_separator ()); 00115 path.replace_all ("\\", CmtSystem::file_separator ()); 00116 00117 CmtSystem::cmt_string_vector refs; 00118 cmt_regexp expression (".*[.]cmtref$"); 00119 00120 // Look for all cmtref files in this PATH pattern 00121 00122 CmtSystem::scan_dir (path, expression, refs); 00123 00124 for (int j = 0; j < refs.size (); j++) 00125 { 00126 const cmt_string& ref_file = refs[j]; 00127 00128 // We get the absolute location of the installed file 00129 00130 cmt_string ref; 00131 ref.read (ref_file); 00132 int pos; 00133 00134 ref.replace_all ("\"", ""); 00135 00136 if (Cmt::get_debug ()) 00137 { 00138 cout << "CmtInstallAreaMgr::config> " << ref_file << " " << ref << endl; 00139 } 00140 00141 pos = ref.find ("\r\n"); 00142 if (pos != cmt_string::npos) ref.erase (pos); 00143 pos = ref.find ('\n'); 00144 if (pos != cmt_string::npos) ref.erase (pos); 00145 pos = ref.find ('\r'); 00146 if (pos != cmt_string::npos) ref.erase (pos); 00147 pos = ref.find (' '); 00148 if (pos != cmt_string::npos) ref.erase (pos); 00149 00150 // If the referenced file cannot be reached we remove the 00151 // corresponding installation 00152 // (this happens if the referenced file has be removed, or 00153 // moved away) 00154 00155 if (!CmtSystem::test_file (ref)) 00156 { 00157 cmt_string ref_name; 00158 00159 // Get the name of the referenced file 00160 CmtSystem::basename (ref, ref_name); 00161 00162 // Get the installation directory 00163 CmtSystem::dirname (ref_file, ref); 00164 00165 ref += CmtSystem::file_separator (); 00166 ref += ref_name; 00167 00168 // Remove both the installed file 00169 // and the reference file 00170 00171 if (!Cmt::get_quiet ()) 00172 { 00173 cout << "# Removing obsolete installed file [" << ref << "]"; 00174 cout << " (and " << ref_file << ")" << endl; 00175 } 00176 00177 CmtSystem::remove_file (ref); 00178 CmtSystem::remove_file (ref_file); 00179 } 00180 } 00181 } 00182 } |
|
Definition at line 184 of file cmt_install_area.cxx. References m_installarea. Referenced by Cmt::do_build_library_links(), and Cmt::do_remove_library_links().
00185 { 00186 return (m_installarea); 00187 } |
|
Definition at line 16 of file cmt_install_area.cxx. Referenced by Cmt::do_build_library_links(), Cmt::do_remove_library_links(), Cmt::do_setup(), and StandardMacroBuilder::fill_for_install_area().
00017 { 00018 static CmtInstallAreaMgr me; 00019 00020 return (me); 00021 } |
|
Definition at line 73 of file cmt_install_area.cxx. References build_current_installarea(), m_installarea, and setup_current_installarea(). Referenced by Cmt::do_setup(), and StandardMacroBuilder::fill_for_install_area().
00074 { 00075 m_installarea = build_current_installarea (); 00076 00077 setup_current_installarea (); 00078 } |
|
Definition at line 23 of file cmt_install_area.cxx. References build_current_installarea(), Symbol::build_macro_value(), Use::current(), CmtSystem::file_separator(), Symbol::find(), Project::find_by_cmtpath(), Project::get_name(), Symbol::is_selected(), m_installarea, and SyntaxParser::parse_requirements_line(). Referenced by setup().
00024 { 00025 m_installarea = build_current_installarea (); 00026 00027 if (m_installarea == "") return; 00028 00029 cmt_string macro_name; 00030 00031 Project* project = Project::find_by_cmtpath (m_installarea); 00032 00033 if (project != 0) 00034 { 00035 macro_name = project->get_name (); 00036 } 00037 else 00038 { 00039 macro_name = "cmt"; 00040 } 00041 00042 macro_name += "_installarea_prefix"; 00043 00044 Symbol* macro = Symbol::find (macro_name); 00045 00046 cmt_string installarea_prefix; 00047 00048 if (macro != 0) 00049 { 00050 installarea_prefix = macro->build_macro_value (); 00051 } 00052 00053 if (installarea_prefix != "") 00054 { 00055 m_installarea += CmtSystem::file_separator (); 00056 m_installarea += installarea_prefix; 00057 } 00058 00059 Use& current_use = Use::current (); 00060 cmt_string buffer; 00061 00062 if (!Symbol::is_selected ("CMTINSTALLAREA")) 00063 { 00064 buffer = "macro CMTINSTALLAREA \""; 00065 buffer += m_installarea; 00066 buffer += "\""; 00067 00068 SyntaxParser::parse_requirements_line (buffer, ¤t_use); 00069 buffer = ""; 00070 } 00071 } |
|
Definition at line 32 of file cmt_install_area.h. Referenced by get_installarea(), setup(), and setup_current_installarea(). |
|
Definition at line 31 of file cmt_install_area.h. |