diff --git a/src/libcalamares/geoip/Handler.cpp b/src/libcalamares/geoip/Handler.cpp index 192ab1a7c..df033f476 100644 --- a/src/libcalamares/geoip/Handler.cpp +++ b/src/libcalamares/geoip/Handler.cpp @@ -64,17 +64,21 @@ Handler::Handler( const QString& implementation, const QString& url, const QStri { bool ok = false; m_type = handlerTypes().find( implementation, ok ); -#if !defined(QT_XML_LIB) - if ( m_type == Type::XML ) - { - m_type = Type::None; - cWarning() << "GeoIP style XML is not supported in this version of Calamares."; - } -#endif if ( !ok ) { - cWarning() << "GeoIP Style" << implementation << "is not recognized."; + cWarning() << "GeoIP style" << implementation << "is not recognized."; } + else if ( m_type == Type::None ) + { + cWarning() << "GeoIP style *none* does not do anything."; + } +#if !defined(QT_XML_LIB) + else if ( m_type == Type::XML ) + { + m_type = Type::None; + cWarning() << "GeoIP style *xml* is not supported in this version of Calamares."; + } +#endif } Handler::~Handler() diff --git a/src/libcalamares/geoip/Handler.h b/src/libcalamares/geoip/Handler.h index 5c3207b60..8e435b5b7 100644 --- a/src/libcalamares/geoip/Handler.h +++ b/src/libcalamares/geoip/Handler.h @@ -25,7 +25,7 @@ #include #include -namespace CalamaresUtils +namespace CalamaresUtils { namespace GeoIP { @@ -80,6 +80,8 @@ public: bool isValid() const { return m_type != Type::None; } Type type() const { return m_type; } + QString url() const { return m_url; } + QString selector() const { return m_selector; } private: Type m_type; diff --git a/src/libcalamaresui/modulesystem/Module.cpp b/src/libcalamaresui/modulesystem/Module.cpp index d05245384..44798b32b 100644 --- a/src/libcalamaresui/modulesystem/Module.cpp +++ b/src/libcalamaresui/modulesystem/Module.cpp @@ -198,7 +198,7 @@ Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::Ex return; } } - cDebug() << "No config file found in" << Logger::DebugList( configCandidates ); + cDebug() << "No config file for" << m_name << "found anywhere at" << Logger::DebugList( configCandidates ); } diff --git a/src/libcalamaresui/modulesystem/ModuleManager.cpp b/src/libcalamaresui/modulesystem/ModuleManager.cpp index 185ec37e9..a030e55cd 100644 --- a/src/libcalamaresui/modulesystem/ModuleManager.cpp +++ b/src/libcalamaresui/modulesystem/ModuleManager.cpp @@ -90,10 +90,14 @@ ModuleManager::doInit() if ( success ) { QFileInfo descriptorFileInfo( currentDir.absoluteFilePath( QLatin1Literal( "module.desc") ) ); - if ( ! ( descriptorFileInfo.exists() && descriptorFileInfo.isReadable() ) ) + if ( !descriptorFileInfo.exists() ) { - cDebug() << Q_FUNC_INFO << "unreadable file: " - << descriptorFileInfo.absoluteFilePath(); + cDebug() << "ModuleManager expected descriptor is missing:" << descriptorFileInfo.absoluteFilePath(); + continue; + } + if ( !descriptorFileInfo.isReadable() ) + { + cDebug() << "ModuleManager descriptor file is unreadable:" << descriptorFileInfo.absoluteFilePath(); continue; } @@ -111,13 +115,14 @@ ModuleManager::doInit() } else { - cWarning() << "Cannot cd into module directory " - << path << "/" << subdir; + cWarning() << "ModuleManager module directory is not accessible:" << path << "/" << subdir; } } } else - cDebug() << "ModuleManager bad search path" << path; + { + cDebug() << "ModuleManager module search path does not exist:" << path; + } } // At this point m_availableModules is filled with whatever was found in the // search paths. @@ -359,7 +364,7 @@ ModuleManager::checkDependencies() m_availableDescriptorsByModuleName.erase( it ); failed << moduleName; cWarning() << "Module" << moduleName << "requires modules" << Logger::DebugList( unmet ); - cWarning() << Logger::SubEntry << "but these are not available (listed in settings, or installed)."; + cWarning() << Logger::SubEntry << "but these are not available (listed in settings, or installed)."; break; } } diff --git a/src/modules/welcome/WelcomeViewStep.cpp b/src/modules/welcome/WelcomeViewStep.cpp index a27cc4cf0..938fe1f45 100644 --- a/src/modules/welcome/WelcomeViewStep.cpp +++ b/src/modules/welcome/WelcomeViewStep.cpp @@ -128,16 +128,24 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap ) CalamaresUtils::getString( geoip, "style" ), CalamaresUtils::getString( geoip, "url" ), CalamaresUtils::getString( geoip, "selector" ) ); - auto* future = new FWString(); - connect( future, &FWString::finished, [view=this, f=future, h=handler]() + if ( handler->type() != CalamaresUtils::GeoIP::Handler::Type::None ) { - QString countryResult = f->future().result(); - cDebug() << "GeoIP result for welcome=" << countryResult; - view->setCountry( countryResult ); - f->deleteLater(); - delete h; - } ); - future->setFuture( handler->queryRaw() ); + auto* future = new FWString(); + connect( future, &FWString::finished, [view=this, f=future, h=handler]() + { + QString countryResult = f->future().result(); + cDebug() << "GeoIP result for welcome=" << countryResult; + view->setCountry( countryResult, h ); + f->deleteLater(); + delete h; + } ); + future->setFuture( handler->queryRaw() ); + } + else + { + // Would not produce useful country code anyway. + delete handler; + } } @@ -156,12 +164,22 @@ WelcomeViewStep::checkRequirements() return m_requirementsChecker->checkRequirements(); } +static inline void +logGeoIPHandler( CalamaresUtils::GeoIP::Handler* handler ) +{ + if ( handler ) + { + cDebug() << Logger::SubEntry << "Obtained from" << handler->url() << " (" << static_cast( handler->type() ) << handler->selector() << ')'; + } +} + void -WelcomeViewStep::setCountry( const QString& countryCode ) +WelcomeViewStep::setCountry( const QString& countryCode, CalamaresUtils::GeoIP::Handler* handler ) { if ( countryCode.length() != 2 ) { cDebug() << "Unusable country code" << countryCode; + logGeoIPHandler( handler ); return; } @@ -169,6 +187,7 @@ WelcomeViewStep::setCountry( const QString& countryCode ) if ( c_l.first == QLocale::Country::AnyCountry ) { cDebug() << "Unusable country code" << countryCode; + logGeoIPHandler( handler ); return; } else diff --git a/src/modules/welcome/WelcomeViewStep.h b/src/modules/welcome/WelcomeViewStep.h index 7deed2167..5d27d7aad 100644 --- a/src/modules/welcome/WelcomeViewStep.h +++ b/src/modules/welcome/WelcomeViewStep.h @@ -32,6 +32,14 @@ class WelcomePage; class GeneralRequirements; +namespace CalamaresUtils +{ + namespace GeoIP + { + class Handler; + } +} // namespace + class PLUGINDLLEXPORT WelcomeViewStep : public Calamares::ViewStep { Q_OBJECT @@ -57,9 +65,10 @@ public: /** @brief Sets the country that Calamares is running in. * * This (ideally) sets up language and locale settings that are right for - * the given 2-letter country code. + * the given 2-letter country code. Uses the handler's information (if + * given) for error reporting. */ - void setCountry( const QString& ); + void setCountry( const QString&, CalamaresUtils::GeoIP::Handler* handler ); Calamares::RequirementsList checkRequirements() override;