Ignore:
Timestamp:
07/25/11 23:16:48 (22 months ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2
Children:
04ef932
Parents:
7ec3dd1
Message:

2011-07-25

  • merged in all 0.3.9 changes into 0.4.0
  • refactored where filter to be "non template" to drastically reduce compile time (as well as potentially size if I ever go dll instead of static link)
  • streamlined checkeventlog toi be same as "the other" where filters as well as dropped support of "old" syntax.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • helpers/installer-dlls/main_dll/main_dll.cpp

    r3bdaf18 re11d494  
    114114class installer_logger : public settings::logger_interface { 
    115115public: 
    116   msi_helper &h; 
     116  msi_helper *h; 
    117117  std::wstring error; 
    118  
    119   installer_logger(msi_helper &h) : h(h) {} 
     118  std::list<std::wstring> debug_log; 
     119 
     120  installer_logger(msi_helper *h) : h(h) {} 
    120121 
    121122  virtual void err(std::string file, int line, std::wstring message) { 
    122123    error = message; 
    123     h.logMessage(_T("ERROR: ") + message); 
     124    h->logMessage(_T("ERROR: ") + message); 
     125    debug_log.push_back(_T("ERROR: ") + message); 
    124126  } 
    125127  virtual void warn(std::string file, int line, std::wstring message) { 
    126     h.logMessage(_T("WARN: ") + message); 
     128    h->logMessage(_T("WARN: ") + message); 
     129    debug_log.push_back(_T("WARN: ") + message); 
    127130  } 
    128131  virtual void info(std::string file, int line, std::wstring message) { 
    129     h.logMessage(_T("INFO: ") + message); 
    130   } 
    131   virtual void debug(std::string file, int line, std::wstring message) {} 
     132    h->logMessage(_T("INFO: ") + message); 
     133    debug_log.push_back(_T("INFO: ") + message); 
     134  } 
     135  virtual void debug(std::string file, int line, std::wstring message) { 
     136    debug_log.push_back(_T("DEBUG: ") + message); 
     137  } 
     138  std::list<std::wstring> get_debug() { 
     139    return debug_log; 
     140  } 
    132141}; 
    133142 
    134143struct installer_settings_provider : public settings_manager::provider_interface { 
    135144 
    136   msi_helper &h; 
     145  msi_helper *h; 
    137146  std::wstring basepath; 
    138147  installer_logger logger; 
    139148 
    140   installer_settings_provider(msi_helper &h, std::wstring basepath) : h(h), logger(h), basepath(basepath) {} 
     149  installer_settings_provider(msi_helper *h, std::wstring basepath) : h(h), logger(h), basepath(basepath) {} 
    141150 
    142151  virtual std::wstring expand_path(std::wstring file) { 
     
    157166  std::wstring get_error() { 
    158167    return logger.error; 
     168  } 
     169  std::list<std::wstring> get_debug() { 
     170    return logger.get_debug(); 
    159171  } 
    160172}; 
     
    199211    } 
    200212 
    201     installer_settings_provider provider(h, target); 
     213    installer_settings_provider provider(&h, target); 
    202214    if (!settings_manager::init_settings(&provider, _T(""))) { 
     215      h.logMessage(_T("Settings context had fatal errors")); 
    203216      h.setProperty(_T("CONF_OLD_ERROR"), provider.get_error()); 
    204217      h.setProperty(_T("CONF_CAN_CHANGE"), _T("0")); 
    205218      h.setProperty(_T("CONF_OLD_FOUND"), _T("0")); 
    206219      h.setProperty(_T("CONF_HAS_ERRORS"), _T("1")); 
    207       return ERROR_SUCCESS; 
    208220    } 
    209221    if (provider.has_error()) { 
    210       h.setProperty(_T("CONF_OLD_ERROR"), provider.get_error()); 
    211       h.setProperty(_T("CONF_CAN_CHANGE"), _T("0")); 
    212       h.setProperty(_T("CONF_OLD_FOUND"), _T("0")); 
    213       h.setProperty(_T("CONF_HAS_ERRORS"), _T("1")); 
    214       return ERROR_SUCCESS; 
    215     } 
     222      h.logMessage(_T("Settings context reported errors (debug log end)")); 
     223      BOOST_FOREACH(std::wstring l, provider.get_debug()) { 
     224        h.logMessage(l); 
     225      } 
     226      h.logMessage(_T("Settings context reported errors (debug log end)")); 
     227      if (!settings_manager::has_boot_conf()) { 
     228        h.logMessage(_T("boot.conf was NOT found (so no new configuration)")); 
     229        if (settings_manager::context_exists(DEFAULT_CONF_OLD_LOCATION)) { 
     230          h.logMessage(std::wstring(_T("Old configuration found: ")) + DEFAULT_CONF_OLD_LOCATION); 
     231          h.setProperty(_T("CONF_OLD_ERROR"), std::wstring(_T("Old configuration (")) + DEFAULT_CONF_OLD_LOCATION + _T(") was found but we got errors accessing it: ") + provider.get_error()); 
     232          h.setProperty(_T("CONF_CAN_CHANGE"), _T("0")); 
     233          h.setProperty(_T("CONF_OLD_FOUND"), _T("0")); 
     234          h.setProperty(_T("CONF_HAS_ERRORS"), _T("1")); 
     235          return ERROR_SUCCESS; 
     236        } else { 
     237          h.logMessage(_T("Failed to read configuration but no configuration was found (so we are assuming there is no configuration).")); 
     238          h.setProperty(_T("CONF_CAN_CHANGE"), _T("1")); 
     239          h.setProperty(_T("CONF_OLD_FOUND"), _T("0")); 
     240          h.setProperty(_T("CONF_HAS_ERRORS"), _T("0")); 
     241          return ERROR_SUCCESS; 
     242        } 
     243      } else { 
     244        h.logMessage(_T("boot.conf was found but we got errors booting it...")); 
     245        h.setProperty(_T("CONF_OLD_ERROR"), provider.get_error()); 
     246        h.setProperty(_T("CONF_CAN_CHANGE"), _T("0")); 
     247        h.setProperty(_T("CONF_OLD_FOUND"), _T("0")); 
     248        h.setProperty(_T("CONF_HAS_ERRORS"), _T("1")); 
     249        return ERROR_SUCCESS; 
     250      } 
     251    } 
     252 
     253 
    216254    h.setProperty(_T("CONFIGURATION_TYPE"), settings_manager::get_settings()->get_context()); 
    217255    h.setProperty(_T("CONF_CAN_CHANGE"), _T("1")); 
    218     h.setProperty(_T("CONF_OLD_FOUND"), _T("1")); 
    219256    h.setProperty(_T("CONF_HAS_ERRORS"), _T("0")); 
    220257 
     
    341378    int add_defaults = data.get_next_int(); 
    342379 
    343     installer_settings_provider provider(h, target); 
    344     if (!settings_manager::init_settings(&provider, _T(""))) { 
     380    installer_settings_provider provider(&h, target); 
     381    if (!settings_manager::init_settings(&provider, context)) { 
    345382      h.errorMessage(_T("Failed to boot settings: ") + provider.get_error()); 
    346383      return ERROR_INSTALL_FAILURE; 
    347384    } 
     385    h.logMessage(_T("Switching to: ") + context); 
    348386    settings_manager::change_context(context); 
    349387 
Note: See TracChangeset for help on using the changeset viewer.