#include
Collaboration diagram for CmtInstallAreaMgr:
Public Methods |
|
void? | setup () |
void? | config () const |
const cmt_string&? | get_install_area () const |
Static Public Methods |
|
CmtInstallAreaMgr&? | instance () |
Private Methods |
|
cmt_string? | build_current_install_area () const |
Private Attributes |
|
cmt_vector<CmtInstallPathPattern>? | m_patterns |
cmt_string? | m_install_area |
|
? |
Definition at line 162 of file cmt_install_area.cxx. Referenced by config(), and setup(). 00163 { 00164 cmt_string installarea; 00165 00166 const CmtSystem::cmt_string_vector& paths = Cmt::get_cmt_path (); 00167 const CmtSystem::cmt_string_vector& path_sources = Cmt::get_cmt_path_sources (); 00168 00169 const cmt_string pwd = CmtSystem::pwd (); 00170 00171 for (int i = 0; i < paths.size (); i++) 00172 { 00173 const cmt_string& p = paths[i]; 00174 const cmt_string& s = path_sources[i]; 00175 00176 if (s == "default path") continue; 00177 00178 if (!CmtSystem::test_directory (p)) continue; 00179 00180 CmtSystem::cd (p); 00181 const cmt_string fp = CmtSystem::pwd (); 00182 CmtSystem::cd (pwd); 00183 00184 // To become the current area, a path must correspond to the current package 00185 if (pwd.find (fp) == cmt_string::npos) continue; 00186 00187 return (p); 00188 break; 00189 } 00190 00191 return (installarea); 00192 } |
|
? |
Definition at line 53 of file cmt_install_area.cxx. Referenced by Cmt::do_config(), and Cmt::do_setup(). 00054 { 00055 cmt_string installarea = build_current_install_area (); 00056 00057 if (installarea == "") return; 00058 00059 // cout << "InstallArea installed in " << installarea << endl; 00060 00061 if (!Cmt::get_quiet ()) 00062 { 00063 cout << "# Doing cleanup in the installation area " << installarea << endl; 00064 } 00065 00066 CmtPathPattern::apply_all (); 00067 00068 Symbol* macro = Symbol::find ("cmt_installarea_paths"); 00069 if (macro == 0) return; 00070 cmt_string installarea_paths = macro->build_macro_value (); 00071 00072 CmtSystem::cmt_string_vector areapaths; 00073 CmtSystem::split (installarea_paths, " \t", areapaths); 00074 00075 // Try a cleanup only in this selected install area 00076 00077 for (int i = 0; i < areapaths.size (); i++) 00078 { 00079 const cmt_string& p = areapaths[i]; 00080 00081 cmt_string path = installarea; 00082 path += CmtSystem::file_separator (); 00083 path += p; 00084 00085 Symbol::expand (path); 00086 00087 path.replace_all ("/", CmtSystem::file_separator ()); 00088 path.replace_all ("\\", CmtSystem::file_separator ()); 00089 00090 CmtSystem::cmt_string_vector refs; 00091 cmt_regexp expression (".*[.]cmtref$"); 00092 00093 // Look for all cmtref files in this PATH pattern 00094 00095 CmtSystem::scan_dir (path, expression, refs); 00096 00097 for (int j = 0; j < refs.size (); j++) 00098 { 00099 const cmt_string& ref_file = refs[j]; 00100 00101 // We get the absolute location of the installed file 00102 00103 cmt_string ref; 00104 ref.read (ref_file); 00105 int pos; 00106 00107 ref.replace_all ("\"", ""); 00108 00109 if (Cmt::get_debug ()) 00110 { 00111 cout << "CmtInstallAreaMgr::config> " << ref_file << " " << ref << endl; 00112 } 00113 00114 pos = ref.find ("\r\n"); 00115 if (pos != cmt_string::npos) ref.erase (pos); 00116 pos = ref.find ('\n'); 00117 if (pos != cmt_string::npos) ref.erase (pos); 00118 pos = ref.find ('\r'); 00119 if (pos != cmt_string::npos) ref.erase (pos); 00120 pos = ref.find (' '); 00121 if (pos != cmt_string::npos) ref.erase (pos); 00122 00123 // If the referenced file cannot be reached we remove the 00124 // corresponding installation 00125 // (this happens if the referenced file has be removed, or 00126 // moved away) 00127 00128 if (!CmtSystem::test_file (ref)) 00129 { 00130 cmt_string ref_name; 00131 00132 // Get the name of the referenced file 00133 CmtSystem::basename (ref, ref_name); 00134 00135 // Get the installation directory 00136 CmtSystem::dirname (ref_file, ref); 00137 00138 ref += CmtSystem::file_separator (); 00139 ref += ref_name; 00140 00141 // Remove both the installed file 00142 // and the reference file 00143 00144 if (!Cmt::get_quiet ()) 00145 { 00146 cout << "# Removing obsolete installed file [" << ref << "]"; 00147 cout << " (and " << ref_file << ")" << endl; 00148 } 00149 00150 CmtSystem::remove_file (ref); 00151 CmtSystem::remove_file (ref_file); 00152 } 00153 } 00154 } 00155 } |
|
? |
Definition at line 157 of file cmt_install_area.cxx. Referenced by Cmt::do_build_library_links(), Cmt::do_remove_library_links(), and Cmt::do_setup(). 00158 { 00159 return (m_install_area); 00160 } |
|
? |
Definition at line 10 of file cmt_install_area.cxx. Referenced by Cmt::do_build_library_links(), Cmt::do_config(), Cmt::do_remove_library_links(), Cmt::do_setup(), and Cmt::set_standard_macros(). 00011 { 00012 static CmtInstallAreaMgr me; 00013 00014 return (me); 00015 } |
|
? |
Definition at line 17 of file cmt_install_area.cxx. Referenced by Cmt::set_standard_macros(). 00018 { 00019 m_install_area = build_current_install_area (); 00020 00021 if (m_install_area == "") return; 00022 00023 CmtPathPattern::apply_all (); 00024 00025 cmt_string installarea_prefix; 00026 00027 Symbol* macro = Symbol::find ("cmt_installarea_prefix"); 00028 if (macro != 0) 00029 { 00030 installarea_prefix = macro->build_macro_value (); 00031 } 00032 00033 if (installarea_prefix != "") 00034 { 00035 m_install_area += CmtSystem::file_separator (); 00036 m_install_area += installarea_prefix; 00037 } 00038 00039 Use& current_use = Use::current (); 00040 cmt_string buffer; 00041 00042 if (!Symbol::is_selected ("CMTINSTALLAREA")) 00043 { 00044 buffer = "set CMTINSTALLAREA \""; 00045 buffer += m_install_area; 00046 buffer += "\""; 00047 00048 SyntaxParser::parse_requirements_line (buffer, ¤t_use); 00049 buffer = ""; 00050 } 00051 } |
|
? |
Definition at line 25 of file cmt_install_area.h. |
|
? |
Definition at line 24 of file cmt_install_area.h. |