From b1bae4152abffaf3e084889edd62360b66b09316 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 3 Oct 2017 10:29:03 +0200 Subject: [PATCH 01/10] Missing import; thanks to crazy on IRC --- src/modules/initramfscfg/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/initramfscfg/main.py b/src/modules/initramfscfg/main.py index d935328d6..aa63e659b 100644 --- a/src/modules/initramfscfg/main.py +++ b/src/modules/initramfscfg/main.py @@ -24,6 +24,8 @@ # along with Calamares. If not, see . import libcalamares + +import inspect import os import shutil From 78031636af28467bd3085f9d2c7ef5f9454fc4a8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 9 Oct 2017 13:14:53 -0700 Subject: [PATCH 02/10] Correct for distortion of globe. In the timezone widget, locations in the far north -- Inuvik, Thule, Longyearbyen -- were displayed too far south, because the map location calculation assumes a linear gradient, which places 90 degrees north at about 70 degrees. Change calculation to pretend the world is flat south of 62 degrees north, and then 'bend' the remaining 28 degrees of latitude to the top of the image. This puts most places in the right spot, although Yellowknife is now on the south shore of Great Slave. Fort Nelson should be north of Dawson Creek, too -- the math still needs a little work. While here, put Antarctica in the south, otherwise Rothera keeps showing up in Greenland. --- .../locale/timezonewidget/timezonewidget.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/modules/locale/timezonewidget/timezonewidget.cpp b/src/modules/locale/timezonewidget/timezonewidget.cpp index b8713e107..475815cba 100644 --- a/src/modules/locale/timezonewidget/timezonewidget.cpp +++ b/src/modules/locale/timezonewidget/timezonewidget.cpp @@ -20,8 +20,12 @@ * along with Calamares. If not, see . */ +#include + #include "timezonewidget.h" +constexpr double MATH_PI = 3.14159265; + TimeZoneWidget::TimeZoneWidget(QWidget* parent) : QWidget(parent) { @@ -98,6 +102,17 @@ QPoint TimeZoneWidget::getLocationPosition(double longitude, double latitude) { double x = (width / 2.0 + (width / 2.0) * longitude / 180.0) + MAP_X_OFFSET * width; double y = (height / 2.0 - (height / 2.0) * latitude / 90.0) + MAP_Y_OFFSET * height; + //Far north, the MAP_Y_OFFSET no longer holds, cancel the Y offset; it's noticeable + // from 62 degrees north, so scale those 28 degrees as if the world is flat south + // of there, and we have a funny "rounded" top of the world. In practice the locations + // of the different cities / regions looks ok -- at least Thule ends up in the right + // country, and Inuvik isn't in the ocean. + if (latitude > 62.0) + y -= sin(MATH_PI * (latitude - 62.0) / 56.0) * MAP_Y_OFFSET * height; + // Antarctica isn't shown on the map, but you could try clicking there + if (latitude < -60) + y = height - 1; + if (x < 0) x = width+x; if (x >= width) From c10d7470bbc4067be5d9d96277db795ce8cbaa8e Mon Sep 17 00:00:00 2001 From: Gabriel C Date: Wed, 11 Oct 2017 23:03:29 +0200 Subject: [PATCH 03/10] finished: fix configuration file syntax - fixes commit 74c19fc02d6f3cdf9693dcc35efc75b837a6e3e9 - fixes #829 --- src/modules/finished/finished.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/finished/finished.conf b/src/modules/finished/finished.conf index 6bd8bb2d6..debeff19b 100644 --- a/src/modules/finished/finished.conf +++ b/src/modules/finished/finished.conf @@ -1,5 +1,5 @@ -Configuration for the "finished" page, which is usually shown only at -the end of the installation (successful or not). +# Configuration for the "finished" page, which is usually shown only at +# the end of the installation (successful or not). --- # The finished page can hold a "restart system now" checkbox. # If this is false, no checkbox is show and the system is not restarted From 00fa7bff1c0d3973972f5162d3e410d77276ee79 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 12 Oct 2017 07:08:21 -0700 Subject: [PATCH 04/10] Code-formatting, add copyright notice --- .../locale/timezonewidget/timezonewidget.cpp | 147 ++++++++++-------- 1 file changed, 79 insertions(+), 68 deletions(-) diff --git a/src/modules/locale/timezonewidget/timezonewidget.cpp b/src/modules/locale/timezonewidget/timezonewidget.cpp index 475815cba..23f21b237 100644 --- a/src/modules/locale/timezonewidget/timezonewidget.cpp +++ b/src/modules/locale/timezonewidget/timezonewidget.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac + * Copyright 2017, Adriaan de Groot * * Originally from the Manjaro Installation Framework * by Roland Singer @@ -26,59 +27,64 @@ constexpr double MATH_PI = 3.14159265; -TimeZoneWidget::TimeZoneWidget(QWidget* parent) : - QWidget(parent) +TimeZoneWidget::TimeZoneWidget( QWidget* parent ) : + QWidget( parent ) { - setMouseTracking(false); - setCursor(Qt::PointingHandCursor); + setMouseTracking( false ); + setCursor( Qt::PointingHandCursor ); // Font - font.setPointSize(12); - font.setBold(false); + font.setPointSize( 12 ); + font.setBold( false ); // Images - background = QImage(":/images/bg.png").scaled(X_SIZE, Y_SIZE, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - pin = QImage(":/images/pin.png"); + background = QImage( ":/images/bg.png" ).scaled( X_SIZE, Y_SIZE, Qt::IgnoreAspectRatio, Qt::SmoothTransformation ); + pin = QImage( ":/images/pin.png" ); // Set size - setMinimumSize(background.size()); - setMaximumSize(background.size()); + setMinimumSize( background.size() ); + setMaximumSize( background.size() ); // Zone images - QStringList zones = QString(ZONES).split(" ", QString::SkipEmptyParts); - for (int i = 0; i < zones.size(); ++i) - timeZoneImages.append(QImage(":/images/timezone_" + zones.at(i) + ".png").scaled(X_SIZE, Y_SIZE, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); + QStringList zones = QString( ZONES ).split( " ", QString::SkipEmptyParts ); + for ( int i = 0; i < zones.size(); ++i ) + timeZoneImages.append( QImage( ":/images/timezone_" + zones.at( i ) + ".png" ).scaled( X_SIZE, Y_SIZE, Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) ); } -void TimeZoneWidget::setCurrentLocation(QString region, QString zone) { +void TimeZoneWidget::setCurrentLocation( QString region, QString zone ) +{ QHash > hash = LocaleGlobal::getLocations(); - if (!hash.contains(region)) + if ( !hash.contains( region ) ) return; - QList locations = hash.value(region); - for (int i = 0; i < locations.size(); ++i) { - if (locations.at(i).zone == zone) { - setCurrentLocation(locations.at(i)); + QList locations = hash.value( region ); + for ( int i = 0; i < locations.size(); ++i ) + { + if ( locations.at( i ).zone == zone ) + { + setCurrentLocation( locations.at( i ) ); break; } } } - -void TimeZoneWidget::setCurrentLocation(LocaleGlobal::Location location) { +void TimeZoneWidget::setCurrentLocation( LocaleGlobal::Location location ) +{ currentLocation = location; // Set zone - QPoint pos = getLocationPosition(currentLocation.longitude, currentLocation.latitude); + QPoint pos = getLocationPosition( currentLocation.longitude, currentLocation.latitude ); - for (int i = 0; i < timeZoneImages.size(); ++i) { + for ( int i = 0; i < timeZoneImages.size(); ++i ) + { QImage zone = timeZoneImages[i]; // If not transparent set as current - if (zone.pixel(pos) != RGB_TRANSPARENT) { + if ( zone.pixel( pos ) != RGB_TRANSPARENT ) + { currentZoneImage = zone; break; } @@ -95,85 +101,87 @@ void TimeZoneWidget::setCurrentLocation(LocaleGlobal::Location location) { //### -QPoint TimeZoneWidget::getLocationPosition(double longitude, double latitude) { +QPoint TimeZoneWidget::getLocationPosition( double longitude, double latitude ) +{ const int width = this->width(); const int height = this->height(); - double x = (width / 2.0 + (width / 2.0) * longitude / 180.0) + MAP_X_OFFSET * width; - double y = (height / 2.0 - (height / 2.0) * latitude / 90.0) + MAP_Y_OFFSET * height; + double x = ( width / 2.0 + ( width / 2.0 ) * longitude / 180.0 ) + MAP_X_OFFSET * width; + double y = ( height / 2.0 - ( height / 2.0 ) * latitude / 90.0 ) + MAP_Y_OFFSET * height; //Far north, the MAP_Y_OFFSET no longer holds, cancel the Y offset; it's noticeable // from 62 degrees north, so scale those 28 degrees as if the world is flat south // of there, and we have a funny "rounded" top of the world. In practice the locations // of the different cities / regions looks ok -- at least Thule ends up in the right // country, and Inuvik isn't in the ocean. - if (latitude > 62.0) - y -= sin(MATH_PI * (latitude - 62.0) / 56.0) * MAP_Y_OFFSET * height; + if ( latitude > 62.0 ) + y -= sin( MATH_PI * ( latitude - 62.0 ) / 56.0 ) * MAP_Y_OFFSET * height; // Antarctica isn't shown on the map, but you could try clicking there - if (latitude < -60) + if ( latitude < -60 ) y = height - 1; - if (x < 0) + if ( x < 0 ) x = width+x; - if (x >= width) + if ( x >= width ) x -= width; - if (y < 0) + if ( y < 0 ) y = height+y; - if (y >= height) + if ( y >= height ) y -= height; - return QPoint((int)x, (int)y); + return QPoint( ( int )x, ( int )y ); } - -void TimeZoneWidget::paintEvent(QPaintEvent*) { +void TimeZoneWidget::paintEvent( QPaintEvent* ) +{ const int width = this->width(); const int height = this->height(); - QFontMetrics fontMetrics(font); - QPainter painter(this); + QFontMetrics fontMetrics( font ); + QPainter painter( this ); - painter.setRenderHint(QPainter::Antialiasing); - painter.setFont(font); + painter.setRenderHint( QPainter::Antialiasing ); + painter.setFont( font ); // Draw background - painter.drawImage(0, 0, background); + painter.drawImage( 0, 0, background ); // Draw zone image - painter.drawImage(0, 0, currentZoneImage); + painter.drawImage( 0, 0, currentZoneImage ); // Draw pin - QPoint point = getLocationPosition(currentLocation.longitude, currentLocation.latitude); - painter.drawImage(point.x() - pin.width()/2, point.y() - pin.height()/2, pin); + QPoint point = getLocationPosition( currentLocation.longitude, currentLocation.latitude ); + painter.drawImage( point.x() - pin.width()/2, point.y() - pin.height()/2, pin ); // Draw text and box - const int textWidth = fontMetrics.width(LocaleGlobal::Location::pretty(currentLocation.zone)); + const int textWidth = fontMetrics.width( LocaleGlobal::Location::pretty( currentLocation.zone ) ); const int textHeight = fontMetrics.height(); - QRect rect = QRect(point.x() - textWidth/2 - 5, point.y() - textHeight - 8, textWidth + 10, textHeight - 2); + QRect rect = QRect( point.x() - textWidth/2 - 5, point.y() - textHeight - 8, textWidth + 10, textHeight - 2 ); - if (rect.x() <= 5) - rect.moveLeft(5); - if (rect.right() >= width-5) - rect.moveRight(width - 5); - if (rect.y() <= 5) - rect.moveTop(5); - if (rect.y() >= height-5) - rect.moveBottom(height-5); + if ( rect.x() <= 5 ) + rect.moveLeft( 5 ); + if ( rect.right() >= width-5 ) + rect.moveRight( width - 5 ); + if ( rect.y() <= 5 ) + rect.moveTop( 5 ); + if ( rect.y() >= height-5 ) + rect.moveBottom( height-5 ); - painter.setPen(QPen()); // no pen - painter.setBrush(QColor(40, 40, 40)); - painter.drawRoundedRect(rect, 3, 3); - painter.setPen(Qt::white); - painter.drawText(rect.x() + 5, rect.bottom() - 4, LocaleGlobal::Location::pretty(currentLocation.zone)); + painter.setPen( QPen() ); // no pen + painter.setBrush( QColor( 40, 40, 40 ) ); + painter.drawRoundedRect( rect, 3, 3 ); + painter.setPen( Qt::white ); + painter.drawText( rect.x() + 5, rect.bottom() - 4, LocaleGlobal::Location::pretty( currentLocation.zone ) ); painter.end(); } -void TimeZoneWidget::mousePressEvent(QMouseEvent* event) { - if (event->button() != Qt::LeftButton) +void TimeZoneWidget::mousePressEvent( QMouseEvent* event ) +{ + if ( event->button() != Qt::LeftButton ) return; // Set nearest location @@ -182,14 +190,17 @@ void TimeZoneWidget::mousePressEvent(QMouseEvent* event) { QHash > hash = LocaleGlobal::getLocations(); QHash >::iterator iter = hash.begin(); - while (iter != hash.end()) { + while ( iter != hash.end() ) + { QList locations = iter.value(); - for (int i = 0; i < locations.size(); ++i) { + for ( int i = 0; i < locations.size(); ++i ) + { LocaleGlobal::Location loc = locations[i]; - QPoint locPos = getLocationPosition(loc.longitude, loc.latitude); + QPoint locPos = getLocationPosition( loc.longitude, loc.latitude ); - if ((abs(mX - locPos.x()) + abs(mY - locPos.y()) < abs(mX - nX) + abs(mY - nY))) { + if ( ( abs( mX - locPos.x() ) + abs( mY - locPos.y() ) < abs( mX - nX ) + abs( mY - nY ) ) ) + { currentLocation = loc; nX = locPos.x(); nY = locPos.y(); @@ -200,8 +211,8 @@ void TimeZoneWidget::mousePressEvent(QMouseEvent* event) { } // Set zone image and repaint widget - setCurrentLocation(currentLocation); + setCurrentLocation( currentLocation ); // Emit signal - emit locationChanged(currentLocation); + emit locationChanged( currentLocation ); } From 8b76b861ad4d8d75db26d0f042c0d470d5f919ca Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 12 Oct 2017 12:26:50 -0300 Subject: [PATCH 05/10] Code-formatting, add (unused for now) overload of getLocationPosition() --- .../locale/timezonewidget/timezonewidget.h | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/modules/locale/timezonewidget/timezonewidget.h b/src/modules/locale/timezonewidget/timezonewidget.h index 27256fabe..62475e20f 100644 --- a/src/modules/locale/timezonewidget/timezonewidget.h +++ b/src/modules/locale/timezonewidget/timezonewidget.h @@ -48,14 +48,17 @@ class TimeZoneWidget : public QWidget { Q_OBJECT public: - explicit TimeZoneWidget(QWidget* parent = 0); + explicit TimeZoneWidget( QWidget* parent = 0 ); - LocaleGlobal::Location getCurrentLocation() { return currentLocation; } - void setCurrentLocation(QString region, QString zone); - void setCurrentLocation(LocaleGlobal::Location location); + LocaleGlobal::Location getCurrentLocation() + { + return currentLocation; + } + void setCurrentLocation( QString region, QString zone ); + void setCurrentLocation( LocaleGlobal::Location location ); signals: - void locationChanged(LocaleGlobal::Location location); + void locationChanged( LocaleGlobal::Location location ); private: QFont font; @@ -63,10 +66,14 @@ private: QList timeZoneImages; LocaleGlobal::Location currentLocation; - QPoint getLocationPosition(double longitude, double latitude); + QPoint getLocationPosition( const LocaleGlobal::Location& l ) + { + return getLocationPosition( l.longitude, l.latitude ); + } + QPoint getLocationPosition( double longitude, double latitude ); - void paintEvent(QPaintEvent* event); - void mousePressEvent(QMouseEvent* event); + void paintEvent( QPaintEvent* event ); + void mousePressEvent( QMouseEvent* event ); }; #endif // TIMEZONEWIDGET_H From b805a8df7455a4b6b7c88630c800ebafda1ea5f1 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 12 Oct 2017 12:33:03 -0300 Subject: [PATCH 06/10] CMake: minor docs, typo's --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 80d925b15..0017a29cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,7 @@ if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) # Clang warnings: doing *everything* is counter-productive, since it warns # about things which we can't fix (e.g. C++98 incompatibilities, but - # Calaares is C++14). + # Calamares is C++14). foreach( CLANG_WARNINGS -Weverything -Wno-c++98-compat @@ -88,6 +88,8 @@ else() set( SUPPRESS_BOOST_WARNINGS "" ) endif() +# Use mark_thirdparty_code() to reduce warnings from the compiler +# on code that we're not going to fix. Call this with a list of files. macro(mark_thirdparty_code) set_source_files_properties( ${ARGV} PROPERTIES From e9205125eacdae6d52a9093e1a0c7e0c13831551 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 12 Oct 2017 12:55:07 -0300 Subject: [PATCH 07/10] Testing: add test to check the shipped config-files for correctness. --- src/modules/CMakeLists.txt | 5 +++ src/modules/test_conf.cpp | 66 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 src/modules/test_conf.cpp diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt index 48cda5c72..d48ecd29f 100644 --- a/src/modules/CMakeLists.txt +++ b/src/modules/CMakeLists.txt @@ -1,5 +1,10 @@ include( CMakeColors ) +if( BUILD_TESTING ) + add_executable( test_conf test_conf.cpp ) + target_link_libraries( test_conf ${YAMLCPP_LIBRARY} ) +endif() + file( GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*" ) string( REPLACE " " ";" SKIP_LIST "${SKIP_MODULES}" ) foreach( SUBDIRECTORY ${SUBDIRECTORIES} ) diff --git a/src/modules/test_conf.cpp b/src/modules/test_conf.cpp new file mode 100644 index 000000000..d5ac7c6ce --- /dev/null +++ b/src/modules/test_conf.cpp @@ -0,0 +1,66 @@ +/* === This file is part of Calamares - === + * + * Copyright 2017, Adriaan de Groot + * + * Calamares is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Calamares is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Calamares. If not, see . + */ + +/** + * This is a test-application that just checks the YAML config-file + * shipped with each module for correctness -- well, for parseability. + */ + +#include +#include + +using std::cerr; + +int main(int argc, char** argv) +{ + if (argc != 2) + { + cerr << "Usage: test_conf \n"; + return 1; + } + + try + { + YAML::Node doc = YAML::LoadFile( argv[1] ); + + if ( doc.IsNull() ) + { + // Special case: empty config files are valid, + // but aren't a map. For the example configs, + // this is still an error. + cerr << "WARNING:" << argv[1] << '\n'; + cerr << "WARNING: empty YAML\n"; + return 1; + } + + if ( !doc.IsMap() ) + { + cerr << "WARNING:" << argv[1] << '\n'; + cerr << "WARNING: not-a-YAML-map\n"; + return 1; + } + } + catch ( YAML::Exception& e ) + { + cerr << "WARNING:" << argv[1] << '\n'; + cerr << "WARNING: YAML parser error " << e.what() << '\n'; + return 1; + } + + return 0; +} From 6000cbaae247d14edc09afbe4c2f7eed930df201 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 12 Oct 2017 13:01:53 -0300 Subject: [PATCH 08/10] Testing: test each module's config files --- CMakeModules/CalamaresAddModuleSubdirectory.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeModules/CalamaresAddModuleSubdirectory.cmake b/CMakeModules/CalamaresAddModuleSubdirectory.cmake index 1b60c59a7..66595d269 100644 --- a/CMakeModules/CalamaresAddModuleSubdirectory.cmake +++ b/CMakeModules/CalamaresAddModuleSubdirectory.cmake @@ -39,7 +39,13 @@ function( calamares_add_module_subdirectory ) # message( " ${Green}FILES:${ColorReset} ${MODULE_FILES}" ) message( " ${Green}MODULE_DESTINATION:${ColorReset} ${MODULE_DESTINATION}" ) if( MODULE_CONFIG_FILES ) - if (INSTALL_CONFIG) + if ( BUILD_TESTING ) + foreach( _config_file ${MODULE_CONFIG_FILES} ) + add_test(NAME config-${SUBDIRECTORY} + COMMAND test_conf ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${_config_file} ) + endforeach() + endif() + if ( INSTALL_CONFIG ) message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${MODULE_CONFIG_FILES} => ${MODULE_DATA_DESTINATION}" ) else() message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${MODULE_CONFIG_FILES} => [Skipping installation]" ) From c6c6c2f22f854695299a0c8961329470c4849d87 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 12 Oct 2017 13:37:54 -0300 Subject: [PATCH 09/10] Testing: refactor so that C++ and Python modules all get yaml-config tests --- .../CalamaresAddModuleSubdirectory.cmake | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/CMakeModules/CalamaresAddModuleSubdirectory.cmake b/CMakeModules/CalamaresAddModuleSubdirectory.cmake index 66595d269..caf1b707e 100644 --- a/CMakeModules/CalamaresAddModuleSubdirectory.cmake +++ b/CMakeModules/CalamaresAddModuleSubdirectory.cmake @@ -6,9 +6,12 @@ set( MODULE_DATA_DESTINATION share/calamares/modules ) function( calamares_add_module_subdirectory ) set( SUBDIRECTORY ${ARGV0} ) + set( MODULE_CONFIG_FILES "" ) + # If this subdirectory has a CMakeLists.txt, we add_subdirectory it... if( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/CMakeLists.txt" ) add_subdirectory( ${SUBDIRECTORY} ) + file( GLOB MODULE_CONFIG_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY} "${SUBDIRECTORY}/*.conf" ) # ...otherwise, we look for a module.desc. elseif( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/module.desc" ) set( MODULES_DIR ${CMAKE_INSTALL_LIBDIR}/calamares/modules ) @@ -39,12 +42,6 @@ function( calamares_add_module_subdirectory ) # message( " ${Green}FILES:${ColorReset} ${MODULE_FILES}" ) message( " ${Green}MODULE_DESTINATION:${ColorReset} ${MODULE_DESTINATION}" ) if( MODULE_CONFIG_FILES ) - if ( BUILD_TESTING ) - foreach( _config_file ${MODULE_CONFIG_FILES} ) - add_test(NAME config-${SUBDIRECTORY} - COMMAND test_conf ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${_config_file} ) - endforeach() - endif() if ( INSTALL_CONFIG ) message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${MODULE_CONFIG_FILES} => ${MODULE_DATA_DESTINATION}" ) else() @@ -62,9 +59,23 @@ function( calamares_add_module_subdirectory ) RENAME calamares-${SUBDIRECTORY}.mo ) endif() - else() message( "-- ${BoldYellow}Warning:${ColorReset} tried to add module subdirectory ${BoldRed}${SUBDIRECTORY}${ColorReset} which has no CMakeLists.txt or module.desc." ) message( "" ) endif() + + # Check any config files for basic correctness + if ( BUILD_TESTING AND MODULE_CONFIG_FILES ) + set( _count 0 ) + foreach( _config_file ${MODULE_CONFIG_FILES} ) + set( _count_str "-${_count}" ) + if ( _count EQUAL 0 ) + set( _count_str "" ) + endif() + add_test( + NAME config-${SUBDIRECTORY}${_count_str} + COMMAND test_conf ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${_config_file} ) + math( EXPR _count "${_count} + 1" ) + endforeach() + endif() endfunction() From aabcd6ba86c102a15ec50972732b6aeb99573e22 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 13 Oct 2017 16:45:37 -0300 Subject: [PATCH 10/10] Bump version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0017a29cf..0ca5efb80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -166,7 +166,7 @@ set( CALAMARES_TRANSLATION_LANGUAGES ar ast bg ca cs_CZ da de el en en_GB es_MX ### Bump version here set( CALAMARES_VERSION_MAJOR 3 ) set( CALAMARES_VERSION_MINOR 1 ) -set( CALAMARES_VERSION_PATCH 5 ) +set( CALAMARES_VERSION_PATCH 6 ) set( CALAMARES_VERSION_RC 0 ) set( CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH} )