From f6cb8799298070d28941ad6dd08449db58a0e7f2 Mon Sep 17 00:00:00 2001 From: Anubhav Choudhary Date: Sat, 23 Jan 2021 20:43:55 +0530 Subject: [PATCH 01/93] branding.desc updated --- src/branding/default/branding.desc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/branding/default/branding.desc b/src/branding/default/branding.desc index 5a8dd3f49..cb2418149 100644 --- a/src/branding/default/branding.desc +++ b/src/branding/default/branding.desc @@ -219,3 +219,16 @@ slideshow: "show.qml" slideshowAPI: 2 +# These options are to customize online uploading of logs to pastebins: +# - style : Defines the kind of pastebin service to be used. Takes +# string as input +# - url : Defines the address of pastebin service to be used. +# Takes string as input +# - port : Defines the port number to be used to send logs. Takes +# integer as input +# - enable : Defines if the functionality is to be used or not. Takes +# bool as input +logUpload.style : "fische" +logUpload.url : "termbin.com" +logUpload.port : 9999 +logUpload.enable : true From ff66e4b3d5c38933dee8043c0259622ba8f98e05 Mon Sep 17 00:00:00 2001 From: Anubhav Choudhary Date: Sat, 23 Jan 2021 20:47:33 +0530 Subject: [PATCH 02/93] Redirecting logUpload vars to pasteUtility --- src/libcalamaresui/Branding.cpp | 6 ++++++ src/libcalamaresui/Branding.h | 13 +++++++++++++ src/libcalamaresui/ViewManager.cpp | 7 ++++--- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/libcalamaresui/Branding.cpp b/src/libcalamaresui/Branding.cpp index 8145ad57c..320dccc93 100644 --- a/src/libcalamaresui/Branding.cpp +++ b/src/libcalamaresui/Branding.cpp @@ -86,6 +86,7 @@ const QStringList Branding::s_styleEntryStrings = "sidebarTextSelect", "sidebarTextHighlight" }; + // clang-format on // *INDENT-ON* @@ -510,6 +511,11 @@ Branding::initSimpleSettings( const YAML::Node& doc ) { m_windowHeight = WindowDimension( CalamaresUtils::windowPreferredHeight, WindowDimensionUnit::Pixies ); } + + m_logUploadEnable = doc[ "logUpload.enable" ].as< bool >( false ); + m_logUploadURL = getString( doc, "logUpload.url") ; + m_logUploadPort = doc[ "logUpload.port" ].as< int >(); + m_logUploadStyle= getString(doc, "logUpload.style" ); } void diff --git a/src/libcalamaresui/Branding.h b/src/libcalamaresui/Branding.h index b03df3acd..f5c8fb78e 100644 --- a/src/libcalamaresui/Branding.h +++ b/src/libcalamaresui/Branding.h @@ -42,6 +42,7 @@ public: * e.g. *Branding::ProductName to get the string value for * the product name. */ + enum StringEntry { ProductName, @@ -214,6 +215,13 @@ public: */ void setGlobals( GlobalStorage* globalStorage ) const; + + //Paste functionality related + bool logUploadEnable() { return m_logUploadEnable; }; + QString logUploadURL() { return m_logUploadURL; }; + int logUploadPort() { return m_logUploadPort; }; + QString logUploadStyle() { return m_logUploadStyle; }; + public slots: QString string( StringEntry stringEntry ) const; QString versionedName() const { return string( VersionedName ); } @@ -261,6 +269,11 @@ private: bool m_welcomeStyleCalamares; bool m_welcomeExpandingLogo; + bool m_logUploadEnable; + QString m_logUploadURL; + int m_logUploadPort; + QString m_logUploadStyle; + WindowExpansion m_windowExpansion; WindowDimension m_windowHeight, m_windowWidth; WindowPlacement m_windowPlacement; diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index f43152209..770d79d89 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -140,7 +140,7 @@ ViewManager::insertViewStep( int before, ViewStep* step ) void ViewManager::onInstallationFailed( const QString& message, const QString& details ) { - bool shouldOfferWebPaste = false; // TODO: config var + bool shouldOfferWebPaste = Calamares::Branding::instance()->logUploadEnable(); // TODO: config var cError() << "Installation failed:"; cDebug() << "- message:" << message; @@ -183,8 +183,9 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail connect( msgBox, &QMessageBox::buttonClicked, [msgBox]( QAbstractButton* button ) { if ( msgBox->buttonRole( button ) == QMessageBox::ButtonRole::YesRole ) { - // TODO: host and port should be configurable - QString pasteUrlMsg = CalamaresUtils::sendLogToPastebin( msgBox, QStringLiteral( "termbin.com" ), 9999 ); + QString pasteURLHost = Calamares::Branding::instance()->logUploadURL(); + int pasteURLPort = Calamares::Branding::instance()->logUploadPort(); + QString pasteUrlMsg = CalamaresUtils::sendLogToPastebin( msgBox, pasteURLHost, pasteURLPort ); QString pasteUrlTitle = tr( "Install Log Paste URL" ); if ( pasteUrlMsg.isEmpty() ) From a2c930a714e460900039a54c9fd268fe94dfc39a Mon Sep 17 00:00:00 2001 From: Anubhav Choudhary Date: Sat, 23 Jan 2021 21:16:32 +0530 Subject: [PATCH 03/93] Code-formatted and Copyright-text added --- src/branding/default/branding.desc | 8 +++++--- src/libcalamaresui/Branding.cpp | 5 +++-- src/libcalamaresui/Branding.h | 11 ++++++----- src/libcalamaresui/ViewManager.cpp | 11 ++++------- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/branding/default/branding.desc b/src/branding/default/branding.desc index cb2418149..8325dd17f 100644 --- a/src/branding/default/branding.desc +++ b/src/branding/default/branding.desc @@ -220,15 +220,17 @@ slideshowAPI: 2 # These options are to customize online uploading of logs to pastebins: -# - style : Defines the kind of pastebin service to be used. Takes -# string as input +# - style : Defines the kind of pastebin service to be used. ie it can +# provide the functionality of controlling privacy of +# paste (in future).Currently only "fiche" servers +# are supported. Takes string as input # - url : Defines the address of pastebin service to be used. # Takes string as input # - port : Defines the port number to be used to send logs. Takes # integer as input # - enable : Defines if the functionality is to be used or not. Takes # bool as input -logUpload.style : "fische" +logUpload.style : "fiche" logUpload.url : "termbin.com" logUpload.port : 9999 logUpload.enable : true diff --git a/src/libcalamaresui/Branding.cpp b/src/libcalamaresui/Branding.cpp index 320dccc93..c08fd732e 100644 --- a/src/libcalamaresui/Branding.cpp +++ b/src/libcalamaresui/Branding.cpp @@ -4,6 +4,7 @@ * SPDX-FileCopyrightText: 2017-2019 Adriaan de Groot * SPDX-FileCopyrightText: 2018 Raul Rodrigo Segura (raurodse) * SPDX-FileCopyrightText: 2019 Camilo Higuita + * SPDX-FileCopyrightText: 2021 Anubhav Choudhary * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is Free Software: see the License-Identifier above. @@ -513,9 +514,9 @@ Branding::initSimpleSettings( const YAML::Node& doc ) } m_logUploadEnable = doc[ "logUpload.enable" ].as< bool >( false ); - m_logUploadURL = getString( doc, "logUpload.url") ; + m_logUploadURL = getString( doc, "logUpload.url" ); m_logUploadPort = doc[ "logUpload.port" ].as< int >(); - m_logUploadStyle= getString(doc, "logUpload.style" ); + m_logUploadStyle = getString( doc, "logUpload.style" ); } void diff --git a/src/libcalamaresui/Branding.h b/src/libcalamaresui/Branding.h index f5c8fb78e..d273c81c6 100644 --- a/src/libcalamaresui/Branding.h +++ b/src/libcalamaresui/Branding.h @@ -4,6 +4,7 @@ * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot * SPDX-FileCopyrightText: 2018 Raul Rodrigo Segura (raurodse) * SPDX-FileCopyrightText: 2019 Camilo Higuita + * SPDX-FileCopyrightText: 2021 Anubhav Choudhary * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is Free Software: see the License-Identifier above. @@ -216,11 +217,11 @@ public: void setGlobals( GlobalStorage* globalStorage ) const; - //Paste functionality related - bool logUploadEnable() { return m_logUploadEnable; }; - QString logUploadURL() { return m_logUploadURL; }; - int logUploadPort() { return m_logUploadPort; }; - QString logUploadStyle() { return m_logUploadStyle; }; + //Paste functionality related + bool logUploadEnable() { return m_logUploadEnable; }; + QString logUploadURL() { return m_logUploadURL; }; + int logUploadPort() { return m_logUploadPort; }; + QString logUploadStyle() { return m_logUploadStyle; }; public slots: QString string( StringEntry stringEntry ) const; diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index 770d79d89..5786c44a5 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -4,6 +4,7 @@ * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot * SPDX-FileCopyrightText: 2019 Dominic Hayes * SPDX-FileCopyrightText: 2019 Gabriel Craciunescu + * SPDX-FileCopyrightText: 2021 Anubhav Choudhary * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is Free Software: see the License-Identifier above. @@ -140,7 +141,7 @@ ViewManager::insertViewStep( int before, ViewStep* step ) void ViewManager::onInstallationFailed( const QString& message, const QString& details ) { - bool shouldOfferWebPaste = Calamares::Branding::instance()->logUploadEnable(); // TODO: config var + bool shouldOfferWebPaste = Calamares::Branding::instance()->logUploadEnable(); cError() << "Installation failed:"; cDebug() << "- message:" << message; @@ -531,13 +532,9 @@ ViewManager::updateCancelEnabled( bool enabled ) } void -ViewManager::updateBackAndNextVisibility( bool visible) -{ - UPDATE_BUTTON_PROPERTY( backAndNextVisible, visible ) -} +ViewManager::updateBackAndNextVisibility( bool visible ) { UPDATE_BUTTON_PROPERTY( backAndNextVisible, visible ) } -QVariant -ViewManager::data( const QModelIndex& index, int role ) const +QVariant ViewManager::data( const QModelIndex& index, int role ) const { if ( !index.isValid() ) { From 186c065b4cba56359e0b938208e2ab08834a0806 Mon Sep 17 00:00:00 2001 From: Anubhav Choudhary Date: Sat, 23 Jan 2021 22:49:23 +0530 Subject: [PATCH 04/93] PasteURL sent to clipboard --- src/libcalamaresui/utils/Paste.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libcalamaresui/utils/Paste.cpp b/src/libcalamaresui/utils/Paste.cpp index 8099d9024..a48a7c097 100644 --- a/src/libcalamaresui/utils/Paste.cpp +++ b/src/libcalamaresui/utils/Paste.cpp @@ -15,6 +15,8 @@ #include #include #include +#include +#include namespace CalamaresUtils { @@ -22,7 +24,8 @@ namespace CalamaresUtils QString sendLogToPastebin( QObject* parent, const QString& ficheHost, quint16 fichePort ) { - QString pasteUrlFmt = parent->tr( "Install log posted to:\n%1" ); + QString pasteUrlFmt = parent->tr( "Install log posted to\n\n%1\n\nLink copied to clipboard" ); + QFile pasteSourceFile( Logger::logFile() ); if ( !pasteSourceFile.open( QIODevice::ReadOnly | QIODevice::Text ) ) { @@ -78,6 +81,14 @@ sendLogToPastebin( QObject* parent, const QString& ficheHost, quint16 fichePort QRegularExpression pasteUrlRegex( "^http[s]?://" + ficheHost ); QString pasteUrlMsg = QString( pasteUrlFmt ).arg( pasteUrlStr ); + QClipboard* clipboard = QApplication::clipboard(); + clipboard->setText(pasteUrlStr, QClipboard::Clipboard); + + if (clipboard->supportsSelection()) + { + clipboard->setText(pasteUrlStr, QClipboard::Selection); + } + if ( nBytesRead < 8 || !pasteUrl.isValid() || !pasteUrlRegex.match( pasteUrlStr ).hasMatch() ) { cError() << "No data from paste server"; From b4078f36342638165651a95ad43dae2e98a2017b Mon Sep 17 00:00:00 2001 From: Anubhav Choudhary Date: Mon, 25 Jan 2021 01:09:20 +0530 Subject: [PATCH 05/93] Changed branding keynames + minor fixes --- src/branding/default/branding.desc | 17 +++++++---------- src/libcalamaresui/Branding.cpp | 8 +++----- src/libcalamaresui/Branding.h | 14 ++++++-------- src/libcalamaresui/ViewManager.cpp | 24 ++++++++++++++++++------ src/libcalamaresui/utils/Paste.cpp | 30 ++++++++++++++++++++++-------- src/libcalamaresui/utils/Paste.h | 6 ++++-- 6 files changed, 60 insertions(+), 39 deletions(-) diff --git a/src/branding/default/branding.desc b/src/branding/default/branding.desc index 8325dd17f..92d0bba10 100644 --- a/src/branding/default/branding.desc +++ b/src/branding/default/branding.desc @@ -220,17 +220,14 @@ slideshowAPI: 2 # These options are to customize online uploading of logs to pastebins: -# - style : Defines the kind of pastebin service to be used. ie it can -# provide the functionality of controlling privacy of -# paste (in future).Currently only "fiche" servers -# are supported. Takes string as input +# - type : Defines the kind of pastebin service to be used.Currently +# it accepts two values: +# - none : disables the pastebin functionality +# - fiche : use fiche pastebin server # - url : Defines the address of pastebin service to be used. # Takes string as input # - port : Defines the port number to be used to send logs. Takes # integer as input -# - enable : Defines if the functionality is to be used or not. Takes -# bool as input -logUpload.style : "fiche" -logUpload.url : "termbin.com" -logUpload.port : 9999 -logUpload.enable : true +uploadServer.type : "fiche" +uploadServer.url : "termbin.com" +uploadServer.port : 9999 diff --git a/src/libcalamaresui/Branding.cpp b/src/libcalamaresui/Branding.cpp index c08fd732e..40383c992 100644 --- a/src/libcalamaresui/Branding.cpp +++ b/src/libcalamaresui/Branding.cpp @@ -87,7 +87,6 @@ const QStringList Branding::s_styleEntryStrings = "sidebarTextSelect", "sidebarTextHighlight" }; - // clang-format on // *INDENT-ON* @@ -513,10 +512,9 @@ Branding::initSimpleSettings( const YAML::Node& doc ) m_windowHeight = WindowDimension( CalamaresUtils::windowPreferredHeight, WindowDimensionUnit::Pixies ); } - m_logUploadEnable = doc[ "logUpload.enable" ].as< bool >( false ); - m_logUploadURL = getString( doc, "logUpload.url" ); - m_logUploadPort = doc[ "logUpload.port" ].as< int >(); - m_logUploadStyle = getString( doc, "logUpload.style" ); + m_uploadServerURL = getString( doc, "uploadServer.url" ); + m_uploadServerPort = doc[ "uploadServer.port" ].as< int >(); + m_uploadServerType = getString( doc, "uploadServer.type" ); } void diff --git a/src/libcalamaresui/Branding.h b/src/libcalamaresui/Branding.h index d273c81c6..493579a34 100644 --- a/src/libcalamaresui/Branding.h +++ b/src/libcalamaresui/Branding.h @@ -218,10 +218,9 @@ public: //Paste functionality related - bool logUploadEnable() { return m_logUploadEnable; }; - QString logUploadURL() { return m_logUploadURL; }; - int logUploadPort() { return m_logUploadPort; }; - QString logUploadStyle() { return m_logUploadStyle; }; + QString uploadServerType() { return m_uploadServerType; }; + QString uploadServerURL() { return m_uploadServerURL; }; + int uploadServerPort() { return m_uploadServerPort; }; public slots: QString string( StringEntry stringEntry ) const; @@ -270,10 +269,9 @@ private: bool m_welcomeStyleCalamares; bool m_welcomeExpandingLogo; - bool m_logUploadEnable; - QString m_logUploadURL; - int m_logUploadPort; - QString m_logUploadStyle; + QString m_uploadServerType; + QString m_uploadServerURL; + int m_uploadServerPort; WindowExpansion m_windowExpansion; WindowDimension m_windowHeight, m_windowWidth; diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index 5786c44a5..ae2460c37 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -141,7 +141,8 @@ ViewManager::insertViewStep( int before, ViewStep* step ) void ViewManager::onInstallationFailed( const QString& message, const QString& details ) { - bool shouldOfferWebPaste = Calamares::Branding::instance()->logUploadEnable(); + QString UploadServerType = Calamares::Branding::instance()->uploadServerType(); + bool shouldOfferWebPaste = CalamaresUtils::UploadServersList.contains( UploadServerType ); cError() << "Installation failed:"; cDebug() << "- message:" << message; @@ -184,9 +185,16 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail connect( msgBox, &QMessageBox::buttonClicked, [msgBox]( QAbstractButton* button ) { if ( msgBox->buttonRole( button ) == QMessageBox::ButtonRole::YesRole ) { - QString pasteURLHost = Calamares::Branding::instance()->logUploadURL(); - int pasteURLPort = Calamares::Branding::instance()->logUploadPort(); - QString pasteUrlMsg = CalamaresUtils::sendLogToPastebin( msgBox, pasteURLHost, pasteURLPort ); + QString pasteUrlMsg; + QString UploadServerType = Calamares::Branding::instance()->uploadServerType(); + if ( UploadServerType == "fiche" ) + { + pasteUrlMsg = CalamaresUtils::sendLogToPastebin( msgBox ); + } + else + { + pasteUrlMsg = QString(); + } QString pasteUrlTitle = tr( "Install Log Paste URL" ); if ( pasteUrlMsg.isEmpty() ) @@ -532,9 +540,13 @@ ViewManager::updateCancelEnabled( bool enabled ) } void -ViewManager::updateBackAndNextVisibility( bool visible ) { UPDATE_BUTTON_PROPERTY( backAndNextVisible, visible ) } +ViewManager::updateBackAndNextVisibility( bool visible ) +{ + UPDATE_BUTTON_PROPERTY( backAndNextVisible, visible ) +} -QVariant ViewManager::data( const QModelIndex& index, int role ) const +QVariant +ViewManager::data( const QModelIndex& index, int role ) const { if ( !index.isValid() ) { diff --git a/src/libcalamaresui/utils/Paste.cpp b/src/libcalamaresui/utils/Paste.cpp index a48a7c097..269876017 100644 --- a/src/libcalamaresui/utils/Paste.cpp +++ b/src/libcalamaresui/utils/Paste.cpp @@ -9,6 +9,7 @@ #include "Paste.h" +#include "Branding.h" #include "utils/Logger.h" #include @@ -17,13 +18,24 @@ #include #include #include +#include namespace CalamaresUtils { +QStringList UploadServersList = { + "fiche" + // In future more serverTypes can be added as Calamares support them + // "none" serverType is explicitly not mentioned here +}; + QString -sendLogToPastebin( QObject* parent, const QString& ficheHost, quint16 fichePort ) +sendLogToPastebin( QObject* parent ) { + + const QString& ficheHost = Calamares::Branding::instance()->uploadServerURL(); + quint16 fichePort = Calamares::Branding::instance()->uploadServerPort(); + QString pasteUrlFmt = parent->tr( "Install log posted to\n\n%1\n\nLink copied to clipboard" ); QFile pasteSourceFile( Logger::logFile() ); @@ -81,15 +93,17 @@ sendLogToPastebin( QObject* parent, const QString& ficheHost, quint16 fichePort QRegularExpression pasteUrlRegex( "^http[s]?://" + ficheHost ); QString pasteUrlMsg = QString( pasteUrlFmt ).arg( pasteUrlStr ); - QClipboard* clipboard = QApplication::clipboard(); - clipboard->setText(pasteUrlStr, QClipboard::Clipboard); - - if (clipboard->supportsSelection()) + if ( nBytesRead >= 8 && pasteUrl.isValid() && pasteUrlRegex.match( pasteUrlStr ).hasMatch() ) { - clipboard->setText(pasteUrlStr, QClipboard::Selection); - } + QClipboard* clipboard = QApplication::clipboard(); + clipboard->setText(pasteUrlStr, QClipboard::Clipboard); - if ( nBytesRead < 8 || !pasteUrl.isValid() || !pasteUrlRegex.match( pasteUrlStr ).hasMatch() ) + if (clipboard->supportsSelection()) + { + clipboard->setText(pasteUrlStr, QClipboard::Selection); + } + } + else { cError() << "No data from paste server"; return QString(); diff --git a/src/libcalamaresui/utils/Paste.h b/src/libcalamaresui/utils/Paste.h index f802dfe2e..69adfa99c 100644 --- a/src/libcalamaresui/utils/Paste.h +++ b/src/libcalamaresui/utils/Paste.h @@ -10,7 +10,7 @@ #ifndef UTILS_PASTE_H #define UTILS_PASTE_H -#include // for quint16 +#include class QObject; class QString; @@ -22,7 +22,9 @@ namespace CalamaresUtils * * Returns the (string) URL that the pastebin gives us. */ -QString sendLogToPastebin( QObject* parent, const QString& ficheHost, quint16 fichePort ); +QString sendLogToPastebin( QObject* parent ); + +extern QStringList UploadServersList; } // namespace CalamaresUtils From 13181a52ee1931a0e21cb7c546d53249d6429891 Mon Sep 17 00:00:00 2001 From: benne-dee <78043691+benne-dee@users.noreply.github.com> Date: Wed, 27 Jan 2021 22:38:40 +0530 Subject: [PATCH 06/93] Define schema for groups in netinstall.schema.yaml --- src/modules/netinstall/netinstall.schema.yaml | 60 ++++++++++++++++++- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/src/modules/netinstall/netinstall.schema.yaml b/src/modules/netinstall/netinstall.schema.yaml index a66c877d1..61ab1c8f4 100644 --- a/src/modules/netinstall/netinstall.schema.yaml +++ b/src/modules/netinstall/netinstall.schema.yaml @@ -1,8 +1,64 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: GPL-3.0-or-later --- -$schema: https://json-schema.org/schema# +$schema: http://json-schema.org/draft-07/schema# $id: https://calamares.io/schemas/netinstall +definitions: + package: + $id: '#definitions/package' + oneOf: + - + type: string + description: bare package - actual package name as passed to the package manager + (e.g. `qt5-creator-dev`). + - + type: object + description: rich package - one with a package-name (for the package-manager) and + a description (for the human). + properties: + name: { type: string } + description: { type: string } + group: + $id: '#definitions/group' + type: object + description: Longer discussion in `netinstall.conf` file under 'Groups Format' + properties: + name: { type: string } + description: { type: string } + packages: + type: array + items: { $ref: '#definitions/package' } + hidden: { type: boolean, default: false } + selected: { type: boolean } + critical: { type: boolean, default: false } + immutable: { type: boolean } + expanded: { type: boolean } + subgroups: + type: array + items: { $ref: '#definitions/group' } + pre-install: + type: string + description: an optional command to run within the new system before the group's + packages are installed. It will run before **each** package in the group + is installed. + post-install: + type: string + description: an optional command to run within the new system after the group's + packages are installed. It will run after **each** package in the group + is installed. + required: [name, description] # Always required, at any level in the subgroups hirearchy + if: + properties: + subgroups: + maxItems: 0 + then: + required: [name, description, packages] # bottom-most (sub)group requires some package (otherwise, why bother?) + # This should validate `netinstall.yaml` also. + groups: + $id: '#definitions/groups' + type: array + items: { $ref: '#definitions/group' } + additionalProperties: false type: object properties: @@ -14,5 +70,5 @@ properties: properties: sidebar: { type: string } title: { type: string } - groups: { type: array } # TODO: the schema for the whole groups file + groups: { $ref: '#definitions/groups' } # DONE: the schema for groups required: [ groupsUrl ] From f8385d2cb8912f9cdcf5cdebd52a002535a7016a Mon Sep 17 00:00:00 2001 From: benne-dee <78043691+benne-dee@users.noreply.github.com> Date: Wed, 27 Jan 2021 23:12:29 +0530 Subject: [PATCH 07/93] Fix https in URL --- src/modules/netinstall/netinstall.schema.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/netinstall/netinstall.schema.yaml b/src/modules/netinstall/netinstall.schema.yaml index 61ab1c8f4..e1db5715e 100644 --- a/src/modules/netinstall/netinstall.schema.yaml +++ b/src/modules/netinstall/netinstall.schema.yaml @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: GPL-3.0-or-later --- -$schema: http://json-schema.org/draft-07/schema# +$schema: https://json-schema.org/draft-07/schema# $id: https://calamares.io/schemas/netinstall definitions: package: From 5c402ffd66db3fd92378646fa8701d9d2c6eba0d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 28 Jan 2021 22:12:19 +0100 Subject: [PATCH 08/93] [libcalamares] Truncate to a character count as well --- src/libcalamares/utils/String.cpp | 31 +++++++++++++++++++++- src/libcalamares/utils/Tests.cpp | 44 ++++++++++++++++++++++++++++++- 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/src/libcalamares/utils/String.cpp b/src/libcalamares/utils/String.cpp index 0c7bf8fb5..02b41f1c0 100644 --- a/src/libcalamares/utils/String.cpp +++ b/src/libcalamares/utils/String.cpp @@ -175,7 +175,36 @@ truncateMultiLine( const QString& string, CalamaresUtils::LinesStartEnd lines, C } } - return front + back; + if ( front.length() + back.length() <= chars.total ) + { + return front + back; + } + + // We need to cut off some bits, preserving whether there are + // newlines present at the end of the string. Go case-by-case: + if ( !front.isEmpty() && back.isEmpty() ) + { + // Truncate towards the front + bool needsNewline = front.endsWith( NEWLINE ); + front.truncate( chars.total ); + if ( !front.endsWith( NEWLINE ) && needsNewline ) + { + front.append( NEWLINE ); + } + return front; + } + if ( front.isEmpty() && !back.isEmpty() ) + { + // Truncate towards the tail + return back.right( chars.total ); + } + // Both are non-empty, so nibble away at both of them + front.truncate( chars.total / 2 ); + if ( !front.endsWith( NEWLINE ) ) + { + front.append( NEWLINE ); + } + return front + back.right( chars.total / 2 ); } diff --git a/src/libcalamares/utils/Tests.cpp b/src/libcalamares/utils/Tests.cpp index 3992fe78a..d8abd9c5f 100644 --- a/src/libcalamares/utils/Tests.cpp +++ b/src/libcalamares/utils/Tests.cpp @@ -597,6 +597,8 @@ and the translations updated.)" ); QVERIFY( !longString.endsWith( NEWLINE ) ); QCOMPARE( longString.count( NEWLINE ), 2 ); QVERIFY( longString.length() > insufficientLength ); + // Even the first line must be more than the insufficientLength + QVERIFY( longString.indexOf( NEWLINE ) > insufficientLength ); // Grab first line, untruncated { @@ -626,11 +628,51 @@ and the translations updated.)" ); QVERIFY( longString.endsWith( s ) ); QVERIFY( !s.endsWith( NEWLINE ) ); QVERIFY( s.endsWith( "updated." ) ); - cDebug() << "Result-line" << Logger::Quote << s; QCOMPARE( s.count( NEWLINE ), 1 ); // Because last line doesn't end with a newline QVERIFY( s.startsWith( "displayed in " ) ); } + // First line, truncated + { + auto s = truncateMultiLine( longString, LinesStartEnd { 1, 0 }, CharCount { insufficientLength } ); + cDebug() << "Result-line" << Logger::Quote << s; + QVERIFY( s.length() > 1 ); + QVERIFY( s.endsWith( NEWLINE ) ); + QVERIFY( s.startsWith( "Some " ) ); + // Because the first line has a newline, the truncated version does too, + // but that makes it one longer than requested. + QCOMPARE( s.length(), insufficientLength + 1 ); + QVERIFY( longString.startsWith( s.left( insufficientLength ) ) ); + } + + // Last line, truncated; this line is quite short + { + const int quiteShort = 8; + QVERIFY( longString.lastIndexOf( NEWLINE ) < longString.length() - quiteShort ); + + auto s = truncateMultiLine( longString, LinesStartEnd { 0, 1 }, CharCount { quiteShort } ); + cDebug() << "Result-line" << Logger::Quote << s; + QVERIFY( s.length() > 1 ); + QVERIFY( !s.endsWith( NEWLINE ) ); // Because the original doesn't either + QVERIFY( s.startsWith( "upda" ) ); + QCOMPARE( s.length(), quiteShort ); // No extra newlines + QVERIFY( longString.endsWith( s ) ); + } + + // First and last, but both truncated + { + const int quiteShort = 16; + QVERIFY( longString.indexOf( NEWLINE ) > quiteShort ); + QVERIFY( longString.lastIndexOf( NEWLINE ) < longString.length() - quiteShort ); + + auto s = truncateMultiLine( longString, LinesStartEnd { 1, 1 }, CharCount { quiteShort } ); + cDebug() << "Result-line" << Logger::Quote << s; + QVERIFY( s.length() > 1 ); + QVERIFY( !s.endsWith( NEWLINE ) ); // Because the original doesn't either + QVERIFY( s.startsWith( "Some " ) ); + QVERIFY( s.endsWith( "updated." ) ); + QCOMPARE( s.length(), quiteShort + 1 ); // Newline between front and back part + } } From 7ab9c63903f8a09d1b90a96851fc2759f8744987 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 29 Jan 2021 11:53:36 +0100 Subject: [PATCH 09/93] [libcalamares] Extend test with some degenerate cases --- src/libcalamares/utils/Tests.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/libcalamares/utils/Tests.cpp b/src/libcalamares/utils/Tests.cpp index d8abd9c5f..3ee48890e 100644 --- a/src/libcalamares/utils/Tests.cpp +++ b/src/libcalamares/utils/Tests.cpp @@ -67,6 +67,7 @@ private Q_SLOTS: /** @brief Test smart string truncation. */ void testStringTruncation(); void testStringTruncationShorter(); + void testStringTruncationDegenerate(); private: void recursiveCompareMap( const QVariantMap& a, const QVariantMap& b, int depth ); @@ -675,6 +676,36 @@ and the translations updated.)" ); } } +void LibCalamaresTests::testStringTruncationDegenerate() +{ + Logger::setupLogLevel( Logger::LOGDEBUG ); + + using namespace CalamaresUtils; + + // This is quite long, 1 line only, with no newlines + const QString longString( + "The portscout new distfile checker has detected that one or more of your" + "ports appears to be out of date. Please take the opportunity to check" + "each of the ports listed below, and if possible and appropriate," + "submit/commit an update. If any ports have already been updated, you can" + "safely ignore the entry." ); + + const char NEWLINE = '\n'; + const int quiteShort = 16; + QVERIFY( longString.length() > quiteShort); + QVERIFY( !longString.contains(NEWLINE)); + QVERIFY( longString.indexOf(NEWLINE) < 0); + + { + auto s = truncateMultiLine( longString, LinesStartEnd { 1, 0 }, CharCount { quiteShort } ); + cDebug() << "Result-line" << Logger::Quote << s; + QVERIFY( s.length() > 1 ); + QCOMPARE( s.length(), quiteShort); // Newline between front and back part + QVERIFY( s.startsWith( "The " ) ); + QVERIFY( s.endsWith( "entry." ) ); + } +} + QTEST_GUILESS_MAIN( LibCalamaresTests ) From e56bdd019f8eca7e37319f86d2db4a6510a41fb6 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Sat, 30 Jan 2021 05:37:41 -0500 Subject: [PATCH 10/93] modules/bootloader: Use the correct names for the shim binaries Ever since signed shim binaries for multiple architectures became available, the shim binaries installed in Linux distributions have been renamed to include the EFI architecture in the binary names. This started in Fedora, but is now used in openSUSE and Ubuntu too. Reference for shim binary names comes from shim spec in Fedora: https://src.fedoraproject.org/rpms/shim/blob/d8c3c8e39235507feb17b4e81851da087ae83c77/f/shim.spec#_23-32 --- AUTHORS | 1 + src/modules/bootloader/main.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index 912d48da7..1c4d7aa24 100644 --- a/AUTHORS +++ b/AUTHORS @@ -38,6 +38,7 @@ and moral support from (alphabetically by first name or nickname): - Kevin Kofler - Kyle Robertze - Lisa Vitolo + - Neal Gompa - n3rdopolis - Philip Müller - Ramon Buldó diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py index ec9a6f2e6..03fdb0c5b 100644 --- a/src/modules/bootloader/main.py +++ b/src/modules/bootloader/main.py @@ -14,6 +14,7 @@ # SPDX-FileCopyrightText: 2017-2019 Adriaan de Groot # SPDX-FileCopyrightText: 2017 Gabriel Craciunescu # SPDX-FileCopyrightText: 2017 Ben Green +# SPDX-FileCopyrightText: 2021 Neal Gompa # SPDX-License-Identifier: GPL-3.0-or-later # # Calamares is Free Software: see the License-Identifier above. @@ -372,9 +373,9 @@ def install_secureboot(efi_directory): install_efi_directory = install_path + efi_directory if efi_word_size() == "64": - install_efi_bin = "shim64.efi" - else: - install_efi_bin = "shim.efi" + install_efi_bin = "shimx64.efi" + elif efi_word_size() == "32": + install_efi_bin = "shimia32.efi" # Copied, roughly, from openSUSE's install script, # and pythonified. *disk* is something like /dev/sda, From 0d44d2838fdc0c63e3d65d909b6e5b2a77e01127 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Sun, 31 Jan 2021 00:54:48 +0100 Subject: [PATCH 11/93] Changes: document Neal Gompa's fix from #1628 --- CHANGES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES b/CHANGES index d112470b4..187ec76e4 100644 --- a/CHANGES +++ b/CHANGES @@ -12,6 +12,7 @@ website will have to do for older versions. This release contains contributions from (alphabetically by first name): - Anubhav Choudhary - Gaël PORTAY + - Neal Gompa ## Core ## - It is now possible to hide the *next* and *back* buttons during @@ -28,6 +29,8 @@ This release contains contributions from (alphabetically by first name): failed installations if automount grabs partitions while they are being created. The code is prepared to handle other ways to control automount-behavior as well. + - *bootloader* now uses the current file names for the UEFI Secure Boot + shim instead of obsolete ones. # 3.2.35.1 (2020-12-07) # From caff0176b160883167a7438c188fc03df7297ed2 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 31 Jan 2021 21:40:41 +0100 Subject: [PATCH 12/93] [libcalamares] Need for unique_ptr FIXES #1631 --- src/libcalamares/JobQueue.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libcalamares/JobQueue.cpp b/src/libcalamares/JobQueue.cpp index b66be7ebe..a975c2c91 100644 --- a/src/libcalamares/JobQueue.cpp +++ b/src/libcalamares/JobQueue.cpp @@ -19,6 +19,8 @@ #include #include +#include + namespace Calamares { From 0592d40bc26842ede3ab21f4648039aa0f3532d5 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 31 Jan 2021 21:50:33 +0100 Subject: [PATCH 13/93] CI: rename neon build (to make it obvious there are other possibilities) --- .github/workflows/{ci.yml => ci-neon.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{ci.yml => ci-neon.yml} (99%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci-neon.yml similarity index 99% rename from .github/workflows/ci.yml rename to .github/workflows/ci-neon.yml index c2699507d..0c691dbd3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci-neon.yml @@ -1,4 +1,4 @@ -name: ci +name: ci-neon on: push: From a289518a8a1dcc50e0958e1bc7f3ce1d242f641d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 31 Jan 2021 22:01:41 +0100 Subject: [PATCH 14/93] CI: munge the issues-notifications --- .github/workflows/issues.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index c647936d7..e1d41e3ef 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -1,17 +1,28 @@ name: issues -on: issues +on: + issues: + types: [opened, reopened, closed] jobs: irc: runs-on: ubuntu-latest steps: - - name: notify + name: notify-new uses: rectalogic/notify-irc@v1 + if: ${{ github.event.issue.state }} == "open" with: server: chat.freenode.net channel: "#calamares" nickname: gh-issues - message: | - ${{ github.actor }} issue ${{ github.event.issue.title }} + message: "New issue [${{ github.event.issue.title }}](${{ github.event.issue.url }})" + - + name: notify-closed + uses: rectalogic/notify-irc@v1 + if: ${{ github.event.issue.state }} != "open" + with: + server: chat.freenode.net + channel: "#calamares" + nickname: gh-issues + message: "Closed issue [${{ github.event.issue.title }}](${{ github.event.issue.url }})" From 413614e14bf701d8fe7f4757f6213f45aed48f14 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 31 Jan 2021 23:07:48 +0100 Subject: [PATCH 15/93] CI: massage the issues-messages a little more, fix logic --- .github/workflows/issues.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index e1d41e3ef..d98230d91 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -11,18 +11,18 @@ jobs: - name: notify-new uses: rectalogic/notify-irc@v1 - if: ${{ github.event.issue.state }} == "open" + if: github.event.issue.state == "open" with: server: chat.freenode.net channel: "#calamares" nickname: gh-issues - message: "New issue [${{ github.event.issue.title }}](${{ github.event.issue.url }})" + message: "[${{ github.event.issue.title }}](${{ github.event.issue.url }}) opened by ${{ github.actor }}" - name: notify-closed uses: rectalogic/notify-irc@v1 - if: ${{ github.event.issue.state }} != "open" + if: github.event.issue.state != "open" with: server: chat.freenode.net channel: "#calamares" nickname: gh-issues - message: "Closed issue [${{ github.event.issue.title }}](${{ github.event.issue.url }})" + message: "[${{ github.event.issue.title }}](${{ github.event.issue.url }}) closed by ${{ github.actor }}" From 3ca770aa631dbdbfeca81d6fb33246e59295fb59 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Feb 2021 13:27:33 +0100 Subject: [PATCH 16/93] CI: another round of CI-wrangling --- .github/workflows/ci-neon.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index 0c691dbd3..95fbd5230 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -85,12 +85,23 @@ jobs: working-directory: ${{ env.BUILDDIR }} run: | make install VERBOSE=1 + - + name: Dump steps context + env: + JOBS_CONTEXT: ${{ toJSON(job) }} + STEPS_CONTEXT: ${{ toJSON(steps) }} + run: | + echo "STEPS" + echo "$STEPS_CONTEXT" + echo "JOB" + echo "$JOB_CONTEXT" - name: notify uses: rectalogic/notify-irc@v1 + if: always() with: server: chat.freenode.net channel: "#calamares" nickname: gh-notify message: | - ${{ github.actor }} pushed ${{ github.event.ref }} CI ${{ steps.install.conclusion }} JOB ${{ github.job }} RUN ${{ github.run_id }} + ${{ github.actor }} result ${{ steps.install.conclusion }} - ${{ steps.install.outcome }} - ${{ job.status }} RUN ${{ github.run_id }} From bd6aa58322baecf70e4ed70e634ad3117b91ffc5 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Feb 2021 13:52:55 +0100 Subject: [PATCH 17/93] CI: another try at notification on build --- .github/workflows/ci-neon.yml | 45 ++++++++++++++++------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index 95fbd5230..37eee1dcd 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -27,16 +27,13 @@ jobs: image: docker://kdeneon/plasma:user options: --tmpfs /build:rw --user 0:0 steps: - - - name: prepare env + - name: prepare env run: | sudo apt-get update sudo apt-get -y install git-core - - - name: checkout + - name: checkout uses: actions/checkout@v2 - - - name: install dependencies + - name: install dependencies run: | sudo apt-get -y install \ build-essential \ @@ -66,27 +63,15 @@ jobs: qtdeclarative5-dev \ qttools5-dev \ qttools5-dev-tools - - - name: prepare build + - name: prepare build run: | test -n "$BUILDDIR" || { echo "! \$BUILDDIR not set" ; exit 1 ; } mkdir -p $BUILDDIR test -f $SRCDIR/CMakeLists.txt || { echo "! Missing $SRCDIR/CMakeLists.txt" ; exit 1 ; } - - - name: cmake + - name: Calamares: cmake working-directory: ${{ env.BUILDDIR }} run: cmake $CMAKE_ARGS $SRCDIR - - - name: make - working-directory: ${{ env.BUILDDIR }} - run: make -j2 VERBOSE=1 - - - name: install - working-directory: ${{ env.BUILDDIR }} - run: | - make install VERBOSE=1 - - - name: Dump steps context + - name: Dump steps context env: JOBS_CONTEXT: ${{ toJSON(job) }} STEPS_CONTEXT: ${{ toJSON(steps) }} @@ -94,9 +79,8 @@ jobs: echo "STEPS" echo "$STEPS_CONTEXT" echo "JOB" - echo "$JOB_CONTEXT" - - - name: notify + echo "$JOBS_CONTEXT" + - name: notify uses: rectalogic/notify-irc@v1 if: always() with: @@ -104,4 +88,15 @@ jobs: channel: "#calamares" nickname: gh-notify message: | - ${{ github.actor }} result ${{ steps.install.conclusion }} - ${{ steps.install.outcome }} - ${{ job.status }} RUN ${{ github.run_id }} + ${{ github.actor }} $${ github.sha }} on ${{ github.ref }} + result ${{ steps.checkout.conclusion }} - ${{ steps.checkout.outcome }} - ${{ job.status }} RUN ${{ github.run_id }} ${{ github.job_id }} + +# Unused while we figure out notifications. +# - name: make +# working-directory: ${{ env.BUILDDIR }} +# run: make -j2 VERBOSE=1 +# - name: install +# working-directory: ${{ env.BUILDDIR }} +# run: | +# make install VERBOSE=1 +# From c5729b861f3cef0944a2a04eb7143b71a58ac5e8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Feb 2021 13:57:28 +0100 Subject: [PATCH 18/93] CI: fix YAML typo --- .github/workflows/ci-neon.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index 37eee1dcd..d33cc24f2 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -27,13 +27,13 @@ jobs: image: docker://kdeneon/plasma:user options: --tmpfs /build:rw --user 0:0 steps: - - name: prepare env + - name: "prepare env" run: | sudo apt-get update sudo apt-get -y install git-core - - name: checkout + - name: "checkout" uses: actions/checkout@v2 - - name: install dependencies + - name: "install dependencies" run: | sudo apt-get -y install \ build-essential \ @@ -63,15 +63,15 @@ jobs: qtdeclarative5-dev \ qttools5-dev \ qttools5-dev-tools - - name: prepare build + - name: "prepare build" run: | test -n "$BUILDDIR" || { echo "! \$BUILDDIR not set" ; exit 1 ; } mkdir -p $BUILDDIR test -f $SRCDIR/CMakeLists.txt || { echo "! Missing $SRCDIR/CMakeLists.txt" ; exit 1 ; } - - name: Calamares: cmake + - name: "Calamares: cmake" working-directory: ${{ env.BUILDDIR }} run: cmake $CMAKE_ARGS $SRCDIR - - name: Dump steps context + - name: "dump context" env: JOBS_CONTEXT: ${{ toJSON(job) }} STEPS_CONTEXT: ${{ toJSON(steps) }} @@ -80,7 +80,7 @@ jobs: echo "$STEPS_CONTEXT" echo "JOB" echo "$JOBS_CONTEXT" - - name: notify + - name: "notify" uses: rectalogic/notify-irc@v1 if: always() with: @@ -92,10 +92,10 @@ jobs: result ${{ steps.checkout.conclusion }} - ${{ steps.checkout.outcome }} - ${{ job.status }} RUN ${{ github.run_id }} ${{ github.job_id }} # Unused while we figure out notifications. -# - name: make +# - name: "Calamares: make" # working-directory: ${{ env.BUILDDIR }} # run: make -j2 VERBOSE=1 -# - name: install +# - name: "Calamares: install" # working-directory: ${{ env.BUILDDIR }} # run: | # make install VERBOSE=1 From 5643c5cdc75c160a443d80a81bcba5075365974e Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Feb 2021 14:09:52 +0100 Subject: [PATCH 19/93] CI: another try at notification on build --- .github/workflows/ci-neon.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index d33cc24f2..b255adebd 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -75,11 +75,14 @@ jobs: env: JOBS_CONTEXT: ${{ toJSON(job) }} STEPS_CONTEXT: ${{ toJSON(steps) }} + EVENT_CONTEXT: ${{ toJSON(github.event) }} run: | echo "STEPS" echo "$STEPS_CONTEXT" echo "JOB" echo "$JOBS_CONTEXT" + echo "EVENT" + echo "$EVENT_CONTEXT" - name: "notify" uses: rectalogic/notify-irc@v1 if: always() @@ -88,8 +91,8 @@ jobs: channel: "#calamares" nickname: gh-notify message: | - ${{ github.actor }} $${ github.sha }} on ${{ github.ref }} - result ${{ steps.checkout.conclusion }} - ${{ steps.checkout.outcome }} - ${{ job.status }} RUN ${{ github.run_id }} ${{ github.job_id }} + ${{ github.actor }} ${{ github.sha }} on ${{ github.ref }} + result ${{ job.status }} RUN ${{ github.run_id }} ${{ github.job }} # Unused while we figure out notifications. # - name: "Calamares: make" From 9af44a3c8d70293a4604d064889ce736c6c039a5 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Feb 2021 14:25:02 +0100 Subject: [PATCH 20/93] CI: one more with shorter notifications --- .github/workflows/ci-neon.yml | 16 ++++++++++++---- .github/workflows/issues.yml | 6 ++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index b255adebd..c7bf22f77 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -83,16 +83,24 @@ jobs: echo "$JOBS_CONTEXT" echo "EVENT" echo "$EVENT_CONTEXT" - - name: "notify" + - name: "notify: ok" uses: rectalogic/notify-irc@v1 - if: always() + if: ${{ success() }} + with: + server: chat.freenode.net + channel: "#calamares" + nickname: gh-notify + message: "CI OK for '${{ github.event.head_commit.message }}'" + - name: "notify: fail" + uses: rectalogic/notify-irc@v1 + if: ${{ failure() }} with: server: chat.freenode.net channel: "#calamares" nickname: gh-notify message: | - ${{ github.actor }} ${{ github.sha }} on ${{ github.ref }} - result ${{ job.status }} RUN ${{ github.run_id }} ${{ github.job }} + CI FAIL for '${{ github.event.head_commit.message }}' + .. DIFF ${{ github.event.compare }} # Unused while we figure out notifications. # - name: "Calamares: make" diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index d98230d91..9ceb5315c 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -8,8 +8,7 @@ jobs: irc: runs-on: ubuntu-latest steps: - - - name: notify-new + - name: "notify: new" uses: rectalogic/notify-irc@v1 if: github.event.issue.state == "open" with: @@ -17,8 +16,7 @@ jobs: channel: "#calamares" nickname: gh-issues message: "[${{ github.event.issue.title }}](${{ github.event.issue.url }}) opened by ${{ github.actor }}" - - - name: notify-closed + - name: "notify: closed" uses: rectalogic/notify-irc@v1 if: github.event.issue.state != "open" with: From 1da84ca09ba904eec55db57896624a6564a3acd9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Feb 2021 14:41:07 +0100 Subject: [PATCH 21/93] CI: restore full build, restrict to 'our' repo - this should prevent forks from duplicate-reporting builds --- .github/workflows/ci-neon.yml | 31 ++++++++----------------------- .github/workflows/issues.yml | 5 +++-- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index c7bf22f77..0cb51e01a 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -26,6 +26,7 @@ jobs: container: image: docker://kdeneon/plasma:user options: --tmpfs /build:rw --user 0:0 + if: github.repository == "calamares/calamares" steps: - name: "prepare env" run: | @@ -71,18 +72,12 @@ jobs: - name: "Calamares: cmake" working-directory: ${{ env.BUILDDIR }} run: cmake $CMAKE_ARGS $SRCDIR - - name: "dump context" - env: - JOBS_CONTEXT: ${{ toJSON(job) }} - STEPS_CONTEXT: ${{ toJSON(steps) }} - EVENT_CONTEXT: ${{ toJSON(github.event) }} - run: | - echo "STEPS" - echo "$STEPS_CONTEXT" - echo "JOB" - echo "$JOBS_CONTEXT" - echo "EVENT" - echo "$EVENT_CONTEXT" + - name: "Calamares: make" + working-directory: ${{ env.BUILDDIR }} + run: make -j2 VERBOSE=1 + - name: "Calamares: install" + working-directory: ${{ env.BUILDDIR }} + run: make install VERBOSE=1 - name: "notify: ok" uses: rectalogic/notify-irc@v1 if: ${{ success() }} @@ -90,7 +85,7 @@ jobs: server: chat.freenode.net channel: "#calamares" nickname: gh-notify - message: "CI OK for '${{ github.event.head_commit.message }}'" + message: "CI OK for '${{ github.event.head_commit.message }}' in ${{ github.repository }}" - name: "notify: fail" uses: rectalogic/notify-irc@v1 if: ${{ failure() }} @@ -101,13 +96,3 @@ jobs: message: | CI FAIL for '${{ github.event.head_commit.message }}' .. DIFF ${{ github.event.compare }} - -# Unused while we figure out notifications. -# - name: "Calamares: make" -# working-directory: ${{ env.BUILDDIR }} -# run: make -j2 VERBOSE=1 -# - name: "Calamares: install" -# working-directory: ${{ env.BUILDDIR }} -# run: | -# make install VERBOSE=1 -# diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 9ceb5315c..87ba94d70 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -7,6 +7,7 @@ on: jobs: irc: runs-on: ubuntu-latest + if: github.repository == "calamares/calamares" steps: - name: "notify: new" uses: rectalogic/notify-irc@v1 @@ -15,7 +16,7 @@ jobs: server: chat.freenode.net channel: "#calamares" nickname: gh-issues - message: "[${{ github.event.issue.title }}](${{ github.event.issue.url }}) opened by ${{ github.actor }}" + message: "[${{ github.event.issue.title }}](${{ github.event.issue.html_url }}) opened by ${{ github.actor }}" - name: "notify: closed" uses: rectalogic/notify-irc@v1 if: github.event.issue.state != "open" @@ -23,4 +24,4 @@ jobs: server: chat.freenode.net channel: "#calamares" nickname: gh-issues - message: "[${{ github.event.issue.title }}](${{ github.event.issue.url }}) closed by ${{ github.actor }}" + message: "[${{ github.event.issue.title }}](${{ github.event.issue.html_url }}) closed by ${{ github.actor }}" From eee5674f6d3e5a0b2f7257a609fd3af3904c7b01 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Feb 2021 15:04:13 +0100 Subject: [PATCH 22/93] CI: remove if-expression, it triggers a syntax error - unclear why this wasn't evaluated in expression context before --- .github/workflows/ci-neon.yml | 4 ++-- .github/workflows/issues.yml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index 0cb51e01a..32399d20c 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -26,7 +26,7 @@ jobs: container: image: docker://kdeneon/plasma:user options: --tmpfs /build:rw --user 0:0 - if: github.repository == "calamares/calamares" + if: ${{ github.repository == "calamares/calamares" }} steps: - name: "prepare env" run: | @@ -94,5 +94,5 @@ jobs: channel: "#calamares" nickname: gh-notify message: | - CI FAIL for '${{ github.event.head_commit.message }}' + CI FAIL for '${{ github.event.head_commit.message }}' in ${{ github.repository }} .. DIFF ${{ github.event.compare }} diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 87ba94d70..1d039795c 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -7,7 +7,6 @@ on: jobs: irc: runs-on: ubuntu-latest - if: github.repository == "calamares/calamares" steps: - name: "notify: new" uses: rectalogic/notify-irc@v1 From 1742c10f7d58bf1bf1498009656351280afa6399 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Feb 2021 15:05:33 +0100 Subject: [PATCH 23/93] CI: remove if entirely - expression context is not enough --- .github/workflows/ci-neon.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index 32399d20c..a0b596928 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -26,7 +26,6 @@ jobs: container: image: docker://kdeneon/plasma:user options: --tmpfs /build:rw --user 0:0 - if: ${{ github.repository == "calamares/calamares" }} steps: - name: "prepare env" run: | From f2bd956b89ff868955f62c0c75c931f1e20748aa Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Feb 2021 16:28:20 +0100 Subject: [PATCH 24/93] CI: try a different form of if() --- .github/workflows/ci-neon.yml | 1 + .github/workflows/issues.yml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index a0b596928..3e090b283 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -26,6 +26,7 @@ jobs: container: image: docker://kdeneon/plasma:user options: --tmpfs /build:rw --user 0:0 + if: ${{ github.repository == 'calamares/calamares' }} steps: - name: "prepare env" run: | diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 1d039795c..698f0d733 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -10,7 +10,7 @@ jobs: steps: - name: "notify: new" uses: rectalogic/notify-irc@v1 - if: github.event.issue.state == "open" + if: github.event.issue.state == 'open' with: server: chat.freenode.net channel: "#calamares" @@ -18,7 +18,7 @@ jobs: message: "[${{ github.event.issue.title }}](${{ github.event.issue.html_url }}) opened by ${{ github.actor }}" - name: "notify: closed" uses: rectalogic/notify-irc@v1 - if: github.event.issue.state != "open" + if: github.event.issue.state != 'open' with: server: chat.freenode.net channel: "#calamares" From 3692988b1716245ff8fcc9883956ed2c3e44b595 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Feb 2021 16:57:05 +0100 Subject: [PATCH 25/93] CI: cut down expression context --- .github/workflows/ci-neon.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index 3e090b283..bad6ead1e 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -26,7 +26,7 @@ jobs: container: image: docker://kdeneon/plasma:user options: --tmpfs /build:rw --user 0:0 - if: ${{ github.repository == 'calamares/calamares' }} + if: github.repository == 'calamares/calamares' steps: - name: "prepare env" run: | From 2f18921db9901625d64074321095c4f2f98f1259 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Feb 2021 17:09:50 +0100 Subject: [PATCH 26/93] CI: compress steps - don't need multiple prepare steps - try to use git output for SHA and log message --- .github/workflows/ci-neon.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index bad6ead1e..d7da036b1 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -32,10 +32,6 @@ jobs: run: | sudo apt-get update sudo apt-get -y install git-core - - name: "checkout" - uses: actions/checkout@v2 - - name: "install dependencies" - run: | sudo apt-get -y install \ build-essential \ cmake \ @@ -64,11 +60,15 @@ jobs: qtdeclarative5-dev \ qttools5-dev \ qttools5-dev-tools + - name: "prepare source" + uses: actions/checkout@v2 - name: "prepare build" + id: pre_build run: | test -n "$BUILDDIR" || { echo "! \$BUILDDIR not set" ; exit 1 ; } mkdir -p $BUILDDIR test -f $SRCDIR/CMakeLists.txt || { echo "! Missing $SRCDIR/CMakeLists.txt" ; exit 1 ; } + echo "::set-output name=message::"`git log -1 --abbrev-commit --pretty=oneline --no-decorate ${{ github.event.head_commit.id }} - name: "Calamares: cmake" working-directory: ${{ env.BUILDDIR }} run: cmake $CMAKE_ARGS $SRCDIR @@ -85,7 +85,7 @@ jobs: server: chat.freenode.net channel: "#calamares" nickname: gh-notify - message: "CI OK for '${{ github.event.head_commit.message }}' in ${{ github.repository }}" + message: "CI OK ${{ github.repository }} ${{ steps.pre_build.outputs.message }}" - name: "notify: fail" uses: rectalogic/notify-irc@v1 if: ${{ failure() }} @@ -94,5 +94,5 @@ jobs: channel: "#calamares" nickname: gh-notify message: | - CI FAIL for '${{ github.event.head_commit.message }}' in ${{ github.repository }} - .. DIFF ${{ github.event.compare }} + CI FAIL ${{ github.repository }} ${{ steps.pre_build.outputs.message }} + .. DIFF ${{ github.event.compare }} From 14dcbb94a34492b0319d4ade289d5d1449644f92 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Feb 2021 17:18:44 +0100 Subject: [PATCH 27/93] CI: fix typo, tighten up messages --- .github/workflows/ci-neon.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index d7da036b1..753bffd58 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -68,7 +68,7 @@ jobs: test -n "$BUILDDIR" || { echo "! \$BUILDDIR not set" ; exit 1 ; } mkdir -p $BUILDDIR test -f $SRCDIR/CMakeLists.txt || { echo "! Missing $SRCDIR/CMakeLists.txt" ; exit 1 ; } - echo "::set-output name=message::"`git log -1 --abbrev-commit --pretty=oneline --no-decorate ${{ github.event.head_commit.id }} + echo "::set-output name=message::"`git log -1 --abbrev-commit --pretty=oneline --no-decorate ${{ github.event.head_commit.id }}` - name: "Calamares: cmake" working-directory: ${{ env.BUILDDIR }} run: cmake $CMAKE_ARGS $SRCDIR @@ -85,7 +85,7 @@ jobs: server: chat.freenode.net channel: "#calamares" nickname: gh-notify - message: "CI OK ${{ github.repository }} ${{ steps.pre_build.outputs.message }}" + message: "${{ github.workflow }} OK ${{ github.repository }} ${{ steps.pre_build.outputs.message }}" - name: "notify: fail" uses: rectalogic/notify-irc@v1 if: ${{ failure() }} @@ -94,5 +94,5 @@ jobs: channel: "#calamares" nickname: gh-notify message: | - CI FAIL ${{ github.repository }} ${{ steps.pre_build.outputs.message }} + ${{ github.workflow }} FAIL ${{ github.repository }} ${{ steps.pre_build.outputs.message }} .. DIFF ${{ github.event.compare }} From 7a0e91f0763eaebc8b365b70a5039faa0d1f81e4 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Feb 2021 23:12:14 +0100 Subject: [PATCH 28/93] CI: shorten the notification stanzas --- .github/workflows/ci-neon.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index 753bffd58..751d210cf 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -82,17 +82,14 @@ jobs: uses: rectalogic/notify-irc@v1 if: ${{ success() }} with: - server: chat.freenode.net channel: "#calamares" - nickname: gh-notify message: "${{ github.workflow }} OK ${{ github.repository }} ${{ steps.pre_build.outputs.message }}" - name: "notify: fail" uses: rectalogic/notify-irc@v1 if: ${{ failure() }} with: - server: chat.freenode.net channel: "#calamares" - nickname: gh-notify message: | ${{ github.workflow }} FAIL ${{ github.repository }} ${{ steps.pre_build.outputs.message }} .. DIFF ${{ github.event.compare }} +# END From a34ca69d52aa6542b4197feb3e88344c32b83c51 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Feb 2021 23:14:06 +0100 Subject: [PATCH 29/93] CI: run CI everywhere, but notify us only when building the upstream version --- .github/workflows/ci-neon.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index 751d210cf..422287dec 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -26,7 +26,6 @@ jobs: container: image: docker://kdeneon/plasma:user options: --tmpfs /build:rw --user 0:0 - if: github.repository == 'calamares/calamares' steps: - name: "prepare env" run: | @@ -80,13 +79,13 @@ jobs: run: make install VERBOSE=1 - name: "notify: ok" uses: rectalogic/notify-irc@v1 - if: ${{ success() }} + if: ${{ success() && github.repository == 'calamares/calamares' }} with: channel: "#calamares" message: "${{ github.workflow }} OK ${{ github.repository }} ${{ steps.pre_build.outputs.message }}" - name: "notify: fail" uses: rectalogic/notify-irc@v1 - if: ${{ failure() }} + if: ${{ failure() && github.repository == 'calamares/calamares' }} with: channel: "#calamares" message: | From 343f4cefc88ed8352984cac6ec83d470a9851ce3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Feb 2021 23:15:15 +0100 Subject: [PATCH 30/93] CI: build on older Debian on a schedule --- .github/workflows/ci-debian.yml | 87 +++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 .github/workflows/ci-debian.yml diff --git a/.github/workflows/ci-debian.yml b/.github/workflows/ci-debian.yml new file mode 100644 index 000000000..1fa4135ef --- /dev/null +++ b/.github/workflows/ci-debian.yml @@ -0,0 +1,87 @@ +name: ci-debian-9 + +on: + schedule: + - cron: "12 23 * * *" + +env: + BUILDDIR: /build + SRCDIR: ${{ github.workspace }} + CMAKE_ARGS: | + -DWEBVIEW_FORCE_WEBKIT=1 + -DKDE_INSTALL_USE_QT_SYS_PATHS=ON + -DWITH_PYTHONQT=OFF" + -DCMAKE_BUILD_TYPE=Debug + +jobs: + build: + runs-on: ubuntu-latest + container: + image: docker://debian:9 + options: --tmpfs /build:rw --user 0:0 + steps: + - name: "prepare env" + run: | + sudo apt-get update + sudo apt-get -y install git-core + sudo apt-get -y install \ + build-essential \ + cmake \ + extra-cmake-modules \ + gettext \ + kio-dev \ + libatasmart-dev \ + libboost-python-dev \ + libkf5config-dev \ + libkf5coreaddons-dev \ + libkf5i18n-dev \ + libkf5iconthemes-dev \ + libkf5parts-dev \ + libkf5service-dev \ + libkf5solid-dev \ + libkpmcore-dev \ + libparted-dev \ + libpolkit-qt5-1-dev \ + libqt5svg5-dev \ + libqt5webkit5-dev \ + libyaml-cpp-dev \ + os-prober \ + pkg-config \ + python3-dev \ + qtbase5-dev \ + qtdeclarative5-dev \ + qttools5-dev \ + qttools5-dev-tools + - name: "prepare source" + uses: actions/checkout@v2 + - name: "prepare build" + id: pre_build + run: | + test -n "$BUILDDIR" || { echo "! \$BUILDDIR not set" ; exit 1 ; } + mkdir -p $BUILDDIR + test -f $SRCDIR/CMakeLists.txt || { echo "! Missing $SRCDIR/CMakeLists.txt" ; exit 1 ; } + echo "::set-output name=message::"`git log -1 --abbrev-commit --pretty=oneline --no-decorate ${{ github.event.head_commit.id }}` + - name: "Calamares: cmake" + working-directory: ${{ env.BUILDDIR }} + run: cmake $CMAKE_ARGS $SRCDIR + - name: "Calamares: make" + working-directory: ${{ env.BUILDDIR }} + run: make -j2 VERBOSE=1 + - name: "Calamares: install" + working-directory: ${{ env.BUILDDIR }} + run: make install VERBOSE=1 + - name: "notify: ok" + uses: rectalogic/notify-irc@v1 + if: ${{ success() && github.repository == 'calamares/calamares' }} + with: + channel: "#calamares" + message: "${{ github.workflow }} OK ${{ github.repository }} ${{ steps.pre_build.outputs.message }}" + - name: "notify: fail" + uses: rectalogic/notify-irc@v1 + if: ${{ failure() && github.repository == 'calamares/calamares' }} + with: + channel: "#calamares" + message: | + ${{ github.workflow }} FAIL ${{ github.repository }} ${{ steps.pre_build.outputs.message }} + .. DIFF ${{ github.event.compare }} +# END From 73ab41c5722ac8fde55d69c7ba1d3ff6f8c22018 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Feb 2021 23:42:10 +0100 Subject: [PATCH 31/93] CI: partial back-out to chase IRC message failure --- .github/workflows/ci-neon.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index 422287dec..c06933715 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -82,7 +82,8 @@ jobs: if: ${{ success() && github.repository == 'calamares/calamares' }} with: channel: "#calamares" - message: "${{ github.workflow }} OK ${{ github.repository }} ${{ steps.pre_build.outputs.message }}" + message: | + ${{ github.workflow }} OK ${{ github.repository }} ${{ steps.pre_build.outputs.message }} - name: "notify: fail" uses: rectalogic/notify-irc@v1 if: ${{ failure() && github.repository == 'calamares/calamares' }} @@ -91,4 +92,3 @@ jobs: message: | ${{ github.workflow }} FAIL ${{ github.repository }} ${{ steps.pre_build.outputs.message }} .. DIFF ${{ github.event.compare }} -# END From 6743de076f07e8ae155a3752cd339424a7878a5f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Feb 2021 23:56:42 +0100 Subject: [PATCH 32/93] CI: frustrated by weird Python failures now --- .github/workflows/ci-neon.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index c06933715..91f79eb9f 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -68,19 +68,21 @@ jobs: mkdir -p $BUILDDIR test -f $SRCDIR/CMakeLists.txt || { echo "! Missing $SRCDIR/CMakeLists.txt" ; exit 1 ; } echo "::set-output name=message::"`git log -1 --abbrev-commit --pretty=oneline --no-decorate ${{ github.event.head_commit.id }}` - - name: "Calamares: cmake" - working-directory: ${{ env.BUILDDIR }} - run: cmake $CMAKE_ARGS $SRCDIR - - name: "Calamares: make" - working-directory: ${{ env.BUILDDIR }} - run: make -j2 VERBOSE=1 - - name: "Calamares: install" - working-directory: ${{ env.BUILDDIR }} - run: make install VERBOSE=1 +# - name: "Calamares: cmake" +# working-directory: ${{ env.BUILDDIR }} +# run: cmake $CMAKE_ARGS $SRCDIR +# - name: "Calamares: make" +# working-directory: ${{ env.BUILDDIR }} +# run: make -j2 VERBOSE=1 +# - name: "Calamares: install" +# working-directory: ${{ env.BUILDDIR }} +# run: make install VERBOSE=1 - name: "notify: ok" uses: rectalogic/notify-irc@v1 if: ${{ success() && github.repository == 'calamares/calamares' }} with: + server: chat.freenode.net + nickname: cala-notify channel: "#calamares" message: | ${{ github.workflow }} OK ${{ github.repository }} ${{ steps.pre_build.outputs.message }} @@ -88,6 +90,8 @@ jobs: uses: rectalogic/notify-irc@v1 if: ${{ failure() && github.repository == 'calamares/calamares' }} with: + server: chat.freenode.net + nickname: cala-notify channel: "#calamares" message: | ${{ github.workflow }} FAIL ${{ github.repository }} ${{ steps.pre_build.outputs.message }} From fa258e3100faca36d18ba1164c4d7244cd0e3079 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Feb 2021 00:04:33 +0100 Subject: [PATCH 33/93] CI: try again to avoid trailing blank lines --- .github/workflows/ci-neon.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index 91f79eb9f..d21a9f518 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -84,8 +84,7 @@ jobs: server: chat.freenode.net nickname: cala-notify channel: "#calamares" - message: | - ${{ github.workflow }} OK ${{ github.repository }} ${{ steps.pre_build.outputs.message }} + message: "${{ github.workflow }} OK ${{ github.repository }} ${{ steps.pre_build.outputs.message }}" - name: "notify: fail" uses: rectalogic/notify-irc@v1 if: ${{ failure() && github.repository == 'calamares/calamares' }} @@ -93,6 +92,4 @@ jobs: server: chat.freenode.net nickname: cala-notify channel: "#calamares" - message: | - ${{ github.workflow }} FAIL ${{ github.repository }} ${{ steps.pre_build.outputs.message }} - .. DIFF ${{ github.event.compare }} + message: "${{ github.workflow }} FAIL ${{ github.repository }} ${{ steps.pre_build.outputs.message }}\n.. DIFF ${{ github.event.compare }}" From 455cc29bc360525049d38fd4fababb0f20560ebc Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Feb 2021 00:11:50 +0100 Subject: [PATCH 34/93] CI: restore build steps --- .github/workflows/ci-neon.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index d21a9f518..bccdbd71e 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -68,15 +68,15 @@ jobs: mkdir -p $BUILDDIR test -f $SRCDIR/CMakeLists.txt || { echo "! Missing $SRCDIR/CMakeLists.txt" ; exit 1 ; } echo "::set-output name=message::"`git log -1 --abbrev-commit --pretty=oneline --no-decorate ${{ github.event.head_commit.id }}` -# - name: "Calamares: cmake" -# working-directory: ${{ env.BUILDDIR }} -# run: cmake $CMAKE_ARGS $SRCDIR -# - name: "Calamares: make" -# working-directory: ${{ env.BUILDDIR }} -# run: make -j2 VERBOSE=1 -# - name: "Calamares: install" -# working-directory: ${{ env.BUILDDIR }} -# run: make install VERBOSE=1 + - name: "Calamares: cmake" + working-directory: ${{ env.BUILDDIR }} + run: cmake $CMAKE_ARGS $SRCDIR + - name: "Calamares: make" + working-directory: ${{ env.BUILDDIR }} + run: make -j2 VERBOSE=1 + - name: "Calamares: install" + working-directory: ${{ env.BUILDDIR }} + run: make install VERBOSE=1 - name: "notify: ok" uses: rectalogic/notify-irc@v1 if: ${{ success() && github.repository == 'calamares/calamares' }} From 81e5bf4e6e0e0e566c3c9648dd43e88c58c956d7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Feb 2021 00:13:07 +0100 Subject: [PATCH 35/93] CI: update Debian-build notifications, too --- .github/workflows/ci-debian.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-debian.yml b/.github/workflows/ci-debian.yml index 1fa4135ef..b60ce29e6 100644 --- a/.github/workflows/ci-debian.yml +++ b/.github/workflows/ci-debian.yml @@ -74,14 +74,15 @@ jobs: uses: rectalogic/notify-irc@v1 if: ${{ success() && github.repository == 'calamares/calamares' }} with: + server: chat.freenode.net + nickname: cala-notify channel: "#calamares" message: "${{ github.workflow }} OK ${{ github.repository }} ${{ steps.pre_build.outputs.message }}" - name: "notify: fail" uses: rectalogic/notify-irc@v1 if: ${{ failure() && github.repository == 'calamares/calamares' }} with: + server: chat.freenode.net + nickname: cala-notify channel: "#calamares" - message: | - ${{ github.workflow }} FAIL ${{ github.repository }} ${{ steps.pre_build.outputs.message }} - .. DIFF ${{ github.event.compare }} -# END + message: "${{ github.workflow }} FAIL ${{ github.repository }} ${{ steps.pre_build.outputs.message }}\n.. DIFF ${{ github.event.compare }}" From 74eada048b903d42d7ca251a2fd425f8cf950a17 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Feb 2021 00:33:01 +0100 Subject: [PATCH 36/93] CI: allow manually starting Debian builds, too --- .github/workflows/ci-debian.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-debian.yml b/.github/workflows/ci-debian.yml index b60ce29e6..b5fd42822 100644 --- a/.github/workflows/ci-debian.yml +++ b/.github/workflows/ci-debian.yml @@ -3,6 +3,7 @@ name: ci-debian-9 on: schedule: - cron: "12 23 * * *" + workflow_dispatch: env: BUILDDIR: /build From a215871da87abe87b4154479b954420aecc973d3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Feb 2021 00:39:45 +0100 Subject: [PATCH 37/93] CI: Debian doesn't come with sudo pre-installed --- .github/workflows/ci-debian.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-debian.yml b/.github/workflows/ci-debian.yml index b5fd42822..039a2cc29 100644 --- a/.github/workflows/ci-debian.yml +++ b/.github/workflows/ci-debian.yml @@ -23,9 +23,9 @@ jobs: steps: - name: "prepare env" run: | - sudo apt-get update - sudo apt-get -y install git-core - sudo apt-get -y install \ + apt-get update + apt-get -y install git-core + apt-get -y install \ build-essential \ cmake \ extra-cmake-modules \ From 3d72fb1bbebfc4ccb7633112508627be0914a1c8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Feb 2021 00:49:38 +0100 Subject: [PATCH 38/93] CI: notify about issues consistently with CI-builds --- .github/workflows/issues.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 698f0d733..ed7184789 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -13,14 +13,14 @@ jobs: if: github.event.issue.state == 'open' with: server: chat.freenode.net + nickname: cala-notify channel: "#calamares" - nickname: gh-issues message: "[${{ github.event.issue.title }}](${{ github.event.issue.html_url }}) opened by ${{ github.actor }}" - name: "notify: closed" uses: rectalogic/notify-irc@v1 if: github.event.issue.state != 'open' with: server: chat.freenode.net + nickname: cala-notify channel: "#calamares" - nickname: gh-issues message: "[${{ github.event.issue.title }}](${{ github.event.issue.html_url }}) closed by ${{ github.actor }}" From 45fb77fbf30b8856eba548606a7531e0c713fabe Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Feb 2021 00:49:58 +0100 Subject: [PATCH 39/93] CI: split Debian package installation --- .github/workflows/ci-debian.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-debian.yml b/.github/workflows/ci-debian.yml index 039a2cc29..1e7a0484f 100644 --- a/.github/workflows/ci-debian.yml +++ b/.github/workflows/ci-debian.yml @@ -40,7 +40,6 @@ jobs: libkf5parts-dev \ libkf5service-dev \ libkf5solid-dev \ - libkpmcore-dev \ libparted-dev \ libpolkit-qt5-1-dev \ libqt5svg5-dev \ @@ -53,6 +52,7 @@ jobs: qtdeclarative5-dev \ qttools5-dev \ qttools5-dev-tools + apt-get -y install libkpmcore-dev - name: "prepare source" uses: actions/checkout@v2 - name: "prepare build" From 4acf0d4d3420668267b754ab2f9976071a45b836 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Feb 2021 12:04:45 +0100 Subject: [PATCH 40/93] CI: show slightly more information on neon CI runs --- .github/workflows/ci-neon.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index bccdbd71e..eee870b1a 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -84,7 +84,7 @@ jobs: server: chat.freenode.net nickname: cala-notify channel: "#calamares" - message: "${{ github.workflow }} OK ${{ github.repository }} ${{ steps.pre_build.outputs.message }}" + message: "${{ github.workflow }} OK ${{ github.actor }} on ${{ github.event.ref }}\n.. ${{ steps.pre_build.outputs.message }}" - name: "notify: fail" uses: rectalogic/notify-irc@v1 if: ${{ failure() && github.repository == 'calamares/calamares' }} @@ -92,4 +92,4 @@ jobs: server: chat.freenode.net nickname: cala-notify channel: "#calamares" - message: "${{ github.workflow }} FAIL ${{ github.repository }} ${{ steps.pre_build.outputs.message }}\n.. DIFF ${{ github.event.compare }}" + message: "${{ github.workflow }} FAIL ${{ github.actor }} on ${{ github.event.ref }}\n.. ${{ steps.pre_build.outputs.message }}\n.. DIFF ${{ github.event.compare }}" From d4a564044642d5dd2a905888d993bb241a339c67 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Feb 2021 12:13:45 +0100 Subject: [PATCH 41/93] CI: Debian 9 is too old, stick with 10, update dependencies --- .github/workflows/ci-debian.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-debian.yml b/.github/workflows/ci-debian.yml index 1e7a0484f..6992b0a7f 100644 --- a/.github/workflows/ci-debian.yml +++ b/.github/workflows/ci-debian.yml @@ -1,4 +1,4 @@ -name: ci-debian-9 +name: ci-debian-10 on: schedule: @@ -18,7 +18,7 @@ jobs: build: runs-on: ubuntu-latest container: - image: docker://debian:9 + image: docker://debian:10 options: --tmpfs /build:rw --user 0:0 steps: - name: "prepare env" @@ -52,7 +52,18 @@ jobs: qtdeclarative5-dev \ qttools5-dev \ qttools5-dev-tools + # Same name as on KDE neon, different version apt-get -y install libkpmcore-dev + # Additional dependencies + apt-get -y install \ + libappstreamqt-dev \ + libicu-dev \ + libkf5crash-dev \ + libkf5package-dev \ + libkf5plasma-dev \ + libpwquality-dev \ + libqt5webenginewidgets5 \ + qtwebengine5-dev - name: "prepare source" uses: actions/checkout@v2 - name: "prepare build" @@ -78,7 +89,7 @@ jobs: server: chat.freenode.net nickname: cala-notify channel: "#calamares" - message: "${{ github.workflow }} OK ${{ github.repository }} ${{ steps.pre_build.outputs.message }}" + message: "${{ github.workflow }} OK ${{ steps.pre_build.outputs.message }}" - name: "notify: fail" uses: rectalogic/notify-irc@v1 if: ${{ failure() && github.repository == 'calamares/calamares' }} @@ -86,4 +97,4 @@ jobs: server: chat.freenode.net nickname: cala-notify channel: "#calamares" - message: "${{ github.workflow }} FAIL ${{ github.repository }} ${{ steps.pre_build.outputs.message }}\n.. DIFF ${{ github.event.compare }}" + message: "${{ github.workflow }} FAIL ${{ steps.pre_build.outputs.message }}\n.. DIFF ${{ github.event.compare }}" From 18cc4b5c6f2870fe7fbe6c36d3c0a7fc45642945 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Feb 2021 12:52:12 +0100 Subject: [PATCH 42/93] CI: add a scheduled openSUSE build, too --- .github/workflows/ci-opensuse.yml | 98 +++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 .github/workflows/ci-opensuse.yml diff --git a/.github/workflows/ci-opensuse.yml b/.github/workflows/ci-opensuse.yml new file mode 100644 index 000000000..dbf7ce15c --- /dev/null +++ b/.github/workflows/ci-opensuse.yml @@ -0,0 +1,98 @@ +name: ci-opensuse-leap + +on: + schedule: + - cron: "32 23 * * *" + workflow_dispatch: + +env: + BUILDDIR: /build + SRCDIR: ${{ github.workspace }} + CMAKE_ARGS: | + -DWEBVIEW_FORCE_WEBKIT=1 + -DKDE_INSTALL_USE_QT_SYS_PATHS=ON + -DWITH_PYTHONQT=OFF" + -DCMAKE_BUILD_TYPE=Debug + +jobs: + build: + runs-on: ubuntu-latest + container: + image: docker://opensuse/leap + options: --tmpfs /build:rw --user 0:0 + steps: + - name: "prepare env" + run: | + zypper --non-interactive up + zypper --non-interactive in git-core + # From deploycala.py + zypper --non-interactive in \ + "autoconf" \ + "automake" \ + "bison" \ + "flex" \ + "git" \ + "libtool" \ + "m4" \ + "make" \ + "cmake" \ + "extra-cmake-modules" \ + "gcc-c++" \ + "libqt5-qtbase-devel" \ + "libqt5-linguist-devel" \ + "libqt5-qtsvg-devel" \ + "libqt5-qtdeclarative-devel" \ + "libqt5-qtwebengine-devel" \ + "yaml-cpp-devel" \ + "libpolkit-qt5-1-devel" \ + "kservice-devel" \ + "kpackage-devel" \ + "kparts-devel" \ + "kcrash-devel" \ + "kpmcore-devel" \ + "plasma5-workspace-devel" \ + "plasma-framework-devel" \ + "libpwquality-devel" \ + "parted-devel" \ + "python3-devel" \ + "boost-devel" \ + "libboost_python-py3-*-devel" + # Additional dependencies + zypper --non-interactive in \ + libicu-devel \ + libAppStreamQt-devel \ + libatasmart-devel + - name: "prepare source" + uses: actions/checkout@v2 + - name: "prepare build" + id: pre_build + run: | + test -n "$BUILDDIR" || { echo "! \$BUILDDIR not set" ; exit 1 ; } + mkdir -p $BUILDDIR + test -f $SRCDIR/CMakeLists.txt || { echo "! Missing $SRCDIR/CMakeLists.txt" ; exit 1 ; } + echo "::set-output name=message::"`git log -1 --abbrev-commit --pretty=oneline --no-decorate ${{ github.event.head_commit.id }}` + - name: "Calamares: cmake" + working-directory: ${{ env.BUILDDIR }} + run: cmake $CMAKE_ARGS $SRCDIR + - name: "Calamares: make" + working-directory: ${{ env.BUILDDIR }} + run: make -j2 VERBOSE=1 + - name: "Calamares: install" + working-directory: ${{ env.BUILDDIR }} + run: make install VERBOSE=1 + - name: "notify: ok" + uses: rectalogic/notify-irc@v1 + if: ${{ success() && github.repository == 'calamares/calamares' }} + with: + server: chat.freenode.net + nickname: cala-notify + channel: "#calamares" + message: "${{ github.workflow }} OK ${{ steps.pre_build.outputs.message }}" + - name: "notify: fail" + uses: rectalogic/notify-irc@v1 + if: ${{ failure() && github.repository == 'calamares/calamares' }} + with: + server: chat.freenode.net + nickname: cala-notify + channel: "#calamares" + message: "${{ github.workflow }} FAIL ${{ steps.pre_build.outputs.message }}\n.. DIFF ${{ github.event.compare }}" From e99c60728bc0ef91c1daa9d0702eee9ee314be6b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Feb 2021 13:36:05 +0100 Subject: [PATCH 43/93] CI: the 'DIFF' line does not make sense for scheduled builds --- .github/workflows/ci-debian.yml | 2 +- .github/workflows/ci-opensuse.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-debian.yml b/.github/workflows/ci-debian.yml index 6992b0a7f..70697f596 100644 --- a/.github/workflows/ci-debian.yml +++ b/.github/workflows/ci-debian.yml @@ -97,4 +97,4 @@ jobs: server: chat.freenode.net nickname: cala-notify channel: "#calamares" - message: "${{ github.workflow }} FAIL ${{ steps.pre_build.outputs.message }}\n.. DIFF ${{ github.event.compare }}" + message: "${{ github.workflow }} FAIL ${{ steps.pre_build.outputs.message }}" diff --git a/.github/workflows/ci-opensuse.yml b/.github/workflows/ci-opensuse.yml index dbf7ce15c..9e6f72002 100644 --- a/.github/workflows/ci-opensuse.yml +++ b/.github/workflows/ci-opensuse.yml @@ -95,4 +95,4 @@ jobs: server: chat.freenode.net nickname: cala-notify channel: "#calamares" - message: "${{ github.workflow }} FAIL ${{ steps.pre_build.outputs.message }}\n.. DIFF ${{ github.event.compare }}" + message: "${{ github.workflow }} FAIL ${{ steps.pre_build.outputs.message }}" From a383aa974abe8e54f886eb9c23437d2bdb05b623 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Feb 2021 13:38:52 +0100 Subject: [PATCH 44/93] [users] Need for unique_ptr - Although unique_ptr is only used when ICU is enabled, include it always because it is likely that we'll use more unique_ptr in the implementation at some point. --- src/modules/users/Config.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/users/Config.cpp b/src/modules/users/Config.cpp index ba7341a9c..165e21b9c 100644 --- a/src/modules/users/Config.cpp +++ b/src/modules/users/Config.cpp @@ -36,6 +36,8 @@ static const char TRANSLITERATOR_ID[] = "Russian-Latin/BGN;" "Latin-ASCII"; #endif +#include + static const QRegExp USERNAME_RX( "^[a-z_][a-z0-9_-]*[$]?$" ); static constexpr const int USERNAME_MAX_LENGTH = 31; From eafb8149b356fad37c919955f6f50515b456bd17 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Feb 2021 15:35:53 +0100 Subject: [PATCH 45/93] [libcalamares] Test some degenerate truncation cases --- src/libcalamares/utils/String.cpp | 25 +++++++++++++++++++++---- src/libcalamares/utils/String.h | 2 ++ src/libcalamares/utils/Tests.cpp | 29 ++++++++++++++++------------- 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/src/libcalamares/utils/String.cpp b/src/libcalamares/utils/String.cpp index 02b41f1c0..615d30309 100644 --- a/src/libcalamares/utils/String.cpp +++ b/src/libcalamares/utils/String.cpp @@ -135,14 +135,15 @@ truncateMultiLine( const QString& string, CalamaresUtils::LinesStartEnd lines, C return shorter; } - const int linesInString = string.count( NEWLINE ) + ( string.endsWith( NEWLINE ) ? 0 : 1 ); - if ( ( string.length() <= chars.total ) && ( linesInString <= maxLines ) ) + const int physicalLinesInString = string.count( NEWLINE ); + const int logicalLinesInString = physicalLinesInString + ( string.endsWith( NEWLINE ) ? 0 : 1 ); + if ( ( string.length() <= chars.total ) && ( logicalLinesInString <= maxLines ) ) { return string; } QString front, back; - if ( string.count( NEWLINE ) >= maxLines ) + if ( physicalLinesInString >= maxLines ) { int from = -1; for ( int i = 0; i < lines.atStart; ++i ) @@ -174,6 +175,22 @@ truncateMultiLine( const QString& string, CalamaresUtils::LinesStartEnd lines, C back = string.right( lastNewLine ); } } + else + { + // We have: <= maxLines and longer than chars.total, so: + // - carve out a chunk in the middle, based a little on + // how the balance of atStart and atEnd is + const int charsToChop = string.length() - chars.total; + if ( charsToChop < 1 ) + { + // That's strange, again + return string; + } + const int startPortion = charsToChop * lines.atStart / maxLines; + const int endPortion = charsToChop * lines.atEnd / maxLines; + front = string.left( string.length() / 2 - startPortion ); + back = string.right( string.length() / 2 - endPortion ); + } if ( front.length() + back.length() <= chars.total ) { @@ -200,7 +217,7 @@ truncateMultiLine( const QString& string, CalamaresUtils::LinesStartEnd lines, C } // Both are non-empty, so nibble away at both of them front.truncate( chars.total / 2 ); - if ( !front.endsWith( NEWLINE ) ) + if ( !front.endsWith( NEWLINE ) && physicalLinesInString > 0 ) { front.append( NEWLINE ); } diff --git a/src/libcalamares/utils/String.h b/src/libcalamares/utils/String.h index 43e0474fa..e08255f86 100644 --- a/src/libcalamares/utils/String.h +++ b/src/libcalamares/utils/String.h @@ -89,6 +89,8 @@ struct CharCount * @p lines.atStart is zero) or end (if @p lines.atEnd is zero) or in the middle * (if both are nonzero). * + * Asking for 0 lines will make this behave like QString::truncate(). + * * @param string the input string. * @param lines number of lines to preserve. * @param chars maximum number of characters in the returned string. diff --git a/src/libcalamares/utils/Tests.cpp b/src/libcalamares/utils/Tests.cpp index 3ee48890e..cdb37f20d 100644 --- a/src/libcalamares/utils/Tests.cpp +++ b/src/libcalamares/utils/Tests.cpp @@ -676,33 +676,36 @@ and the translations updated.)" ); } } -void LibCalamaresTests::testStringTruncationDegenerate() +void +LibCalamaresTests::testStringTruncationDegenerate() { Logger::setupLogLevel( Logger::LOGDEBUG ); using namespace CalamaresUtils; // This is quite long, 1 line only, with no newlines - const QString longString( - "The portscout new distfile checker has detected that one or more of your" - "ports appears to be out of date. Please take the opportunity to check" - "each of the ports listed below, and if possible and appropriate," - "submit/commit an update. If any ports have already been updated, you can" - "safely ignore the entry." ); + const QString longString( "The portscout new distfile checker has detected that one or more of your " + "ports appears to be out of date. Please take the opportunity to check " + "each of the ports listed below, and if possible and appropriate, " + "submit/commit an update. If any ports have already been updated, you can " + "safely ignore the entry." ); const char NEWLINE = '\n'; const int quiteShort = 16; - QVERIFY( longString.length() > quiteShort); - QVERIFY( !longString.contains(NEWLINE)); - QVERIFY( longString.indexOf(NEWLINE) < 0); + QVERIFY( longString.length() > quiteShort ); + QVERIFY( !longString.contains( NEWLINE ) ); + QVERIFY( longString.indexOf( NEWLINE ) < 0 ); { auto s = truncateMultiLine( longString, LinesStartEnd { 1, 0 }, CharCount { quiteShort } ); cDebug() << "Result-line" << Logger::Quote << s; QVERIFY( s.length() > 1 ); - QCOMPARE( s.length(), quiteShort); // Newline between front and back part - QVERIFY( s.startsWith( "The " ) ); - QVERIFY( s.endsWith( "entry." ) ); + QCOMPARE( s.length(), quiteShort ); // No newline between front and back part + QVERIFY( s.startsWith( "The port" ) ); // 8, which is quiteShort / 2 + QVERIFY( s.endsWith( "e entry." ) ); // also 8 chars + + auto t = truncateMultiLine( longString, LinesStartEnd { 2, 2 }, CharCount { quiteShort } ); + QCOMPARE( s, t ); } } From c3d27be103c46e7873bb9df04853960756bf578b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Feb 2021 16:36:56 +0100 Subject: [PATCH 46/93] Changes: patch up the credits --- CHANGES | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 187ec76e4..21324721f 100644 --- a/CHANGES +++ b/CHANGES @@ -11,7 +11,11 @@ website will have to do for older versions. This release contains contributions from (alphabetically by first name): - Anubhav Choudhary + - benne-dee - Gaël PORTAY + - Jonas Strassel + - Kevin Kofler + - Matti Hyttinen - Neal Gompa ## Core ## @@ -19,6 +23,8 @@ This release contains contributions from (alphabetically by first name): the "exec" phase of installation. THanks Anubhav. ## Modules ## + - *bootloader* now uses the current file names for the UEFI Secure Boot + shim instead of obsolete ones. - *partition* includes more information about what it will do, including GPT partition types (in human-readable format, if possible). Thanks Gaël. - Some edge-cases with overlay filesystems have been resolved in the @@ -29,8 +35,6 @@ This release contains contributions from (alphabetically by first name): failed installations if automount grabs partitions while they are being created. The code is prepared to handle other ways to control automount-behavior as well. - - *bootloader* now uses the current file names for the UEFI Secure Boot - shim instead of obsolete ones. # 3.2.35.1 (2020-12-07) # From f3752e200ad299f7021b40d3e615cb056bc5a534 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Feb 2021 16:40:01 +0100 Subject: [PATCH 47/93] [libcalamaresui] Display first 6, last 2 lines of long error messages, preserve newlines --- src/libcalamaresui/ViewManager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index 39f0bb902..d25b7cdee 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -153,7 +153,10 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail QString text = "

" + message + "

"; if ( !details.isEmpty() ) { - text += "

" + CalamaresUtils::truncateMultiLine( details, CalamaresUtils::LinesStartEnd { 8, 0 } ) + "

"; + text += "

" + + CalamaresUtils::truncateMultiLine( details, CalamaresUtils::LinesStartEnd { 6, 2 } ) + .replace( '\n', QStringLiteral( "
" ) ) + + "

"; } if ( shouldOfferWebPaste ) { From 1704ad597795d3142627e2fc3119fae3dab621a8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Feb 2021 19:18:19 +0100 Subject: [PATCH 48/93] [partition] Add a job to handle automount behavior - while here, nudge CalamaresUtils automount API a little, since it doesn't really need an rvalue-ref. --- src/libcalamares/partition/AutoMount.cpp | 2 +- src/libcalamares/partition/AutoMount.h | 2 +- src/modules/partition/CMakeLists.txt | 1 + .../partition/jobs/AutoMountManagementJob.cpp | 39 +++++++++++++++++ .../partition/jobs/AutoMountManagementJob.h | 42 +++++++++++++++++++ 5 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 src/modules/partition/jobs/AutoMountManagementJob.cpp create mode 100644 src/modules/partition/jobs/AutoMountManagementJob.h diff --git a/src/libcalamares/partition/AutoMount.cpp b/src/libcalamares/partition/AutoMount.cpp index 0fc253067..0edc89bf4 100644 --- a/src/libcalamares/partition/AutoMount.cpp +++ b/src/libcalamares/partition/AutoMount.cpp @@ -79,7 +79,7 @@ automountDisable( bool disable ) void -automountRestore( std::shared_ptr< AutoMountInfo >&& t ) +automountRestore( const std::shared_ptr< AutoMountInfo >& t ) { QDBusConnection dbus = QDBusConnection::sessionBus(); enableSolidAutoMount( dbus, t->wasSolidModuleAutoLoaded ); diff --git a/src/libcalamares/partition/AutoMount.h b/src/libcalamares/partition/AutoMount.h index a9a88e320..c792eeb99 100644 --- a/src/libcalamares/partition/AutoMount.h +++ b/src/libcalamares/partition/AutoMount.h @@ -43,7 +43,7 @@ DLLEXPORT std::shared_ptr< AutoMountInfo > automountDisable( bool disable = true * Pass the value returned from automountDisable() to restore the * previous settings. */ -DLLEXPORT void automountRestore( std::shared_ptr< AutoMountInfo >&& t ); +DLLEXPORT void automountRestore( const std::shared_ptr< AutoMountInfo >& t ); } // namespace Partition } // namespace CalamaresUtils diff --git a/src/modules/partition/CMakeLists.txt b/src/modules/partition/CMakeLists.txt index b623309c5..ac47714ce 100644 --- a/src/modules/partition/CMakeLists.txt +++ b/src/modules/partition/CMakeLists.txt @@ -79,6 +79,7 @@ if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND gui/ScanningDialog.cpp gui/ReplaceWidget.cpp gui/VolumeGroupBaseDialog.cpp + jobs/AutoMountManagementJob.cpp jobs/ClearMountsJob.cpp jobs/ClearTempMountsJob.cpp jobs/CreatePartitionJob.cpp diff --git a/src/modules/partition/jobs/AutoMountManagementJob.cpp b/src/modules/partition/jobs/AutoMountManagementJob.cpp new file mode 100644 index 000000000..2ea23666c --- /dev/null +++ b/src/modules/partition/jobs/AutoMountManagementJob.cpp @@ -0,0 +1,39 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2021 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Calamares is Free Software: see the License-Identifier above. + * + */ + +#include "AutoMountManagementJob.h" + +#include "utils/Logger.h" + +AutoMountManagementJob::AutoMountManagementJob( bool disable ) + : m_disable( disable ) +{ +} + +QString +AutoMountManagementJob::prettyName() const +{ + return tr( "Manage auto-mount settings" ); +} + +Calamares::JobResult +AutoMountManagementJob::exec() +{ + cDebug() << "this" << Logger::Pointer( this ) << "value" << Logger::Pointer( m_stored.get() ); + if ( m_stored ) + { + CalamaresUtils::Partition::automountRestore( m_stored ); + m_stored.reset(); + } + else + { + m_stored = CalamaresUtils::Partition::automountDisable( m_disable ); + } + return Calamares::JobResult::ok(); +} diff --git a/src/modules/partition/jobs/AutoMountManagementJob.h b/src/modules/partition/jobs/AutoMountManagementJob.h new file mode 100644 index 000000000..e1dcf16dc --- /dev/null +++ b/src/modules/partition/jobs/AutoMountManagementJob.h @@ -0,0 +1,42 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2021 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Calamares is Free Software: see the License-Identifier above. + * + */ + +#ifndef PARTITION_AUTOMOUNTMANAGEMENTJOB_H +#define PARTITION_AUTOMOUNTMANAGEMENTJOB_H + +#include "Job.h" + +#include "partition/AutoMount.h" + +/** + * This job sets automounting to a specific value, and when run a + * second time, **re**sets to the original value. See the documentation + * for CalamaresUtils::Partition::automountDisable() for details. + * Use @c true to **disable** automounting. + * + * Effectively: queue the **same** job twice; the first time it runs + * it will set the automount behavior, and the second time it + * restores the original. + * + */ +class AutoMountManagementJob : public Calamares::Job +{ + Q_OBJECT +public: + AutoMountManagementJob( bool disable = true ); + + QString prettyName() const override; + Calamares::JobResult exec() override; + +private: + bool m_disable; + decltype( CalamaresUtils::Partition::automountDisable( true ) ) m_stored; +}; + +#endif /* PARTITION_AUTOMOUNTMANAGEMENTJOB_H */ From aae815cf3bc081c72936571761d46df5c02e0b8e Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 2 Feb 2021 23:01:59 +0100 Subject: [PATCH 49/93] [partition] Add trivial test for automount management job --- .../partition/tests/AutoMountTests.cpp | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/modules/partition/tests/AutoMountTests.cpp diff --git a/src/modules/partition/tests/AutoMountTests.cpp b/src/modules/partition/tests/AutoMountTests.cpp new file mode 100644 index 000000000..b31b8cbc5 --- /dev/null +++ b/src/modules/partition/tests/AutoMountTests.cpp @@ -0,0 +1,58 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Calamares is Free Software: see the License-Identifier above. + * + */ + +#include "jobs/AutoMountManagementJob.h" + +#include "utils/Logger.h" + +#include +#include + +class AutoMountJobTests : public QObject +{ + Q_OBJECT +public: + AutoMountJobTests(); + +private Q_SLOTS: + void testRunThrice(); +}; + +AutoMountJobTests::AutoMountJobTests() {} + +/* This doesn't really test anything, since automount management + * is supposed to be opaque: the job always returns true. What + * is interesting is the debug output, where the job informs + * about the pointer it holds. + * + * That should output 0, then non-zero, then 0 again. + * + */ +void +AutoMountJobTests::testRunThrice() +{ + Logger::setupLogLevel( Logger::LOGDEBUG ); + + auto original = CalamaresUtils::Partition::automountDisable( true ); + cDebug() << "Got automount info" << Logger::Pointer( original.get() ); + + AutoMountManagementJob j( false ); + QVERIFY( j.exec() ); + QVERIFY( j.exec() ); + QVERIFY( j.exec() ); + + CalamaresUtils::Partition::automountRestore( original ); +} + + +QTEST_GUILESS_MAIN( AutoMountJobTests ) + +#include "utils/moc-warnings.h" + +#include "AutoMountTests.moc" From c98a330bf96449baf45ce206df8e45924e4c3d0c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 3 Feb 2021 00:46:00 +0100 Subject: [PATCH 50/93] [libcalamares] Store DBus reply value, drop debug-logging --- src/libcalamares/partition/AutoMount.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/libcalamares/partition/AutoMount.cpp b/src/libcalamares/partition/AutoMount.cpp index 0edc89bf4..adc844816 100644 --- a/src/libcalamares/partition/AutoMount.cpp +++ b/src/libcalamares/partition/AutoMount.cpp @@ -12,6 +12,8 @@ #include +#include + namespace CalamaresUtils { namespace Partition @@ -58,13 +60,21 @@ querySolidAutoMount( QDBusConnection& dbus, AutoMountInfo& info ) // Find previous setting; this **does** need to block auto msg = kdedCall( QStringLiteral( "isModuleAutoloaded" ) ); msg.setArguments( { moduleName } ); + std::optional< bool > result; QDBusMessage r = dbus.call( msg, QDBus::Block ); if ( r.type() == QDBusMessage::ReplyMessage ) { auto arg = r.arguments(); - cDebug() << arg; - info.wasSolidModuleAutoLoaded = false; + if ( arg.length() == 1 ) + { + auto v = arg.at( 0 ); + if ( v.isValid() && v.type() == QVariant::Bool ) + { + result = v.toBool(); + } + } } + info.wasSolidModuleAutoLoaded = result.has_value() ? result.value() : false; } std::shared_ptr< AutoMountInfo > From c43a6ab86630c77bc3187f59b4be4c6b180f5a8b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 3 Feb 2021 00:46:34 +0100 Subject: [PATCH 51/93] [partition] Improve logging in automount test - switch logging in job to VERBOSE because we don't want to be printing pointers to the regular session log - switch logging in test to VERBOSE to actually see the messages from the Job - hook the test into the build --- src/modules/partition/jobs/AutoMountManagementJob.cpp | 2 +- src/modules/partition/tests/AutoMountTests.cpp | 2 +- src/modules/partition/tests/CMakeLists.txt | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/partition/jobs/AutoMountManagementJob.cpp b/src/modules/partition/jobs/AutoMountManagementJob.cpp index 2ea23666c..7ce3ac930 100644 --- a/src/modules/partition/jobs/AutoMountManagementJob.cpp +++ b/src/modules/partition/jobs/AutoMountManagementJob.cpp @@ -25,7 +25,7 @@ AutoMountManagementJob::prettyName() const Calamares::JobResult AutoMountManagementJob::exec() { - cDebug() << "this" << Logger::Pointer( this ) << "value" << Logger::Pointer( m_stored.get() ); + Logger::CDebug(Logger::LOGVERBOSE) << "this" << Logger::Pointer( this ) << "value" << Logger::Pointer( m_stored.get() ); if ( m_stored ) { CalamaresUtils::Partition::automountRestore( m_stored ); diff --git a/src/modules/partition/tests/AutoMountTests.cpp b/src/modules/partition/tests/AutoMountTests.cpp index b31b8cbc5..f09cd3d97 100644 --- a/src/modules/partition/tests/AutoMountTests.cpp +++ b/src/modules/partition/tests/AutoMountTests.cpp @@ -37,7 +37,7 @@ AutoMountJobTests::AutoMountJobTests() {} void AutoMountJobTests::testRunThrice() { - Logger::setupLogLevel( Logger::LOGDEBUG ); + Logger::setupLogLevel( Logger::LOGVERBOSE ); auto original = CalamaresUtils::Partition::automountDisable( true ); cDebug() << "Got automount info" << Logger::Pointer( original.get() ); diff --git a/src/modules/partition/tests/CMakeLists.txt b/src/modules/partition/tests/CMakeLists.txt index f16435230..8edef484c 100644 --- a/src/modules/partition/tests/CMakeLists.txt +++ b/src/modules/partition/tests/CMakeLists.txt @@ -58,3 +58,11 @@ calamares_add_test( DEFINITIONS ${_partition_defs} ) +calamares_add_test( + automounttests + SOURCES + ${PartitionModule_SOURCE_DIR}/jobs/AutoMountManagementJob.cpp + AutoMountTests.cpp + LIBRARIES + calamares +) From 38fa1d95674eb1371b01f1c3892ff9691013dda4 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 3 Feb 2021 00:54:38 +0100 Subject: [PATCH 52/93] [libcalamares] Distinguish logging raw, shared and unique pointers - It shouldn't be necessary to explicitly .get() pointers for logging, and it's convenient to know when a pointer is smart. * no annotation means raw (e.g. @0x0) * S means shared * U means unique --- src/libcalamares/utils/Logger.h | 32 +++++++++++++++++-- .../partition/jobs/AutoMountManagementJob.cpp | 2 +- .../partition/tests/AutoMountTests.cpp | 2 +- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/libcalamares/utils/Logger.h b/src/libcalamares/utils/Logger.h index a53ab7e19..f318c78a6 100644 --- a/src/libcalamares/utils/Logger.h +++ b/src/libcalamares/utils/Logger.h @@ -13,10 +13,13 @@ #ifndef UTILS_LOGGER_H #define UTILS_LOGGER_H -#include - #include "DllMacro.h" +#include +#include + +#include + namespace Logger { struct FuncSuppressor @@ -206,16 +209,34 @@ public: * Pointers are printed as void-pointer, so just an address (unlike, say, * QObject pointers which show an address and some metadata) preceded * by an '@'. This avoids C-style (void*) casts in the code. + * + * Shared pointers are indicated by 'S@' and unique pointers by 'U@'. */ struct Pointer { public: explicit Pointer( const void* p ) : ptr( p ) + , kind( 0 ) + { + } + + template < typename T > + explicit Pointer( const std::shared_ptr< T >& p ) + : ptr( p.get() ) + , kind( 'S' ) + { + } + + template < typename T > + explicit Pointer( const std::unique_ptr< T >& p ) + : ptr( p.get() ) + , kind( 'U' ) { } const void* const ptr; + const char kind; }; /** @brief output operator for DebugRow */ @@ -256,7 +277,12 @@ operator<<( QDebug& s, const DebugMap& t ) inline QDebug& operator<<( QDebug& s, const Pointer& p ) { - s << NoQuote << '@' << p.ptr << Quote; + s << NoQuote; + if ( p.kind ) + { + s << p.kind; + } + s << '@' << p.ptr << Quote; return s; } } // namespace Logger diff --git a/src/modules/partition/jobs/AutoMountManagementJob.cpp b/src/modules/partition/jobs/AutoMountManagementJob.cpp index 7ce3ac930..8078c17d5 100644 --- a/src/modules/partition/jobs/AutoMountManagementJob.cpp +++ b/src/modules/partition/jobs/AutoMountManagementJob.cpp @@ -25,7 +25,7 @@ AutoMountManagementJob::prettyName() const Calamares::JobResult AutoMountManagementJob::exec() { - Logger::CDebug(Logger::LOGVERBOSE) << "this" << Logger::Pointer( this ) << "value" << Logger::Pointer( m_stored.get() ); + Logger::CDebug(Logger::LOGVERBOSE) << "this" << Logger::Pointer( this ) << "value" << Logger::Pointer( m_stored ); if ( m_stored ) { CalamaresUtils::Partition::automountRestore( m_stored ); diff --git a/src/modules/partition/tests/AutoMountTests.cpp b/src/modules/partition/tests/AutoMountTests.cpp index f09cd3d97..87b6d5d4a 100644 --- a/src/modules/partition/tests/AutoMountTests.cpp +++ b/src/modules/partition/tests/AutoMountTests.cpp @@ -40,7 +40,7 @@ AutoMountJobTests::testRunThrice() Logger::setupLogLevel( Logger::LOGVERBOSE ); auto original = CalamaresUtils::Partition::automountDisable( true ); - cDebug() << "Got automount info" << Logger::Pointer( original.get() ); + cDebug() << "Got automount info" << Logger::Pointer( original ); AutoMountManagementJob j( false ); QVERIFY( j.exec() ); From 17f73b1294aec3d82f4efef035a1bf0e6ce2703f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 3 Feb 2021 01:26:49 +0100 Subject: [PATCH 53/93] [partition] Test automount job in a queue --- .../partition/jobs/AutoMountManagementJob.cpp | 3 +- .../partition/tests/AutoMountTests.cpp | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/modules/partition/jobs/AutoMountManagementJob.cpp b/src/modules/partition/jobs/AutoMountManagementJob.cpp index 8078c17d5..9472eae9c 100644 --- a/src/modules/partition/jobs/AutoMountManagementJob.cpp +++ b/src/modules/partition/jobs/AutoMountManagementJob.cpp @@ -25,7 +25,8 @@ AutoMountManagementJob::prettyName() const Calamares::JobResult AutoMountManagementJob::exec() { - Logger::CDebug(Logger::LOGVERBOSE) << "this" << Logger::Pointer( this ) << "value" << Logger::Pointer( m_stored ); + Logger::CDebug( Logger::LOGVERBOSE ) << "this" << Logger::Pointer( this ) << "value" << Logger::Pointer( m_stored ) + << ( m_stored ? "restore" : m_disable ? "disable" : "enable" ); if ( m_stored ) { CalamaresUtils::Partition::automountRestore( m_stored ); diff --git a/src/modules/partition/tests/AutoMountTests.cpp b/src/modules/partition/tests/AutoMountTests.cpp index 87b6d5d4a..fcebe02bd 100644 --- a/src/modules/partition/tests/AutoMountTests.cpp +++ b/src/modules/partition/tests/AutoMountTests.cpp @@ -10,6 +10,7 @@ #include "jobs/AutoMountManagementJob.h" #include "utils/Logger.h" +#include "JobQueue.h" #include #include @@ -22,6 +23,7 @@ public: private Q_SLOTS: void testRunThrice(); + void testRunQueue(); }; AutoMountJobTests::AutoMountJobTests() {} @@ -50,6 +52,33 @@ AutoMountJobTests::testRunThrice() CalamaresUtils::Partition::automountRestore( original ); } +void AutoMountJobTests::testRunQueue() +{ + Calamares::JobQueue q; + Calamares::job_ptr jp( new AutoMountManagementJob( false ) ); + QSignalSpy progress( &q, &Calamares::JobQueue::progress ); + QSignalSpy finish( &q, &Calamares::JobQueue::finished ); + QSignalSpy fail( &q, &Calamares::JobQueue::failed ); + + Logger::setupLogLevel( Logger::LOGVERBOSE ); + cDebug() << "Got automount job" << jp; + + QVERIFY( !q.isRunning() ); + q.enqueue( 2, { jp, jp } ); + QVERIFY( !q.isRunning() ); + + QEventLoop loop; + QTimer::singleShot( std::chrono::milliseconds( 100 ), [&q](){ q.start(); } ); + QTimer::singleShot( std::chrono::milliseconds( 5000 ), [&loop](){ loop.quit(); } ); + connect( &q, &Calamares::JobQueue::finished, &loop, &QEventLoop::quit ); + loop.exec(); + + QCOMPARE( fail.count(), 0 ); + QCOMPARE( finish.count(), 1 ); + // 5 progress: 0% and 100% for each *job* and then 100% overall + QCOMPARE( progress.count(), 5 ); +} + QTEST_GUILESS_MAIN( AutoMountJobTests ) From 144b51f00ea4a04c4cbf2db45e2abf556eab5f6a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 3 Feb 2021 01:31:37 +0100 Subject: [PATCH 54/93] [partition] Use automount control FIXES #1604 (Admittedly, this fixes the problem only when there's Plasma Solid automount present, and not any of the other kinds; but none of those have been reported yet, and adding them into AutoMount.cpp is opaque to the rest of the system) --- src/modules/partition/core/PartitionCoreModule.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/partition/core/PartitionCoreModule.cpp b/src/modules/partition/core/PartitionCoreModule.cpp index 254d007c1..f99c78745 100644 --- a/src/modules/partition/core/PartitionCoreModule.cpp +++ b/src/modules/partition/core/PartitionCoreModule.cpp @@ -21,6 +21,7 @@ #include "core/PartUtils.h" #include "core/PartitionInfo.h" #include "core/PartitionModel.h" +#include "jobs/AutoMountManagementJob.h" #include "jobs/ClearMountsJob.h" #include "jobs/ClearTempMountsJob.h" #include "jobs/CreatePartitionJob.h" @@ -576,6 +577,11 @@ PartitionCoreModule::jobs( const Config* config ) const #endif #endif + // The automountControl job goes in the list twice: the first + // time it runs, it disables automount and remembers the old setting + // for automount; the second time it restores that old setting. + Calamares::job_ptr automountControl( new AutoMountManagementJob( true /* disable automount */ ) ); + lst << automountControl; lst << Calamares::job_ptr( new ClearTempMountsJob() ); for ( auto info : m_deviceInfos ) @@ -592,6 +598,7 @@ PartitionCoreModule::jobs( const Config* config ) const devices << info->device.data(); } lst << Calamares::job_ptr( new FillGlobalStorageJob( config, devices, m_bootLoaderInstallPath ) ); + lst << automountControl; return lst; } From 3fbca3ab4c03f8c30fd6f253b780d274e5d8a0ed Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Jan 2021 23:49:09 +0100 Subject: [PATCH 55/93] Changes: pre-release housekeeping --- CHANGES | 7 +++++-- CMakeLists.txt | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 21324721f..d83e1b4e5 100644 --- a/CHANGES +++ b/CHANGES @@ -7,7 +7,7 @@ contributors are listed. Note that Calamares does not have a historical changelog -- this log starts with version 3.2.0. The release notes on the website will have to do for older versions. -# 3.2.36 (unreleased) # +# 3.2.36 (2021-02-03) # This release contains contributions from (alphabetically by first name): - Anubhav Choudhary @@ -20,11 +20,14 @@ This release contains contributions from (alphabetically by first name): ## Core ## - It is now possible to hide the *next* and *back* buttons during - the "exec" phase of installation. THanks Anubhav. + the "exec" phase of installation. Thanks Anubhav. + - The Calamares CI has migrated to GitHub actions. Thanks Jonas. ## Modules ## - *bootloader* now uses the current file names for the UEFI Secure Boot shim instead of obsolete ones. + - The *mount* module creates swap in its own subvolume, if btrfs is used. + Thanks Matti. - *partition* includes more information about what it will do, including GPT partition types (in human-readable format, if possible). Thanks Gaël. - Some edge-cases with overlay filesystems have been resolved in the diff --git a/CMakeLists.txt b/CMakeLists.txt index 976823805..775b42bc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,7 @@ project( CALAMARES LANGUAGES C CXX ) -set( CALAMARES_VERSION_RC 1 ) # Set to 0 during release cycle, 1 during development +set( CALAMARES_VERSION_RC 0 ) # Set to 0 during release cycle, 1 during development ### OPTIONS # From 39cae1f0fbc79cf4774c5d7d2d002a533c03ec14 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 3 Feb 2021 11:57:24 +0100 Subject: [PATCH 56/93] CI: change notification usernames and messages a little --- .github/workflows/ci-debian.yml | 8 ++++---- .github/workflows/ci-neon.yml | 8 ++++---- .github/workflows/ci-opensuse.yml | 10 +++++----- .github/workflows/issues.yml | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci-debian.yml b/.github/workflows/ci-debian.yml index 70697f596..26f58f594 100644 --- a/.github/workflows/ci-debian.yml +++ b/.github/workflows/ci-debian.yml @@ -87,14 +87,14 @@ jobs: if: ${{ success() && github.repository == 'calamares/calamares' }} with: server: chat.freenode.net - nickname: cala-notify + nickname: cala-ci channel: "#calamares" - message: "${{ github.workflow }} OK ${{ steps.pre_build.outputs.message }}" + message: "SCHEDULED ${{ github.workflow }} OK ${{ steps.pre_build.outputs.message }}" - name: "notify: fail" uses: rectalogic/notify-irc@v1 if: ${{ failure() && github.repository == 'calamares/calamares' }} with: server: chat.freenode.net - nickname: cala-notify + nickname: cala-ci channel: "#calamares" - message: "${{ github.workflow }} FAIL ${{ steps.pre_build.outputs.message }}" + message: "SCHEDULED ${{ github.workflow }} FAIL ${{ steps.pre_build.outputs.message }}" diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index eee870b1a..eb5904209 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -82,14 +82,14 @@ jobs: if: ${{ success() && github.repository == 'calamares/calamares' }} with: server: chat.freenode.net - nickname: cala-notify + nickname: cala-ci channel: "#calamares" - message: "${{ github.workflow }} OK ${{ github.actor }} on ${{ github.event.ref }}\n.. ${{ steps.pre_build.outputs.message }}" + message: "PUSH ${{ github.workflow }} OK ${{ github.actor }} on ${{ github.event.ref }}\n.. ${{ steps.pre_build.outputs.message }}" - name: "notify: fail" uses: rectalogic/notify-irc@v1 if: ${{ failure() && github.repository == 'calamares/calamares' }} with: server: chat.freenode.net - nickname: cala-notify + nickname: cala-ci channel: "#calamares" - message: "${{ github.workflow }} FAIL ${{ github.actor }} on ${{ github.event.ref }}\n.. ${{ steps.pre_build.outputs.message }}\n.. DIFF ${{ github.event.compare }}" + message: "PUSH ${{ github.workflow }} FAIL ${{ github.actor }} on ${{ github.event.ref }}\n.. ${{ steps.pre_build.outputs.message }}\n.. DIFF ${{ github.event.compare }}" diff --git a/.github/workflows/ci-opensuse.yml b/.github/workflows/ci-opensuse.yml index 9e6f72002..c9098dbc1 100644 --- a/.github/workflows/ci-opensuse.yml +++ b/.github/workflows/ci-opensuse.yml @@ -1,4 +1,4 @@ -name: ci-opensuse-leap +name: ci-opensuse on: schedule: @@ -85,14 +85,14 @@ jobs: if: ${{ success() && github.repository == 'calamares/calamares' }} with: server: chat.freenode.net - nickname: cala-notify + nickname: cala-ci channel: "#calamares" - message: "${{ github.workflow }} OK ${{ steps.pre_build.outputs.message }}" + message: "SCHEDULED ${{ github.workflow }} OK ${{ steps.pre_build.outputs.message }}" - name: "notify: fail" uses: rectalogic/notify-irc@v1 if: ${{ failure() && github.repository == 'calamares/calamares' }} with: server: chat.freenode.net - nickname: cala-notify + nickname: cala-ci channel: "#calamares" - message: "${{ github.workflow }} FAIL ${{ steps.pre_build.outputs.message }}" + message: "SCHEDULED ${{ github.workflow }} FAIL ${{ steps.pre_build.outputs.message }}" diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index ed7184789..e8d2821ae 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -13,14 +13,14 @@ jobs: if: github.event.issue.state == 'open' with: server: chat.freenode.net - nickname: cala-notify + nickname: cala-issues channel: "#calamares" - message: "[${{ github.event.issue.title }}](${{ github.event.issue.html_url }}) opened by ${{ github.actor }}" + message: "OPENED ${{ github.event.issue.html_url }} by ${{ github.actor }} ${{ github.event.issue.title }}" - name: "notify: closed" uses: rectalogic/notify-irc@v1 if: github.event.issue.state != 'open' with: server: chat.freenode.net - nickname: cala-notify + nickname: cala-issues channel: "#calamares" - message: "[${{ github.event.issue.title }}](${{ github.event.issue.html_url }}) closed by ${{ github.actor }}" + message: "CLOSED ${{ github.event.issue.html_url }} by ${{ github.actor }} ${{ github.event.issue.title }}" From 0d1355d4577ffbd4f6f5a616bfbdfee2c464ca02 Mon Sep 17 00:00:00 2001 From: Calamares CI Date: Wed, 3 Feb 2021 12:05:46 +0100 Subject: [PATCH 57/93] i18n: [calamares] Automatic merge of Transifex translations --- lang/calamares_he.ts | 8 +++--- lang/calamares_id.ts | 34 +++++++++++------------ lang/calamares_ne_NP.ts | 60 ++++++++++++++++++++--------------------- lang/calamares_pt_BR.ts | 10 +++---- lang/calamares_tr_TR.ts | 2 +- 5 files changed, 57 insertions(+), 57 deletions(-) diff --git a/lang/calamares_he.ts b/lang/calamares_he.ts index 7e8ae9cdb..97683a19a 100644 --- a/lang/calamares_he.ts +++ b/lang/calamares_he.ts @@ -495,7 +495,7 @@ The installer will quit and all changes will be lost. %1 Installer - תכנית התקנת %1 + אשף התקנת %1 @@ -539,7 +539,7 @@ The installer will quit and all changes will be lost. Reuse %1 as home partition for %2. - להשתמש ב־%1 כמחיצת הבית (home) עבור %2. + שימוש ב־%1 כמחיצת הבית (home) עבור %2. @@ -3341,7 +3341,7 @@ Output: Flag new partition as <strong>%1</strong>. - סמן מחיצה חדשה כ <strong>%1</strong>. + סימון המחיצה החדשה בתור <strong>%1</strong>. @@ -4065,7 +4065,7 @@ Output: Your Full Name - שם המלא + שמך המלא diff --git a/lang/calamares_id.ts b/lang/calamares_id.ts index 33966e696..b790ef61b 100644 --- a/lang/calamares_id.ts +++ b/lang/calamares_id.ts @@ -11,12 +11,12 @@ This system was started with an <strong>EFI</strong> boot environment.<br><br>To configure startup from an EFI environment, this installer must deploy a boot loader application, like <strong>GRUB</strong> or <strong>systemd-boot</strong> on an <strong>EFI System Partition</strong>. This is automatic, unless you choose manual partitioning, in which case you must choose it or create it on your own. - Sistem ini telah dimulai dengan lingkungan boot <strong>EFI</strong>.<br><br>Untuk mengkonfigurasi startup dari lingkungan EFI, installer ini seharusnya memaparkan sebuah aplikasi boot loader, seperti <strong>GRUB</strong> atau <strong>systemd-boot</strong> pada sebuah <strong>EFI System Partition</strong>. Ini adalah otomatis, kecuali kalau kamu memilih pemartisian manual, dalam beberapa kasus kamu harus memilihnya atau menciptakannya pada milikmu. + Sistem ini telah dimulai dengan lingkungan boot <strong>EFI</strong>.<br><br>Untuk mengkonfigurasi startup dari lingkungan EFI, installer ini seharusnya memaparkan sebuah aplikasi boot loader, seperti <strong>GRUB</strong> atau <strong>systemd-boot</strong> pada sebuah <strong>EFI System Partition</strong>. Ini adalah otomatis, kecuali kalau kamu memilih pemartisian manual, dalam kasus ini kamu harus memilihnya atau menciptakannya sendiri. This system was started with a <strong>BIOS</strong> boot environment.<br><br>To configure startup from a BIOS environment, this installer must install a boot loader, like <strong>GRUB</strong>, either at the beginning of a partition or on the <strong>Master Boot Record</strong> near the beginning of the partition table (preferred). This is automatic, unless you choose manual partitioning, in which case you must set it up on your own. - Sistem ini dimulai dengan sebuah lingkungan boot <strong>BIOS</strong>.<br><br>Untuk mengkonfigurasi startup dari sebuah lingkungan BIOS, installer ini seharusnya memasang sebuah boot loader, seperti <strong>GRUB</strong>, baik di awal partisi atau pada <strong>Master Boot Record</strong> di dekat awalan tabel partisi (yang disukai). Ini adalah otomatis, kecuali kalau kamu memilih pemartisian manual, dalam beberapa kasus kamu harus menyetelnya pada milikmu. + Sistem ini dimulai dengan sebuah lingkungan boot <strong>BIOS</strong>.<br><br>Untuk mengkonfigurasi startup dari sebuah lingkungan BIOS, installer ini harus memasang sebuah boot loader, seperti <strong>GRUB</strong>, baik di awal partisi atau pada <strong>Master Boot Record</strong> di dekat awalan tabel partisi (yang disukai). Ini adalah otomatis, kecuali kalau kamu memilih pemartisian manual, dalam beberapa kasus kamu harus menyetelnya sendiri. @@ -101,7 +101,7 @@ Reload Stylesheet - + Muat ulang Lembar gaya @@ -235,8 +235,8 @@ Waiting for %n module(s). - - + + Menunggu %n modul(). @@ -267,7 +267,7 @@ Would you like to paste the install log to the web? - Maukah anda untuk menempelkan log pemasangan ke situs? + Maukah anda untuk menempelkan log instalasi ke situs? @@ -324,7 +324,7 @@ Continue with installation? - + Lanjutkan instalasi? @@ -454,7 +454,8 @@ Instalasi akan ditutup dan semua perubahan akan hilang. Install log posted to: %1 - + Log instalasi terunggah ke: +%1 @@ -630,7 +631,7 @@ Instalasi akan ditutup dan semua perubahan akan hilang. No Swap - Tidak perlu SWAP + Tidak pakai SWAP @@ -640,7 +641,7 @@ Instalasi akan ditutup dan semua perubahan akan hilang. Swap (no Hibernate) - Swap (tidak hibernasi) + Swap (tanpa hibernasi) @@ -768,8 +769,7 @@ Instalasi akan ditutup dan semua perubahan akan hilang. This computer does not satisfy the minimum requirements for installing %1.<br/>Installation cannot continue. <a href="#details">Details...</a> - Komputer ini tidak memenuhi syarat minimum untuk memasang %1. -Installer tidak dapat dilanjutkan. <a href=" + Komputer ini tidak memenuhi syarat minimum untuk memasang %1.<br/>Instalasi tidak dapat dilanjutkan. <a href="#details">Lebih rinci...</a> @@ -790,7 +790,7 @@ Instalasi dapat dilanjutkan, namun beberapa fitur akan dinonfungsikan. <h1>Welcome to the Calamares setup program for %1</h1> - + <h1>Selamat datang ke program Calamares untuk %1</h1> @@ -815,12 +815,12 @@ Instalasi dapat dilanjutkan, namun beberapa fitur akan dinonfungsikan. '%1' is not allowed as username. - + '%1' tidak diperbolehkan sebagai nama pengguna. Your username must start with a lowercase letter or underscore. - + Nama penggunamu harus diawali dengan huruf kecil atau garis bawah. @@ -840,12 +840,12 @@ Instalasi dapat dilanjutkan, namun beberapa fitur akan dinonfungsikan. '%1' is not allowed as hostname. - + '%1' tidak diperbolehkan sebagai hostname. Only letters, numbers, underscore and hyphen are allowed. - + Hanya huruf, angka, garis bawah, dan tanda penghubung yang diperbolehkan. diff --git a/lang/calamares_ne_NP.ts b/lang/calamares_ne_NP.ts index 13990c086..6cd62c736 100644 --- a/lang/calamares_ne_NP.ts +++ b/lang/calamares_ne_NP.ts @@ -39,7 +39,7 @@ Do not install a boot loader - + बूट लोडर install नगर्ने @@ -52,7 +52,7 @@ Blank Page - + खाली पृष्ठ @@ -60,7 +60,7 @@ Form - + फारम @@ -80,7 +80,7 @@ Type: - + प्रकार @@ -96,7 +96,7 @@ Tools - + औजारहरु @@ -145,7 +145,7 @@ Done - + सकियो @@ -153,7 +153,7 @@ Example job (%1) - + उदाहरण कार्य (%1) @@ -212,7 +212,7 @@ Loading ... - + लोड हुँदैछ ... @@ -222,7 +222,7 @@ Loading failed. - + लोड भएन । @@ -366,7 +366,7 @@ Setup is complete. Close the setup program. - + सेटअप सकियो । सेटअप प्रोग्राम बन्द गर्नु होस  @@ -504,7 +504,7 @@ The installer will quit and all changes will be lost. Form - + फारम @@ -547,7 +547,7 @@ The installer will quit and all changes will be lost. Boot loader location: - + बूट लोडरको स्थान @@ -631,12 +631,12 @@ The installer will quit and all changes will be lost. No Swap - + swap छैन Reuse Swap - + swap पुनः प्रयोग गर्नुहोस @@ -789,22 +789,22 @@ The installer will quit and all changes will be lost. <h1>Welcome to the Calamares setup program for %1</h1> - + %1 को लागि Calamares Setup Programमा स्वागत छ । <h1>Welcome to %1 setup</h1> - + %1 को Setupमा स्वागत छ । <h1>Welcome to the Calamares installer for %1</h1> - + %1 को लागि Calamares Installerमा स्वागत छ । <h1>Welcome to the %1 installer</h1> - + %1 को Installerमा स्वागत छ । @@ -849,7 +849,7 @@ The installer will quit and all changes will be lost. Your passwords do not match! - + पासवर्डहरू मिलेन ।  @@ -1256,7 +1256,7 @@ The installer will quit and all changes will be lost. Form - + फारम @@ -1323,7 +1323,7 @@ The installer will quit and all changes will be lost. Form - + फारम @@ -1605,7 +1605,7 @@ The installer will quit and all changes will be lost. Form - + फारम @@ -2263,7 +2263,7 @@ The installer will quit and all changes will be lost. Form - + फारम @@ -2317,7 +2317,7 @@ The installer will quit and all changes will be lost. Form - + फारम @@ -2335,7 +2335,7 @@ The installer will quit and all changes will be lost. Form - + फारम @@ -2511,7 +2511,7 @@ The installer will quit and all changes will be lost. Form - + फारम @@ -2721,7 +2721,7 @@ The installer will quit and all changes will be lost. Form - + फारम @@ -2945,7 +2945,7 @@ Output: Form - + फारम @@ -3588,7 +3588,7 @@ Output: Form - + फारम @@ -3736,7 +3736,7 @@ Output: Form - + फारम diff --git a/lang/calamares_pt_BR.ts b/lang/calamares_pt_BR.ts index 563fa2982..9ce469a7d 100644 --- a/lang/calamares_pt_BR.ts +++ b/lang/calamares_pt_BR.ts @@ -291,7 +291,7 @@ &Close - Fe&char + &Fechar @@ -396,7 +396,7 @@ &Done - Concluí&do + &Concluído @@ -512,7 +512,7 @@ O instalador será fechado e todas as alterações serão perdidas. Select storage de&vice: - Selecione o dispositi&vo de armazenamento: + Selecione o dispositivo de armazenamento: @@ -898,7 +898,7 @@ O instalador será fechado e todas as alterações serão perdidas. Fi&le System: - Sistema de &Arquivos: + Sistema de Arquivos: @@ -908,7 +908,7 @@ O instalador será fechado e todas as alterações serão perdidas. &Mount Point: - Ponto de &Montagem: + Ponto de Montagem: diff --git a/lang/calamares_tr_TR.ts b/lang/calamares_tr_TR.ts index e69766fff..0df78b0c7 100644 --- a/lang/calamares_tr_TR.ts +++ b/lang/calamares_tr_TR.ts @@ -3845,7 +3845,7 @@ Kuruluma devam edebilirsiniz fakat bazı özellikler devre dışı kalabilir. <h1>%1</h1><br/><strong>%2<br/>for %3</strong><br/><br/>Copyright 2014-2017 Teo Mrnjavac &lt;teo@kde.org&gt;<br/>Copyright 2017-2020 Adriaan de Groot &lt;groot@kde.org&gt;<br/>Thanks to <a href="https://calamares.io/team/">the Calamares team</a> and the <a href="https://www.transifex.com/calamares/calamares/">Calamares translators team</a>.<br/><br/><a href="https://calamares.io/">Calamares</a> development is sponsored by <br/><a href="http://www.blue-systems.com/">Blue Systems</a> - Liberating Software. - <h1>%1</h1><br/><strong>%2<br/>for %3</strong><br/><br/>Telif Hakkı 2014-2017 Teo Mrnjavac &lt;teo@kde.org&gt;<br/>Telif Hakkı 2017-2020 Adriaan de Groot &lt;groot@kde.org&gt;<br/>Teşekkrürler <a href="https://calamares.io/team/">Calamares takımı</a> ve <a href="https://www.transifex.com/calamares/calamares/">Calamares çeviri ekibi</a>.<br/><br/><a href="https://calamares.io/">Calamares</a> gelişim sponsoru <br/><a href="http://www.blue-systems.com/">Blue Systems</a> - Özgür Yazılım + <h1>%1</h1><br/><strong>%2<br/>for %3</strong><br/><br/>Telif Hakkı 2014-2017 Teo Mrnjavac &lt;teo@kde.org&gt;<br/>Telif Hakkı 2017-2020 Adriaan de Groot &lt;groot@kde.org&gt;<br/>Teşekkürler <a href="https://calamares.io/team/">Calamares takımı</a> ve <a href="https://www.transifex.com/calamares/calamares/">Calamares çeviri ekibi</a>.<br/><br/><a href="https://calamares.io/">Calamares</a> gelişim sponsoru <br/><a href="http://www.blue-systems.com/">Blue Systems</a> - Özgür Yazılım From 2f7790d691bc617081642500c21c82a51a6ba3db Mon Sep 17 00:00:00 2001 From: Calamares CI Date: Wed, 3 Feb 2021 12:05:46 +0100 Subject: [PATCH 58/93] i18n: [python] Automatic merge of Transifex translations --- lang/python/az/LC_MESSAGES/python.po | 4 ++-- lang/python/az_AZ/LC_MESSAGES/python.po | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lang/python/az/LC_MESSAGES/python.po b/lang/python/az/LC_MESSAGES/python.po index 5a03b748d..1b6dc2444 100644 --- a/lang/python/az/LC_MESSAGES/python.po +++ b/lang/python/az/LC_MESSAGES/python.po @@ -4,7 +4,7 @@ # FIRST AUTHOR , YEAR. # # Translators: -# xxmn77 , 2020 +# Xəyyam Qocayev , 2020 # #, fuzzy msgid "" @@ -13,7 +13,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-07 17:09+0100\n" "PO-Revision-Date: 2017-08-09 10:34+0000\n" -"Last-Translator: xxmn77 , 2020\n" +"Last-Translator: Xəyyam Qocayev , 2020\n" "Language-Team: Azerbaijani (https://www.transifex.com/calamares/teams/20061/az/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/lang/python/az_AZ/LC_MESSAGES/python.po b/lang/python/az_AZ/LC_MESSAGES/python.po index 027e819d5..546cd56c1 100644 --- a/lang/python/az_AZ/LC_MESSAGES/python.po +++ b/lang/python/az_AZ/LC_MESSAGES/python.po @@ -4,7 +4,7 @@ # FIRST AUTHOR , YEAR. # # Translators: -# xxmn77 , 2020 +# Xəyyam Qocayev , 2020 # #, fuzzy msgid "" @@ -13,7 +13,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-12-07 17:09+0100\n" "PO-Revision-Date: 2017-08-09 10:34+0000\n" -"Last-Translator: xxmn77 , 2020\n" +"Last-Translator: Xəyyam Qocayev , 2020\n" "Language-Team: Azerbaijani (Azerbaijan) (https://www.transifex.com/calamares/teams/20061/az_AZ/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" From b8a9c4c3b78aa58e289dd9212f399e3f6af690b0 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 3 Feb 2021 13:48:01 +0100 Subject: [PATCH 59/93] [users] Be more forgiving in tests - the host system's /etc/group is being read, and that varies between host OS versions; since I was doing today's release on KaOS, the test was failing because of arbitrary differences between the default groups on each Linux flavor. --- src/modules/users/TestGroupInformation.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/modules/users/TestGroupInformation.cpp b/src/modules/users/TestGroupInformation.cpp index 21b8d47ce..31ca032c7 100644 --- a/src/modules/users/TestGroupInformation.cpp +++ b/src/modules/users/TestGroupInformation.cpp @@ -64,10 +64,9 @@ GroupTests::testReadGroup() #else QVERIFY( groups.contains( QStringLiteral( "root" ) ) ); #endif - // openSUSE doesn't have "sys" - // QVERIFY( groups.contains( QStringLiteral( "sys" ) ) ); - QVERIFY( groups.contains( QStringLiteral( "nogroup" ) ) ); QVERIFY( groups.contains( QStringLiteral( "tty" ) ) ); + // openSUSE doesn't have "sys", KaOS doesn't have "nogroup" + QVERIFY( groups.contains( QStringLiteral( "sys" ) ) || groups.contains( QStringLiteral( "nogroup" ) ) ); for ( const QString& s : groups ) { From 4ae3a7af617dfe6272558cc39c94a4c2dbde6bb8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 3 Feb 2021 16:54:18 +0100 Subject: [PATCH 60/93] [finished] Start Config-ification - Introduce a Config class with suitable properties for use in QML, read configuration; this is unused right now. --- src/modules/finished/CMakeLists.txt | 1 + src/modules/finished/Config.cpp | 84 +++++++++++++++++++++++++++++ src/modules/finished/Config.h | 53 ++++++++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 src/modules/finished/Config.cpp create mode 100644 src/modules/finished/Config.h diff --git a/src/modules/finished/CMakeLists.txt b/src/modules/finished/CMakeLists.txt index 21eb1ad18..b4d59db8f 100644 --- a/src/modules/finished/CMakeLists.txt +++ b/src/modules/finished/CMakeLists.txt @@ -11,6 +11,7 @@ calamares_add_plugin( finished TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES + Config.cpp FinishedViewStep.cpp FinishedPage.cpp UI diff --git a/src/modules/finished/Config.cpp b/src/modules/finished/Config.cpp new file mode 100644 index 000000000..7a84e8f22 --- /dev/null +++ b/src/modules/finished/Config.cpp @@ -0,0 +1,84 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2021 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Calamares is Free Software: see the License-Identifier above. + * + */ + +#include "Config.h" + +#include "utils/Logger.h" +#include "utils/Variant.h" + +const NamedEnumTable< Config::RestartMode >& +restartModes() +{ + using M = Config::RestartMode; + static const NamedEnumTable< M > table { { "never", M::Never }, + { "user-unchecked", M::UserDefaultUnchecked }, + { "unchecked", M::UserDefaultUnchecked }, + { "user-checked", M::UserDefaultChecked }, + { "checked", M::UserDefaultChecked }, + { "always", M::Always } + + }; + return table; +} + + +Config::Config( QObject* parent ) + : QObject( parent ) +{ +} + +void +Config::setConfigurationMap( const QVariantMap& configurationMap ) +{ + RestartMode mode = RestartMode::Never; + + QString restartMode = CalamaresUtils::getString( configurationMap, "restartNowMode" ); + if ( restartMode.isEmpty() ) + { + if ( configurationMap.contains( "restartNowEnabled" ) ) + { + cWarning() << "Configuring the finished module with deprecated restartNowEnabled settings"; + } + + bool restartNowEnabled = CalamaresUtils::getBool( configurationMap, "restartNowEnabled", false ); + bool restartNowChecked = CalamaresUtils::getBool( configurationMap, "restartNowChecked", false ); + + if ( !restartNowEnabled ) + { + mode = RestartMode::Never; + } + else + { + mode = restartNowChecked ? RestartMode::UserDefaultChecked : RestartMode::UserDefaultUnchecked; + } + } + else + { + bool ok = false; + mode = restartModes().find( restartMode, ok ); + if ( !ok ) + { + cWarning() << "Configuring the finished module with bad restartNowMode" << restartMode; + } + } + + m_restartNowMode = mode; + + if ( mode != RestartMode::Never ) + { + QString restartNowCommand = CalamaresUtils::getString( configurationMap, "restartNowCommand" ); + if ( restartNowCommand.isEmpty() ) + { + restartNowCommand = QStringLiteral( "shutdown -r now" ); + } + m_restartNowCommand = restartNowCommand; + } + + m_notifyOnFinished = CalamaresUtils::getBool( configurationMap, "notifyOnFinished", false ); +} diff --git a/src/modules/finished/Config.h b/src/modules/finished/Config.h new file mode 100644 index 000000000..9b8c5d8d3 --- /dev/null +++ b/src/modules/finished/Config.h @@ -0,0 +1,53 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2021 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Calamares is Free Software: see the License-Identifier above. + * + */ + +#ifndef FINISHED_CONFIG_H +#define FINISHED_CONFIG_H + +#include "utils/NamedEnum.h" + +#include + +#include + +class Config : public QObject +{ + Q_OBJECT + + Q_PROPERTY( QString restartNowCommand READ restartNowCommand CONSTANT FINAL ) + Q_PROPERTY( RestartMode restartNowMode READ restartNowMode CONSTANT FINAL ) + Q_PROPERTY( bool notifyOnFinished READ notifyOnFinished CONSTANT FINAL ) + +public: + Config( QObject* parent = nullptr ); + + enum class RestartMode + { + Never, + UserDefaultUnchecked, + UserDefaultChecked, + Always + }; + Q_ENUM( RestartMode ) + + QString restartNowCommand() const { return m_restartNowCommand; } + RestartMode restartNowMode() const { return m_restartNowMode; } + bool notifyOnFinished() const { return m_notifyOnFinished; } + + void setConfigurationMap( const QVariantMap& configurationMap ); + +private: + QString m_restartNowCommand; + RestartMode m_restartNowMode = RestartMode::Never; + bool m_notifyOnFinished = false; +}; + +const NamedEnumTable< Config::RestartMode >& restartModes(); + +#endif From c82b802f4ed6f41d3da8a9febb9bf1eb68680412 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 3 Feb 2021 17:12:33 +0100 Subject: [PATCH 61/93] [libcalamares] Typo in documentation --- src/libcalamares/utils/NamedEnum.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcalamares/utils/NamedEnum.h b/src/libcalamares/utils/NamedEnum.h index cf56a26f2..1ac6c67b5 100644 --- a/src/libcalamares/utils/NamedEnum.h +++ b/src/libcalamares/utils/NamedEnum.h @@ -98,7 +98,7 @@ struct NamedEnumTable /** @brief Find a value @p s in the table and return its name. * - * Returns emptry string if the value is not found. + * Returns empty string if the value is not found. */ string_t find( enum_t s ) const { From cb4248e56d8f3b8a770c71ec511ebd29faf2d6c3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 3 Feb 2021 17:14:49 +0100 Subject: [PATCH 62/93] [finished] Move config from viewstep to config object - the configuration is still duplicated in the widget, and functionality still needs to move to the Config object - the ViewStep is cut down to almost nothing --- src/modules/finished/FinishedPage.cpp | 18 +++--- src/modules/finished/FinishedPage.h | 9 +-- src/modules/finished/FinishedViewStep.cpp | 71 ++--------------------- src/modules/finished/FinishedViewStep.h | 18 ++---- 4 files changed, 25 insertions(+), 91 deletions(-) diff --git a/src/modules/finished/FinishedPage.cpp b/src/modules/finished/FinishedPage.cpp index 23f09df99..618efa02e 100644 --- a/src/modules/finished/FinishedPage.cpp +++ b/src/modules/finished/FinishedPage.cpp @@ -10,10 +10,12 @@ */ #include "FinishedPage.h" +#include "ui_FinishedPage.h" +#include "Branding.h" +#include "Settings.h" #include "CalamaresVersion.h" #include "ViewManager.h" -#include "ui_FinishedPage.h" #include "utils/CalamaresUtilsGui.h" #include "utils/Logger.h" #include "utils/Retranslator.h" @@ -24,13 +26,11 @@ #include #include -#include "Branding.h" -#include "Settings.h" FinishedPage::FinishedPage( QWidget* parent ) : QWidget( parent ) , ui( new Ui::FinishedPage ) - , m_mode( FinishedViewStep::RestartMode::UserUnchecked ) + , m_mode( Config::RestartMode::UserDefaultUnchecked ) { ui->setupUi( this ); @@ -66,15 +66,15 @@ FinishedPage::FinishedPage( QWidget* parent ) void -FinishedPage::setRestart( FinishedViewStep::RestartMode mode ) +FinishedPage::setRestart( Config::RestartMode mode ) { - using Mode = FinishedViewStep::RestartMode; + using Mode = Config::RestartMode; m_mode = mode; ui->restartCheckBox->setVisible( mode != Mode::Never ); ui->restartCheckBox->setEnabled( mode != Mode::Always ); - ui->restartCheckBox->setChecked( ( mode == Mode::Always ) || ( mode == Mode::UserChecked ) ); + ui->restartCheckBox->setChecked( ( mode == Mode::Always ) || ( mode == Mode::UserDefaultChecked ) ); } @@ -89,7 +89,7 @@ void FinishedPage::setUpRestart() { cDebug() << "FinishedPage::setUpRestart(), Quit button" - << "setup=" << FinishedViewStep::modeName( m_mode ) << "command=" << m_restartNowCommand; + << "setup=" << restartModes().find( m_mode ) << "command=" << m_restartNowCommand; connect( qApp, &QApplication::aboutToQuit, [this]() { if ( ui->restartCheckBox->isVisible() && ui->restartCheckBox->isChecked() ) @@ -124,5 +124,5 @@ FinishedPage::onInstallationFailed( const QString& message, const QString& detai "The error message was: %2." ) .arg( branding->versionedName() ) .arg( message ) ); - setRestart( FinishedViewStep::RestartMode::Never ); + setRestart( Config::RestartMode::Never ); } diff --git a/src/modules/finished/FinishedPage.h b/src/modules/finished/FinishedPage.h index 1df022f58..30df5f8c3 100644 --- a/src/modules/finished/FinishedPage.h +++ b/src/modules/finished/FinishedPage.h @@ -11,9 +11,10 @@ #ifndef FINISHEDPAGE_H #define FINISHEDPAGE_H -#include -#include "FinishedViewStep.h" +#include "Config.h" + +#include namespace Ui { @@ -26,7 +27,7 @@ class FinishedPage : public QWidget public: explicit FinishedPage( QWidget* parent = nullptr ); - void setRestart( FinishedViewStep::RestartMode mode ); + void setRestart( Config::RestartMode mode ); void setRestartNowCommand( const QString& command ); void setUpRestart(); @@ -40,7 +41,7 @@ protected: private: Ui::FinishedPage* ui; - FinishedViewStep::RestartMode m_mode; + Config::RestartMode m_mode; QString m_restartNowCommand; }; diff --git a/src/modules/finished/FinishedViewStep.cpp b/src/modules/finished/FinishedViewStep.cpp index 525108dc7..cd7fcc0d0 100644 --- a/src/modules/finished/FinishedViewStep.cpp +++ b/src/modules/finished/FinishedViewStep.cpp @@ -25,24 +25,11 @@ #include #include -static const NamedEnumTable< FinishedViewStep::RestartMode >& -modeNames() -{ - using Mode = FinishedViewStep::RestartMode; - - static const NamedEnumTable< Mode > names { { QStringLiteral( "never" ), Mode::Never }, - { QStringLiteral( "user-unchecked" ), Mode::UserUnchecked }, - { QStringLiteral( "user-checked" ), Mode::UserChecked }, - { QStringLiteral( "always" ), Mode::Always } }; - - return names; -} - FinishedViewStep::FinishedViewStep( QObject* parent ) : Calamares::ViewStep( parent ) + , m_config( new Config( this )) , m_widget( new FinishedPage() ) , installFailed( false ) - , m_notifyOnFinished( false ) { auto jq = Calamares::JobQueue::instance(); connect( jq, &Calamares::JobQueue::failed, m_widget, &FinishedPage::onInstallationFailed ); @@ -146,7 +133,7 @@ FinishedViewStep::onActivate() { m_widget->setUpRestart(); - if ( m_notifyOnFinished ) + if ( m_config->notifyOnFinished() ) { sendNotification(); } @@ -170,59 +157,13 @@ FinishedViewStep::onInstallationFailed( const QString& message, const QString& d void FinishedViewStep::setConfigurationMap( const QVariantMap& configurationMap ) { - RestartMode mode = RestartMode::Never; + m_config->setConfigurationMap(configurationMap); + m_widget->setRestart( m_config->restartNowMode() ); - QString restartMode = CalamaresUtils::getString( configurationMap, "restartNowMode" ); - if ( restartMode.isEmpty() ) + if ( m_config->restartNowMode() != Config::RestartMode::Never ) { - if ( configurationMap.contains( "restartNowEnabled" ) ) - { - cWarning() << "Configuring the finished module with deprecated restartNowEnabled settings"; - } - - bool restartNowEnabled = CalamaresUtils::getBool( configurationMap, "restartNowEnabled", false ); - bool restartNowChecked = CalamaresUtils::getBool( configurationMap, "restartNowChecked", false ); - - if ( !restartNowEnabled ) - { - mode = RestartMode::Never; - } - else - { - mode = restartNowChecked ? RestartMode::UserChecked : RestartMode::UserUnchecked; - } + m_widget->setRestartNowCommand( m_config->restartNowCommand() ); } - else - { - bool ok = false; - mode = modeNames().find( restartMode, ok ); - if ( !ok ) - { - cWarning() << "Configuring the finished module with bad restartNowMode" << restartMode; - } - } - - m_widget->setRestart( mode ); - - if ( mode != RestartMode::Never ) - { - QString restartNowCommand = CalamaresUtils::getString( configurationMap, "restartNowCommand" ); - if ( restartNowCommand.isEmpty() ) - { - restartNowCommand = QStringLiteral( "shutdown -r now" ); - } - m_widget->setRestartNowCommand( restartNowCommand ); - } - - m_notifyOnFinished = CalamaresUtils::getBool( configurationMap, "notifyOnFinished", false ); } -QString -FinishedViewStep::modeName( FinishedViewStep::RestartMode m ) -{ - bool ok = false; - return modeNames().find( m, ok ); // May be QString() -} - - CALAMARES_PLUGIN_FACTORY_DEFINITION( FinishedViewStepFactory, registerPlugin< FinishedViewStep >(); ) diff --git a/src/modules/finished/FinishedViewStep.h b/src/modules/finished/FinishedViewStep.h index 729f9126d..aa71ab38a 100644 --- a/src/modules/finished/FinishedViewStep.h +++ b/src/modules/finished/FinishedViewStep.h @@ -11,12 +11,14 @@ #ifndef FINISHEDVIEWSTEP_H #define FINISHEDVIEWSTEP_H -#include +#include "Config.h" +#include "DllMacro.h" #include "utils/PluginFactory.h" #include "viewpages/ViewStep.h" -#include "DllMacro.h" + +#include class FinishedPage; @@ -25,16 +27,6 @@ class PLUGINDLLEXPORT FinishedViewStep : public Calamares::ViewStep Q_OBJECT public: - enum class RestartMode - { - Never = 0, ///< @brief Don't show button, just exit - UserUnchecked, ///< @brief Show button, starts unchecked - UserChecked, ///< @brief Show button, starts checked - Always ///< @brief Show button, can't change, checked - }; - /// @brief Returns the config-name of the given restart-mode @p m - static QString modeName( RestartMode m ); - explicit FinishedViewStep( QObject* parent = nullptr ); ~FinishedViewStep() override; @@ -58,6 +50,7 @@ public slots: void onInstallationFailed( const QString& message, const QString& details ); private: + Config* m_config; FinishedPage* m_widget; /** @@ -67,7 +60,6 @@ private: void sendNotification(); bool installFailed; - bool m_notifyOnFinished; }; CALAMARES_PLUGIN_FACTORY_DECLARATION( FinishedViewStepFactory ) From 84240683f5591a9fe6b6ba7069851f105e89927d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 3 Feb 2021 17:16:22 +0100 Subject: [PATCH 63/93] [finished] Apply coding style --- src/modules/finished/FinishedPage.cpp | 2 +- src/modules/finished/FinishedViewStep.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/finished/FinishedPage.cpp b/src/modules/finished/FinishedPage.cpp index 618efa02e..118ee96bf 100644 --- a/src/modules/finished/FinishedPage.cpp +++ b/src/modules/finished/FinishedPage.cpp @@ -13,8 +13,8 @@ #include "ui_FinishedPage.h" #include "Branding.h" -#include "Settings.h" #include "CalamaresVersion.h" +#include "Settings.h" #include "ViewManager.h" #include "utils/CalamaresUtilsGui.h" #include "utils/Logger.h" diff --git a/src/modules/finished/FinishedViewStep.cpp b/src/modules/finished/FinishedViewStep.cpp index cd7fcc0d0..310dda25a 100644 --- a/src/modules/finished/FinishedViewStep.cpp +++ b/src/modules/finished/FinishedViewStep.cpp @@ -27,7 +27,7 @@ FinishedViewStep::FinishedViewStep( QObject* parent ) : Calamares::ViewStep( parent ) - , m_config( new Config( this )) + , m_config( new Config( this ) ) , m_widget( new FinishedPage() ) , installFailed( false ) { @@ -157,7 +157,7 @@ FinishedViewStep::onInstallationFailed( const QString& message, const QString& d void FinishedViewStep::setConfigurationMap( const QVariantMap& configurationMap ) { - m_config->setConfigurationMap(configurationMap); + m_config->setConfigurationMap( configurationMap ); m_widget->setRestart( m_config->restartNowMode() ); if ( m_config->restartNowMode() != Config::RestartMode::Never ) From fc034828c71eeb8f2881adb692298aa42169fb13 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 5 Feb 2021 13:10:12 +0100 Subject: [PATCH 64/93] Changes: post-release housekeeping --- CHANGES | 12 ++++++++++++ CMakeLists.txt | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index d83e1b4e5..aa5dba206 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,18 @@ contributors are listed. Note that Calamares does not have a historical changelog -- this log starts with version 3.2.0. The release notes on the website will have to do for older versions. +# 3.2.37 (unreleased) # + +This release contains contributions from (alphabetically by first name): + - No external contributors yet + +## Core ## + - No core changes yet + +## Modules ## + - No module changes yet + + # 3.2.36 (2021-02-03) # This release contains contributions from (alphabetically by first name): diff --git a/CMakeLists.txt b/CMakeLists.txt index 775b42bc5..108549a8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,11 +41,11 @@ # TODO:3.3: Require CMake 3.12 cmake_minimum_required( VERSION 3.3 FATAL_ERROR ) project( CALAMARES - VERSION 3.2.36 + VERSION 3.2.37 LANGUAGES C CXX ) -set( CALAMARES_VERSION_RC 0 ) # Set to 0 during release cycle, 1 during development +set( CALAMARES_VERSION_RC 1 ) # Set to 0 during release cycle, 1 during development ### OPTIONS # From f045e4f00e3e45bf977a8a1cbf048aab617ae95c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 7 Feb 2021 22:35:32 +0100 Subject: [PATCH 65/93] [libcalamares] Switch default language in Belarus *If* the distro has GeoIP enabled and auto-selects the language for Calamares, then Belarus now selects Russian, rather the Belarusian. This is based on some personal input, mostly, and Wikipedia census data. FIXES #1634 --- src/libcalamares/locale/CountryData_p.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libcalamares/locale/CountryData_p.cpp b/src/libcalamares/locale/CountryData_p.cpp index 932a1996d..f439de27c 100644 --- a/src/libcalamares/locale/CountryData_p.cpp +++ b/src/libcalamares/locale/CountryData_p.cpp @@ -29,7 +29,8 @@ /* MODIFICATIONS * * Edited anyway: - * 20191211 India changed to AnyLanguage, since Hindi doesn't make sense. #1284 + * 20191211 India (IN) changed to AnyLanguage, since Hindi doesn't make sense. #1284 + * 20210207 Belarus (BY) changed to Russian, as the more-common-language. #1634 * */ @@ -77,7 +78,7 @@ static const CountryData country_data_table[] = { { QLocale::Language::Portuguese, QLocale::Country::Brazil, 'B', 'R' }, { QLocale::Language::Dzongkha, QLocale::Country::Bhutan, 'B', 'T' }, { QLocale::Language::AnyLanguage, QLocale::Country::BouvetIsland, 'B', 'V' }, -{ QLocale::Language::Belarusian, QLocale::Country::Belarus, 'B', 'Y' }, +{ QLocale::Language::Russian, QLocale::Country::Belarus, 'B', 'Y' }, { QLocale::Language::Swahili, QLocale::Country::CongoKinshasa, 'C', 'D' }, { QLocale::Language::French, QLocale::Country::CentralAfricanRepublic, 'C', 'F' }, { QLocale::Language::French, QLocale::Country::CongoBrazzaville, 'C', 'G' }, From e49f0cf3bac8135465bb1258b72065f738650e18 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 9 Feb 2021 17:03:19 +0100 Subject: [PATCH 66/93] [libcalamares] Document NamedEnum in much more detail --- src/libcalamares/utils/NamedEnum.h | 155 ++++++++++++++++++++++++++--- 1 file changed, 140 insertions(+), 15 deletions(-) diff --git a/src/libcalamares/utils/NamedEnum.h b/src/libcalamares/utils/NamedEnum.h index cf56a26f2..1d839ddc4 100644 --- a/src/libcalamares/utils/NamedEnum.h +++ b/src/libcalamares/utils/NamedEnum.h @@ -11,11 +11,13 @@ /** @brief Support for "named" enumerations * - * For tables which map string names to enum values, provide a NamedEnumTable - * which hangs on to an initializer_list of pairs of names and values. - * This table can be used with find() to map names to values, or - * values to names. A convenience function smash() is provided to help - * in printing integer (underlying) values of an enum. + * When a string needs to be one specific string out of a set of + * alternatives -- one "name" from an enumerated set -- then it + * is useful to have an **enum type** for the enumeration so that + * C++ code can work with the (strong) type of the enum, while + * the string can be used for human-readable interaction. + * The `NamedEnumTable` template provides support for naming + * values of an enum. */ #ifndef UTILS_NAMEDENUM_H @@ -27,7 +29,100 @@ #include #include -/** @brief Type for collecting parts of a named enum. */ +/** @brief Type for collecting parts of a named enum. + * + * The `NamedEnumTable` template provides support for naming + * values of an enum. It supports mapping strings to enum values + * and mapping enum values to strings. + * + * ## Example + * + * Suppose we have code where there are three alternatives; it is + * useful to have a strong type to make the alternatives visible + * in that code, so the compiler can help check: + * + * ``` + * enum class MilkshakeSize { None, Small, Large }; + * ``` + * + * In a switch() statement, the compiler will check that all kinds + * of milkshakes are dealt with; we can pass a MilkshakeSize to + * a function and rest assured that nobody will call that function + * with a silly value, like `1`. + * + * There is no relation between the C++ identifiers used, and + * any I/O related to that enumeration. In other words, + * + * ``` + * std::cout << MilkshakeSize::Small; + * ``` + * + * Will **not** print out "Small", or "small", or 1. It won't even + * compile, because there is no mapping of the enum values to + * something that can be output. + * + * By making a `NamedEnumTable` we can define a mapping + * between strings (names) and enum values, so that we can easily + * output the human-readable name, and also take string input + * and convert it to an enum value. Suppose we have a function + * `milkshakeSizeNames()` that returns a reference to such a table, + * then we can use `find()` to map enums-to-names and names-to-enums. + * + * ``` + * const auto& names = milkshakeSizeNames(); + * MilkshakeSize sz{ MilkshakeSize::Large }; + * std::cout << names.find(sz); // Probably "large" + * + * bool ok; + * sz = names.find( "small", ok ); // Probably MilkshakeSize::Small + * ``` + * + * ## Usage + * + * It is recommended to use a static const declaration for the table; + * typical use will define a function that returns a reference to + * the table, for shared use. + * + * The constructor for a table takes an initializer_list; each element + * of the initializer_list is a **pair** consisting of a name and + * an associated enum value. The names should be QStrings. For each enum + * value that is listed, the canonical name should come **first** in the + * table, so that printing the enum values gives the canonical result. + * + * ``` + * static const NamedEnumTable& milkshakeSizeNames() + * { + * static NamedEnumTable n { // Initializer list for n + * { "large", MilkshakeSize::Large }, // One pair of name-and-value + * { "small", MilkshakeSize::Small }, + * { "big", MilkshakeSize::Large } + * }; + * return n; + * } + * ``` + * + * The function `eNames()`, above, returns a reference to a name table + * for the enum (presumably an enum class) `E`. It is possible to have + * more than one table for an enum, or to make the table locally, + * but **usually** you want one definitive table of names and values. + * The `eNames()` function gives you that definitive table. In Calamres + * code, such functions are usually named after the underlying enum. + * + * Using this particular table, looking up "large" will return `MilkshakeSize::Large`, + * looking up "big" will **also** return `MilkshakeSize::Large`, looking up "derp" + * will return `MilkshakeSize::Large` (because that is the first value in the table) + * but will set the boolean `ok` parameter to false. Conversely, looking + * up `MilkshakeSize::Large` will return "large" (never "big"). + * + * Note that this particular table does **not** name MilkshakeSize::None, + * so it is probably wrong: you can't get a string for that enum + * value, and no string will map to MilkshakeSize::None either. + * In general, tables should cover all of the enum values. + * + * Passing an empty initializer_list to the constructor is supported, + * but will cause UB if the table is ever used for looking up a string. + * + */ template < typename T > struct NamedEnumTable { @@ -43,7 +138,9 @@ struct NamedEnumTable * Use braced-initialisation for NamedEnum, and remember that the * elements of the list are **pairs**, e.g. * + * ``` * static const NamedEnumTable c{ {"red", Colors::Red } }; + * ``` */ NamedEnumTable( const std::initializer_list< pair_t >& v ) : table( v ) @@ -55,10 +152,12 @@ struct NamedEnumTable * * Searches case-insensitively. * - * If the name @p s is not found, @p ok is set to false and + * If the name @p s is not found, @p ok is set to @c false and * the first enum value in the table is returned. Otherwise, - * @p ok is set to true and the corresponding value is returned. - * + * @p ok is set to @c true and the corresponding value is returned. + * Use the output value of @p ok to determine if the lookup was + * successful: there is otherwise no sensible way to distinguish + * found-the-name-of-the-first-item from not-found. */ enum_t find( const string_t& s, bool& ok ) const { @@ -75,11 +174,17 @@ struct NamedEnumTable return table.begin()->second; } - /** @brief Find a value @p s in the table. + /** @brief Find a value @p s in the table and return its name. * - * If the value @p s is not found, @p ok is set to false and - * an empty string is returned. Otherwise, @p is set to true - * and the corresponding name is returned. + * If @p s is an enum value in the table, return the corresponding + * name (the first name with that value, if there are aliases) + * and set @p ok to @c true. + * + * If the value @p s is not found, @p ok is set to @c false and + * an empty string is returned. This indicates that the table does + * not cover all of the values * in `enum_t` (and @p s is one + * of them), **or** that the passed-in value of @p s is + * not a legal value, e.g. via a static_cast. */ string_t find( enum_t s, bool& ok ) const { @@ -98,7 +203,10 @@ struct NamedEnumTable /** @brief Find a value @p s in the table and return its name. * - * Returns emptry string if the value is not found. + * Returns an empty string if the value @p s is not found (this + * indicates that the table does not cover all of the values + * in `enum_t`, **or** that the passed-in value of @p s is + * not a legal value, e.g. via a static_cast). */ string_t find( enum_t s ) const { @@ -107,7 +215,24 @@ struct NamedEnumTable } }; -/** @brief Smashes an enum value to its underlying type. */ +/** @brief Smashes an enum value to its underlying type. + * + * While an enum **class** is not an integral type, and its values can't be + * printed or treated like an integer (like an old-style enum can), + * the underlying type **is** integral. This template function + * returns the value of an enum value, in its underlying type. + * This can be useful for debugging purposes, e.g. + * + * ``` + * MilkshakeSize sz{ MilkshakeSize::None }; + * std::cout << milkshakeSizeNames().find( sz ) << smash( sz ); + * ``` + * + * This will print both the name and the underlying integer for the + * value; assuming the table from the example is used, there is + * no name for MilkshakeSize::None, so it will print an empty string, + * followed by the integral representation -- probably a 0. + */ template < typename E > constexpr typename std::underlying_type< E >::type smash( const E e ) From 7057081bdff9fa1110f9abca9b28360462836972 Mon Sep 17 00:00:00 2001 From: Anubhav Choudhary Date: Wed, 10 Feb 2021 14:38:26 +0530 Subject: [PATCH 67/93] QUrl for serverURL + renames --- src/libcalamaresui/Branding.h | 5 +++-- src/libcalamaresui/ViewManager.cpp | 12 ++++++------ src/libcalamaresui/utils/Paste.cpp | 4 ++-- src/libcalamaresui/utils/Paste.h | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/libcalamaresui/Branding.h b/src/libcalamaresui/Branding.h index 493579a34..2afb8edc2 100644 --- a/src/libcalamaresui/Branding.h +++ b/src/libcalamaresui/Branding.h @@ -23,6 +23,7 @@ #include #include #include +#include namespace YAML { @@ -219,7 +220,7 @@ public: //Paste functionality related QString uploadServerType() { return m_uploadServerType; }; - QString uploadServerURL() { return m_uploadServerURL; }; + QUrl uploadServerURL() { return m_uploadServerURL; }; int uploadServerPort() { return m_uploadServerPort; }; public slots: @@ -270,7 +271,7 @@ private: bool m_welcomeExpandingLogo; QString m_uploadServerType; - QString m_uploadServerURL; + QUrl m_uploadServerURL; int m_uploadServerPort; WindowExpansion m_windowExpansion; diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index ae2460c37..3ffd3b43c 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -141,8 +141,8 @@ ViewManager::insertViewStep( int before, ViewStep* step ) void ViewManager::onInstallationFailed( const QString& message, const QString& details ) { - QString UploadServerType = Calamares::Branding::instance()->uploadServerType(); - bool shouldOfferWebPaste = CalamaresUtils::UploadServersList.contains( UploadServerType ); + QString serverType = Calamares::Branding::instance()->uploadServerType(); + bool shouldOfferWebPaste = CalamaresUtils::UploadServersList.contains( serverType ); cError() << "Installation failed:"; cDebug() << "- message:" << message; @@ -186,10 +186,10 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail if ( msgBox->buttonRole( button ) == QMessageBox::ButtonRole::YesRole ) { QString pasteUrlMsg; - QString UploadServerType = Calamares::Branding::instance()->uploadServerType(); - if ( UploadServerType == "fiche" ) + QString serverType = Calamares::Branding::instance()->uploadServerType(); + if ( serverType == "fiche" ) { - pasteUrlMsg = CalamaresUtils::sendLogToPastebin( msgBox ); + pasteUrlMsg = CalamaresUtils::ficheLogUpload( msgBox ); } else { @@ -545,7 +545,7 @@ ViewManager::updateBackAndNextVisibility( bool visible ) UPDATE_BUTTON_PROPERTY( backAndNextVisible, visible ) } -QVariant +QVariant ViewManager::data( const QModelIndex& index, int role ) const { if ( !index.isValid() ) diff --git a/src/libcalamaresui/utils/Paste.cpp b/src/libcalamaresui/utils/Paste.cpp index 269876017..2fea0806e 100644 --- a/src/libcalamaresui/utils/Paste.cpp +++ b/src/libcalamaresui/utils/Paste.cpp @@ -30,10 +30,10 @@ QStringList UploadServersList = { }; QString -sendLogToPastebin( QObject* parent ) +ficheLogUpload( QObject* parent ) { - const QString& ficheHost = Calamares::Branding::instance()->uploadServerURL(); + const QString& ficheHost = Calamares::Branding::instance()->uploadServerURL().toString(); quint16 fichePort = Calamares::Branding::instance()->uploadServerPort(); QString pasteUrlFmt = parent->tr( "Install log posted to\n\n%1\n\nLink copied to clipboard" ); diff --git a/src/libcalamaresui/utils/Paste.h b/src/libcalamaresui/utils/Paste.h index 69adfa99c..29e73fc1c 100644 --- a/src/libcalamaresui/utils/Paste.h +++ b/src/libcalamaresui/utils/Paste.h @@ -22,7 +22,7 @@ namespace CalamaresUtils * * Returns the (string) URL that the pastebin gives us. */ -QString sendLogToPastebin( QObject* parent ); +QString ficheLogUpload( QObject* parent ); extern QStringList UploadServersList; From 97388512616b82e9a39021c30b50d70b8829d0e3 Mon Sep 17 00:00:00 2001 From: Anubhav Choudhary Date: Mon, 15 Feb 2021 20:51:41 +0530 Subject: [PATCH 68/93] YAML list for uploadServer key --- src/branding/default/branding.desc | 7 ++++--- src/libcalamaresui/Branding.cpp | 22 ++++++++++++++++++---- src/libcalamaresui/Branding.h | 21 +++++++++++---------- src/libcalamaresui/ViewManager.cpp | 4 ++-- src/libcalamaresui/utils/Paste.cpp | 4 ++-- 5 files changed, 37 insertions(+), 21 deletions(-) diff --git a/src/branding/default/branding.desc b/src/branding/default/branding.desc index 92d0bba10..cd83b02f1 100644 --- a/src/branding/default/branding.desc +++ b/src/branding/default/branding.desc @@ -228,6 +228,7 @@ slideshowAPI: 2 # Takes string as input # - port : Defines the port number to be used to send logs. Takes # integer as input -uploadServer.type : "fiche" -uploadServer.url : "termbin.com" -uploadServer.port : 9999 +uploadServer : + type : "fiche" + url : "termbin.com" + port : 9999 diff --git a/src/libcalamaresui/Branding.cpp b/src/libcalamaresui/Branding.cpp index 40383c992..25024368f 100644 --- a/src/libcalamaresui/Branding.cpp +++ b/src/libcalamaresui/Branding.cpp @@ -87,6 +87,13 @@ const QStringList Branding::s_styleEntryStrings = "sidebarTextSelect", "sidebarTextHighlight" }; + +const QStringList Branding::s_uploadServerStrings = +{ + "type", + "url", + "port" +}; // clang-format on // *INDENT-ON* @@ -219,6 +226,12 @@ Branding::Branding( const QString& brandingFilePath, QObject* parent ) return imageFi.absoluteFilePath(); } ); loadStrings( m_style, doc, "style", []( const QString& s ) -> QString { return s; } ); + + const QVariantMap temp = CalamaresUtils::yamlMapToVariant( doc[ "uploadServer" ] ); + for ( auto it = temp.constBegin(); it != temp.constEnd(); ++it ) + { + m_uploadServer.insert( it.key(), it.value().toString() ); + } } catch ( YAML::Exception& e ) { @@ -279,6 +292,11 @@ Branding::imagePath( Branding::ImageEntry imageEntry ) const return m_images.value( s_imageEntryStrings.value( imageEntry ) ); } +QString +Branding::uploadServer( Branding::UploadServerEntry uploadServerEntry ) const +{ + return m_uploadServer.value( s_uploadServerStrings.value( uploadServerEntry ) ); +} QPixmap Branding::image( Branding::ImageEntry imageEntry, const QSize& size ) const @@ -511,10 +529,6 @@ Branding::initSimpleSettings( const YAML::Node& doc ) { m_windowHeight = WindowDimension( CalamaresUtils::windowPreferredHeight, WindowDimensionUnit::Pixies ); } - - m_uploadServerURL = getString( doc, "uploadServer.url" ); - m_uploadServerPort = doc[ "uploadServer.port" ].as< int >(); - m_uploadServerType = getString( doc, "uploadServer.type" ); } void diff --git a/src/libcalamaresui/Branding.h b/src/libcalamaresui/Branding.h index 2afb8edc2..87f71e862 100644 --- a/src/libcalamaresui/Branding.h +++ b/src/libcalamaresui/Branding.h @@ -83,6 +83,14 @@ public: }; Q_ENUM( StyleEntry ) + enum UploadServerEntry : short + { + Type, + URL, + Port + }; + Q_ENUM( UploadServerEntry ) + /** @brief Setting for how much the main window may expand. */ enum class WindowExpansion { @@ -217,12 +225,6 @@ public: */ void setGlobals( GlobalStorage* globalStorage ) const; - - //Paste functionality related - QString uploadServerType() { return m_uploadServerType; }; - QUrl uploadServerURL() { return m_uploadServerURL; }; - int uploadServerPort() { return m_uploadServerPort; }; - public slots: QString string( StringEntry stringEntry ) const; QString versionedName() const { return string( VersionedName ); } @@ -232,6 +234,7 @@ public slots: QString styleString( StyleEntry styleEntry ) const; QString imagePath( ImageEntry imageEntry ) const; + QString uploadServer( UploadServerEntry uploadServerEntry ) const; PanelSide sidebarSide() const { return m_sidebarSide; } PanelSide navigationSide() const { return m_navigationSide; } @@ -242,12 +245,14 @@ private: static const QStringList s_stringEntryStrings; static const QStringList s_imageEntryStrings; static const QStringList s_styleEntryStrings; + static const QStringList s_uploadServerStrings; QString m_descriptorPath; // Path to descriptor (e.g. "/etc/calamares/default/branding.desc") QString m_componentName; // Matches last part of full path to containing directory QMap< QString, QString > m_strings; QMap< QString, QString > m_images; QMap< QString, QString > m_style; + QMap< QString, QString > m_uploadServer; /* The slideshow can be done in one of two ways: * - as a sequence of images @@ -270,10 +275,6 @@ private: bool m_welcomeStyleCalamares; bool m_welcomeExpandingLogo; - QString m_uploadServerType; - QUrl m_uploadServerURL; - int m_uploadServerPort; - WindowExpansion m_windowExpansion; WindowDimension m_windowHeight, m_windowWidth; WindowPlacement m_windowPlacement; diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index 3ffd3b43c..500700123 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -141,7 +141,7 @@ ViewManager::insertViewStep( int before, ViewStep* step ) void ViewManager::onInstallationFailed( const QString& message, const QString& details ) { - QString serverType = Calamares::Branding::instance()->uploadServerType(); + QString serverType = Calamares::Branding::instance()->uploadServer( Calamares::Branding::Type ); bool shouldOfferWebPaste = CalamaresUtils::UploadServersList.contains( serverType ); cError() << "Installation failed:"; @@ -186,7 +186,7 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail if ( msgBox->buttonRole( button ) == QMessageBox::ButtonRole::YesRole ) { QString pasteUrlMsg; - QString serverType = Calamares::Branding::instance()->uploadServerType(); + QString serverType = Calamares::Branding::instance()->uploadServer( Calamares::Branding::Type ); if ( serverType == "fiche" ) { pasteUrlMsg = CalamaresUtils::ficheLogUpload( msgBox ); diff --git a/src/libcalamaresui/utils/Paste.cpp b/src/libcalamaresui/utils/Paste.cpp index 2fea0806e..27ae7f8f7 100644 --- a/src/libcalamaresui/utils/Paste.cpp +++ b/src/libcalamaresui/utils/Paste.cpp @@ -33,8 +33,8 @@ QString ficheLogUpload( QObject* parent ) { - const QString& ficheHost = Calamares::Branding::instance()->uploadServerURL().toString(); - quint16 fichePort = Calamares::Branding::instance()->uploadServerPort(); + const QString& ficheHost = Calamares::Branding::instance()->uploadServer( Calamares::Branding::URL ); + quint16 fichePort = Calamares::Branding::instance()->uploadServer( Calamares::Branding::Port ).toInt(); QString pasteUrlFmt = parent->tr( "Install log posted to\n\n%1\n\nLink copied to clipboard" ); From f15a599bbd82bc914e1036c54a69a9210f647754 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 16 Feb 2021 12:45:34 +0100 Subject: [PATCH 69/93] CI: shuffle workflow naming, add a nightly neon build as well --- .github/workflows/ci-neon.yml | 2 +- .../{ci-debian.yml => scheduled-debian.yml} | 0 .github/workflows/scheduled-neon.yml | 89 +++++++++++++++++++ ...ci-opensuse.yml => scheduled-opensuse.yml} | 0 4 files changed, 90 insertions(+), 1 deletion(-) rename .github/workflows/{ci-debian.yml => scheduled-debian.yml} (100%) create mode 100644 .github/workflows/scheduled-neon.yml rename .github/workflows/{ci-opensuse.yml => scheduled-opensuse.yml} (100%) diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/ci-neon.yml index eb5904209..80b10ab53 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/ci-neon.yml @@ -1,4 +1,4 @@ -name: ci-neon +name: ci-push on: push: diff --git a/.github/workflows/ci-debian.yml b/.github/workflows/scheduled-debian.yml similarity index 100% rename from .github/workflows/ci-debian.yml rename to .github/workflows/scheduled-debian.yml diff --git a/.github/workflows/scheduled-neon.yml b/.github/workflows/scheduled-neon.yml new file mode 100644 index 000000000..a47b8460e --- /dev/null +++ b/.github/workflows/scheduled-neon.yml @@ -0,0 +1,89 @@ +name: ci-neon + +on: + schedule: + - cron: "52 23 * * *" + workflow_dispatch: + +env: + BUILDDIR: /build + SRCDIR: ${{ github.workspace }} + CMAKE_ARGS: | + -DWEBVIEW_FORCE_WEBKIT=1 + -DKDE_INSTALL_USE_QT_SYS_PATHS=ON + -DWITH_PYTHONQT=OFF" + -DCMAKE_BUILD_TYPE=Debug + +jobs: + build: + runs-on: ubuntu-latest + container: + image: docker://kdeneon/plasma:user + options: --tmpfs /build:rw --user 0:0 + steps: + - name: "prepare env" + run: | + sudo apt-get update + sudo apt-get -y install git-core + sudo apt-get -y install \ + build-essential \ + cmake \ + extra-cmake-modules \ + gettext \ + kio-dev \ + libatasmart-dev \ + libboost-python-dev \ + libkf5config-dev \ + libkf5coreaddons-dev \ + libkf5i18n-dev \ + libkf5iconthemes-dev \ + libkf5parts-dev \ + libkf5service-dev \ + libkf5solid-dev \ + libkpmcore-dev \ + libparted-dev \ + libpolkit-qt5-1-dev \ + libqt5svg5-dev \ + libqt5webkit5-dev \ + libyaml-cpp-dev \ + os-prober \ + pkg-config \ + python3-dev \ + qtbase5-dev \ + qtdeclarative5-dev \ + qttools5-dev \ + qttools5-dev-tools + - name: "prepare source" + uses: actions/checkout@v2 + - name: "prepare build" + id: pre_build + run: | + test -n "$BUILDDIR" || { echo "! \$BUILDDIR not set" ; exit 1 ; } + mkdir -p $BUILDDIR + test -f $SRCDIR/CMakeLists.txt || { echo "! Missing $SRCDIR/CMakeLists.txt" ; exit 1 ; } + echo "::set-output name=message::"`git log -1 --abbrev-commit --pretty=oneline --no-decorate ${{ github.event.head_commit.id }}` + - name: "Calamares: cmake" + working-directory: ${{ env.BUILDDIR }} + run: cmake $CMAKE_ARGS $SRCDIR + - name: "Calamares: make" + working-directory: ${{ env.BUILDDIR }} + run: make -j2 VERBOSE=1 + - name: "Calamares: install" + working-directory: ${{ env.BUILDDIR }} + run: make install VERBOSE=1 + - name: "notify: ok" + uses: rectalogic/notify-irc@v1 + if: ${{ success() && github.repository == 'calamares/calamares' }} + with: + server: chat.freenode.net + nickname: cala-ci + channel: "#calamares" + message: "SCHEDULED ${{ github.workflow }} OK ${{ steps.pre_build.outputs.message }}" + - name: "notify: fail" + uses: rectalogic/notify-irc@v1 + if: ${{ failure() && github.repository == 'calamares/calamares' }} + with: + server: chat.freenode.net + nickname: cala-ci + channel: "#calamares" + message: "SCHEDULED ${{ github.workflow }} FAIL ${{ steps.pre_build.outputs.message }}" diff --git a/.github/workflows/ci-opensuse.yml b/.github/workflows/scheduled-opensuse.yml similarity index 100% rename from .github/workflows/ci-opensuse.yml rename to .github/workflows/scheduled-opensuse.yml From 112b51756b2c6e17de97640ab3769994e7181312 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 16 Feb 2021 13:03:22 +0100 Subject: [PATCH 70/93] CI: keep a tarball of the scheduled neon build --- .github/workflows/scheduled-neon.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/scheduled-neon.yml b/.github/workflows/scheduled-neon.yml index a47b8460e..4295f8025 100644 --- a/.github/workflows/scheduled-neon.yml +++ b/.github/workflows/scheduled-neon.yml @@ -70,7 +70,17 @@ jobs: run: make -j2 VERBOSE=1 - name: "Calamares: install" working-directory: ${{ env.BUILDDIR }} - run: make install VERBOSE=1 + run: make install VERBOSE=1 DESTDIR=${{ env.BUILDDIR }}/stage + - name: "Calamares: archive" + working-directory: ${{ env.BUILDDIR }} + run: tar czf calamares.tar.gz stage + - name: "upload" + uses: actions/upload-artifact@v2 + with: + name: calamares-tarball + path: ${{ env.BUILDDIR }}/calamares.tar.gz + if-no-files-found: error + retention-days: 3 - name: "notify: ok" uses: rectalogic/notify-irc@v1 if: ${{ success() && github.repository == 'calamares/calamares' }} From d0a65641e282471ef76308662b1a104774461aa0 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 16 Feb 2021 14:25:10 +0100 Subject: [PATCH 71/93] CI: rename the scheduled, nightly builds again --- .github/workflows/{scheduled-debian.yml => nightly-debian.yml} | 2 +- .github/workflows/{scheduled-neon.yml => nightly-neon.yml} | 2 +- .../workflows/{scheduled-opensuse.yml => nightly-opensuse.yml} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename .github/workflows/{scheduled-debian.yml => nightly-debian.yml} (99%) rename .github/workflows/{scheduled-neon.yml => nightly-neon.yml} (99%) rename .github/workflows/{scheduled-opensuse.yml => nightly-opensuse.yml} (99%) diff --git a/.github/workflows/scheduled-debian.yml b/.github/workflows/nightly-debian.yml similarity index 99% rename from .github/workflows/scheduled-debian.yml rename to .github/workflows/nightly-debian.yml index 26f58f594..4c3dc67ca 100644 --- a/.github/workflows/scheduled-debian.yml +++ b/.github/workflows/nightly-debian.yml @@ -1,4 +1,4 @@ -name: ci-debian-10 +name: nightly-debian-10 on: schedule: diff --git a/.github/workflows/scheduled-neon.yml b/.github/workflows/nightly-neon.yml similarity index 99% rename from .github/workflows/scheduled-neon.yml rename to .github/workflows/nightly-neon.yml index 4295f8025..c20887fc3 100644 --- a/.github/workflows/scheduled-neon.yml +++ b/.github/workflows/nightly-neon.yml @@ -1,4 +1,4 @@ -name: ci-neon +name: nightly-neon on: schedule: diff --git a/.github/workflows/scheduled-opensuse.yml b/.github/workflows/nightly-opensuse.yml similarity index 99% rename from .github/workflows/scheduled-opensuse.yml rename to .github/workflows/nightly-opensuse.yml index c9098dbc1..0ededfaf0 100644 --- a/.github/workflows/scheduled-opensuse.yml +++ b/.github/workflows/nightly-opensuse.yml @@ -1,4 +1,4 @@ -name: ci-opensuse +name: nightly-opensuse on: schedule: From 6bf82e9c656a73e0464b57fe99acb7eb24010372 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 16 Feb 2021 16:32:34 +0100 Subject: [PATCH 72/93] [welcome] Update .conf documentation - fix typo - don't suggest google as internetCheckUrl - mark TODOs for #1384 --- src/modules/welcome/welcome.conf | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/modules/welcome/welcome.conf b/src/modules/welcome/welcome.conf index bd15a6f2d..b3da8d366 100644 --- a/src/modules/welcome/welcome.conf +++ b/src/modules/welcome/welcome.conf @@ -10,14 +10,19 @@ # can check requirements for installation. --- # 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 URLs themselves come from `branding.desc`. Each button +# is show if the corresponding *show* setting +# here is "true". If the setting is "false", the button is hidden. +# Empty or not-set is interpreted as "false". +# +# TODO:3.3 Remove the URL fallback here; URLs only in `branding.desc` +# # 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. +# instead of the one from the branding file. showSupportUrl: true showKnownIssuesUrl: true showReleaseNotesUrl: false +# TODO:3.3 Move to branding, keep only a bool here showDonateUrl: https://kde.org/community/donations/ # Requirements checking. These are general, generic, things @@ -26,7 +31,7 @@ showDonateUrl: https://kde.org/community/donations/ 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. + # to satisfy this requirement, yet have no space to install to. requiredStorage: 5.5 # Amount of available RAM, in GiB. Floating-point is allowed here. @@ -34,7 +39,10 @@ requirements: # 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 + # Use a privacy-respecting URL here, preferably in your distro's domain. + # + # The URL is only used if "internet" is in the *check* list below. + internetCheckUrl: http://example.com # List conditions to check. Each listed condition will be # probed in some way, and yields true or false according to From ce6fae900febada1faf6285f80ca10ab60d175fa Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 17 Feb 2021 10:41:55 +0100 Subject: [PATCH 73/93] CI: massage message a bit and adjust naming scheme --- .github/workflows/nightly-debian.yml | 4 ++-- .github/workflows/nightly-neon.yml | 4 ++-- .github/workflows/nightly-opensuse.yml | 4 ++-- .github/workflows/{ci-neon.yml => push.yml} | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) rename .github/workflows/{ci-neon.yml => push.yml} (88%) diff --git a/.github/workflows/nightly-debian.yml b/.github/workflows/nightly-debian.yml index 4c3dc67ca..3fd558e21 100644 --- a/.github/workflows/nightly-debian.yml +++ b/.github/workflows/nightly-debian.yml @@ -89,7 +89,7 @@ jobs: server: chat.freenode.net nickname: cala-ci channel: "#calamares" - message: "SCHEDULED ${{ github.workflow }} OK ${{ steps.pre_build.outputs.message }}" + message: "OK ${{ github.workflow }} in ${{ github.repository }} ${{ steps.pre_build.outputs.message }}" - name: "notify: fail" uses: rectalogic/notify-irc@v1 if: ${{ failure() && github.repository == 'calamares/calamares' }} @@ -97,4 +97,4 @@ jobs: server: chat.freenode.net nickname: cala-ci channel: "#calamares" - message: "SCHEDULED ${{ github.workflow }} FAIL ${{ steps.pre_build.outputs.message }}" + message: "FAIL ${{ github.workflow }} in ${{ github.repository }} ${{ steps.pre_build.outputs.message }}" diff --git a/.github/workflows/nightly-neon.yml b/.github/workflows/nightly-neon.yml index c20887fc3..92f71c10b 100644 --- a/.github/workflows/nightly-neon.yml +++ b/.github/workflows/nightly-neon.yml @@ -88,7 +88,7 @@ jobs: server: chat.freenode.net nickname: cala-ci channel: "#calamares" - message: "SCHEDULED ${{ github.workflow }} OK ${{ steps.pre_build.outputs.message }}" + message: "OK ${{ github.workflow }} in ${{ github.repository }} ${{ steps.pre_build.outputs.message }}" - name: "notify: fail" uses: rectalogic/notify-irc@v1 if: ${{ failure() && github.repository == 'calamares/calamares' }} @@ -96,4 +96,4 @@ jobs: server: chat.freenode.net nickname: cala-ci channel: "#calamares" - message: "SCHEDULED ${{ github.workflow }} FAIL ${{ steps.pre_build.outputs.message }}" + message: "FAIL ${{ github.workflow }} in ${{ github.repository }} ${{ steps.pre_build.outputs.message }}" diff --git a/.github/workflows/nightly-opensuse.yml b/.github/workflows/nightly-opensuse.yml index 0ededfaf0..c3762fb99 100644 --- a/.github/workflows/nightly-opensuse.yml +++ b/.github/workflows/nightly-opensuse.yml @@ -87,7 +87,7 @@ jobs: server: chat.freenode.net nickname: cala-ci channel: "#calamares" - message: "SCHEDULED ${{ github.workflow }} OK ${{ steps.pre_build.outputs.message }}" + message: "OK ${{ github.workflow }} in ${{ github.repository }} ${{ steps.pre_build.outputs.message }}" - name: "notify: fail" uses: rectalogic/notify-irc@v1 if: ${{ failure() && github.repository == 'calamares/calamares' }} @@ -95,4 +95,4 @@ jobs: server: chat.freenode.net nickname: cala-ci channel: "#calamares" - message: "SCHEDULED ${{ github.workflow }} FAIL ${{ steps.pre_build.outputs.message }}" + message: "FAIL ${{ github.workflow }} in ${{ github.repository }} ${{ steps.pre_build.outputs.message }}" diff --git a/.github/workflows/ci-neon.yml b/.github/workflows/push.yml similarity index 88% rename from .github/workflows/ci-neon.yml rename to .github/workflows/push.yml index 80b10ab53..0889ea278 100644 --- a/.github/workflows/ci-neon.yml +++ b/.github/workflows/push.yml @@ -84,7 +84,7 @@ jobs: server: chat.freenode.net nickname: cala-ci channel: "#calamares" - message: "PUSH ${{ github.workflow }} OK ${{ github.actor }} on ${{ github.event.ref }}\n.. ${{ steps.pre_build.outputs.message }}" + message: "OK ${{ github.workflow }} in ${{ github.repository }} ${{ github.actor }} on ${{ github.event.ref }}\n.. ${{ steps.pre_build.outputs.message }}" - name: "notify: fail" uses: rectalogic/notify-irc@v1 if: ${{ failure() && github.repository == 'calamares/calamares' }} @@ -92,4 +92,4 @@ jobs: server: chat.freenode.net nickname: cala-ci channel: "#calamares" - message: "PUSH ${{ github.workflow }} FAIL ${{ github.actor }} on ${{ github.event.ref }}\n.. ${{ steps.pre_build.outputs.message }}\n.. DIFF ${{ github.event.compare }}" + message: "FAIL ${{ github.workflow }} in ${{ github.repository }} ${{ github.actor }} on ${{ github.event.ref }}\n.. ${{ steps.pre_build.outputs.message }}\n.. DIFF ${{ github.event.compare }}" From 49f4e7b8e13ddedb1242f8be7e5c2a325260450f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 17 Feb 2021 14:19:45 +0100 Subject: [PATCH 74/93] [calamares] Make the widget-tree more informative, mention class name --- src/calamares/DebugWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calamares/DebugWindow.cpp b/src/calamares/DebugWindow.cpp index 4a68d4ae2..96f4fb335 100644 --- a/src/calamares/DebugWindow.cpp +++ b/src/calamares/DebugWindow.cpp @@ -59,7 +59,7 @@ dumpWidgetTree( QDebug& deb, const QWidget* widget, int depth ) { deb << ' '; } - deb << widget->objectName(); + deb << widget->metaObject()->className() << widget->objectName(); for ( const auto* w : widget->findChildren< QWidget* >( QString(), Qt::FindDirectChildrenOnly ) ) { From 7e6c3a230942754b8da793836d1a7151d8c20dc9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 17 Feb 2021 14:25:06 +0100 Subject: [PATCH 75/93] [libcalamaresui] Give the slideshow-widgets a name - this is the *working* part of the slideshow, not its background --- src/libcalamaresui/viewpages/Slideshow.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libcalamaresui/viewpages/Slideshow.cpp b/src/libcalamaresui/viewpages/Slideshow.cpp index 268843421..f6df1cae4 100644 --- a/src/libcalamaresui/viewpages/Slideshow.cpp +++ b/src/libcalamaresui/viewpages/Slideshow.cpp @@ -43,6 +43,8 @@ SlideshowQML::SlideshowQML( QWidget* parent ) , m_qmlComponent( nullptr ) , m_qmlObject( nullptr ) { + m_qmlShow->setObjectName("qml"); + CalamaresUtils::registerQmlModels(); m_qmlShow->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); @@ -203,6 +205,8 @@ SlideshowPictures::SlideshowPictures( QWidget* parent ) , m_imageIndex( 0 ) , m_images( Branding::instance()->slideshowImages() ) { + m_label->setObjectName("image"); + m_label->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); m_label->setAlignment( Qt::AlignCenter ); m_timer->setInterval( std::chrono::milliseconds( 2000 ) ); From 3a4dcb691322369cdb8c49bac23b875a834fbebe Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 17 Feb 2021 14:34:33 +0100 Subject: [PATCH 76/93] [libcalamaresui] Give slideshow (ExecutionViewStep) widgets names --- src/libcalamaresui/viewpages/ExecutionViewStep.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libcalamaresui/viewpages/ExecutionViewStep.cpp b/src/libcalamaresui/viewpages/ExecutionViewStep.cpp index bb629b217..c5785b087 100644 --- a/src/libcalamaresui/viewpages/ExecutionViewStep.cpp +++ b/src/libcalamaresui/viewpages/ExecutionViewStep.cpp @@ -62,6 +62,10 @@ ExecutionViewStep::ExecutionViewStep( QObject* parent ) , m_label( new QLabel ) , m_slideshow( makeSlideshow( m_widget ) ) { + m_widget->setObjectName( "slideshow" ); + m_progressBar->setObjectName( "exec-progress" ); + m_label->setObjectName( "exec-message" ); + QVBoxLayout* layout = new QVBoxLayout( m_widget ); QVBoxLayout* innerLayout = new QVBoxLayout; From cdbf45b5d30f5f03d86e8fd8a558178737e7d96d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 19 Feb 2021 14:29:46 +0100 Subject: [PATCH 77/93] [libcalamaresui] Remove unused include --- src/libcalamaresui/viewpages/ExecutionViewStep.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libcalamaresui/viewpages/ExecutionViewStep.cpp b/src/libcalamaresui/viewpages/ExecutionViewStep.cpp index c5785b087..cac9b28be 100644 --- a/src/libcalamaresui/viewpages/ExecutionViewStep.cpp +++ b/src/libcalamaresui/viewpages/ExecutionViewStep.cpp @@ -24,7 +24,6 @@ #include "utils/CalamaresUtilsGui.h" #include "utils/Dirs.h" #include "utils/Logger.h" -#include "utils/Qml.h" #include "utils/Retranslator.h" #include From 9c8194402b7180f64d1deb8a43f75d66db2f2e2c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 19 Feb 2021 14:33:38 +0100 Subject: [PATCH 78/93] [keyboard] Add ASCII mapping for Greek FIXES #1642 --- src/modules/keyboard/non-ascii-layouts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/keyboard/non-ascii-layouts b/src/modules/keyboard/non-ascii-layouts index 454278a3e..fe3f285a2 100644 --- a/src/modules/keyboard/non-ascii-layouts +++ b/src/modules/keyboard/non-ascii-layouts @@ -6,3 +6,4 @@ #layout additional-layout additional-variant vconsole-keymap ru us - ruwin_alt_sh-UTF-8 ua us - ua-utf +gr us - gr From f0aa515c8bcd59e8bc0449dd6c29fc6cd6d8ad08 Mon Sep 17 00:00:00 2001 From: benne-dee <78043691+benne-dee@users.noreply.github.com> Date: Mon, 22 Feb 2021 22:17:06 +0530 Subject: [PATCH 79/93] [netinstall] Schema validates also groups file --- src/modules/netinstall/netinstall.schema.yaml | 45 ++++++++++++------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/src/modules/netinstall/netinstall.schema.yaml b/src/modules/netinstall/netinstall.schema.yaml index e1db5715e..05ab4cd08 100644 --- a/src/modules/netinstall/netinstall.schema.yaml +++ b/src/modules/netinstall/netinstall.schema.yaml @@ -1,4 +1,5 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot +# SPDX-FileContributor: benne-dee ( worked on groups schema ) # SPDX-License-Identifier: GPL-3.0-or-later --- $schema: https://json-schema.org/draft-07/schema# @@ -7,11 +8,11 @@ definitions: package: $id: '#definitions/package' oneOf: - - + - type: string description: bare package - actual package name as passed to the package manager (e.g. `qt5-creator-dev`). - - + - type: object description: rich package - one with a package-name (for the package-manager) and a description (for the human). @@ -59,16 +60,30 @@ definitions: type: array items: { $ref: '#definitions/group' } -additionalProperties: false -type: object -properties: - groupsUrl: { type: string } - required: { type: boolean, default: false } - label: # Translatable labels - type: object - additionalProperties: true - properties: - sidebar: { type: string } - title: { type: string } - groups: { $ref: '#definitions/groups' } # DONE: the schema for groups -required: [ groupsUrl ] +oneOf: +- # netinstall.conf + type: object + description: netinstall.conf schema + additionalProperties: false + properties: + groupsUrl: { type: string } + required: { type: boolean, default: false } + label: # Translatable labels + type: object + additionalProperties: true + properties: + sidebar: { type: string } + title: { type: string } + groups: { $ref: '#definitions/groups' } + required: [ groupsUrl ] + +- # Groups file with top level *groups* key + type: object + description: Groups file with top level *groups* key + additionalProperties: false + properties: + groups: { $ref: '#definitions/groups' } + required: [ groups ] + +- # Groups file bare + { $ref: '#definitions/groups' } From 288fe5b274b59e3d3b29b364efc15a272fb204eb Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 23 Feb 2021 12:50:52 +0100 Subject: [PATCH 80/93] [finished] Rename and document following coding style --- src/modules/finished/FinishedViewStep.cpp | 6 +++--- src/modules/finished/FinishedViewStep.h | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/modules/finished/FinishedViewStep.cpp b/src/modules/finished/FinishedViewStep.cpp index 310dda25a..1469262a0 100644 --- a/src/modules/finished/FinishedViewStep.cpp +++ b/src/modules/finished/FinishedViewStep.cpp @@ -29,7 +29,7 @@ FinishedViewStep::FinishedViewStep( QObject* parent ) : Calamares::ViewStep( parent ) , m_config( new Config( this ) ) , m_widget( new FinishedPage() ) - , installFailed( false ) + , m_installFailed( false ) { auto jq = Calamares::JobQueue::instance(); connect( jq, &Calamares::JobQueue::failed, m_widget, &FinishedPage::onInstallationFailed ); @@ -94,7 +94,7 @@ FinishedViewStep::sendNotification() { // If the installation failed, don't send notification popup; // there's a (modal) dialog popped up with the failure notice. - if ( installFailed ) + if ( m_installFailed ) { return; } @@ -151,7 +151,7 @@ FinishedViewStep::onInstallationFailed( const QString& message, const QString& d { Q_UNUSED( message ) Q_UNUSED( details ) - installFailed = true; + m_installFailed = true; } void diff --git a/src/modules/finished/FinishedViewStep.h b/src/modules/finished/FinishedViewStep.h index aa71ab38a..ac54fdd35 100644 --- a/src/modules/finished/FinishedViewStep.h +++ b/src/modules/finished/FinishedViewStep.h @@ -50,16 +50,18 @@ public slots: void onInstallationFailed( const QString& message, const QString& details ); private: - Config* m_config; - FinishedPage* m_widget; - /** - * @brief At the end of installation (when this step is activated), - * send a desktop notification via DBus that the install is done. + * @brief Send notification at the end via DBus + * + * At the end of installation (when this step is activated), + * send a desktop notification via DBus that the install is done. + * If the installation failed, no notification is sent. */ void sendNotification(); - bool installFailed; + Config* m_config; + FinishedPage* m_widget; + bool m_installFailed; // Track if onInstallationFailed() was called }; CALAMARES_PLUGIN_FACTORY_DECLARATION( FinishedViewStepFactory ) From 9d6d8ecaea64d6476776b547ad737d545419ee3c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 23 Feb 2021 15:03:16 +0100 Subject: [PATCH 81/93] [finished] Heavy refactor - move most of the business logic to Config - make retranslate of the page more robust (e.g. changing language after failure would restore the un-failed message) There's still some bits left. --- src/modules/finished/Config.cpp | 47 +++++++ src/modules/finished/Config.h | 17 ++- src/modules/finished/FinishedPage.cpp | 147 +++++++++++----------- src/modules/finished/FinishedPage.h | 13 +- src/modules/finished/FinishedViewStep.cpp | 29 +++-- 5 files changed, 159 insertions(+), 94 deletions(-) diff --git a/src/modules/finished/Config.cpp b/src/modules/finished/Config.cpp index 7a84e8f22..a612661a8 100644 --- a/src/modules/finished/Config.cpp +++ b/src/modules/finished/Config.cpp @@ -33,11 +33,55 @@ Config::Config( QObject* parent ) { } +void +Config::setRestartNowMode( Config::RestartMode m ) +{ + // Can only go "down" in state (Always > UserDefaultChecked > .. > Never) + if ( m > m_restartNowMode ) + { + return; + } + + // If changing to an unconditional mode, also set other flag + if ( m == RestartMode::Always || m == RestartMode::Never ) + { + setRestartNowWanted( m == RestartMode::Always ); + } + + if ( m != m_restartNowMode ) + { + m_restartNowMode = m; + emit restartModeChanged( m ); + } +} + +void +Config::setRestartNowWanted( bool w ) +{ + // Follow the mode which may affect @p w + if ( m_restartNowMode == RestartMode::Always ) + { + w = true; + } + if ( m_restartNowMode == RestartMode::Never ) + { + w = false; + } + + if ( w != m_userWantsRestart ) + { + m_userWantsRestart = w; + emit restartNowWantedChanged( w ); + } +} + + void Config::setConfigurationMap( const QVariantMap& configurationMap ) { RestartMode mode = RestartMode::Never; + //TODO:3.3 remove deprecated restart settings QString restartMode = CalamaresUtils::getString( configurationMap, "restartNowMode" ); if ( restartMode.isEmpty() ) { @@ -69,6 +113,9 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) } m_restartNowMode = mode; + m_userWantsRestart = ( mode == RestartMode::Always || mode == RestartMode::UserDefaultChecked ); + emit restartModeChanged( m_restartNowMode ); + emit restartNowWantedChanged( m_userWantsRestart ); if ( mode != RestartMode::Never ) { diff --git a/src/modules/finished/Config.h b/src/modules/finished/Config.h index 9b8c5d8d3..32cc7bf22 100644 --- a/src/modules/finished/Config.h +++ b/src/modules/finished/Config.h @@ -20,8 +20,10 @@ class Config : public QObject { Q_OBJECT + Q_PROPERTY( RestartMode restartNowMode READ restartNowMode WRITE setRestartNowMode NOTIFY restartModeChanged ) + Q_PROPERTY( bool restartNowWanted READ restartNowWanted WRITE setRestartNowWanted NOTIFY restartNowWantedChanged ) + Q_PROPERTY( QString restartNowCommand READ restartNowCommand CONSTANT FINAL ) - Q_PROPERTY( RestartMode restartNowMode READ restartNowMode CONSTANT FINAL ) Q_PROPERTY( bool notifyOnFinished READ notifyOnFinished CONSTANT FINAL ) public: @@ -36,15 +38,26 @@ public: }; Q_ENUM( RestartMode ) - QString restartNowCommand() const { return m_restartNowCommand; } RestartMode restartNowMode() const { return m_restartNowMode; } + bool restartNowWanted() const { return m_userWantsRestart; } + + QString restartNowCommand() const { return m_restartNowCommand; } bool notifyOnFinished() const { return m_notifyOnFinished; } void setConfigurationMap( const QVariantMap& configurationMap ); +public slots: + void setRestartNowMode( RestartMode m ); + void setRestartNowWanted( bool w ); + +signals: + void restartModeChanged( RestartMode m ); + void restartNowWantedChanged( bool w ); + private: QString m_restartNowCommand; RestartMode m_restartNowMode = RestartMode::Never; + bool m_userWantsRestart = false; bool m_notifyOnFinished = false; }; diff --git a/src/modules/finished/FinishedPage.cpp b/src/modules/finished/FinishedPage.cpp index 118ee96bf..5f021dd3d 100644 --- a/src/modules/finished/FinishedPage.cpp +++ b/src/modules/finished/FinishedPage.cpp @@ -27,10 +27,9 @@ #include -FinishedPage::FinishedPage( QWidget* parent ) +FinishedPage::FinishedPage( Config* config, QWidget* parent ) : QWidget( parent ) , ui( new Ui::FinishedPage ) - , m_mode( Config::RestartMode::UserDefaultUnchecked ) { ui->setupUi( this ); @@ -38,68 +37,19 @@ FinishedPage::FinishedPage( QWidget* parent ) ui->mainText->setWordWrap( true ); ui->mainText->setOpenExternalLinks( true ); - CALAMARES_RETRANSLATE( - const auto* branding = Calamares::Branding::instance(); ui->retranslateUi( this ); - if ( Calamares::Settings::instance()->isSetupMode() ) { - ui->mainText->setText( tr( "

All done.


" - "%1 has been set up on your computer.
" - "You may now start using your new system." ) - .arg( branding->versionedName() ) ); - ui->restartCheckBox->setToolTip( tr( "" - "

When this box is checked, your system will " - "restart immediately when you click on " - "Done " - "or close the setup program.

" ) ); - } else { - ui->mainText->setText( tr( "

All done.


" - "%1 has been installed on your computer.
" - "You may now restart into your new system, or continue " - "using the %2 Live environment." ) - .arg( branding->versionedName(), branding->productName() ) ); - ui->restartCheckBox->setToolTip( tr( "" - "

When this box is checked, your system will " - "restart immediately when you click on " - "Done " - "or close the installer.

" ) ); - } ) -} + connect( config, &Config::restartModeChanged, [this]( Config::RestartMode mode ) { + using Mode = Config::RestartMode; - -void -FinishedPage::setRestart( Config::RestartMode mode ) -{ - using Mode = Config::RestartMode; - - m_mode = mode; - - ui->restartCheckBox->setVisible( mode != Mode::Never ); - ui->restartCheckBox->setEnabled( mode != Mode::Always ); - ui->restartCheckBox->setChecked( ( mode == Mode::Always ) || ( mode == Mode::UserDefaultChecked ) ); -} - - -void -FinishedPage::setRestartNowCommand( const QString& command ) -{ - m_restartNowCommand = command; -} - - -void -FinishedPage::setUpRestart() -{ - cDebug() << "FinishedPage::setUpRestart(), Quit button" - << "setup=" << restartModes().find( m_mode ) << "command=" << m_restartNowCommand; - - connect( qApp, &QApplication::aboutToQuit, [this]() { - if ( ui->restartCheckBox->isVisible() && ui->restartCheckBox->isChecked() ) - { - cDebug() << "Running restart command" << m_restartNowCommand; - QProcess::execute( "/bin/sh", { "-c", m_restartNowCommand } ); - } + ui->restartCheckBox->setVisible( mode != Mode::Never ); + ui->restartCheckBox->setEnabled( mode != Mode::Always ); + } ); + connect( config, &Config::restartNowWantedChanged, ui->restartCheckBox, &QCheckBox::setChecked ); + connect( ui->restartCheckBox, &QCheckBox::stateChanged, [config]( int state ) { + config->setRestartNowWanted( state != 0 ); } ); -} + CALAMARES_RETRANSLATE_SLOT( &FinishedPage::retranslate ); +} void FinishedPage::focusInEvent( QFocusEvent* e ) @@ -110,19 +60,64 @@ FinishedPage::focusInEvent( QFocusEvent* e ) void FinishedPage::onInstallationFailed( const QString& message, const QString& details ) { - const auto* branding = Calamares::Branding::instance(); - Q_UNUSED( details ) - if ( Calamares::Settings::instance()->isSetupMode() ) - ui->mainText->setText( tr( "

Setup Failed


" - "%1 has not been set up on your computer.
" - "The error message was: %2." ) - .arg( branding->versionedName() ) - .arg( message ) ); - else - ui->mainText->setText( tr( "

Installation Failed


" - "%1 has not been installed on your computer.
" - "The error message was: %2." ) - .arg( branding->versionedName() ) - .arg( message ) ); - setRestart( Config::RestartMode::Never ); + m_failure = !message.isEmpty() ? message : details; + retranslate(); +} + +void +FinishedPage::retranslate() +{ + + const auto* branding = Calamares::Branding::instance(); + + ui->retranslateUi( this ); + if ( !m_failure.has_value() ) + { + if ( Calamares::Settings::instance()->isSetupMode() ) + { + ui->mainText->setText( tr( "

All done.


" + "%1 has been set up on your computer.
" + "You may now start using your new system." ) + .arg( branding->versionedName() ) ); + ui->restartCheckBox->setToolTip( tr( "" + "

When this box is checked, your system will " + "restart immediately when you click on " + "Done " + "or close the setup program.

" ) ); + } + else + { + ui->mainText->setText( tr( "

All done.


" + "%1 has been installed on your computer.
" + "You may now restart into your new system, or continue " + "using the %2 Live environment." ) + .arg( branding->versionedName(), branding->productName() ) ); + ui->restartCheckBox->setToolTip( tr( "" + "

When this box is checked, your system will " + "restart immediately when you click on " + "Done " + "or close the installer.

" ) ); + } + } + else + { + const QString message = m_failure.value(); + + if ( Calamares::Settings::instance()->isSetupMode() ) + { + ui->mainText->setText( tr( "

Setup Failed


" + "%1 has not been set up on your computer.
" + "The error message was: %2." ) + .arg( branding->versionedName() ) + .arg( message ) ); + } + else + { + ui->mainText->setText( tr( "

Installation Failed


" + "%1 has not been installed on your computer.
" + "The error message was: %2." ) + .arg( branding->versionedName() ) + .arg( message ) ); + } + } } diff --git a/src/modules/finished/FinishedPage.h b/src/modules/finished/FinishedPage.h index 30df5f8c3..4e312ab8b 100644 --- a/src/modules/finished/FinishedPage.h +++ b/src/modules/finished/FinishedPage.h @@ -16,6 +16,8 @@ #include +#include + namespace Ui { class FinishedPage; @@ -25,24 +27,19 @@ class FinishedPage : public QWidget { Q_OBJECT public: - explicit FinishedPage( QWidget* parent = nullptr ); + explicit FinishedPage( Config* config, QWidget* parent = nullptr ); - void setRestart( Config::RestartMode mode ); - void setRestartNowCommand( const QString& command ); - - void setUpRestart(); public slots: void onInstallationFailed( const QString& message, const QString& details ); + void retranslate(); protected: void focusInEvent( QFocusEvent* e ) override; //choose the child widget to focus private: Ui::FinishedPage* ui; - - Config::RestartMode m_mode; - QString m_restartNowCommand; + std::optional< QString > m_failure; }; #endif // FINISHEDPAGE_H diff --git a/src/modules/finished/FinishedViewStep.cpp b/src/modules/finished/FinishedViewStep.cpp index 1469262a0..48e2c47d5 100644 --- a/src/modules/finished/FinishedViewStep.cpp +++ b/src/modules/finished/FinishedViewStep.cpp @@ -28,7 +28,7 @@ FinishedViewStep::FinishedViewStep( QObject* parent ) : Calamares::ViewStep( parent ) , m_config( new Config( this ) ) - , m_widget( new FinishedPage() ) + , m_widget( new FinishedPage( m_config ) ) , m_installFailed( false ) { auto jq = Calamares::JobQueue::instance(); @@ -128,10 +128,29 @@ FinishedViewStep::sendNotification() } +#if 0 +void +FinishedPage::setUpRestart() +{ + cDebug() << "FinishedPage::setUpRestart(), Quit button" + << "setup=" << restartModes().find( m_mode ) << "command=" << m_restartNowCommand; + + connect( qApp, &QApplication::aboutToQuit, [this]() + { + if ( ui->restartCheckBox->isVisible() && ui->restartCheckBox->isChecked() ) + { + cDebug() << "Running restart command" << m_restartNowCommand; + QProcess::execute( "/bin/sh", { "-c", m_restartNowCommand } ); + } + } ); +} +#endif + + void FinishedViewStep::onActivate() { - m_widget->setUpRestart(); + // m_widget->setUpRestart(); if ( m_config->notifyOnFinished() ) { @@ -158,12 +177,6 @@ void FinishedViewStep::setConfigurationMap( const QVariantMap& configurationMap ) { m_config->setConfigurationMap( configurationMap ); - m_widget->setRestart( m_config->restartNowMode() ); - - if ( m_config->restartNowMode() != Config::RestartMode::Never ) - { - m_widget->setRestartNowCommand( m_config->restartNowCommand() ); - } } CALAMARES_PLUGIN_FACTORY_DEFINITION( FinishedViewStepFactory, registerPlugin< FinishedViewStep >(); ) From 7d024cf72be5a5a9d336376bcc24a1c33d550c12 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 23 Feb 2021 15:36:44 +0100 Subject: [PATCH 82/93] [finished] Move restart handling to Config --- src/modules/finished/Config.cpp | 12 ++++++++++++ src/modules/finished/Config.h | 10 ++++++++-- src/modules/finished/FinishedViewStep.cpp | 24 ++--------------------- 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/modules/finished/Config.cpp b/src/modules/finished/Config.cpp index a612661a8..b8f30be05 100644 --- a/src/modules/finished/Config.cpp +++ b/src/modules/finished/Config.cpp @@ -12,6 +12,8 @@ #include "utils/Logger.h" #include "utils/Variant.h" +#include + const NamedEnumTable< Config::RestartMode >& restartModes() { @@ -75,6 +77,16 @@ Config::setRestartNowWanted( bool w ) } } +void +Config::doRestart() +{ + if ( restartNowMode() != RestartMode::Never && restartNowWanted() ) + { + cDebug() << "Running restart command" << m_restartNowCommand; + QProcess::execute( "/bin/sh", { "-c", m_restartNowCommand } ); + } +} + void Config::setConfigurationMap( const QVariantMap& configurationMap ) diff --git a/src/modules/finished/Config.h b/src/modules/finished/Config.h index 32cc7bf22..718a3fae2 100644 --- a/src/modules/finished/Config.h +++ b/src/modules/finished/Config.h @@ -14,8 +14,6 @@ #include -#include - class Config : public QObject { Q_OBJECT @@ -50,6 +48,14 @@ public slots: void setRestartNowMode( RestartMode m ); void setRestartNowWanted( bool w ); + /** @brief Run the restart command, if desired. + * + * This should generally not be called somewhere during the + * application's execution, but only in response to QApplication::quit() + * or something like that when the user expects the system to restart. + */ + void doRestart(); + signals: void restartModeChanged( RestartMode m ); void restartNowWantedChanged( bool w ); diff --git a/src/modules/finished/FinishedViewStep.cpp b/src/modules/finished/FinishedViewStep.cpp index 48e2c47d5..176b27cb4 100644 --- a/src/modules/finished/FinishedViewStep.cpp +++ b/src/modules/finished/FinishedViewStep.cpp @@ -20,7 +20,7 @@ #include "utils/NamedEnum.h" #include "utils/Variant.h" -#include +#include #include #include #include @@ -128,34 +128,14 @@ FinishedViewStep::sendNotification() } -#if 0 -void -FinishedPage::setUpRestart() -{ - cDebug() << "FinishedPage::setUpRestart(), Quit button" - << "setup=" << restartModes().find( m_mode ) << "command=" << m_restartNowCommand; - - connect( qApp, &QApplication::aboutToQuit, [this]() - { - if ( ui->restartCheckBox->isVisible() && ui->restartCheckBox->isChecked() ) - { - cDebug() << "Running restart command" << m_restartNowCommand; - QProcess::execute( "/bin/sh", { "-c", m_restartNowCommand } ); - } - } ); -} -#endif - - void FinishedViewStep::onActivate() { - // m_widget->setUpRestart(); - if ( m_config->notifyOnFinished() ) { sendNotification(); } + connect( qApp, &QApplication::aboutToQuit, m_config, &Config::doRestart ); } From 76a2791b1229977c9799ef60dba80344439e3266 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 23 Feb 2021 15:42:14 +0100 Subject: [PATCH 83/93] [finished] Clean up includes --- src/modules/finished/FinishedPage.cpp | 10 ++-------- src/modules/finished/FinishedPage.h | 3 +-- src/modules/finished/FinishedViewStep.cpp | 3 ++- src/modules/finished/FinishedViewStep.h | 6 +----- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/modules/finished/FinishedPage.cpp b/src/modules/finished/FinishedPage.cpp index 5f021dd3d..6c5f9ad16 100644 --- a/src/modules/finished/FinishedPage.cpp +++ b/src/modules/finished/FinishedPage.cpp @@ -10,21 +10,15 @@ */ #include "FinishedPage.h" + +#include "Config.h" #include "ui_FinishedPage.h" #include "Branding.h" -#include "CalamaresVersion.h" #include "Settings.h" -#include "ViewManager.h" -#include "utils/CalamaresUtilsGui.h" -#include "utils/Logger.h" #include "utils/Retranslator.h" -#include -#include #include -#include -#include FinishedPage::FinishedPage( Config* config, QWidget* parent ) diff --git a/src/modules/finished/FinishedPage.h b/src/modules/finished/FinishedPage.h index 4e312ab8b..068efbdb5 100644 --- a/src/modules/finished/FinishedPage.h +++ b/src/modules/finished/FinishedPage.h @@ -12,12 +12,11 @@ #define FINISHEDPAGE_H -#include "Config.h" - #include #include +class Config; namespace Ui { class FinishedPage; diff --git a/src/modules/finished/FinishedViewStep.cpp b/src/modules/finished/FinishedViewStep.cpp index 176b27cb4..146a7c215 100644 --- a/src/modules/finished/FinishedViewStep.cpp +++ b/src/modules/finished/FinishedViewStep.cpp @@ -10,12 +10,13 @@ */ #include "FinishedViewStep.h" + +#include "Config.h" #include "FinishedPage.h" #include "Branding.h" #include "JobQueue.h" #include "Settings.h" - #include "utils/Logger.h" #include "utils/NamedEnum.h" #include "utils/Variant.h" diff --git a/src/modules/finished/FinishedViewStep.h b/src/modules/finished/FinishedViewStep.h index ac54fdd35..e2ce8ba55 100644 --- a/src/modules/finished/FinishedViewStep.h +++ b/src/modules/finished/FinishedViewStep.h @@ -11,15 +11,11 @@ #ifndef FINISHEDVIEWSTEP_H #define FINISHEDVIEWSTEP_H -#include "Config.h" - #include "DllMacro.h" #include "utils/PluginFactory.h" #include "viewpages/ViewStep.h" - -#include - +class Config; class FinishedPage; class PLUGINDLLEXPORT FinishedViewStep : public Calamares::ViewStep From ec4b6752d6fc01c8bf522e3e675f0a78a40a976d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 23 Feb 2021 15:54:19 +0100 Subject: [PATCH 84/93] [finished] Move notification to Config --- src/modules/finished/Config.cpp | 37 ++++++++++++++++ src/modules/finished/Config.h | 11 +++++ src/modules/finished/FinishedViewStep.cpp | 52 ++--------------------- src/modules/finished/FinishedViewStep.h | 9 ---- 4 files changed, 51 insertions(+), 58 deletions(-) diff --git a/src/modules/finished/Config.cpp b/src/modules/finished/Config.cpp index b8f30be05..e382478a3 100644 --- a/src/modules/finished/Config.cpp +++ b/src/modules/finished/Config.cpp @@ -9,10 +9,15 @@ #include "Config.h" +#include "Branding.h" +#include "Settings.h" #include "utils/Logger.h" #include "utils/Variant.h" #include +#include +#include +#include const NamedEnumTable< Config::RestartMode >& restartModes() @@ -88,6 +93,38 @@ Config::doRestart() } +void +Config::doNotify() +{ + QDBusInterface notify( + "org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications" ); + if ( notify.isValid() ) + { + const auto* branding = Calamares::Branding::instance(); + QDBusReply< uint > r = notify.call( + "Notify", + QString( "Calamares" ), + QVariant( 0U ), + QString( "calamares" ), + Calamares::Settings::instance()->isSetupMode() ? tr( "Setup Complete" ) : tr( "Installation Complete" ), + Calamares::Settings::instance()->isSetupMode() + ? tr( "The setup of %1 is complete." ).arg( branding->versionedName() ) + : tr( "The installation of %1 is complete." ).arg( branding->versionedName() ), + QStringList(), + QVariantMap(), + QVariant( 0 ) ); + if ( !r.isValid() ) + { + cWarning() << "Could not call org.freedesktop.Notifications.Notify at end of installation." << r.error(); + } + } + else + { + cWarning() << "Could not get dbus interface for notifications at end of installation." << notify.lastError(); + } +} + + void Config::setConfigurationMap( const QVariantMap& configurationMap ) { diff --git a/src/modules/finished/Config.h b/src/modules/finished/Config.h index 718a3fae2..d5335df83 100644 --- a/src/modules/finished/Config.h +++ b/src/modules/finished/Config.h @@ -56,6 +56,17 @@ public slots: */ void doRestart(); + /** @brief Send DBus notification, if desired. + * + * This takes notifyOnFinished() into account. + * + * At the end of installation (when the FinishedViewStep is activated), + * send a desktop notification via DBus that the install is done. + * If the installation failed, don't call this method because + * the notification is a positive one. + */ + void doNotify(); + signals: void restartModeChanged( RestartMode m ); void restartNowWantedChanged( bool w ); diff --git a/src/modules/finished/FinishedViewStep.cpp b/src/modules/finished/FinishedViewStep.cpp index 146a7c215..70eb4127a 100644 --- a/src/modules/finished/FinishedViewStep.cpp +++ b/src/modules/finished/FinishedViewStep.cpp @@ -14,17 +14,9 @@ #include "Config.h" #include "FinishedPage.h" -#include "Branding.h" #include "JobQueue.h" -#include "Settings.h" -#include "utils/Logger.h" -#include "utils/NamedEnum.h" -#include "utils/Variant.h" #include -#include -#include -#include FinishedViewStep::FinishedViewStep( QObject* parent ) : Calamares::ViewStep( parent ) @@ -90,53 +82,15 @@ FinishedViewStep::isAtEnd() const return true; } -void -FinishedViewStep::sendNotification() -{ - // If the installation failed, don't send notification popup; - // there's a (modal) dialog popped up with the failure notice. - if ( m_installFailed ) - { - return; - } - - QDBusInterface notify( - "org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications" ); - if ( notify.isValid() ) - { - const auto* branding = Calamares::Branding::instance(); - QDBusReply< uint > r = notify.call( - "Notify", - QString( "Calamares" ), - QVariant( 0U ), - QString( "calamares" ), - Calamares::Settings::instance()->isSetupMode() ? tr( "Setup Complete" ) : tr( "Installation Complete" ), - Calamares::Settings::instance()->isSetupMode() - ? tr( "The setup of %1 is complete." ).arg( branding->versionedName() ) - : tr( "The installation of %1 is complete." ).arg( branding->versionedName() ), - QStringList(), - QVariantMap(), - QVariant( 0 ) ); - if ( !r.isValid() ) - { - cWarning() << "Could not call org.freedesktop.Notifications.Notify at end of installation." << r.error(); - } - } - else - { - cWarning() << "Could not get dbus interface for notifications at end of installation." << notify.lastError(); - } -} - void FinishedViewStep::onActivate() { - if ( m_config->notifyOnFinished() ) + if ( !m_installFailed ) { - sendNotification(); + m_config->doNotify(); + connect( qApp, &QApplication::aboutToQuit, m_config, &Config::doRestart ); } - connect( qApp, &QApplication::aboutToQuit, m_config, &Config::doRestart ); } diff --git a/src/modules/finished/FinishedViewStep.h b/src/modules/finished/FinishedViewStep.h index e2ce8ba55..a35d7fac8 100644 --- a/src/modules/finished/FinishedViewStep.h +++ b/src/modules/finished/FinishedViewStep.h @@ -46,15 +46,6 @@ public slots: void onInstallationFailed( const QString& message, const QString& details ); private: - /** - * @brief Send notification at the end via DBus - * - * At the end of installation (when this step is activated), - * send a desktop notification via DBus that the install is done. - * If the installation failed, no notification is sent. - */ - void sendNotification(); - Config* m_config; FinishedPage* m_widget; bool m_installFailed; // Track if onInstallationFailed() was called From 5af614daf7a9d06a0576cb0ff8b68a92039b67ba Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 23 Feb 2021 15:59:40 +0100 Subject: [PATCH 85/93] [finished] Allow positive and negative notifications at end. --- src/modules/finished/Config.cpp | 42 +++++++++++++++++++++++---------- src/modules/finished/Config.h | 4 +--- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/modules/finished/Config.cpp b/src/modules/finished/Config.cpp index e382478a3..a749b0176 100644 --- a/src/modules/finished/Config.cpp +++ b/src/modules/finished/Config.cpp @@ -94,25 +94,41 @@ Config::doRestart() void -Config::doNotify() +Config::doNotify( bool hasFailed ) { QDBusInterface notify( "org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications" ); if ( notify.isValid() ) { + cDebug() << "Sending notification of completion. Failed?" << hasFailed; + + QString title; + QString message; + if ( hasFailed ) + { + title = Calamares::Settings::instance()->isSetupMode() ? tr( "Setup Failed" ) : tr( "Installation Failed" ); + message = Calamares::Settings::instance()->isSetupMode() + ? tr( "The setup of %1 did not complete successfully." ) + : tr( "The installation of %1 did not complete successfully." ); + } + else + { + title = Calamares::Settings::instance()->isSetupMode() ? tr( "Setup Complete" ) + : tr( "Installation Complete" ); + message = Calamares::Settings::instance()->isSetupMode() ? tr( "The setup of %1 is complete." ) + : tr( "The installation of %1 is complete." ); + } + const auto* branding = Calamares::Branding::instance(); - QDBusReply< uint > r = notify.call( - "Notify", - QString( "Calamares" ), - QVariant( 0U ), - QString( "calamares" ), - Calamares::Settings::instance()->isSetupMode() ? tr( "Setup Complete" ) : tr( "Installation Complete" ), - Calamares::Settings::instance()->isSetupMode() - ? tr( "The setup of %1 is complete." ).arg( branding->versionedName() ) - : tr( "The installation of %1 is complete." ).arg( branding->versionedName() ), - QStringList(), - QVariantMap(), - QVariant( 0 ) ); + QDBusReply< uint > r = notify.call( "Notify", + QString( "Calamares" ), + QVariant( 0U ), + QString( "calamares" ), + title, + message.arg( branding->versionedName() ), + QStringList(), + QVariantMap(), + QVariant( 0 ) ); if ( !r.isValid() ) { cWarning() << "Could not call org.freedesktop.Notifications.Notify at end of installation." << r.error(); diff --git a/src/modules/finished/Config.h b/src/modules/finished/Config.h index d5335df83..78078b99b 100644 --- a/src/modules/finished/Config.h +++ b/src/modules/finished/Config.h @@ -62,10 +62,8 @@ public slots: * * At the end of installation (when the FinishedViewStep is activated), * send a desktop notification via DBus that the install is done. - * If the installation failed, don't call this method because - * the notification is a positive one. */ - void doNotify(); + void doNotify( bool hasFailed = false ); signals: void restartModeChanged( RestartMode m ); From a4682db9872e14c953c1de3a1084a7baea816890 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 23 Feb 2021 16:05:48 +0100 Subject: [PATCH 86/93] [finished] Tidy up notification-at-end (and allow failed notifications) --- src/modules/finished/Config.cpp | 5 +++++ src/modules/finished/FinishedViewStep.cpp | 12 ++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/modules/finished/Config.cpp b/src/modules/finished/Config.cpp index a749b0176..5119da942 100644 --- a/src/modules/finished/Config.cpp +++ b/src/modules/finished/Config.cpp @@ -96,6 +96,11 @@ Config::doRestart() void Config::doNotify( bool hasFailed ) { + if ( !notifyOnFinished() ) + { + return; + } + QDBusInterface notify( "org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications" ); if ( notify.isValid() ) diff --git a/src/modules/finished/FinishedViewStep.cpp b/src/modules/finished/FinishedViewStep.cpp index 70eb4127a..3f9fd3aab 100644 --- a/src/modules/finished/FinishedViewStep.cpp +++ b/src/modules/finished/FinishedViewStep.cpp @@ -25,7 +25,6 @@ FinishedViewStep::FinishedViewStep( QObject* parent ) , m_installFailed( false ) { auto jq = Calamares::JobQueue::instance(); - connect( jq, &Calamares::JobQueue::failed, m_widget, &FinishedPage::onInstallationFailed ); connect( jq, &Calamares::JobQueue::failed, this, &FinishedViewStep::onInstallationFailed ); emit nextStatusChanged( true ); @@ -86,11 +85,8 @@ FinishedViewStep::isAtEnd() const void FinishedViewStep::onActivate() { - if ( !m_installFailed ) - { - m_config->doNotify(); - connect( qApp, &QApplication::aboutToQuit, m_config, &Config::doRestart ); - } + m_config->doNotify( m_installFailed ); + connect( qApp, &QApplication::aboutToQuit, m_config, &Config::doRestart ); } @@ -103,9 +99,9 @@ FinishedViewStep::jobs() const void FinishedViewStep::onInstallationFailed( const QString& message, const QString& details ) { - Q_UNUSED( message ) - Q_UNUSED( details ) m_installFailed = true; + m_config->setRestartNowMode( Config::RestartMode::Never ); + m_widget->onInstallationFailed( message, details ); } void From b30bb7ae0bfc48deeda50cd437de3f526ad9fe4c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 23 Feb 2021 16:33:38 +0100 Subject: [PATCH 87/93] CI: note Linuxisms in the script --- ci/RELEASE.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/RELEASE.sh b/ci/RELEASE.sh index 6f1b198c9..706d4c2ea 100755 --- a/ci/RELEASE.sh +++ b/ci/RELEASE.sh @@ -7,6 +7,8 @@ # # Release script for Calamares # +# NOTE: this script contains Linuxisms (in particular, expects GNU mktemp(1)) +# # This attempts to perform the different steps of the RELEASE.md # document automatically. It's not tested on other machines or # setups other than [ade]'s development VM. From 108e227eec518fc790003766ab5dc21a95306126 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 23 Feb 2021 16:33:47 +0100 Subject: [PATCH 88/93] Changes: pre-release housekeeping --- CHANGES | 28 ++++++++++++++++++++++++---- CMakeLists.txt | 2 +- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index aa5dba206..471236b5f 100644 --- a/CHANGES +++ b/CHANGES @@ -7,16 +7,36 @@ contributors are listed. Note that Calamares does not have a historical changelog -- this log starts with version 3.2.0. The release notes on the website will have to do for older versions. -# 3.2.37 (unreleased) # +# 3.2.37 (2021-02-23) # This release contains contributions from (alphabetically by first name): - - No external contributors yet + - benne-dee ## Core ## - - No core changes yet + - Calamares has a table of 'best guess' languages for each country + and when GeoIP is enabled, it will automatically select that + country's language as default -- the user can of course pick + a different one. The 'best guess' is based on Unicode / ISO + data, which is sometimes dubious. Based on some personal notes, + the 'best guess' language for Belarus has been changed to Russian. + - Calamares has a table of 'best guess' keyboard mappings, + allowing native language input. However, usernames and + passwords should be in US-ASCII (this is a limitation of + the login system -- **some** parts of the system will support + non-ASCII input, but it's better safe than sorry). + Add Greek to the list of languages that needs US-ASCII + in addition to native input. + - The CI infrastructure now builds Calamares and Calamares-extensions + on a nightly basis. ## Modules ## - - No module changes yet + - The *netinstall* module has a YAML schema, allowing packagers + to validate and verify their netinstall configurations before + shipping an ISO (or writing bug reports). Thanks benne-dee. + - The *finished* module has been heavily refactored, opening + the way to a QML-based version of the same module. This is + also preparatory work for allowing packagers (e.g. PostmarketOS) + to customize the messages on the finished page. # 3.2.36 (2021-02-03) # diff --git a/CMakeLists.txt b/CMakeLists.txt index 108549a8a..bcd14adb2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,7 @@ project( CALAMARES LANGUAGES C CXX ) -set( CALAMARES_VERSION_RC 1 ) # Set to 0 during release cycle, 1 during development +set( CALAMARES_VERSION_RC 0 ) # Set to 0 during release cycle, 1 during development ### OPTIONS # From f9a8a9f58817c1ee351cfde3657613552c917fc9 Mon Sep 17 00:00:00 2001 From: Calamares CI Date: Tue, 23 Feb 2021 16:36:31 +0100 Subject: [PATCH 89/93] i18n: [calamares] Automatic merge of Transifex translations --- lang/calamares_he.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lang/calamares_he.ts b/lang/calamares_he.ts index 97683a19a..57d654e05 100644 --- a/lang/calamares_he.ts +++ b/lang/calamares_he.ts @@ -145,7 +145,7 @@ Done - בוצע + סיום
@@ -2504,7 +2504,7 @@ The installer will quit and all changes will be lost. Free Space - זכרון פנוי + שטח פנוי @@ -2931,7 +2931,7 @@ Output: Unpartitioned space or unknown partition table - הזכרון לא מחולק למחיצות או שטבלת המחיצות אינה מוכרת + השטח לא מחולק למחיצות או שטבלת המחיצות אינה מוכרת @@ -2991,7 +2991,7 @@ Output: %1 cannot be installed on empty space. Please select an existing partition. - לא ניתן להתקין את %1 על זכרון ריק. אנא בחר מחיצה קיימת. + לא ניתן להתקין את %1 על שטח ריק. נא לבחור מחיצה קיימת. From 46ab3ac27793be82574b27599ee72709b985a614 Mon Sep 17 00:00:00 2001 From: Calamares CI Date: Tue, 23 Feb 2021 16:36:31 +0100 Subject: [PATCH 90/93] i18n: [python] Automatic merge of Transifex translations --- lang/python/he/LC_MESSAGES/python.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/python/he/LC_MESSAGES/python.po b/lang/python/he/LC_MESSAGES/python.po index 459e858b3..6f6200ac7 100644 --- a/lang/python/he/LC_MESSAGES/python.po +++ b/lang/python/he/LC_MESSAGES/python.po @@ -5,7 +5,7 @@ # # Translators: # Eli Shleifer , 2017 -# Omeritzics Games , 2020 +# Omer I.S. , 2020 # Yaron Shahrabani , 2020 # #, fuzzy From 0f87a4a91aa708870340f8af8d690e0490ab9434 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 23 Feb 2021 21:32:59 +0100 Subject: [PATCH 91/93] Changes: post-release housekeeping --- CHANGES | 12 ++++++++++++ CMakeLists.txt | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 471236b5f..e6e8de223 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,18 @@ contributors are listed. Note that Calamares does not have a historical changelog -- this log starts with version 3.2.0. The release notes on the website will have to do for older versions. +# 3.2.38 (unreleased) # + +This release contains contributions from (alphabetically by first name): + - No external contributors yet + +## Core ## + - No core changes yet + +## Modules ## + - No module changes yet + + # 3.2.37 (2021-02-23) # This release contains contributions from (alphabetically by first name): diff --git a/CMakeLists.txt b/CMakeLists.txt index bcd14adb2..8f28b11c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,11 +41,11 @@ # TODO:3.3: Require CMake 3.12 cmake_minimum_required( VERSION 3.3 FATAL_ERROR ) project( CALAMARES - VERSION 3.2.37 + VERSION 3.2.38 LANGUAGES C CXX ) -set( CALAMARES_VERSION_RC 0 ) # Set to 0 during release cycle, 1 during development +set( CALAMARES_VERSION_RC 1 ) # Set to 0 during release cycle, 1 during development ### OPTIONS # From 3d58127234d1b6ac20fa3aa82fbc848dd475e42b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Mar 2021 16:37:17 +0100 Subject: [PATCH 92/93] CI: enable CPack --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f28b11c2..e5e559714 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -686,3 +686,16 @@ feature_summary( DESCRIPTION "The following REQUIRED packages were not found:" QUIET_ON_EMPTY ) + +### PACKAGING +# +# Note: most distro's will do distro-specific packaging rather than +# using CPack, and this duplicates information in the AppStream, too. +# TODO:3.3 With newer CMake, move HOMEPAGE_URL to the project()call +set(CPACK_PACKAGE_VENDOR calamares) +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A Linux system installer") +set(CPACK_PACKAGE_DESCRIPTION "Calamares is a Linux system installer, intended for Linux distributions to use on their ISOs and other bootable media to install the distribution to the end-user's computer. Calamares can also be used as an OEM configuration tool. It is modular, extensible and highly-configurable for Linux distributions from all five major Linux families.") +set(CPACK_PACKAGE_HOMEPAGE_URL "https://calamares.io") +set(CPACK_PACKAGE_ICON "data/images/squid.png") + +include(CPack) From 1496173b2c1aceaadf7ec4af63ea5b611b7d37fd Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Mar 2021 16:47:47 +0100 Subject: [PATCH 93/93] CI: Add -Og for debug builds, for better ABI checking --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e5e559714..758ae3332 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,7 +194,7 @@ include( CMakeColors ) set( CMAKE_CXX_STANDARD 17 ) set( CMAKE_CXX_STANDARD_REQUIRED ON ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=return-type" ) -set( CMAKE_CXX_FLAGS_DEBUG "-g ${CMAKE_CXX_FLAGS_DEBUG}" ) +set( CMAKE_CXX_FLAGS_DEBUG "-Og -g ${CMAKE_CXX_FLAGS_DEBUG}" ) set( CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG" ) set( CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" ) set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" ) @@ -202,7 +202,7 @@ set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" ) set( CMAKE_C_STANDARD 99 ) set( CMAKE_C_STANDARD_REQUIRED ON ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall" ) -set( CMAKE_C_FLAGS_DEBUG "-g" ) +set( CMAKE_C_FLAGS_DEBUG "-Og -g" ) set( CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG" ) set( CMAKE_C_FLAGS_RELEASE "-O4 -DNDEBUG" ) set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" ) @@ -230,6 +230,10 @@ if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) string( APPEND CMAKE_CXX_FLAGS " ${CLANG_WARNINGS}" ) endforeach() + # The dwarf-debugging flags are slightly different, too + string( APPEND CMAKE_CXX_FLAGS_DEBUG " -gdwarf" ) + string( APPEND CMAKE_C_FLAGS_DEBUG " -gdwarf" ) + # Third-party code where we don't care so much about compiler warnings # (because it's uncomfortable to patch) get different flags; use # mark_thirdparty_code( [...] )