diff --git a/.gitignore b/.gitignore index 2f36a5de6..da0f082a6 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,4 @@ CMakeLists.txt.user # Kate *.kate-swp +tags diff --git a/CHANGES b/CHANGES index 64102fae8..b1b74f4ee 100644 --- a/CHANGES +++ b/CHANGES @@ -6,14 +6,18 @@ website will have to do for older versions. # 3.2.26 (unreleased) # This release contains contributions from (alphabetically by first name): - - No external contributors yet + - Pablo Ovelleiro Corral ## Core ## - - No core changes yet + - External modules can now be built again, outside of the Calamares + source and build-tree. ## Modules ## - - No module changes yet - + - *locale* put some more places into the correct timezone **visually**; + for instance Norfolk Island gave up UTC+11.5 in 2015 and is now + UTC+11, but Calamares still showed it in a zone separate from UTC+11. + - *packages* gained support for the Void Linux package manager, + *xbps*. (thanks Pablo) # 3.2.25 (2020-06-06) # diff --git a/CMakeLists.txt b/CMakeLists.txt index 020b83e80..09e5c6d1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,7 +162,13 @@ if(NOT CMAKE_VERSION VERSION_LESS "3.10.0") ) endif() +# CMake Modules +include( CMakePackageConfigHelpers ) include( CTest ) +include( FeatureSummary ) + +# Calamares Modules +include( CMakeColors ) ### C++ SETUP # @@ -248,9 +254,6 @@ if( CMAKE_COMPILER_IS_GNUCXX ) endif() endif() -include( FeatureSummary ) -include( CMakeColors ) - ### DEPENDENCIES # @@ -520,16 +523,10 @@ endif() # make predefined install dirs available everywhere include( GNUInstallDirs ) -# make uninstall support -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - IMMEDIATE @ONLY -) - -# Early configure these files as we need them later on -set( CALAMARES_CMAKE_DIR "${CMAKE_SOURCE_DIR}/CMakeModules" ) -set( CALAMARES_LIBRARIES calamares ) +# This is used by CalamaresAddLibrary; once Calamares is installed, +# the CalamaresConfig.cmake module sets this variable to the IMPORTED +# libraries for Calamares. +set( Calamares_LIBRARIES calamares ) add_subdirectory( src ) @@ -539,32 +536,39 @@ add_feature_info(Config ${INSTALL_CONFIG} "Install Calamares configuration") add_feature_info(KCrash ${WITH_KF5Crash} "Crash dumps via KCrash") add_feature_info(KDBusAddons ${WITH_KF5DBus} "Unique-application via DBus") -# Add all targets to the build-tree export set +### CMake infrastructure installation +# +# set( CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Calamares" CACHE PATH "Installation directory for CMake files" ) set( CMAKE_INSTALL_FULL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}" ) -export( TARGETS calamares - FILE "${PROJECT_BINARY_DIR}/CalamaresLibraryDepends.cmake" ) -# Export the package for use from the build-tree -# (this registers the build-tree with a global CMake-registry) export( PACKAGE Calamares ) - -# Create a CalamaresBuildTreeSettings.cmake file for the use from the build tree -configure_file( CalamaresBuildTreeSettings.cmake.in "${PROJECT_BINARY_DIR}/CalamaresBuildTreeSettings.cmake" @ONLY ) - -# Create the CalamaresConfig.cmake and CalamaresConfigVersion files -file( RELATIVE_PATH CONF_REL_INCLUDE_DIR "${CMAKE_INSTALL_FULL_CMAKEDIR}" "${CMAKE_INSTALL_FULL_INCLUDEDIR}" ) - -configure_file( CalamaresConfig.cmake.in "${PROJECT_BINARY_DIR}/CalamaresConfig.cmake" @ONLY ) -configure_file( CalamaresConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake" @ONLY ) -configure_file( CalamaresUse.cmake.in "${PROJECT_BINARY_DIR}/CalamaresUse.cmake" @ONLY ) +configure_package_config_file( + "CalamaresConfig.cmake.in" + "${PROJECT_BINARY_DIR}/CalamaresConfig.cmake" + INSTALL_DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" + PATH_VARS + CMAKE_INSTALL_INCLUDEDIR + CMAKE_INSTALL_LIBDIR + CMAKE_INSTALL_DATADIR +) +write_basic_package_version_file( + ${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion +) +install( + EXPORT Calamares + DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" + FILE "CalamaresTargets.cmake" + NAMESPACE Calamares:: +) # Install the cmake files install( FILES "${PROJECT_BINARY_DIR}/CalamaresConfig.cmake" "${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake" - "${PROJECT_BINARY_DIR}/CalamaresUse.cmake" "CMakeModules/CalamaresAddBrandingSubdirectory.cmake" "CMakeModules/CalamaresAddLibrary.cmake" "CMakeModules/CalamaresAddModuleSubdirectory.cmake" @@ -573,48 +577,36 @@ install( "CMakeModules/CalamaresAddTranslations.cmake" "CMakeModules/CalamaresAutomoc.cmake" "CMakeModules/CMakeColors.cmake" + "CMakeModules/FindYAMLCPP.cmake" DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" ) -# Install the export set for use with the install-tree -install( - EXPORT - CalamaresLibraryDepends - DESTINATION - "${CMAKE_INSTALL_CMAKEDIR}" -) - +### Miscellaneous installs +# +# if( INSTALL_CONFIG ) install( - FILES - settings.conf - DESTINATION - share/calamares + FILES settings.conf + DESTINATIONshare/calamares ) endif() if( INSTALL_POLKIT ) install( - FILES - com.github.calamares.calamares.policy - DESTINATION - "${POLKITQT-1_POLICY_FILES_INSTALL_DIR}" + FILES com.github.calamares.calamares.policy + DESTINATION "${POLKITQT-1_POLICY_FILES_INSTALL_DIR}" ) endif() install( - FILES - calamares.desktop - DESTINATION - ${CMAKE_INSTALL_DATADIR}/applications + FILES calamares.desktop + DESTINATION ${CMAKE_INSTALL_DATADIR}/applications ) install( - FILES - man/calamares.8 - DESTINATION - ${CMAKE_INSTALL_MANDIR}/man8/ + FILES man/calamares.8 + DESTINATION ${CMAKE_INSTALL_MANDIR}/man8/ ) # uninstall target diff --git a/CMakeModules/CalamaresAddLibrary.cmake b/CMakeModules/CalamaresAddLibrary.cmake index 6155293d7..88978e751 100644 --- a/CMakeModules/CalamaresAddLibrary.cmake +++ b/CMakeModules/CalamaresAddLibrary.cmake @@ -93,11 +93,10 @@ function(calamares_add_library) # add link targets target_link_libraries(${target} - LINK_PUBLIC ${CALAMARES_LIBRARIES} + LINK_PUBLIC ${Calamares_LIBRARIES} Qt5::Core Qt5::Gui Qt5::Widgets - ${LIBRARY_QT5_MODULES} ) if(LIBRARY_LINK_LIBRARIES) target_link_libraries(${target} LINK_PUBLIC ${LIBRARY_LINK_LIBRARIES}) diff --git a/CalamaresBuildTreeSettings.cmake.in b/CalamaresBuildTreeSettings.cmake.in deleted file mode 100644 index 507fc3d64..000000000 --- a/CalamaresBuildTreeSettings.cmake.in +++ /dev/null @@ -1,4 +0,0 @@ -set(CALAMARES_INCLUDE_DIRS - "@PROJECT_SOURCE_DIR@/src/libcalamares" - "@PROJECT_BINARY_DIR@/src/libcalamares" -) diff --git a/CalamaresConfig.cmake.in b/CalamaresConfig.cmake.in index 6d32410c6..4c62fb477 100644 --- a/CalamaresConfig.cmake.in +++ b/CalamaresConfig.cmake.in @@ -1,32 +1,78 @@ # Config file for the Calamares package # -# It defines the following variables -# CALAMARES_INCLUDE_DIRS - include directories for Calamares -# CALAMARES_LIBRARIES - libraries to link against -# CALAMARES_USE_FILE - name of a convenience include -# CALAMARES_APPLICATION_NAME - human-readable application name -# -# Typical use is: -# -# find_package(Calamares REQUIRED) -# include("${CALAMARES_USE_FILE}") +# The following IMPORTED targets are defined: +# - Calamares::calamares - the core library +# - Calamares::calamaresui - the UI (and QML) library # +# For legacy use it defines the following variables: +# - Calamares_INCLUDE_DIRS - include directories for Calamares +# - Calamares_LIB_DIRS - library directories +# - Calamares_LIBRARIES - libraries to link against -# Compute paths -get_filename_component(CALAMARES_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -if(EXISTS "${CALAMARES_CMAKE_DIR}/CMakeCache.txt") - # In build tree - include("${CALAMARES_CMAKE_DIR}/CalamaresBuildTreeSettings.cmake") -else() - set(CALAMARES_INCLUDE_DIRS "${CALAMARES_CMAKE_DIR}/@CONF_REL_INCLUDE_DIR@/libcalamares") +@PACKAGE_INIT@ + +### Versioning and IMPORTED targets +# +# +include(${CMAKE_CURRENT_LIST_DIR}/CalamaresConfigVersion.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CalamaresTargets.cmake) + +### Dependencies +# +# The libraries can depend on a variety of Qt and KDE Frameworks +# components, so accumulate them and find (just once). +# +macro(accumulate_deps outvar target namespace) + string(LENGTH ${namespace} _nslen) + get_target_property(_libs ${target} INTERFACE_LINK_LIBRARIES) + foreach(_lib ${_libs}) + if (_lib MATCHES ^${namespace}) + string(SUBSTRING ${_lib} ${_nslen} -1 _component) + list(APPEND ${outvar} ${_component}) + endif() + endforeach() +endmacro() + +# Qt5 infrastructure for translations is required +set(qt5_required Core Widgets LinguistTools) +accumulate_deps(qt5_required Calamares::calamares Qt5::) +accumulate_deps(qt5_required Calamares::calamaresui Qt5::) +find_package(Qt5 CONFIG REQUIRED ${qt5_required}) + +set(kf5_required "") +accumulate_deps(kf5_required Calamares::calamares KF5::) +accumulate_deps(kf5_required Calamares::calamaresui KF5::) +if(kf5_required) + find_package(ECM ${ECM_VERSION} NO_MODULE) + if( ECM_FOUND ) + list(PREPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) + find_package(KF5 REQUIRED COMPONENTS ${kf5_required}) + endif() endif() -# Our library dependencies (contains definitions for IMPORTED targets) -include("${CALAMARES_CMAKE_DIR}/CalamaresLibraryDepends.cmake") +### Legacy support +# +# +set(Calamares_LIB_DIRS "@PACKAGE_CMAKE_INSTALL_LIBDIR@") +set(Calamares_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@") +set(Calamares_LIBRARIES Calamares::calamares) -# These are IMPORTED targets created by CalamaresLibraryDepends.cmake -set(CALAMARES_LIBRARIES calamares) +### CMake support +# +# +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) -# Convenience variables -set(CALAMARES_USE_FILE "${CALAMARES_CMAKE_DIR}/CalamaresUse.cmake") -set(CALAMARES_APPLICATION_NAME "Calamares") +include(CalamaresAddBrandingSubdirectory) +include(CalamaresAddLibrary) +include(CalamaresAddModuleSubdirectory) +include(CalamaresAddPlugin) + +# These are feature-settings that affect consumers of Calamares +# libraries as well; without Python-support in the libs, for instance, +# there's no point in having a Python plugin. +# +# This list should match the one in libcalamares/CalamaresConfig.h, +# which is the C++-language side of the same configuration. +set(Calamares_WITH_PYTHON @WITH_PYTHON@) +set(Calamares_WITH_PYTHONQT @WITH_PYTHONQT@) +set(Calamares_WITH_QML @WITH_QML@) diff --git a/CalamaresConfigVersion.cmake.in b/CalamaresConfigVersion.cmake.in deleted file mode 100644 index 05b87c8d3..000000000 --- a/CalamaresConfigVersion.cmake.in +++ /dev/null @@ -1,12 +0,0 @@ -set(PACKAGE_VERSION "@CALAMARES_VERSION@") - -# Check whether the requested PACKAGE_FIND_VERSION is compatible -if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") - set(PACKAGE_VERSION_COMPATIBLE FALSE) -else() - set(PACKAGE_VERSION_COMPATIBLE TRUE) - if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") - set(PACKAGE_VERSION_EXACT TRUE) - endif() -endif() - diff --git a/CalamaresUse.cmake.in b/CalamaresUse.cmake.in deleted file mode 100644 index 00f3c968d..000000000 --- a/CalamaresUse.cmake.in +++ /dev/null @@ -1,29 +0,0 @@ -# A setup-cmake-things-for-Calamares module. -# -# This module handles looking for dependencies and including -# all of the Calamares macro modules, so that you can focus -# on just using the macros to build Calamares modules. -# Typical use looks like this: -# -# ``` -# find_package( Calamares REQUIRED ) -# include( "${CALAMARES_CMAKE_DIR}/CalamaresUse.cmake" ) -# ``` -# -# The first CMake command finds Calamares (which will contain -# this file), then adds the found location to the search path, -# and then includes this file. After that, you can use -# Calamares module and plugin macros. - -if( NOT CALAMARES_CMAKE_DIR ) - message( FATAL_ERROR "Use find_package(Calamares) first." ) -endif() -set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CALAMARES_CMAKE_DIR} ) - -find_package( Qt5 @QT_VERSION@ CONFIG REQUIRED Core Widgets LinguistTools ) - -include( CalamaresAddLibrary ) -include( CalamaresAddModuleSubdirectory ) -include( CalamaresAddPlugin ) -include( CalamaresAddBrandingSubdirectory ) - diff --git a/settings.conf b/settings.conf index 409468d82..9d566aca9 100644 --- a/settings.conf +++ b/settings.conf @@ -159,7 +159,7 @@ dont-chroot: false # If this is set to true, Calamares refers to itself as a "setup program" # rather than an "installer". Defaults to the value of dont-chroot, but # Calamares will complain if this is not explicitly set. -# oem-setup: true +oem-setup: false # If this is set to true, the "Cancel" button will be disabled entirely. # The button is also hidden from view. diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index b43b89289..0516b5613 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -1,5 +1,5 @@ # === This file is part of Calamares - === -# +# # SPDX-FileCopyrightText: 2020 Adriaan de Groot # # Calamares is free software: you can redistribute it and/or modify @@ -163,21 +163,25 @@ set_target_properties( calamares PROPERTIES VERSION ${CALAMARES_VERSION_SHORT} SOVERSION ${CALAMARES_VERSION_SHORT} + INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_INSTALL_FULL_INCLUDEDIR}/libcalamares ) calamares_automoc( calamares ) target_link_libraries( calamares LINK_PRIVATE ${OPTIONAL_PRIVATE_LIBRARIES} - LINK_PUBLIC yamlcpp + LINK_PUBLIC Qt5::Core KF5::CoreAddons ${OPTIONAL_PUBLIC_LIBRARIES} ) +### Installation +# +# install( TARGETS calamares - EXPORT CalamaresLibraryDepends + EXPORT Calamares RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} @@ -192,13 +196,18 @@ install( CODE " # Install header files file( GLOB rootHeaders "*.h" ) -file( GLOB kdsingleapplicationguardHeaders "kdsingleapplicationguard/*.h" ) -file( GLOB utilsHeaders "utils/*.h" ) +install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h + ${rootHeaders} + DESTINATION include/libcalamares +) +# Install each subdir-worth of header files +foreach( subdir geoip locale modulesystem network partition utils ) + file( GLOB subdir_headers "${subdir}/*.h" ) + install( FILES ${subdir_headers} DESTINATION include/libcalamares/${subdir} ) +endforeach() -install( FILES ${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h DESTINATION include/libcalamares ) -install( FILES ${rootHeaders} DESTINATION include/libcalamares ) -install( FILES ${kdsingleapplicationguardHeaders} DESTINATION include/libcalamares/kdsingleapplicationguard ) -install( FILES ${utilsHeaders} DESTINATION include/libcalamares/utils ) ### TESTING # diff --git a/src/libcalamares/CalamaresConfig.h.in b/src/libcalamares/CalamaresConfig.h.in index 98efa8c26..c081b158f 100644 --- a/src/libcalamares/CalamaresConfig.h.in +++ b/src/libcalamares/CalamaresConfig.h.in @@ -1,5 +1,5 @@ /* === This file is part of Calamares - === - * + * * SPDX-FileCopyrightText: 2020 Adriaan de Groot * * Calamares is free software: you can redistribute it and/or modify @@ -29,7 +29,14 @@ #define CMAKE_INSTALL_FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/calamares" #define CMAKE_INSTALL_FULL_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}" -//cmakedefines for CMake variables (e.g. for optdepends) go here +/* + * These are feature-settings that affect consumers of Calamares + * libraries as well; without Python-support in the libs, for instance, + * there's no point in having a Python plugin. + * + * This list should match the one in CalamaresConfig.cmake + * which is the CMake-time side of the same configuration. + */ #cmakedefine WITH_PYTHON #cmakedefine WITH_PYTHONQT #cmakedefine WITH_QML diff --git a/src/libcalamares/modulesystem/RequirementsModel.cpp b/src/libcalamares/modulesystem/RequirementsModel.cpp index 6f9fc1e7b..41a5616c1 100644 --- a/src/libcalamares/modulesystem/RequirementsModel.cpp +++ b/src/libcalamares/modulesystem/RequirementsModel.cpp @@ -1,5 +1,5 @@ /* === This file is part of Calamares - === - * + * * SPDX-FileCopyrightText: 2019-2020 Adriaan de Groot * * Calamares is free software: you can redistribute it and/or modify @@ -96,13 +96,16 @@ RequirementsModel::roleNames() const void RequirementsModel::describe() const { + cDebug() << "Requirements model has" << m_requirements.count() << "items"; bool acceptable = true; int count = 0; for ( const auto& r : m_requirements ) { + cDebug() << Logger::SubEntry << "requirement" << count << r.name + << "satisfied?" << r.satisfied + << "mandatory?" << r.mandatory; if ( r.mandatory && !r.satisfied ) { - cDebug() << Logger::SubEntry << "requirement" << count << r.name << "is not satisfied."; acceptable = false; } ++count; diff --git a/src/libcalamaresui/CMakeLists.txt b/src/libcalamaresui/CMakeLists.txt index 32fec2cb1..773fdf617 100644 --- a/src/libcalamaresui/CMakeLists.txt +++ b/src/libcalamaresui/CMakeLists.txt @@ -66,8 +66,9 @@ calamares_add_library( calamaresui EXPORT_MACRO UIDLLEXPORT_PRO LINK_LIBRARIES Qt5::Svg + yamlcpp RESOURCES libcalamaresui.qrc - EXPORT CalamaresLibraryDepends + EXPORT Calamares VERSION ${CALAMARES_VERSION_SHORT} ) @@ -82,3 +83,25 @@ endif() if( WITH_QML ) target_link_libraries( calamaresui PUBLIC Qt5::QuickWidgets ) endif() + + +### Installation +# +# +# The library is already installed through calamares_add_library(), +# so we only need to do headers. Unlike the Calamares source tree, +# where libcalamares and libcalamaresui live in different branches, +# we're going to glom it all together in the installed headers location. + +install( + FILES + Branding.h + ViewManager.h + DESTINATION include/libcalamares +) + +# Install each subdir-worth of header files +foreach( subdir modulesystem utils viewpages widgets ) + file( GLOB subdir_headers "${subdir}/*.h" ) + install( FILES ${subdir_headers} DESTINATION include/libcalamares/${subdir} ) +endforeach() diff --git a/src/modules/locale/images/timezone_-1.0.png b/src/modules/locale/images/timezone_-1.0.png index 50ced3980..4fdbd0e3f 100644 Binary files a/src/modules/locale/images/timezone_-1.0.png and b/src/modules/locale/images/timezone_-1.0.png differ diff --git a/src/modules/locale/images/timezone_-10.0.png b/src/modules/locale/images/timezone_-10.0.png index 2a04bf251..5feb49e2b 100644 Binary files a/src/modules/locale/images/timezone_-10.0.png and b/src/modules/locale/images/timezone_-10.0.png differ diff --git a/src/modules/locale/images/timezone_-7.0.png b/src/modules/locale/images/timezone_-7.0.png index a4a12b9ae..c3f98ecbc 100644 Binary files a/src/modules/locale/images/timezone_-7.0.png and b/src/modules/locale/images/timezone_-7.0.png differ diff --git a/src/modules/locale/images/timezone_0.0.png b/src/modules/locale/images/timezone_0.0.png index 02a4c8f8b..f098b9c67 100644 Binary files a/src/modules/locale/images/timezone_0.0.png and b/src/modules/locale/images/timezone_0.0.png differ diff --git a/src/modules/locale/images/timezone_10.0.png b/src/modules/locale/images/timezone_10.0.png index fab3dadac..9304fa4ad 100644 Binary files a/src/modules/locale/images/timezone_10.0.png and b/src/modules/locale/images/timezone_10.0.png differ diff --git a/src/modules/locale/images/timezone_11.0.png b/src/modules/locale/images/timezone_11.0.png index 71e62ee0c..b5395bad1 100644 Binary files a/src/modules/locale/images/timezone_11.0.png and b/src/modules/locale/images/timezone_11.0.png differ diff --git a/src/modules/locale/images/timezone_11.5.png b/src/modules/locale/images/timezone_11.5.png deleted file mode 100644 index 442cabfeb..000000000 Binary files a/src/modules/locale/images/timezone_11.5.png and /dev/null differ diff --git a/src/modules/locale/images/timezone_12.0.png b/src/modules/locale/images/timezone_12.0.png index 9d4b458e7..049026760 100644 Binary files a/src/modules/locale/images/timezone_12.0.png and b/src/modules/locale/images/timezone_12.0.png differ diff --git a/src/modules/locale/images/timezone_2.0.png b/src/modules/locale/images/timezone_2.0.png index fa0bc4818..1bae9510e 100644 Binary files a/src/modules/locale/images/timezone_2.0.png and b/src/modules/locale/images/timezone_2.0.png differ diff --git a/src/modules/locale/locale.qrc b/src/modules/locale/locale.qrc index b6b0d0cf7..713943ae7 100644 --- a/src/modules/locale/locale.qrc +++ b/src/modules/locale/locale.qrc @@ -21,7 +21,6 @@ images/timezone_10.0.png images/timezone_10.5.png images/timezone_11.0.png - images/timezone_11.5.png images/timezone_12.0.png images/timezone_12.75.png images/timezone_13.0.png diff --git a/src/modules/locale/timezonewidget/TimeZoneImage.cpp b/src/modules/locale/timezonewidget/TimeZoneImage.cpp index 52ddc24b1..eec939905 100644 --- a/src/modules/locale/timezonewidget/TimeZoneImage.cpp +++ b/src/modules/locale/timezonewidget/TimeZoneImage.cpp @@ -26,7 +26,7 @@ static const char* zoneNames[] = { "0.0", "1.0", "2.0", "3.0", "3.5", "4.0", "4.5", "5.0", "5.5", "5.75", "6.0", "6.5", "7.0", - "8.0", "9.0", "9.5", "10.0", "10.5", "11.0", "11.5", "12.0", "12.75", "13.0", "-1.0", "-2.0", "-3.0", + "8.0", "9.0", "9.5", "10.0", "10.5", "11.0", "12.0", "12.75", "13.0", "-1.0", "-2.0", "-3.0", "-3.5", "-4.0", "-4.5", "-5.0", "-5.5", "-6.0", "-7.0", "-8.0", "-9.0", "-9.5", "-10.0", "-11.0" }; static_assert( TimeZoneImageList::zoneCount == ( sizeof( zoneNames ) / sizeof( zoneNames[ 0 ] ) ), "Incorrect number of zones" ); @@ -36,7 +36,7 @@ static_assert( TimeZoneImageList::zoneCount == ( sizeof( zoneNames ) / sizeof( z /* static constexpr */ const int TimeZoneImageList::zoneCount; /* static constexpr */ const QSize TimeZoneImageList::imageSize; -static_assert( TimeZoneImageList::zoneCount == 38 ); +static_assert( TimeZoneImageList::zoneCount == 37 ); TimeZoneImageList::TimeZoneImageList() {} diff --git a/src/modules/locale/timezonewidget/TimeZoneImage.h b/src/modules/locale/timezonewidget/TimeZoneImage.h index 0a3aea145..ee02bfbfd 100644 --- a/src/modules/locale/timezonewidget/TimeZoneImage.h +++ b/src/modules/locale/timezonewidget/TimeZoneImage.h @@ -77,7 +77,7 @@ public: QImage find( QPoint p ) const; /// @brief The **expected** number of zones in the list. - static constexpr const int zoneCount = 38; + static constexpr const int zoneCount = 37; /// @brief The expected size of each zone image. static constexpr const QSize imageSize = QSize( 780, 340 ); }; diff --git a/src/modules/mount/main.py b/src/modules/mount/main.py index b10c5c0bf..4e16b43c3 100644 --- a/src/modules/mount/main.py +++ b/src/modules/mount/main.py @@ -52,8 +52,13 @@ def mount_partition(root_mount_point, partition, partitions): # Ensure that the created directory has the correct SELinux context on # SELinux-enabled systems. os.makedirs(mount_point, exist_ok=True) - subprocess.call(['chcon', '--reference=' + raw_mount_point, - mount_point]) + try: + subprocess.call(['chcon', '--reference=' + raw_mount_point, mount_point]) + except FileNotFoundError as e: + libcalamares.utils.warning(str(e)) + except OSError: + libcalamares.utils.error("Cannot run 'chcon' normally.") + raise fstype = partition.get("fs", "").lower() diff --git a/src/modules/netinstall/CMakeLists.txt b/src/modules/netinstall/CMakeLists.txt index 3e6ac3cb5..762e92985 100644 --- a/src/modules/netinstall/CMakeLists.txt +++ b/src/modules/netinstall/CMakeLists.txt @@ -26,5 +26,6 @@ calamares_add_test( PackageModel.cpp LIBRARIES Qt5::Gui + yamlcpp ) diff --git a/src/modules/packages/main.py b/src/modules/packages/main.py index 8f58cd6fb..3e29d72e1 100644 --- a/src/modules/packages/main.py +++ b/src/modules/packages/main.py @@ -274,6 +274,20 @@ class PMApt(PackageManager): # Doesn't need to update the system explicitly pass +class PMXbps(PackageManager): + backend = "xbps" + + def install(self, pkgs, from_local=False): + check_target_env_call(["xbps-install", "-Sy"] + pkgs) + + def remove(self, pkgs): + check_target_env_call(["xbps-remove", "-Ry", "--noconfirm"] + pkgs) + + def update_db(self): + check_target_env_call(["xbps-install", "-S"]) + + def update_system(self): + check_target_env_call(["xbps", "-Suy"]) class PMPacman(PackageManager): backend = "pacman" diff --git a/src/modules/welcome/Config.cpp b/src/modules/welcome/Config.cpp index c842e2451..2bf418ff1 100644 --- a/src/modules/welcome/Config.cpp +++ b/src/modules/welcome/Config.cpp @@ -32,6 +32,7 @@ Config::Config( QObject* parent ) : QObject( parent ) , m_languages( CalamaresUtils::Locale::availableTranslations() ) + , m_filtermodel( std::make_unique< QSortFilterProxyModel >() ) { initLanguages(); @@ -97,6 +98,18 @@ Config::requirementsModel() const return Calamares::ModuleManager::instance()->requirementsModel(); } +QAbstractItemModel* +Config::unsatisfiedRequirements() const +{ + if ( !m_filtermodel->sourceModel() ) + { + m_filtermodel->setFilterRole( Calamares::RequirementsModel::Roles::Satisfied ); + m_filtermodel->setFilterFixedString( QStringLiteral( "false" ) ); + m_filtermodel->setSourceModel( requirementsModel() ); + } + return m_filtermodel.get(); +} + QString Config::languageIcon() const @@ -336,7 +349,7 @@ setCountry( Config* config, const QString& countryCode, CalamaresUtils::GeoIP::H } static inline void -setGeoIP( Config* c, const QVariantMap& configurationMap ) +setGeoIP( Config* config, const QVariantMap& configurationMap ) { bool ok = false; QVariantMap geoip = CalamaresUtils::getSubMap( configurationMap, "geoip", ok ); @@ -350,12 +363,12 @@ setGeoIP( Config* c, const QVariantMap& configurationMap ) if ( handler->type() != CalamaresUtils::GeoIP::Handler::Type::None ) { auto* future = new FWString(); - QObject::connect( future, &FWString::finished, [config = c, f = future, h = handler]() { - QString countryResult = f->future().result(); + QObject::connect( future, &FWString::finished, [config, future, handler]() { + QString countryResult = future->future().result(); cDebug() << "GeoIP result for welcome=" << countryResult; - ::setCountry( config, countryResult, h ); - f->deleteLater(); - delete h; + ::setCountry( config, countryResult, handler ); + future->deleteLater(); + delete handler; } ); future->setFuture( handler->queryRaw() ); } diff --git a/src/modules/welcome/Config.h b/src/modules/welcome/Config.h index 7fe6fa04e..6d14097c5 100644 --- a/src/modules/welcome/Config.h +++ b/src/modules/welcome/Config.h @@ -23,13 +23,37 @@ #include "modulesystem/RequirementsModel.h" #include +#include #include +#include + class Config : public QObject { Q_OBJECT + /** @brief The languages available in Calamares. + * + * This is a list-model, with names and descriptions for the translations + * available to Calamares. + */ Q_PROPERTY( CalamaresUtils::Locale::LabelModel* languagesModel READ languagesModel CONSTANT FINAL ) + /** @brief The requirements (from modules) and their checked-status + * + * The model grows rows over time as each module is checked and its + * requirements are taken into account. The model **as a whole** + * has properties *satisfiedRequirements* and *satisfiedMandatory* + * to say if all of the requirements held in the model have been + * satisfied. See the model documentation for details. + */ Q_PROPERTY( Calamares::RequirementsModel* requirementsModel READ requirementsModel CONSTANT FINAL ) + /** @brief The requirements (from modules) that are **unsatisfied** + * + * This is the same as requirementsModel(), except filtered so + * that only those requirements that are not satisfied are exposed. + * Note that the type is different, so you should still use the + * requirementsModel() for overall status like *satisfiedMandatory*. + */ + Q_PROPERTY( QAbstractItemModel* unsatisfiedRequirements READ unsatisfiedRequirements CONSTANT FINAL ) Q_PROPERTY( QString languageIcon READ languageIcon CONSTANT FINAL ) @@ -83,6 +107,8 @@ public slots: ///@brief The **global** requirements model, from ModuleManager Calamares::RequirementsModel* requirementsModel() const; + QAbstractItemModel* unsatisfiedRequirements() const; + signals: void countryCodeChanged( QString countryCode ); void localeIndexChanged( int localeIndex ); @@ -99,7 +125,8 @@ signals: private: void initLanguages(); - CalamaresUtils::Locale::LabelModel* m_languages; + CalamaresUtils::Locale::LabelModel* m_languages = nullptr; + std::unique_ptr< QSortFilterProxyModel > m_filtermodel; QString m_languageIcon; QString m_countryCode; diff --git a/src/modules/welcome/welcome.conf b/src/modules/welcome/welcome.conf index d8da60d19..45cb654a2 100644 --- a/src/modules/welcome/welcome.conf +++ b/src/modules/welcome/welcome.conf @@ -67,6 +67,14 @@ requirements: # Also, note the analogous feature in `src/modules/locale/locale.conf`, # which is where you will find complete documentation. # +# For testing, the *style* may be set to `fixed`, any URL that +# returns data (e.g. `http://example.com`) and then *selector* +# sets the data that is actually returned (e.g. "DE" to simulate +# the machine being in Germany). +# +# NOTE: the *selector* must pick the country code from the GeoIP +# data. Timezone, city, or other data will not be recognized. +# geoip: style: "none" url: "https://geoip.kde.org/v1/ubiquity" # extended XML format diff --git a/src/modules/welcomeq/Recommended.qml b/src/modules/welcomeq/Recommended.qml index 636311b11..5a6c1316d 100644 --- a/src/modules/welcomeq/Recommended.qml +++ b/src/modules/welcomeq/Recommended.qml @@ -17,6 +17,8 @@ * along with Calamares. If not, see . */ +/* THIS COMPONENT IS UNUSED -- from the default welcomeq.qml at least */ + import io.calamares.core 1.0 import io.calamares.ui 1.0 diff --git a/src/modules/welcomeq/Requirements.qml b/src/modules/welcomeq/Requirements.qml index e81d0a2e6..e7835d868 100644 --- a/src/modules/welcomeq/Requirements.qml +++ b/src/modules/welcomeq/Requirements.qml @@ -44,8 +44,12 @@ Rectangle { activeFocusOnPress: false wrapMode: Text.WordWrap - text: qsTr("

This computer does not satisfy the minimum requirements for installing %1.
+ property var requirementsText: qsTr("

This computer does not satisfy the minimum requirements for installing %1.
Installation cannot continue.

").arg(Branding.string(Branding.VersionedName)) + property var recommendationsText: qsTr("

This computer does not satisfy some of the recommended requirements for setting up %1.
+ Setup can continue, but some features might be disabled.

").arg(Branding.string(Branding.VersionedName)) + + text: config.requirementsModel.satisfiedMandatory ? recommendationsText : requirementsText } Rectangle { @@ -61,6 +65,7 @@ Rectangle { Item { width: 640 height: 35 + visible: true Column { anchors.centerIn: parent @@ -68,18 +73,22 @@ Rectangle { Rectangle { implicitWidth: 640 implicitHeight: 35 - border.color: mandatory ? "#228b22" : "#ff0000" - color: mandatory ? "#f0fff0" : "#ffc0cb" + // Colors and images based on the two satisfied-bools: + // - if satisfied, then green / ok + // - otherwise if mandatory, then red / stop + // - otherwise, then yellow / warning + border.color: satisfied ? "#228b22" : (mandatory ? "#ff0000" : "#ffa411") + color: satisfied ? "#f0fff0" : (mandatory ? "#ffc0cb" : "#ffefd5") Image { anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right anchors.margins: 20 - source: mandatory ? "qrc:/data/images/yes.svgz" : "qrc:/data/images/no.svgz" + source: satisfied ? "qrc:/data/images/yes.svgz" : (mandatory ? "qrc:/data/images/no.svgz" : "qrc:/data/images/information.svgz") } Text { - text: mandatory ? details : negatedText + text: satisfied ? details : negatedText anchors.centerIn: parent font.pointSize: 11 } @@ -89,9 +98,13 @@ Rectangle { } ListView { + id: requirementsList anchors.fill: parent spacing: 5 - model: config.requirementsModel + // This uses the filtered model, so that only unsatisfied + // requirements are ever shown. You could use *requirementsModel* + // to get all of them. + model: config.unsatisfiedRequirements delegate: requirementsDelegate } } diff --git a/src/modules/welcomeq/welcomeq.conf b/src/modules/welcomeq/welcomeq.conf index 2553e157a..32be7fcb5 100644 --- a/src/modules/welcomeq/welcomeq.conf +++ b/src/modules/welcomeq/welcomeq.conf @@ -1,52 +1,24 @@ -# Configuration for the welcome module. The welcome page -# displays some information from the branding file. -# Which parts it displays can be configured through -# the show* variables. +# Configuration for the welcomeq module. # -# In addition to displaying the welcome page, this module -# can check requirements for installation. +# The configuration for welcomeq is exactly the same +# as the welcome module, with the one exception of +# *qmlSearch* which governs QML loading. +# +# No documentation is given here: look in the welcome module. --- -# Setting for QML loading +# Setting for QML loading: use QRC, branding, or both sources of files qmlSearch: both -# Display settings for various buttons on the welcome page. -# The URLs themselves come from branding.desc is the setting -# here is "true". If the setting is false, the button is hidden. -# The setting can also be a full URL which will then be used -# instead of the one from the branding file, or empty or not-set -# which will hide the button. + +# Everythin below here is documented in `welcome.conf` showSupportUrl: true showKnownIssuesUrl: true showReleaseNotesUrl: true - -# If this Url is set to something non-empty, a "donate" -# button is added to the welcome page alongside the -# others (see settings, above). Clicking the button opens -# the corresponding link. (This button has no corresponding -# branding.desc string) -# # showDonateUrl: https://kde.org/community/donations/ -# Requirements checking. These are general, generic, things -# that are checked. They may not match with the actual requirements -# imposed by other modules in the system. requirements: - # Amount of available disk, in GiB. Floating-point is allowed here. - # Note that this does not account for *usable* disk, so it is possible - # to pass this requirement, yet have no space to install to. requiredStorage: 5.5 - - # Amount of available RAM, in GiB. Floating-point is allowed here. requiredRam: 1.0 - - # To check for internet connectivity, Calamares does a HTTP GET - # on this URL; on success (e.g. HTTP code 200) internet is OK. internetCheckUrl: http://google.com - - # List conditions to check. Each listed condition will be - # probed in some way, and yields true or false according to - # the host system satisfying the condition. - # - # This sample file lists all the conditions that are known. check: - storage - ram @@ -54,11 +26,10 @@ requirements: - internet - root - screen - # List conditions that **must** be satisfied (from the list - # of conditions, above) for installation to proceed. - # If any of these conditions are not met, the user cannot - # continue past the welcome page. required: - # - storage - ram - # - root + +geoip: + style: "none" + url: "https://geoip.kde.org/v1/ubiquity" # extended XML format + selector: "CountryCode" # blank uses default, which is wrong diff --git a/src/modules/welcomeq/welcomeq.qml b/src/modules/welcomeq/welcomeq.qml index b92ff9628..ffa480f4a 100644 --- a/src/modules/welcomeq/welcomeq.qml +++ b/src/modules/welcomeq/welcomeq.qml @@ -56,12 +56,8 @@ Page fillMode: Image.PreserveAspectFit } - Recommended { - visible: !config.requirementsModel.satisfiedRequirements - } - Requirements { - visible: !config.requirementsModel.satisfiedMandatory + visible: !config.requirementsModel.satisfiedRequirements } RowLayout {