Merge branch 'calamares' of https://github.com/calamares/calamares into development

This commit is contained in:
Philip Mueller 2024-12-23 08:37:05 +07:00
commit abf3bdb69d
15 changed files with 116 additions and 104 deletions

View File

@ -239,6 +239,9 @@ list(APPEND CMAKE_AUTOMOC_MACRO_NAMES
"K_EXPORT_PLASMA_DATAENGINE_WITH_JSON" "K_EXPORT_PLASMA_DATAENGINE_WITH_JSON"
"K_EXPORT_PLASMA_RUNNER" "K_EXPORT_PLASMA_RUNNER"
) )
if(POLICY CMP0171)
cmake_policy(SET CMP0177 NEW)
endif()
# CMake Modules # CMake Modules
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)

View File

@ -26,10 +26,8 @@ namespace CalamaresPython
boost::python::object boost::python::object
variantToPyObject( const QVariant& variant ) variantToPyObject( const QVariant& variant )
{ {
#ifdef __clang__ QT_WARNING_PUSH
#pragma clang diagnostic push QT_WARNING_DISABLE_CLANG( "-Wswitch-enum" )
#pragma clang diagnostic ignored "-Wswitch-enum"
#endif
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) #if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
const auto IntVariantType = QVariant::Int; const auto IntVariantType = QVariant::Int;
@ -82,9 +80,7 @@ variantToPyObject( const QVariant& variant )
default: default:
return bp::object(); return bp::object();
} }
#ifdef __clang__ QT_WARNING_POP
#pragma clang diagnostic pop
#endif
} }
QVariant QVariant

View File

@ -28,10 +28,8 @@ static const char* s_preScript = nullptr;
namespace bp = boost::python; namespace bp = boost::python;
#ifdef __clang__ QT_WARNING_PUSH
#pragma clang diagnostic push QT_WARNING_DISABLE_CLANG( "-Wdisabled-macro-expansion" )
#pragma clang diagnostic ignored "-Wdisabled-macro-expansion"
#endif
BOOST_PYTHON_FUNCTION_OVERLOADS( mount_overloads, CalamaresPython::mount, 2, 4 ); BOOST_PYTHON_FUNCTION_OVERLOADS( mount_overloads, CalamaresPython::mount, 2, 4 );
BOOST_PYTHON_FUNCTION_OVERLOADS( target_env_call_str_overloads, CalamaresPython::target_env_call, 1, 3 ); BOOST_PYTHON_FUNCTION_OVERLOADS( target_env_call_str_overloads, CalamaresPython::target_env_call, 1, 3 );
@ -52,9 +50,7 @@ BOOST_PYTHON_FUNCTION_OVERLOADS( target_env_process_output_overloads,
4 ); 4 );
BOOST_PYTHON_FUNCTION_OVERLOADS( host_env_process_output_overloads, CalamaresPython::host_env_process_output, 1, 4 ); BOOST_PYTHON_FUNCTION_OVERLOADS( host_env_process_output_overloads, CalamaresPython::host_env_process_output, 1, 4 );
#ifdef __clang__ QT_WARNING_POP
#pragma clang diagnostic pop
#endif
BOOST_PYTHON_MODULE( libcalamares ) BOOST_PYTHON_MODULE( libcalamares )
{ {

View File

@ -20,7 +20,7 @@ struct ParseResult
QString errorMessage; QString errorMessage;
int errorLine = -1; int errorLine = -1;
int errorColumn = -1; int errorColumn = -1;
} };
[[nodiscard]] inline ParseResult [[nodiscard]] inline ParseResult
setXmlContent( QDomDocument& doc, const QByteArray& ba ) setXmlContent( QDomDocument& doc, const QByteArray& ba )

View File

@ -16,18 +16,18 @@
#ifndef PARTITION_KPMHELPER_H #ifndef PARTITION_KPMHELPER_H
#define PARTITION_KPMHELPER_H #define PARTITION_KPMHELPER_H
#include <qglobal.h>
// The kpmcore headers are not C++17 warning-proof, especially // The kpmcore headers are not C++17 warning-proof, especially
// with picky compilers like Clang 10. Since we use Clang for the // with picky compilers like Clang 10. Since we use Clang for the
// find-all-the-warnings case, switch those warnings off for // find-all-the-warnings case, switch those warnings off for
// the we-can't-change-them system headers. // the we-can't-change-them system headers.
#ifdef __clang__ QT_WARNING_PUSH
#pragma clang diagnostic push QT_WARNING_DISABLE_CLANG( "-Wdocumentation" )
#pragma clang diagnostic ignored "-Wdocumentation" QT_WARNING_DISABLE_CLANG( "-Wsuggest-destructor-override" )
#pragma clang diagnostic ignored "-Wsuggest-destructor-override" QT_WARNING_DISABLE_CLANG( "-Winconsistent-missing-destructor-override" )
#pragma clang diagnostic ignored "-Winconsistent-missing-destructor-override"
// Because of __lastType // Because of __lastType
#pragma clang diagnostic ignored "-Wreserved-identifier" QT_WARNING_DISABLE_CLANG( "-Wreserved-identifier" )
#endif
#include <backend/corebackend.h> #include <backend/corebackend.h>
#include <core/device.h> #include <core/device.h>
@ -38,8 +38,6 @@
#include <fs/filesystem.h> #include <fs/filesystem.h>
#include <fs/filesystemfactory.h> #include <fs/filesystemfactory.h>
#ifdef __clang__ QT_WARNING_POP
#pragma clang diagnostic pop
#endif
#endif #endif

View File

@ -43,10 +43,8 @@ Calamares::Python::Dictionary variantHashToPyDict( const QVariantHash& variantHa
py::object py::object
variantToPyObject( const QVariant& variant ) variantToPyObject( const QVariant& variant )
{ {
#ifdef __clang__ QT_WARNING_PUSH
#pragma clang diagnostic push QT_WARNING_DISABLE_CLANG( "-Wswitch-enum" )
#pragma clang diagnostic ignored "-Wswitch-enum"
#endif
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) #if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
const auto IntVariantType = QVariant::Int; const auto IntVariantType = QVariant::Int;
@ -99,9 +97,7 @@ variantToPyObject( const QVariant& variant )
default: default:
return py::none(); return py::none();
} }
#ifdef __clang__ QT_WARNING_POP
#pragma clang diagnostic pop
#endif
} }
Calamares::Python::List Calamares::Python::List

View File

@ -14,20 +14,18 @@
#include <string> #include <string>
#ifdef __clang__ QT_WARNING_PUSH
#pragma clang diagnostic push QT_WARNING_DISABLE_CLANG( "-Wcovered-switch-default" )
#pragma clang diagnostic ignored "-Wcovered-switch-default" QT_WARNING_DISABLE_CLANG( "-Wfloat-equal" )
#pragma clang diagnostic ignored "-Wfloat-equal" QT_WARNING_DISABLE_CLANG( "-Wweak-vtables" )
#pragma clang diagnostic ignored "-Wweak-vtables" QT_WARNING_DISABLE_CLANG( "-Wmissing-variable-declarations" )
#pragma clang diagnostic ignored "-Wmissing-variable-declarations" QT_WARNING_DISABLE_CLANG( "-Wold-style-cast" )
#pragma clang diagnostic ignored "-Wold-style-cast" QT_WARNING_DISABLE_CLANG( "-Wshadow-uncaptured-local" )
#pragma clang diagnostic ignored "-Wshadow-uncaptured-local" QT_WARNING_DISABLE_CLANG( "-Wshadow-field-in-constructor" )
#pragma clang diagnostic ignored "-Wshadow-field-in-constructor" QT_WARNING_DISABLE_CLANG( "-Wshadow-field" )
#pragma clang diagnostic ignored "-Wshadow-field" QT_WARNING_DISABLE_CLANG( "-Wdocumentation" )
#pragma clang diagnostic ignored "-Wdocumentation" QT_WARNING_DISABLE_CLANG( "-Wmissing-noreturn" )
#pragma clang diagnostic ignored "-Wmissing-noreturn" QT_WARNING_DISABLE_CLANG( "-Wreserved-identifier" )
#pragma clang diagnostic ignored "-Wreserved-identifier"
#endif
#undef slots #undef slots
#include <pybind11/pybind11.h> #include <pybind11/pybind11.h>
@ -35,6 +33,8 @@
#include <pybind11/embed.h> #include <pybind11/embed.h>
#include <pybind11/eval.h> #include <pybind11/eval.h>
QT_WARNING_POP
namespace Calamares namespace Calamares
{ {
namespace Python __attribute__( ( visibility( "hidden" ) ) ) namespace Python __attribute__( ( visibility( "hidden" ) ) )
@ -54,8 +54,5 @@ namespace Python __attribute__( ( visibility( "hidden" ) ) )
} // namespace Python } // namespace Python
} // namespace Calamares } // namespace Calamares
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif #endif

View File

@ -5,7 +5,6 @@
* *
* Calamares is Free Software: see the License-Identifier above. * Calamares is Free Software: see the License-Identifier above.
* *
*
*/ */
/* /*
@ -20,36 +19,36 @@
#ifndef UTILS_BOOSTPYTHON_H #ifndef UTILS_BOOSTPYTHON_H
#define UTILS_BOOSTPYTHON_H #define UTILS_BOOSTPYTHON_H
#ifdef __clang__ #include <qglobal.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wreserved-id-macro" QT_WARNING_PUSH
#pragma clang diagnostic ignored "-Wold-style-cast" QT_WARNING_DISABLE_CLANG( "-Wreserved-id-macro" )
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" QT_WARNING_DISABLE_CLANG( "-Wold-style-cast" )
#pragma clang diagnostic ignored "-Wextra-semi-stmt" QT_WARNING_DISABLE_CLANG( "-Wzero-as-null-pointer-constant" )
#pragma clang diagnostic ignored "-Wall" QT_WARNING_DISABLE_CLANG( "-Wextra-semi-stmt" )
#pragma clang diagnostic ignored "-Wimplicit-float-conversion" QT_WARNING_DISABLE_CLANG( "-Wall" )
#pragma clang diagnostic ignored "-Wundef" QT_WARNING_DISABLE_CLANG( "-Wimplicit-float-conversion" )
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec" QT_WARNING_DISABLE_CLANG( "-Wundef" )
#pragma clang diagnostic ignored "-Wshadow-field-in-constructor" QT_WARNING_DISABLE_CLANG( "-Wdeprecated-dynamic-exception-spec" )
#pragma clang diagnostic ignored "-Wshadow" QT_WARNING_DISABLE_CLANG( "-Wshadow-field-in-constructor" )
#pragma clang diagnostic ignored "-Wmissing-noreturn" QT_WARNING_DISABLE_CLANG( "-Wshadow" )
#pragma clang diagnostic ignored "-Wcast-qual" QT_WARNING_DISABLE_CLANG( "-Wmissing-noreturn" )
#pragma clang diagnostic ignored "-Wcast-align" QT_WARNING_DISABLE_CLANG( "-Wcast-qual" )
#pragma clang diagnostic ignored "-Wsign-conversion" QT_WARNING_DISABLE_CLANG( "-Wcast-align" )
#pragma clang diagnostic ignored "-Wdouble-promotion" QT_WARNING_DISABLE_CLANG( "-Wsign-conversion" )
#pragma clang diagnostic ignored "-Wredundant-parens" QT_WARNING_DISABLE_CLANG( "-Wdouble-promotion" )
#pragma clang diagnostic ignored "-Wweak-vtables" QT_WARNING_DISABLE_CLANG( "-Wredundant-parens" )
#pragma clang diagnostic ignored "-Wdeprecated" QT_WARNING_DISABLE_CLANG( "-Wweak-vtables" )
#pragma clang diagnostic ignored "-Wmissing-field-initializers" QT_WARNING_DISABLE_CLANG( "-Wdeprecated" )
#pragma clang diagnostic ignored "-Wdisabled-macro-expansion" QT_WARNING_DISABLE_CLANG( "-Wmissing-field-initializers" )
#pragma clang diagnostic ignored "-Wdocumentation" QT_WARNING_DISABLE_CLANG( "-Wdisabled-macro-expansion" )
#pragma clang diagnostic ignored "-Wcomma" QT_WARNING_DISABLE_CLANG( "-Wdocumentation" )
#pragma clang diagnostic ignored "-Wunused-parameter" QT_WARNING_DISABLE_CLANG( "-Wcomma" )
#pragma clang diagnostic ignored "-Wunused-template" QT_WARNING_DISABLE_CLANG( "-Wunused-parameter" )
QT_WARNING_DISABLE_CLANG( "-Wunused-template" )
// Actually for Python headers // Actually for Python headers
#pragma clang diagnostic ignored "-Wreserved-id-macro" QT_WARNING_DISABLE_CLANG( "-Wreserved-id-macro" )
#endif
#undef slots #undef slots
#include <boost/python.hpp> #include <boost/python.hpp>
@ -58,8 +57,6 @@
#include <boost/python/list.hpp> #include <boost/python/list.hpp>
#include <boost/python/object.hpp> #include <boost/python/object.hpp>
#ifdef __clang__ QT_WARNING_POP
#pragma clang diagnostic pop
#endif
#endif #endif

View File

@ -4,11 +4,8 @@
* SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot <groot@kde.org> * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* *
*
* Calamares is Free Software: see the License-Identifier above. * Calamares is Free Software: see the License-Identifier above.
* *
*
*
*/ */
/* /*
@ -35,19 +32,15 @@ class QFileInfo;
// with picky compilers like Clang 8. Since we use Clang for the // with picky compilers like Clang 8. Since we use Clang for the
// find-all-the-warnings case, switch those warnings off for // find-all-the-warnings case, switch those warnings off for
// the we-can't-change-them system headers. // the we-can't-change-them system headers.
#ifdef __clang__ QT_WARNING_PUSH
#pragma clang diagnostic push QT_WARNING_DISABLE_CLANG( "-Wzero-as-null-pointer-constant" )
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" QT_WARNING_DISABLE_CLANG( "-Wshadow" )
#pragma clang diagnostic ignored "-Wshadow" QT_WARNING_DISABLE_CLANG( "-Wfloat-equal" )
#pragma clang diagnostic ignored "-Wfloat-equal" QT_WARNING_DISABLE_CLANG( "-Wsuggest-destructor-override" )
#pragma clang diagnostic ignored "-Wsuggest-destructor-override"
#endif
#include <yaml-cpp/yaml.h> #include <yaml-cpp/yaml.h>
#ifdef __clang__ QT_WARNING_POP
#pragma clang diagnostic pop
#endif
/// @brief Appends all the elements of @p node to the string list @p v /// @brief Appends all the elements of @p node to the string list @p v
DLLEXPORT void operator>>( const ::YAML::Node& node, QStringList& v ); DLLEXPORT void operator>>( const ::YAML::Node& node, QStringList& v );

View File

@ -22,11 +22,14 @@
* automoc does all the work for us. * automoc does all the work for us.
*/ */
#ifdef __clang__ #ifdef __clang__
#pragma clang diagnostic ignored "-Wextra-semi-stmt" #include <qglobal.h>
#pragma clang diagnostic ignored "-Wredundant-parens" QT_WARNING_PUSH
#pragma clang diagnostic ignored "-Wreserved-identifier" QT_WARNING_DISABLE_CLANG( "-Wextra-semi-stmt" )
QT_WARNING_DISABLE_CLANG( "-Wredundant-parens" )
QT_WARNING_DISABLE_CLANG( "-Wreserved-identifier" )
#if __clang_major__ >= 17 #if __clang_major__ >= 17
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage" QT_WARNING_DISABLE_CLANG( "-Wunsafe-buffer-usage" )
#endif #endif
QT_WARNING_POP
#endif #endif

View File

@ -586,8 +586,21 @@ ChoicePage::applyActionChoice( InstallChoice choice )
&ChoicePage::doAlongsideSetupSplitter, &ChoicePage::doAlongsideSetupSplitter,
Qt::UniqueConnection ); Qt::UniqueConnection );
break; break;
case InstallChoice::NoChoice:
case InstallChoice::Manual: case InstallChoice::Manual:
if ( m_core->isDirty() )
{
ScanningDialog::run(
QtConcurrent::run(
[ = ]
{
QMutexLocker locker( &m_coreMutex );
m_core->revertDevice( selectedDevice() );
} ),
[] {},
this );
}
break;
case InstallChoice::NoChoice:
break; break;
} }
updateNextEnabled(); updateNextEnabled();

View File

@ -13,7 +13,7 @@ if(WITH_QT6)
set(_plasma_libraries "Plasma::Plasma") set(_plasma_libraries "Plasma::Plasma")
set(_plasma_name "Plasma") set(_plasma_name "Plasma")
find_package(${kfname} ${KF_VERSION} QUIET COMPONENTS Config Package) find_package(${kfname} ${KF_VERSION} QUIET COMPONENTS Config Package)
find_package(Plasma ${PLASMA_VERSION}) find_package(Plasma ${PLASMA_VERSION} QUIET)
else() else()
set(_plasma_libraries "${kfname}::Plasma") set(_plasma_libraries "${kfname}::Plasma")
set(_plasma_name "KF5Plasma") set(_plasma_name "KF5Plasma")

View File

@ -48,7 +48,7 @@ class UnpackEntry:
:param destination: :param destination:
""" """
__slots__ = ('source', 'sourcefs', 'destination', 'copied', 'total', 'exclude', 'excludeFile', __slots__ = ('source', 'sourcefs', 'destination', 'copied', 'total', 'exclude', 'excludeFile',
'mountPoint', 'weight', 'condition') 'mountPoint', 'weight', 'condition', 'optional')
def __init__(self, source, sourcefs, destination): def __init__(self, source, sourcefs, destination):
""" """
@ -72,6 +72,7 @@ class UnpackEntry:
self.mountPoint = None self.mountPoint = None
self.weight = 1 self.weight = 1
self.condition = True self.condition = True
self.optional = False
def is_file(self): def is_file(self):
return self.sourcefs == "file" return self.sourcefs == "file"
@ -461,6 +462,7 @@ def run():
for entry in libcalamares.job.configuration["unpack"]: for entry in libcalamares.job.configuration["unpack"]:
source = os.path.abspath(entry["source"]) source = os.path.abspath(entry["source"])
sourcefs = entry["sourcefs"] sourcefs = entry["sourcefs"]
optional = entry.get("optional", False)
if sourcefs not in supported_filesystems: if sourcefs not in supported_filesystems:
libcalamares.utils.warning("The filesystem for \"{}\" ({}) is not supported by your current kernel".format(source, sourcefs)) libcalamares.utils.warning("The filesystem for \"{}\" ({}) is not supported by your current kernel".format(source, sourcefs))
@ -468,9 +470,14 @@ def run():
return (_("Bad unpackfs configuration"), return (_("Bad unpackfs configuration"),
_("The filesystem for \"{}\" ({}) is not supported by your current kernel").format(source, sourcefs)) _("The filesystem for \"{}\" ({}) is not supported by your current kernel").format(source, sourcefs))
if not os.path.exists(source): if not os.path.exists(source):
libcalamares.utils.warning("The source filesystem \"{}\" does not exist".format(source)) if optional:
return (_("Bad unpackfs configuration"), libcalamares.utils.warning("The source filesystem \"{}\" does not exist but is marked as optional, skipping".format(source))
_("The source filesystem \"{}\" does not exist").format(source)) entry["condition"] = False
continue
else:
libcalamares.utils.warning("The source filesystem \"{}\" does not exist".format(source))
return (_("Bad unpackfs configuration"),
_("The source filesystem \"{}\" does not exist").format(source))
if sourcefs == "squashfs": if sourcefs == "squashfs":
if shutil.which("unsquashfs") is None: if shutil.which("unsquashfs") is None:
libcalamares.utils.warning("Failed to find unsquashfs") libcalamares.utils.warning("Failed to find unsquashfs")

View File

@ -102,6 +102,18 @@
# sourcefs: squashfs # sourcefs: squashfs
# destination: "" # destination: ""
# condition: exampleGlobalStorageVariable.subkey # condition: exampleGlobalStorageVariable.subkey
#
# You may also wish to include optional squashfses, which may not exist at certain times
# depending on your image tooling. If an optional squashfs is not found, it is simply
# skipped.
#
# - source: ./example.standard.sqfs
# sourcefs: squashfs
# destination: ""
# - source: ./example.extras.sqfs
# sourcefs: squashfs
# destination: ""
# optional: true
unpack: unpack:
- source: ../CHANGES - source: ../CHANGES

View File

@ -18,6 +18,7 @@ properties:
excludeFile: { type: string } excludeFile: { type: string }
exclude: { type: array, items: { type: string } } exclude: { type: array, items: { type: string } }
weight: { type: integer, exclusiveMinimum: 0 } weight: { type: integer, exclusiveMinimum: 0 }
optional: { type: boolean }
condition: condition:
anyOf: anyOf:
- type: boolean - type: boolean