From 12675be516880d6cc55285a6859edb66e83c10fa Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Fri, 7 Feb 2020 21:25:55 +0100
Subject: [PATCH 01/28] [libcalamaresui] Factor out "simple" QML method calls
---
src/libcalamaresui/CMakeLists.txt | 1 +
src/libcalamaresui/utils/Qml.cpp | 52 +++++++++++++++++++
src/libcalamaresui/utils/Qml.h | 42 +++++++++++++++
.../viewpages/ExecutionViewStep.cpp | 32 +-----------
4 files changed, 97 insertions(+), 30 deletions(-)
create mode 100644 src/libcalamaresui/utils/Qml.cpp
create mode 100644 src/libcalamaresui/utils/Qml.h
diff --git a/src/libcalamaresui/CMakeLists.txt b/src/libcalamaresui/CMakeLists.txt
index 061a401bb..c603ca22d 100644
--- a/src/libcalamaresui/CMakeLists.txt
+++ b/src/libcalamaresui/CMakeLists.txt
@@ -16,6 +16,7 @@ set( calamaresui_SOURCES
utils/CalamaresUtilsGui.cpp
utils/ImageRegistry.cpp
utils/Paste.cpp
+ utils/Qml.cpp
viewpages/BlankViewStep.cpp
viewpages/ExecutionViewStep.cpp
diff --git a/src/libcalamaresui/utils/Qml.cpp b/src/libcalamaresui/utils/Qml.cpp
new file mode 100644
index 000000000..1ea72e674
--- /dev/null
+++ b/src/libcalamaresui/utils/Qml.cpp
@@ -0,0 +1,52 @@
+/* === This file is part of Calamares - ===
+ *
+ * Copyright 2020, Adriaan de Groot
+ *
+ * Calamares is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Calamares is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Calamares. If not, see .
+ */
+
+#include "Qml.h"
+
+#include "utils/Logger.h"
+
+#include
+#include
+#include
+#include
+
+namespace CalamaresUtils
+{
+
+void
+callQMLFunction( QQuickItem* qmlObject, const char* method )
+{
+ QByteArray methodSignature( method );
+ methodSignature.append( "()" );
+
+ if ( qmlObject && qmlObject->metaObject()->indexOfMethod( methodSignature ) >= 0 )
+ {
+ QVariant returnValue;
+ QMetaObject::invokeMethod( qmlObject, method, Q_RETURN_ARG( QVariant, returnValue ) );
+ if ( !returnValue.isNull() )
+ {
+ cDebug() << "QML" << methodSignature << "returned" << returnValue;
+ }
+ }
+ else if ( qmlObject )
+ {
+ cDebug() << "QML" << methodSignature << "is missing.";
+ }
+}
+
+} // namespace CalamaresUtils
diff --git a/src/libcalamaresui/utils/Qml.h b/src/libcalamaresui/utils/Qml.h
new file mode 100644
index 000000000..70f59e7ec
--- /dev/null
+++ b/src/libcalamaresui/utils/Qml.h
@@ -0,0 +1,42 @@
+/* === This file is part of Calamares - ===
+ *
+ * Copyright 2020, Adriaan de Groot
+ *
+ * Calamares is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Calamares is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Calamares. If not, see .
+ */
+
+#ifndef UTILS_QML_H
+#define UTILS_QML_H
+
+#include "DllMacro.h"
+
+class QQuickItem;
+
+namespace CalamaresUtils
+{
+
+/** @brief Calls the QML method @p method on @p qmlObject
+ *
+ * Pass in only the name of the method (e.g. onActivate). This function
+ * checks if the method exists (with no arguments) before trying to
+ * call it, so that no warnings are printed due to missing methods.
+ *
+ * If there is a return value from the QML method, it is logged (but not otherwise used).
+ */
+DLLEXPORT void
+callQMLFunction( QQuickItem* qmlObject, const char* method );
+
+} // namespace CalamaresUtils
+
+#endif
diff --git a/src/libcalamaresui/viewpages/ExecutionViewStep.cpp b/src/libcalamaresui/viewpages/ExecutionViewStep.cpp
index e0921910d..8ea918690 100644
--- a/src/libcalamaresui/viewpages/ExecutionViewStep.cpp
+++ b/src/libcalamaresui/viewpages/ExecutionViewStep.cpp
@@ -31,6 +31,7 @@
#include "utils/CalamaresUtilsGui.h"
#include "utils/Dirs.h"
#include "utils/Logger.h"
+#include "utils/Qml.h"
#include "utils/Retranslator.h"
#include
@@ -42,35 +43,6 @@
#include
#include
-/** @brief Calls the QML method @p method()
- *
- * Pass in only the name of the method (e.g. onActivate). This function
- * checks if the method exists (with no arguments) before trying to
- * call it, so that no warnings are printed due to missing methods.
- *
- * If there is a return value from the QML method, it is logged (but not otherwise used).
- */
-static void
-callQMLFunction( QQuickItem* qmlObject, const char* method )
-{
- QByteArray methodSignature( method );
- methodSignature.append( "()" );
-
- if ( qmlObject && qmlObject->metaObject()->indexOfMethod( methodSignature ) >= 0 )
- {
- QVariant returnValue;
- QMetaObject::invokeMethod( qmlObject, method, Q_RETURN_ARG( QVariant, returnValue ) );
- if ( !returnValue.isNull() )
- {
- cDebug() << "QML" << methodSignature << "returned" << returnValue;
- }
- }
- else if ( qmlObject )
- {
- cDebug() << "QML" << methodSignature << "is missing.";
- }
-}
-
namespace Calamares
{
@@ -205,7 +177,7 @@ changeSlideShowState( Slideshow state, QQuickItem* slideshow, QQuickWidget* widg
if ( Branding::instance()->slideshowAPI() == 2 )
{
// The QML was already loaded in the constructor, need to start it
- callQMLFunction( slideshow, activate ? "onActivate" : "onLeave" );
+ CalamaresUtils::callQMLFunction( slideshow, activate ? "onActivate" : "onLeave" );
}
else if ( !Calamares::Branding::instance()->slideshowPath().isEmpty() )
{
From 1f34c2834e7384aabf742016c9f913c680f7c6e1 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Fri, 7 Feb 2020 21:33:34 +0100
Subject: [PATCH 02/28] [libcalamaresui] Move definitions inside namespace {}
- Remove the extra Calamares:: namespace specifier from half the
definitions.
---
src/libcalamaresui/viewpages/QmlViewStep.cpp | 30 +++++++++++---------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/src/libcalamaresui/viewpages/QmlViewStep.cpp b/src/libcalamaresui/viewpages/QmlViewStep.cpp
index b009d1626..a7a157343 100644
--- a/src/libcalamaresui/viewpages/QmlViewStep.cpp
+++ b/src/libcalamaresui/viewpages/QmlViewStep.cpp
@@ -23,6 +23,7 @@
#include "utils/Dirs.h"
#include "utils/Logger.h"
#include "utils/NamedEnum.h"
+#include "utils/Qml.h"
#include "utils/Variant.h"
#include "widgets/WaitingWidget.h"
@@ -80,57 +81,56 @@ QmlViewStep::prettyName() const
}
-} // namespace Calamares
bool
-Calamares::QmlViewStep::isAtBeginning() const
+QmlViewStep::isAtBeginning() const
{
return true;
}
bool
-Calamares::QmlViewStep::isAtEnd() const
+QmlViewStep::isAtEnd() const
{
return true;
}
bool
-Calamares::QmlViewStep::isBackEnabled() const
+QmlViewStep::isBackEnabled() const
{
return true;
}
bool
-Calamares::QmlViewStep::isNextEnabled() const
+QmlViewStep::isNextEnabled() const
{
return true;
}
Calamares::JobList
-Calamares::QmlViewStep::jobs() const
+QmlViewStep::jobs() const
{
return JobList();
}
void
-Calamares::QmlViewStep::onActivate()
+QmlViewStep::onActivate()
{
// TODO: call into QML
}
void
-Calamares::QmlViewStep::onLeave()
+QmlViewStep::onLeave()
{
// TODO: call into QML
}
QWidget*
-Calamares::QmlViewStep::widget()
+QmlViewStep::widget()
{
return m_widget;
}
void
-Calamares::QmlViewStep::loadComplete()
+QmlViewStep::loadComplete()
{
cDebug() << "QML component" << m_qmlFileName << m_qmlComponent->status();
if ( m_qmlComponent->status() == QQmlComponent::Error )
@@ -163,7 +163,7 @@ Calamares::QmlViewStep::loadComplete()
}
void
-Calamares::QmlViewStep::showQml()
+QmlViewStep::showQml()
{
if ( !m_qmlWidget || !m_qmlObject )
{
@@ -190,7 +190,7 @@ Calamares::QmlViewStep::showQml()
* is badly configured).
*/
QString
-searchQmlFile( Calamares::QmlViewStep::QmlSearch method, const QString& configuredName, const QString& moduleName )
+searchQmlFile( QmlViewStep::QmlSearch method, const QString& configuredName, const QString& moduleName )
{
using QmlSearch = Calamares::QmlViewStep::QmlSearch;
@@ -235,7 +235,7 @@ searchQmlFile( Calamares::QmlViewStep::QmlSearch method, const QString& configur
}
void
-Calamares::QmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
+QmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
{
bool ok = false;
m_searchMethod = searchNames().find( CalamaresUtils::getString( configurationMap, "search" ), ok );
@@ -270,8 +270,10 @@ Calamares::QmlViewStep::setConfigurationMap( const QVariantMap& configurationMap
}
void
-Calamares::QmlViewStep::showFailedQml()
+QmlViewStep::showFailedQml()
{
cWarning() << "QmlViewStep" << moduleInstanceKey() << "loading failed.";
m_spinner->setText( prettyName() + ' ' + tr( "Loading failed." ) );
}
+
+} // namespace Calamares
From 39a54539047666fe337b1aac16b891e06f70d811 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Fri, 7 Feb 2020 22:18:23 +0100
Subject: [PATCH 03/28] [libcalamaresui] Add QML onActivate() and onLeave()
calls.
- This comes from the ExecutionViewStep, V2 loading, which
notifies the QML that the QML is now active.
---
src/libcalamaresui/viewpages/QmlViewStep.cpp | 49 ++++++++++++++++++--
1 file changed, 46 insertions(+), 3 deletions(-)
diff --git a/src/libcalamaresui/viewpages/QmlViewStep.cpp b/src/libcalamaresui/viewpages/QmlViewStep.cpp
index a7a157343..2bfc72757 100644
--- a/src/libcalamaresui/viewpages/QmlViewStep.cpp
+++ b/src/libcalamaresui/viewpages/QmlViewStep.cpp
@@ -19,6 +19,7 @@
#include "QmlViewStep.h"
#include "Branding.h"
+#include "ViewManager.h"
#include "utils/Dirs.h"
#include "utils/Logger.h"
@@ -51,6 +52,36 @@ searchNames()
return names;
}
+/// @brief State-change of the QML, for changeQMLState()
+enum class QMLAction
+{
+ Start,
+ Stop
+};
+
+/** @brief Tells the QML we activated or left it.
+ *
+ * If @p action is @c QMLAction::Start, calls onActivate in the QML.
+ * If @p action is @c QMLAction::Stop, calls onLeave in the QML.
+ *
+ * Sets *activatedInCalamares* property on the QML as well (to true
+ * if @p action is @c QMLAction::Start, false otherwise).
+ */
+static void
+changeQMLState( QMLAction action, QQuickItem* item )
+{
+ static const char propertyName[] = "activatedInCalamares";
+
+ bool activate = action == QMLAction::Start;
+ CalamaresUtils::callQMLFunction( item, activate ? "onActivate" : "onLeave" );
+
+ auto property = item->property( propertyName );
+ if ( property.isValid() && ( property.type() == QVariant::Bool ) && ( property.toBool() != activate ) )
+ {
+ item->setProperty( propertyName, activate );
+ }
+}
+
namespace Calamares
{
@@ -81,7 +112,6 @@ QmlViewStep::prettyName() const
}
-
bool
QmlViewStep::isAtBeginning() const
{
@@ -114,13 +144,19 @@ QmlViewStep::jobs() const
void
QmlViewStep::onActivate()
{
- // TODO: call into QML
+ if ( m_qmlObject )
+ {
+ changeQMLState( QMLAction::Start, m_qmlObject );
+ }
}
void
QmlViewStep::onLeave()
{
- // TODO: call into QML
+ if ( m_qmlObject )
+ {
+ changeQMLState( QMLAction::Stop, m_qmlObject );
+ }
}
QWidget*
@@ -181,6 +217,13 @@ QmlViewStep::showQml()
{
cDebug() << "showQml() called twice";
}
+
+ if ( ViewManager::instance()->currentStep() == this )
+ {
+ // We're alreay visible! Must have been slow QML loading, and we
+ // passed onActivate already.
+ changeQMLState( QMLAction::Start, m_qmlObject );
+ }
}
From 39ef67183620bfad013024d37786dd83512819e2 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Fri, 7 Feb 2020 22:25:51 +0100
Subject: [PATCH 04/28] Changes: mention QML bits
---
CHANGES | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/CHANGES b/CHANGES
index 1f1d37f61..ce161f396 100644
--- a/CHANGES
+++ b/CHANGES
@@ -17,10 +17,18 @@ This release contains contributions from (alphabetically by first name):
translations without requiring a recompile: helpful for translators
and possibly for distributions with their own translation style.
See the translators and deployers wiki for details.
+ - A new `ViewStep` base class, `QmlViewStep`, has been added that loads
+ a configurable QML file and plays it. This is used by the new *notesqml*
+ module -- which is in itself a minimal wrapper around the same that
+ adds only a translatable module name.
## Modules ##
- The *machineid* and *users* modules now prefer high-quality random
data from `/dev/urandom` rather than pseudo-random data. #1254
+ - A new *notesqml* module supports loading QML. This can be used for
+ "fancy" release notes as a QML application, rather than a webview
+ or text widget. Note that this does not replace the slideshow-during-
+ installation module.
# 3.2.18 (2020-01-28) #
From c0e1ebb72a2fe3ccaff1cc7e74ec840b2beca88a Mon Sep 17 00:00:00 2001
From: demmm
Date: Sun, 9 Feb 2020 01:03:52 +0100
Subject: [PATCH 05/28] adding notesqml, copy of dummyqml included in
settings.conf, commented out
---
settings.conf | 1 +
src/modules/notesqml/CMakeLists.txt | 11 ++++
src/modules/notesqml/NotesQmlViewStep.cpp | 52 ++++++++++++++++
src/modules/notesqml/NotesQmlViewStep.h | 48 +++++++++++++++
src/modules/notesqml/notesqml.conf | 25 ++++++++
src/modules/notesqml/notesqml.qml | 74 +++++++++++++++++++++++
src/modules/notesqml/notesqml.qrc | 5 ++
7 files changed, 216 insertions(+)
create mode 100644 src/modules/notesqml/CMakeLists.txt
create mode 100644 src/modules/notesqml/NotesQmlViewStep.cpp
create mode 100644 src/modules/notesqml/NotesQmlViewStep.h
create mode 100644 src/modules/notesqml/notesqml.conf
create mode 100644 src/modules/notesqml/notesqml.qml
create mode 100644 src/modules/notesqml/notesqml.qrc
diff --git a/settings.conf b/settings.conf
index 1c7b773ff..875af11ad 100644
--- a/settings.conf
+++ b/settings.conf
@@ -87,6 +87,7 @@ modules-search: [ local ]
sequence:
- show:
- welcome
+# - notesqml
# - dummypythonqt
- locale
- keyboard
diff --git a/src/modules/notesqml/CMakeLists.txt b/src/modules/notesqml/CMakeLists.txt
new file mode 100644
index 000000000..6aedab5aa
--- /dev/null
+++ b/src/modules/notesqml/CMakeLists.txt
@@ -0,0 +1,11 @@
+calamares_add_plugin( notesqml
+ TYPE viewmodule
+ EXPORT_MACRO PLUGINDLLEXPORT_PRO
+ SOURCES
+ NotesQmlViewStep.cpp
+ RESOURCES
+ notesqml.qrc
+ LINK_PRIVATE_LIBRARIES
+ calamaresui
+ SHARED_LIB
+)
diff --git a/src/modules/notesqml/NotesQmlViewStep.cpp b/src/modules/notesqml/NotesQmlViewStep.cpp
new file mode 100644
index 000000000..e729c2df7
--- /dev/null
+++ b/src/modules/notesqml/NotesQmlViewStep.cpp
@@ -0,0 +1,52 @@
+/* === This file is part of Calamares - ===
+ *
+ * Copyright 2020, Adriaan de Groot
+ * Copyright 2020, Anke Boersma
+ *
+ * Calamares is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Calamares is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Calamares. If not, see .
+ */
+
+#include "NotesQmlViewStep.h"
+
+#include
+
+NotesQmlViewStep::NotesQmlViewStep( QObject* parent )
+ : Calamares::QmlViewStep( "notesqml", parent )
+{
+}
+
+NotesQmlViewStep::~NotesQmlViewStep() {}
+
+QString
+NotesQmlViewStep::prettyName() const
+{
+ return m_notesName ? m_notesName->get() : tr( "Notes" );
+}
+
+void
+NotesQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
+{
+ Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation
+
+ bool qmlLabel_ok = false;
+ auto qmlLabel = CalamaresUtils::getSubMap( configurationMap, "qmlLabel", qmlLabel_ok );
+
+ if ( qmlLabel.contains( "notes" ) )
+ {
+ m_notesName = new CalamaresUtils::Locale::TranslatedString( qmlLabel, "notes" );
+ }
+
+}
+
+CALAMARES_PLUGIN_FACTORY_DEFINITION( NotesQmlViewStepFactory, registerPlugin< NotesQmlViewStep >(); )
diff --git a/src/modules/notesqml/NotesQmlViewStep.h b/src/modules/notesqml/NotesQmlViewStep.h
new file mode 100644
index 000000000..445b34c81
--- /dev/null
+++ b/src/modules/notesqml/NotesQmlViewStep.h
@@ -0,0 +1,48 @@
+/* === This file is part of Calamares - ===
+ *
+ * Copyright 2020, Adriaan de Groot
+ * Copyright 2020, Anke Boersma
+ *
+ * Calamares is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Calamares is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Calamares. If not, see .
+ */
+
+#ifndef NOTESQMLVIEWSTEP_H
+#define NOTESQMLVIEWSTEP_H
+
+#include "PluginDllMacro.h"
+#include "locale/TranslatableConfiguration.h"
+#include "utils/CalamaresUtilsSystem.h"
+#include "utils/Variant.h"
+#include "utils/PluginFactory.h"
+#include "viewpages/QmlViewStep.h"
+
+class PLUGINDLLEXPORT NotesQmlViewStep : public Calamares::QmlViewStep
+{
+ Q_OBJECT
+
+public:
+ NotesQmlViewStep( QObject* parent = nullptr );
+ virtual ~NotesQmlViewStep() override;
+
+ QString prettyName() const override;
+
+ void setConfigurationMap( const QVariantMap& configurationMap ) override;
+
+private:
+ CalamaresUtils::Locale::TranslatedString* m_notesName; // As it appears in the sidebar
+};
+
+CALAMARES_PLUGIN_FACTORY_DECLARATION( NotesQmlViewStepFactory )
+
+#endif
diff --git a/src/modules/notesqml/notesqml.conf b/src/modules/notesqml/notesqml.conf
new file mode 100644
index 000000000..1dcc25cff
--- /dev/null
+++ b/src/modules/notesqml/notesqml.conf
@@ -0,0 +1,25 @@
+# QML modules can search for the QML inside the Qt resources
+# (QRC) which are compiled into the module, or in the branding
+# setup for Calamares, (or both of them, with branding taking
+# precedence). This allows the module to ship a default UI and
+# branding to optionally introduce a replacement file.
+#
+# Generally, leave the search method set to "both" because if
+# you don't want to brand the UI, just don't ship a branding
+# QML file for it.
+#
+# To support instanced QML modules, searches in the branding
+# directory look for the full module@instanceid name as well.
+---
+# Search mode. Valid values are "both", "qrc" and "branding"
+search: both
+
+# Name of the QML file. If not set, uses the name of the instance
+# of the module (e.g. if you list this module in `settings.conf`
+# in the *instances* section, you get *id*, otherwise it would
+# normally be "notesqml").
+#filename: notesqml
+
+qmlLabel:
+ notes: "Release Notes"
+ notes[nl]: "Opmerkingen"
diff --git a/src/modules/notesqml/notesqml.qml b/src/modules/notesqml/notesqml.qml
new file mode 100644
index 000000000..0a60fd741
--- /dev/null
+++ b/src/modules/notesqml/notesqml.qml
@@ -0,0 +1,74 @@
+/* === This file is part of Calamares - ===
+ *
+ * Copyright 2020, Anke Boersma
+ *
+ * Calamares is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Calamares is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Calamares. If not, see .
+ */
+
+import QtQuick 2.7
+import QtQuick.Controls 2.2
+import QtQuick.Window 2.2
+import QtQuick.Layouts 1.3
+import QtQuick.Controls.Material 2.1
+
+Item {
+ width: 740
+ height: 420
+
+ Flickable {
+ id: flick
+ anchors.fill: parent
+ contentHeight: 800
+
+ ScrollBar.vertical: ScrollBar {
+ width: 10
+ policy: ScrollBar.AlwaysOn
+ }
+
+ TextArea {
+ id: intro
+ x: 1
+ y: 0
+ width: 720
+ font.pointSize: 14
+ textFormat: Text.RichText
+ antialiasing: true
+ activeFocusOnPress: false
+ wrapMode: Text.WordWrap
+
+ text: qsTr("Generic GNU/Linux 2020.2 LTS Turgid Tuba
+ This an example QML file, showing options in RichText with Flickable content.
+
+ QML with RichText can use HTML tags, Flickable content is useful for touchscreens.
+
+ This is bold text
+ This is italic text
+ This is underlined text
+ This text will be center-aligned.
+ This is strikethrough
+
+ Code example:
+ ls -l /home
+
+ Lists:
+
+ - Intel CPU systems
+ - AMD CPU systems
+
+
+ The vertical scrollbar is adjustable, current width set to 10.
")
+
+ }
+ }
+}
diff --git a/src/modules/notesqml/notesqml.qrc b/src/modules/notesqml/notesqml.qrc
new file mode 100644
index 000000000..a4aa1909f
--- /dev/null
+++ b/src/modules/notesqml/notesqml.qrc
@@ -0,0 +1,5 @@
+
+
+ notesqml.qml
+
+
From f75a1e1c9aae4fd9767a577478983bd4f4dc86bc Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Mon, 10 Feb 2020 11:06:55 +0100
Subject: [PATCH 06/28] Changes: remove obsolete badge
---
README.md | 1 -
1 file changed, 1 deletion(-)
diff --git a/README.md b/README.md
index e2e87fddf..4a5610dc9 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,6 @@
---------
[![GitHub release](https://img.shields.io/github/release/calamares/calamares.svg)](https://github.com/calamares/calamares/releases)
-[![Build Status](https://calamares.io/ci/buildStatus/icon?job=calamares-post_commit)](https://calamares.io/ci/job/calamares-post_commit/)
[![Travis Build Status](https://travis-ci.org/calamares/calamares.svg?branch=master)](https://travis-ci.org/calamares/calamares)
[![Coverity Scan Build Status](https://scan.coverity.com/projects/5389/badge.svg)](https://scan.coverity.com/projects/5389)
[![GitHub license](https://img.shields.io/github/license/calamares/calamares.svg)](https://github.com/calamares/calamares/blob/master/LICENSE)
From 0dde233c51d74fc3b59c534082fdb92d30f193a3 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Mon, 10 Feb 2020 11:41:38 +0100
Subject: [PATCH 07/28] Docs: move HACKING to the wiki
---
ci/HACKING.md | 212 +-------------------------------------------------
1 file changed, 1 insertion(+), 211 deletions(-)
diff --git a/ci/HACKING.md b/ci/HACKING.md
index 02eb8fd17..f1c8b750b 100644
--- a/ci/HACKING.md
+++ b/ci/HACKING.md
@@ -1,211 +1 @@
-Hacking on Calamares
-====================
-
-These are the guidelines for hacking on Calamares. Except for the licensing,
-which **must** be GPLv3+, these are guidelines and -- like PEP8 -- the most
-important thing is to know when you can ignore them.
-
-
-Licensing
----------
-Calamares is released under the terms of the GNU GPL, version 3 or later.
-Every source file must have a license header, with a list of copyright holders and years.
-
-Example:
-```
-/* === This file is part of Calamares - ===
- *
- * Copyright 2013-2014, Random Person
- * Copyright 2010, Someone Else
- *
- * Calamares is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Calamares is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Calamares. If not, see .
- */
-```
-Copyright holders must be physical or legal personalities. A statement such as
-`Copyright 2014, The FooBarQuux project` has no legal value if "The FooBarQuux
-project" is not the legal name of a person, company, incorporated
-organization, etc.
-
-Please add your name to files you touch when making any contribution (even if
-it's just a typo-fix which might not be copyrightable in all jurisdictions).
-
-
-Formatting C++
---------------
-This formatting guide applies to C++ code only; for Python modules, we use
-[pycodestyle](https://github.com/PyCQA/pycodestyle) to apply a check of
-some PEP8 guidelines.
-
-* Spaces, not tabs.
-* Indentation is 4 spaces.
-* Lines should be limited to 90 characters.
-* Spaces between brackets and argument functions, including for template arguments
-* No space before brackets, except for keywords, for example `function( argument )` but
- `if ( condition )`.
-* For pointer and reference variable declarations, put a space before the variable name
- and no space between the type and the `*` or `&`, e.g. `int* p`.
-* `for`, `if`, `else`, `while` and similar statements put the braces on the next line,
- if the following block is more than one statement. Always use braces.
-* Function and class definitions have their braces on separate lines.
-* A function implementation's return type is on its own line.
-* `CamelCase.{cpp,h}` style file names.
-* Lambdas are preferrably indented to a 4-space tab, even when passed as an
- argument to functions.
-
-Example:
-```
-bool
-MyClass::myMethod( QStringList list, const QString& name )
-{
- if ( list.isEmpty() )
- return false;
-
- cDebug() << "Items in list ..";
- foreach ( const QString& string, list )
- cDebug() << " .." << string;
-
- switch ( m_enumValue )
- {
- case Something:
- return true;
- case SomethingElse:
- doSomething();
- break;
- }
-}
-```
-
-You can use `clang-format` (version 7) to have Calamares sources formatted
-the right way. There is a `.clang-format` file that specifies the details.
-In general:
-```
- $ clang-format-7 -i -style=file
-```
-`
-
-**NOTE:** An .editorconfig file is included to assist with formatting. In
-order to take advantage of this functionality you will need to acquire the
-[EditorConfig](http://editorconfig.org/#download) plug-in for your editor.
-
-
-Naming
-------
-* Use CamelCase for everything.
-* Local variables should start out with a lowercase letter.
-* Class names are capitalized
-* Prefix class member variables with `m_`, e.g. `m_queue`.
-* Prefix static member variables with `s_`, e.g. `s_instance`.
-* Functions are named in the Qt style, like Java's, without the 'get' prefix.
- * A getter is `variable()`.
- * If it's a getter for a boolean, prefix with 'is', so `isCondition()`.
- * A setter is `setVariable( arg )`.
-
-
-Includes
---------
-Header includes should be listed in the following order:
-
-* own header,
-* Calamares includes,
-* includes for Qt-based libraries,
-* Qt includes,
-* other includes.
-
-They should also be sorted alphabetically for ease of locating them.
-
-Includes in a header file should be kept to the absolute minimum, as to keep
-compile times short. This can be achieved by using forward declarations
-instead of includes, like `class QListView;`.
-
-Example:
-```
-#include "Settings.h"
-
-#include "CalamaresApplication.h"
-#include "utils/CalamaresUtils.h"
-#include "utils/Logger.h"
-#include "YamlUtils.h"
-
-#include
-#include
-
-#include
-```
-
-Use include guards, not `#pragma once`.
-
-
-C++ tips
---------
-All C++11 features are acceptable, and the use of new C++11 features is encouraged when
-it makes the code easier to understand and more maintainable.
-
-The use of `nullptr` is preferred over the use of `0` or `NULL`.
-
-For Qt containers it is better to use Qt's own `foreach`. For all other containers, the
-range-based `for` syntax introduced with C++11 is preferred ([see this blog post][1]).
-
-When re-implementing a virtual method, always add the `override` keyword.
-
-Try to keep your code const correct. Declare methods const if they don't mutate the
-object, and use const variables. It improves safety, and also makes it easier to
-understand the code.
-
-For the Qt signal-slot system, the new (Qt5) syntax is to be preferred because it allows
-the compiler to check for the existence of signals and slots. As an added benefit, the
-new syntax can also be used with `tr1::bind` and C++11 lambdas. For more information, see
-the [Qt wiki][2].
-
-Example:
-```
-connect( m_next, &QPushButton::clicked, this, &ViewManager::next );
-
-connect( m_moduleManager, &Calamares::ModuleManager::modulesLoaded, [this]
-{
- m_mainwindow->show();
-});
-```
-
-[1]: http://blog.qt.digia.com/blog/2011/05/26/cpp0x-in-qt/
-[2]: http://qt-project.org/wiki/New_Signal_Slot_Syntax
-
-
-Debugging
----------
-Use `cDebug()` from `utils/Logger.h`. You can pass a debug-level to the
-macro (6 is debugging, higher is less important). Use `cWarning()` for warning
-messages (equivalent to level 2) and `cError()` for errors (level 1). Warnings
-and errors will add relevant text automatically. See `libcalamares/utils/Logger.h`
-for details.
-
-For log messages that are continued across multiple calls to `cDebug()`,
-in particular listing things, conventional formatting is as follows:
-* End the first debug message with ` ..`
-* Start the next debug message by outputting `Logger::SubEntry`
-
-For single-outputs that need to be split across multiplt lines,
-output `Logger::Continuation`.
-
-
-Commit Messages
----------------
-Keep commit messages short(-ish) and try to describe what is being changed
-*as well as why*. Use the commit keywords for GitHub, especially *FIXES:*
-to auto-close issues when they are resolved.
-
-For functional changes to Calamares modules or libraries, try to put
-*[modulename]* in front of the first line of the commit message.
-
-For non-functional changes to infrastructure, try to label the change
-with the kind of change, e.g. *CMake* or *i18n* or *Documentation*.
+This has moved [to the wiki](https://github.com/calamares/calamares/wiki/Develop-Code).
From cc17898da8f67bfd97f3a95ae1e7fddc2524f9d8 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Mon, 10 Feb 2020 11:56:24 +0100
Subject: [PATCH 08/28] Docs: remove references to HACKING.md (moved to wiki)
---
README.md | 2 +-
ci/RELEASE.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 4a5610dc9..7b12532e5 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
[![Coverity Scan Build Status](https://scan.coverity.com/projects/5389/badge.svg)](https://scan.coverity.com/projects/5389)
[![GitHub license](https://img.shields.io/github/license/calamares/calamares.svg)](https://github.com/calamares/calamares/blob/master/LICENSE)
-| [Report a Bug](https://github.com/calamares/calamares/issues/new) | [Contribute](https://github.com/calamares/calamares/blob/master/ci/HACKING.md) | [Translate](https://www.transifex.com/projects/p/calamares/) | Freenode (IRC): #calamares | [Wiki](https://github.com/calamares/calamares/wiki) |
+| [Report a Bug](https://github.com/calamares/calamares/issues/new) | [Translate](https://www.transifex.com/projects/p/calamares/) | [Contribute](https://github.com/calamares/calamares/wiki/Develop-Guide) | Freenode (IRC): #calamares | [Wiki](https://github.com/calamares/calamares/wiki) |
|:-----------------------------------------:|:----------------------:|:-----------------------:|:--------------------------:|:--------------------------:|
### Dependencies
diff --git a/ci/RELEASE.md b/ci/RELEASE.md
index 3198ee95d..0da086585 100644
--- a/ci/RELEASE.md
+++ b/ci/RELEASE.md
@@ -37,7 +37,7 @@ The Calamares release process
* Bump version in `CMakeLists.txt`, *CALAMARES_VERSION* variables, and set
RC to a non-zero value (e.g. doing -rc1, -rc2, ...). Push that.
-* Check `README.md` and everything `ci/HACKING.md`, make sure it's all still
+* Check `README.md` and the [Coding Guide](https://github.com/calamares/calamares/wiki/Develop-Code), make sure it's all still
relevant. Run `ci/calamaresstyle` to check the C++ code style.
Run pycodestyle on recently-modified Python modules, fix what makes sense.
* Check defaults in `settings.conf` and other configuration files.
From 04e608d164695a9e367d663d32e5a183c203ac39 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Mon, 10 Feb 2020 15:28:33 +0100
Subject: [PATCH 09/28] Docs: remove example dummypythonqml from settings.conf
- PythonQt is going to go away (eventually), don't encourage it.
---
settings.conf | 2 --
1 file changed, 2 deletions(-)
diff --git a/settings.conf b/settings.conf
index 875af11ad..c2aa48a37 100644
--- a/settings.conf
+++ b/settings.conf
@@ -88,7 +88,6 @@ sequence:
- show:
- welcome
# - notesqml
-# - dummypythonqt
- locale
- keyboard
- partition
@@ -99,7 +98,6 @@ sequence:
# - dummycpp
# - dummyprocess
# - dummypython
-# - dummypythonqt
- partition
- mount
- unpackfs
From 4f60a6340e2ab5e1b3897f997bb6f9ac6c0ef39d Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Tue, 11 Feb 2020 12:20:39 +0100
Subject: [PATCH 10/28] [dummyqml] Drop module; it makes more sense to just be
notesqml
---
src/modules/dummyqml/CMakeLists.txt | 11 ----
src/modules/dummyqml/DummyQmlViewStep.cpp | 52 -------------------
src/modules/dummyqml/DummyQmlViewStep.h | 48 -----------------
src/modules/dummyqml/dummyqml.conf | 29 -----------
src/modules/dummyqml/dummyqml.qrc | 5 --
.../examples}/dummyqml.qml | 0
6 files changed, 145 deletions(-)
delete mode 100644 src/modules/dummyqml/CMakeLists.txt
delete mode 100644 src/modules/dummyqml/DummyQmlViewStep.cpp
delete mode 100644 src/modules/dummyqml/DummyQmlViewStep.h
delete mode 100644 src/modules/dummyqml/dummyqml.conf
delete mode 100644 src/modules/dummyqml/dummyqml.qrc
rename src/modules/{dummyqml => notesqml/examples}/dummyqml.qml (100%)
diff --git a/src/modules/dummyqml/CMakeLists.txt b/src/modules/dummyqml/CMakeLists.txt
deleted file mode 100644
index 9a7532e9e..000000000
--- a/src/modules/dummyqml/CMakeLists.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-calamares_add_plugin( dummyqml
- TYPE viewmodule
- EXPORT_MACRO PLUGINDLLEXPORT_PRO
- SOURCES
- DummyQmlViewStep.cpp
- RESOURCES
- dummyqml.qrc
- LINK_PRIVATE_LIBRARIES
- calamaresui
- SHARED_LIB
-)
diff --git a/src/modules/dummyqml/DummyQmlViewStep.cpp b/src/modules/dummyqml/DummyQmlViewStep.cpp
deleted file mode 100644
index 030779f7f..000000000
--- a/src/modules/dummyqml/DummyQmlViewStep.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/* === This file is part of Calamares - ===
- *
- * Copyright 2020, Adriaan de Groot
- * Copyright 2020, Anke Boersma
- *
- * Calamares is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Calamares is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Calamares. If not, see .
- */
-
-#include "DummyQmlViewStep.h"
-
-#include
-
-DummyQmlViewStep::DummyQmlViewStep( QObject* parent )
- : Calamares::QmlViewStep( "dummyqml", parent )
-{
-}
-
-DummyQmlViewStep::~DummyQmlViewStep() {}
-
-QString
-DummyQmlViewStep::prettyName() const
-{
- return m_notesName ? m_notesName->get() : tr( "Notes" );
-}
-
-void
-DummyQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
-{
- Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation
-
- bool qmlLabel_ok = false;
- auto qmlLabel = CalamaresUtils::getSubMap( configurationMap, "qmlLabel", qmlLabel_ok );
-
- if ( qmlLabel.contains( "notes" ) )
- {
- m_notesName = new CalamaresUtils::Locale::TranslatedString( qmlLabel, "notes" );
- }
-
-}
-
-CALAMARES_PLUGIN_FACTORY_DEFINITION( DummyQmlViewStepFactory, registerPlugin< DummyQmlViewStep >(); )
diff --git a/src/modules/dummyqml/DummyQmlViewStep.h b/src/modules/dummyqml/DummyQmlViewStep.h
deleted file mode 100644
index cf49436b0..000000000
--- a/src/modules/dummyqml/DummyQmlViewStep.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* === This file is part of Calamares - ===
- *
- * Copyright 2020, Adriaan de Groot
- * Copyright 2020, Anke Boersma
- *
- * Calamares is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Calamares is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Calamares. If not, see .
- */
-
-#ifndef DUMMYQMLVIEWSTEP_H
-#define DUMMYQMLVIEWSTEP_H
-
-#include "PluginDllMacro.h"
-#include "locale/TranslatableConfiguration.h"
-#include "utils/CalamaresUtilsSystem.h"
-#include "utils/Variant.h"
-#include "utils/PluginFactory.h"
-#include "viewpages/QmlViewStep.h"
-
-class PLUGINDLLEXPORT DummyQmlViewStep : public Calamares::QmlViewStep
-{
- Q_OBJECT
-
-public:
- DummyQmlViewStep( QObject* parent = nullptr );
- virtual ~DummyQmlViewStep() override;
-
- QString prettyName() const override;
-
- void setConfigurationMap( const QVariantMap& configurationMap ) override;
-
-private:
- CalamaresUtils::Locale::TranslatedString* m_notesName; // As it appears in the sidebar
-};
-
-CALAMARES_PLUGIN_FACTORY_DECLARATION( DummyQmlViewStepFactory )
-
-#endif
diff --git a/src/modules/dummyqml/dummyqml.conf b/src/modules/dummyqml/dummyqml.conf
deleted file mode 100644
index 9e7a83fdd..000000000
--- a/src/modules/dummyqml/dummyqml.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-# The dummy QML module just displays a QML page. It doesn't
-# have much in the way of own configuration, only where
-# the QML file is searched.
-#
-# QML modules can search for the QML inside the Qt resources
-# (QRC) which are compiled into the module, or in the branding
-# setup for Calamares, (or both of them, with branding taking
-# precedence). This allows the module to ship a default UI and
-# branding to optionally introduce a replacement file.
-#
-# Generally, leave the search method set to "both" because if
-# you don't want to brand the UI, just don't ship a branding
-# QML file for it.
-#
-# To support instanced QML modules, searches in the branding
-# directory look for the full module@instanceid name as well.
----
-# Search mode. Valid values are "both", "qrc" and "branding"
-search: both
-
-# Name of the QML file. If not set, uses the name of the instance
-# of the module (e.g. if you list this module in `settings.conf`
-# in the *instances* section, you get *id*, otherwise it would
-# normally be "dummyqml").
-# filename: dummyqml
-
-qmlLabel:
- notes: "Release Notes"
- notes[nl]: "Opmerkingen"
diff --git a/src/modules/dummyqml/dummyqml.qrc b/src/modules/dummyqml/dummyqml.qrc
deleted file mode 100644
index 85b1da5ca..000000000
--- a/src/modules/dummyqml/dummyqml.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- dummyqml.qml
-
-
diff --git a/src/modules/dummyqml/dummyqml.qml b/src/modules/notesqml/examples/dummyqml.qml
similarity index 100%
rename from src/modules/dummyqml/dummyqml.qml
rename to src/modules/notesqml/examples/dummyqml.qml
From c3c845e9d7e334ca60cbdc3c64e819f31e22ca46 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Tue, 11 Feb 2020 12:29:18 +0100
Subject: [PATCH 11/28] [notesqml] Add some more module documentation
---
src/modules/notesqml/notesqml.conf | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/modules/notesqml/notesqml.conf b/src/modules/notesqml/notesqml.conf
index 1dcc25cff..1afd9e682 100644
--- a/src/modules/notesqml/notesqml.conf
+++ b/src/modules/notesqml/notesqml.conf
@@ -1,3 +1,15 @@
+# The *notesqml* module can be used to display a QML file
+# as an installer step. This is most useful for release-notes
+# and similar somewhat-static content, but if you want to you
+# can put SameGame in there as well.
+#
+# While the module compiles a QML file into a QRC for inclusion
+# into the shared library, normal use will configure it with
+# an external file, either from Calamares AppData directory or
+# from the branding directory.
+#
+# ---
+#
# QML modules can search for the QML inside the Qt resources
# (QRC) which are compiled into the module, or in the branding
# setup for Calamares, (or both of them, with branding taking
@@ -9,7 +21,7 @@
# QML file for it.
#
# To support instanced QML modules, searches in the branding
-# directory look for the full module@instanceid name as well.
+# directory look for the full notesqml@instanceid name as well.
---
# Search mode. Valid values are "both", "qrc" and "branding"
search: both
@@ -20,6 +32,9 @@ search: both
# normally be "notesqml").
#filename: notesqml
+# This is the name of the module in the progress-tree / sidebar
+# in Calamares. To support multiple instances of the QML module,
+# the name is configurable and translatable here.
qmlLabel:
notes: "Release Notes"
notes[nl]: "Opmerkingen"
From 6c0fecd40d7c52dd02be1b9a41af19444407c922 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Tue, 11 Feb 2020 12:55:26 +0100
Subject: [PATCH 12/28] [notesqml] Don't use a fixed width
---
src/modules/notesqml/notesqml.qml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/modules/notesqml/notesqml.qml b/src/modules/notesqml/notesqml.qml
index 0a60fd741..d1ff4f1b5 100644
--- a/src/modules/notesqml/notesqml.qml
+++ b/src/modules/notesqml/notesqml.qml
@@ -32,6 +32,7 @@ Item {
contentHeight: 800
ScrollBar.vertical: ScrollBar {
+ id: fscrollbar
width: 10
policy: ScrollBar.AlwaysOn
}
@@ -40,7 +41,7 @@ Item {
id: intro
x: 1
y: 0
- width: 720
+ width: parent.width - fscrollbar.width
font.pointSize: 14
textFormat: Text.RichText
antialiasing: true
From dd33cbfa360e556ab0cd625f8760611d8ba363a3 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Tue, 11 Feb 2020 12:55:53 +0100
Subject: [PATCH 13/28] Docs: update RELEASE.md procedure
---
ci/RELEASE.md | 108 ++++++++++++++++++++++++++++++++++----------------
1 file changed, 73 insertions(+), 35 deletions(-)
diff --git a/ci/RELEASE.md b/ci/RELEASE.md
index 0da086585..5293abf6b 100644
--- a/ci/RELEASE.md
+++ b/ci/RELEASE.md
@@ -1,17 +1,16 @@
-The Calamares release process
-=============================
+# Calamares Release Process
-> As releases from *master* are now rolling when-they-are-ready releases,
-> some of these steps no longer are followed. In particular, -RC releases
-> are not done anymore (although the RC variable is set in `CMakeLists.txt`
-> to avoid accidents) and most things are automated through the release
-> script [RELEASE.sh](RELEASE.sh)
+> Calamares releases are now rolling when-they-are-ready releases.
+> Releases are made from *master* and tagged there. When, in future,
+> LTS releases resume, these steps may be edited again.
+>
+> Most things are automated through the release script [RELEASE.sh](RELEASE.sh)
-#### (0) A week in advance
+## (0) A week in advance
-* (Only releases from master)
- Run [Coverity scan][coverity], fix what's relevant. The Coverity scan runs
- automatically once a week on master.
+* Run [Coverity scan][coverity], fix what's relevant. The Coverity scan runs
+ automatically once a week on master. The badge is displayed on the
+ project front page and in the wiki.
* Build with clang -Weverything, fix what's relevant.
```
rm -rf build ; mkdir build ; cd build
@@ -26,34 +25,69 @@ The Calamares release process
an additional environment variable to be set for some tests, which will
destroy an attached disk. This is not always desirable. There are some
sample config-files that are empty and which fail the config-tests.
-* (Only releases from master)
- Notify [translators][transifex]. In the dashboard there is an *Announcements*
- link that you can use to send a translation announcement.
+* Notify [translators][transifex]. In the dashboard there is an *Announcements*
+ link that you can use to send a translation announcement. Note that regular
+ use of `txpush.sh` will notify translators as well of any changes.
[coverity]: https://scan.coverity.com/projects/calamares-calamares?tab=overview
[transifex]: https://www.transifex.com/calamares/calamares/dashboard/
-#### (1) Preparation
-* Bump version in `CMakeLists.txt`, *CALAMARES_VERSION* variables, and set
- RC to a non-zero value (e.g. doing -rc1, -rc2, ...). Push that.
-* Check `README.md` and the [Coding Guide](https://github.com/calamares/calamares/wiki/Develop-Code), make sure it's all still
- relevant. Run `ci/calamaresstyle` to check the C++ code style.
- Run pycodestyle on recently-modified Python modules, fix what makes sense.
-* Check defaults in `settings.conf` and other configuration files.
-* (Only releases from master)
- Pull latest translations from Transifex. We only push / pull translations
+## (1) Preparation
+
+* Pull latest translations from Transifex. We only push / pull translations
from master, so longer-lived branches (e.g. 3.1.x) don't get translation
- updates. This is to keep the translation workflow simple.
+ updates. This is to keep the translation workflow simple. The script
+ automatically commits changes to the translations.
```
sh ci/txpull.sh
```
-* (Only releases from master)
- Update the list of enabled translation languages in `CMakeLists.txt`.
+* Update the list of enabled translation languages in `CMakeLists.txt`.
Check the [translation site][transifex] for the list of languages with
- fairly complete translations.
+ fairly complete translations, or use `ci/txstats.py` for an automated
+ suggestion. If there are changes, commit them.
+* Push the changes.
+* Drop the RC variable to 0 in `CMakeLists.txt`, *CALAMARES_VERSION_RC*.
+* Check `README.md` and the
+ [Coding Guide](https://github.com/calamares/calamares/wiki/Develop-Code),
+ make sure it's all still
+ relevant. Run `ci/calamaresstyle` to check the C++ code style.
+ Run pycodestyle on recently-modified Python modules, fix what makes sense.
+* Check defaults in `settings.conf` and other configuration files.
+* Edit `CHANGES` and set the date of the release.
+* Commit both. This is usually done with commit-message
+ *Changes: pre-release housekeeping*.
-#### (2) Tarball
+
+## (2) Release Day
+
+* Run the helper script `ci/RELEASE.sh` or follow steps below.
+ The script checks:
+ - for uncommitted local changes,
+ - if translations are up-to-date and translators
+ have had enough time to chase new strings,
+ - that the build is successful (with gcc and clang, if available),
+ - tests pass,
+ - tarball can be created,
+ - tarball can be signed.
+ On success, it prints out a suitable signature- and SHA256 blurb
+ for use in the release announcement.
+
+### (2.1) Buld and Test
+
+* Build with gcc. If available, build again with Clang and double-check
+ any warnings Clang produces.
+* Run the tests; `make test` in the build directory should have no
+ failures (or if there are, know why they are there).
+
+### (2.2) Tag
+
+* `git tag -s v1.1.0` Make sure the signing key is known in GitHub, so that the
+ tag is shown as a verified tag. Do not sign -rc tags.
+ You can use `make show-version` in the build directory to get the right
+ version number -- this will fail if you didn't follow step (1).
+
+### (2.3) Tarball
* Create tarball: `git-archive-all -v calamares-1.1-rc1.tar.gz` or without
the helper script,
@@ -64,21 +98,25 @@ The Calamares release process
Double check that the tarball matches the version number.
* Test tarball (e.g. unpack somewhere else and run the tests from step 0).
-#### (3) Tag
-* Set RC to zero in `CMakeLists.txt` if this is the actual release.
-* `git tag -s v1.1.0` Make sure the signing key is known in GitHub, so that the
- tag is shown as a verified tag. Do not sign -rc tags.
+## (3) Housekeeping
+
* Generate MD5 and SHA256 checksums.
* Upload tarball.
* Announce on mailing list, notify packagers.
* Write release article.
-
-#### (4) Release day
-
* Publish tarball.
* Update download page.
* Publish release article on `calamares.io`.
* Publicize on social networks.
* Close associated milestone on GitHub if this is the actual release.
* Publish blog post.
+
+## (4) Post-Release
+
+* Bump the version number in `CMakeLists.txt` in the `project()` command.
+* Set *CALAMARES_VERSION_RC* back to 1.
+* Add a placeholder entry for the next release in `CHANGES` with date
+ text *not released yet*.
+* Commit and push that, usually with the message
+ *Changes: post-release housekeeping*.
From 340ffd070c13fb1eceb9b6495a6408f9f154087c Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Tue, 11 Feb 2020 12:57:12 +0100
Subject: [PATCH 14/28] Changes: credit to Anke Boersma for the example notes
---
CHANGES | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGES b/CHANGES
index ce161f396..1322f0449 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,7 +6,7 @@ website will have to do for older versions.
# 3.2.19 (unreleased) #
This release contains contributions from (alphabetically by first name):
- - No other contributors this time around.
+ - Anke Boersma
## Core ##
- *Assamese* translation has been completed.
From 6432b7f42a1c59b4e27e3a1ba56165dc7c34a903 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Tue, 11 Feb 2020 16:46:44 +0100
Subject: [PATCH 15/28] [libcalamares] Hit Boost warnings with a hammer
- Tons of warnings from Clang 9 in Boost::Python code, so
turn of most of those warnings in the Boost-support code.
---
src/libcalamares/PythonJob.cpp | 2 ++
src/libcalamares/PythonJobApi.h | 5 +++++
src/libcalamares/utils/boost-warnings.h | 22 ++++++++++++++++++++++
3 files changed, 29 insertions(+)
diff --git a/src/libcalamares/PythonJob.cpp b/src/libcalamares/PythonJob.cpp
index c18371881..bff7fcc74 100644
--- a/src/libcalamares/PythonJob.cpp
+++ b/src/libcalamares/PythonJob.cpp
@@ -27,6 +27,8 @@
#include
#undef slots
+#include "utils/boost-warnings.h"
+
#include
#include
diff --git a/src/libcalamares/PythonJobApi.h b/src/libcalamares/PythonJobApi.h
index 3d3783f5f..981527951 100644
--- a/src/libcalamares/PythonJobApi.h
+++ b/src/libcalamares/PythonJobApi.h
@@ -25,8 +25,13 @@
#include "PythonJob.h"
#undef slots
+#include "utils/boost-warnings.h"
#include
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
namespace CalamaresPython
{
diff --git a/src/libcalamares/utils/boost-warnings.h b/src/libcalamares/utils/boost-warnings.h
index 65a66b0f6..69fb9ea30 100644
--- a/src/libcalamares/utils/boost-warnings.h
+++ b/src/libcalamares/utils/boost-warnings.h
@@ -5,4 +5,26 @@
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma clang diagnostic ignored "-Wextra-semi-stmt"
#pragma clang diagnostic ignored "-Wall"
+#pragma clang diagnostic ignored "-Wimplicit-float-conversion"
+#pragma clang diagnostic ignored "-Wundef"
+#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
+#pragma clang diagnostic ignored "-Wshadow-field-in-constructor"
+#pragma clang diagnostic ignored "-Wshadow"
+#pragma clang diagnostic ignored "-Wmissing-noreturn"
+#pragma clang diagnostic ignored "-Wcast-qual"
+#pragma clang diagnostic ignored "-Wcast-align"
+#pragma clang diagnostic ignored "-Wsign-conversion"
+#pragma clang diagnostic ignored "-Wdouble-promotion"
+#pragma clang diagnostic ignored "-Wredundant-parens"
+#pragma clang diagnostic ignored "-Wweak-vtables"
+#pragma clang diagnostic ignored "-Wdeprecated"
+#pragma clang diagnostic ignored "-Wmissing-field-initializers"
+#pragma clang diagnostic ignored "-Wdisabled-macro-expansion"
+#pragma clang diagnostic ignored "-Wdocumentation"
+#pragma clang diagnostic ignored "-Wcomma"
+#pragma clang diagnostic ignored "-Wunused-parameter"
+#pragma clang diagnostic ignored "-Wunused-template"
+
+// Actually for Python headers
+#pragma clang diagnostic ignored "-Wreserved-id-macro"
#endif
From 96580e5c40a7540935c6ece8946eb174f43023e3 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Wed, 12 Feb 2020 10:28:48 +0100
Subject: [PATCH 16/28] [libcalamares] Convenience header for Boost and its
warnings
---
src/libcalamares/utils/BoostPython.h | 73 ++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 src/libcalamares/utils/BoostPython.h
diff --git a/src/libcalamares/utils/BoostPython.h b/src/libcalamares/utils/BoostPython.h
new file mode 100644
index 000000000..7bd8865da
--- /dev/null
+++ b/src/libcalamares/utils/BoostPython.h
@@ -0,0 +1,73 @@
+/* === This file is part of Calamares - ===
+ *
+ * Copyright 2019-2020, Adriaan de Groot
+ *
+ * Calamares is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Calamares is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Calamares. If not, see .
+ */
+
+/*
+ * The Python and Boost::Python headers are not C++14 warning-proof, especially
+ * with picky compilers like Clang 8 and 9. Since we use Clang for the
+ * find-all-the-warnings case, switch those warnings off for
+ * the we-can't-change-them system headers.
+ *
+ * This convenience header handles including all the bits we need for
+ * Python support, while silencing warnings.
+ */
+#ifndef UTILS_BOOSTPYTHON_H
+#define UTILS_BOOSTPYTHON_H
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreserved-id-macro"
+#pragma clang diagnostic ignored "-Wold-style-cast"
+#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
+#pragma clang diagnostic ignored "-Wextra-semi-stmt"
+#pragma clang diagnostic ignored "-Wall"
+#pragma clang diagnostic ignored "-Wimplicit-float-conversion"
+#pragma clang diagnostic ignored "-Wundef"
+#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
+#pragma clang diagnostic ignored "-Wshadow-field-in-constructor"
+#pragma clang diagnostic ignored "-Wshadow"
+#pragma clang diagnostic ignored "-Wmissing-noreturn"
+#pragma clang diagnostic ignored "-Wcast-qual"
+#pragma clang diagnostic ignored "-Wcast-align"
+#pragma clang diagnostic ignored "-Wsign-conversion"
+#pragma clang diagnostic ignored "-Wdouble-promotion"
+#pragma clang diagnostic ignored "-Wredundant-parens"
+#pragma clang diagnostic ignored "-Wweak-vtables"
+#pragma clang diagnostic ignored "-Wdeprecated"
+#pragma clang diagnostic ignored "-Wmissing-field-initializers"
+#pragma clang diagnostic ignored "-Wdisabled-macro-expansion"
+#pragma clang diagnostic ignored "-Wdocumentation"
+#pragma clang diagnostic ignored "-Wcomma"
+#pragma clang diagnostic ignored "-Wunused-parameter"
+#pragma clang diagnostic ignored "-Wunused-template"
+
+// Actually for Python headers
+#pragma clang diagnostic ignored "-Wreserved-id-macro"
+#endif
+
+#undef slots
+#include
+#include
+#include
+#include
+#include
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+#endif
From f3e7fe5eb416e38b228ba6f27b9eca1ee8d4af75 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Wed, 12 Feb 2020 10:32:10 +0100
Subject: [PATCH 17/28] [libcalamares] Use more specific include
---
src/libcalamares/PythonJob.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libcalamares/PythonJob.h b/src/libcalamares/PythonJob.h
index c63daacdc..103015932 100644
--- a/src/libcalamares/PythonJob.h
+++ b/src/libcalamares/PythonJob.h
@@ -23,7 +23,7 @@
#include "modulesystem/InstanceKey.h"
-#include
+#include
namespace CalamaresPython
{
From d42e757576543f31b0cc9ac4cab74ca7f9da1370 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Wed, 12 Feb 2020 10:48:19 +0100
Subject: [PATCH 18/28] [libcalamares] Simplify includes
- CalamaresVersion used by the job, not the API presented to Python.
- Untangle Qt includes from there.
---
src/libcalamares/PythonJob.cpp | 1 +
src/libcalamares/PythonJobApi.h | 9 ++++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/libcalamares/PythonJob.cpp b/src/libcalamares/PythonJob.cpp
index bff7fcc74..f5c033826 100644
--- a/src/libcalamares/PythonJob.cpp
+++ b/src/libcalamares/PythonJob.cpp
@@ -19,6 +19,7 @@
#include "PythonJob.h"
+#include "CalamaresVersion.h"
#include "GlobalStorage.h"
#include "JobQueue.h"
#include "PythonHelper.h"
diff --git a/src/libcalamares/PythonJobApi.h b/src/libcalamares/PythonJobApi.h
index 981527951..80a32b930 100644
--- a/src/libcalamares/PythonJobApi.h
+++ b/src/libcalamares/PythonJobApi.h
@@ -20,9 +20,7 @@
#ifndef PYTHONJOBAPI_H
#define PYTHONJOBAPI_H
-#include "CalamaresVersion.h"
-
-#include "PythonJob.h"
+#include "qglobal.h" // For qreal
#undef slots
#include "utils/boost-warnings.h"
@@ -32,6 +30,11 @@
#pragma clang diagnostic pop
#endif
+namespace Calamares
+{
+class PythonJob;
+}
+
namespace CalamaresPython
{
From f8998834cf9ce175b4860980b5da65572e63baa6 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Wed, 12 Feb 2020 10:55:36 +0100
Subject: [PATCH 19/28] [libcalamares] Simplify includes (no Python used in
JobQueue)
---
src/libcalamares/JobQueue.cpp | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/libcalamares/JobQueue.cpp b/src/libcalamares/JobQueue.cpp
index 6772671b7..2690769db 100644
--- a/src/libcalamares/JobQueue.cpp
+++ b/src/libcalamares/JobQueue.cpp
@@ -19,15 +19,11 @@
#include "JobQueue.h"
+#include "CalamaresConfig.h"
#include "GlobalStorage.h"
#include "Job.h"
#include "utils/Logger.h"
-#include "CalamaresConfig.h"
-#ifdef WITH_PYTHON
-#include "PythonHelper.h"
-#endif
-
#include
namespace Calamares
From 95722541d0482cb8c2b11f8c5313cce08b0244ab Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Wed, 12 Feb 2020 11:02:38 +0100
Subject: [PATCH 20/28] [libcalamares] Untangle Python includes
- Use BoostPython.h to manage overall includes
- Remove local home-grown variations
---
src/libcalamares/PythonHelper.cpp | 8 --------
src/libcalamares/PythonHelper.h | 12 +-----------
src/libcalamares/PythonJob.cpp | 11 ++---------
src/libcalamares/PythonJobApi.cpp | 13 ++-----------
src/libcalamares/PythonJobApi.h | 8 +-------
5 files changed, 6 insertions(+), 46 deletions(-)
diff --git a/src/libcalamares/PythonHelper.cpp b/src/libcalamares/PythonHelper.cpp
index 26a57ec14..d08fd66f1 100644
--- a/src/libcalamares/PythonHelper.cpp
+++ b/src/libcalamares/PythonHelper.cpp
@@ -25,14 +25,6 @@
#include
#include
-#undef slots
-#include "utils/boost-warnings.h"
-#include
-
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
-
namespace bp = boost::python;
namespace CalamaresPython
diff --git a/src/libcalamares/PythonHelper.h b/src/libcalamares/PythonHelper.h
index 9035ba6d4..ed1d56151 100644
--- a/src/libcalamares/PythonHelper.h
+++ b/src/libcalamares/PythonHelper.h
@@ -21,20 +21,10 @@
#define CALAMARES_PYTHONJOBHELPER_H
#include "PythonJob.h"
+#include "utils/BoostPython.h"
#include
-#undef slots
-#include "utils/boost-warnings.h"
-
-#include
-#include
-#include
-
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
-
namespace CalamaresPython
{
diff --git a/src/libcalamares/PythonJob.cpp b/src/libcalamares/PythonJob.cpp
index f5c033826..db14c10f8 100644
--- a/src/libcalamares/PythonJob.cpp
+++ b/src/libcalamares/PythonJob.cpp
@@ -23,19 +23,12 @@
#include "GlobalStorage.h"
#include "JobQueue.h"
#include "PythonHelper.h"
+#include "PythonJobApi.h"
+#include "utils/BoostPython.h"
#include "utils/Logger.h"
#include
-#undef slots
-#include "utils/boost-warnings.h"
-
-#include
-#include
-
-#include "PythonJobApi.h"
-
-
namespace bp = boost::python;
BOOST_PYTHON_FUNCTION_OVERLOADS( mount_overloads, CalamaresPython::mount, 2, 4 );
diff --git a/src/libcalamares/PythonJobApi.cpp b/src/libcalamares/PythonJobApi.cpp
index 7b65e979c..e0bb686cd 100644
--- a/src/libcalamares/PythonJobApi.cpp
+++ b/src/libcalamares/PythonJobApi.cpp
@@ -19,26 +19,17 @@
#include "PythonJobApi.h"
+#include "GlobalStorage.h"
+#include "JobQueue.h"
#include "PythonHelper.h"
#include "utils/CalamaresUtilsSystem.h"
#include "utils/Logger.h"
#include "utils/String.h"
-#include "GlobalStorage.h"
-#include "JobQueue.h"
-
#include
#include
#include
-#undef slots
-#include "utils/boost-warnings.h"
-#include
-
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
-
namespace bp = boost::python;
static int
diff --git a/src/libcalamares/PythonJobApi.h b/src/libcalamares/PythonJobApi.h
index 80a32b930..941527d66 100644
--- a/src/libcalamares/PythonJobApi.h
+++ b/src/libcalamares/PythonJobApi.h
@@ -22,13 +22,7 @@
#include "qglobal.h" // For qreal
-#undef slots
-#include "utils/boost-warnings.h"
-#include
-
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
+#include "utils/BoostPython.h"
namespace Calamares
{
From 3b35ca7bb99201232288fbbdc6cdf288c8065f4a Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Wed, 12 Feb 2020 11:04:15 +0100
Subject: [PATCH 21/28] [libcalamares] Simplify includes
- PythonHelper.h already pulls in all the Python machinery
---
src/libcalamares/GlobalStorage.cpp | 7 -------
1 file changed, 7 deletions(-)
diff --git a/src/libcalamares/GlobalStorage.cpp b/src/libcalamares/GlobalStorage.cpp
index 5094ad2fd..2241a3c7a 100644
--- a/src/libcalamares/GlobalStorage.cpp
+++ b/src/libcalamares/GlobalStorage.cpp
@@ -29,13 +29,6 @@
#ifdef WITH_PYTHON
#include "PythonHelper.h"
-
-
-#undef slots
-#include
-#include
-
-namespace bp = boost::python;
#endif
using CalamaresUtils::operator""_MiB;
From 8181808bec342bd2dbeb3f1998098c505af00e6a Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Wed, 12 Feb 2020 11:25:10 +0100
Subject: [PATCH 22/28] [libcalamares] Fix build
- drop now-obsolete boost-warnings.h
- add missing namespace alias to GlobalStorage.h (removed accidentally
in previous commit)
---
src/libcalamares/GlobalStorage.cpp | 1 +
src/libcalamares/utils/boost-warnings.h | 30 -------------------------
2 files changed, 1 insertion(+), 30 deletions(-)
delete mode 100644 src/libcalamares/utils/boost-warnings.h
diff --git a/src/libcalamares/GlobalStorage.cpp b/src/libcalamares/GlobalStorage.cpp
index 2241a3c7a..2ccaf79b4 100644
--- a/src/libcalamares/GlobalStorage.cpp
+++ b/src/libcalamares/GlobalStorage.cpp
@@ -29,6 +29,7 @@
#ifdef WITH_PYTHON
#include "PythonHelper.h"
+namespace bp = boost::python;
#endif
using CalamaresUtils::operator""_MiB;
diff --git a/src/libcalamares/utils/boost-warnings.h b/src/libcalamares/utils/boost-warnings.h
deleted file mode 100644
index 69fb9ea30..000000000
--- a/src/libcalamares/utils/boost-warnings.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wreserved-id-macro"
-#pragma clang diagnostic ignored "-Wold-style-cast"
-#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
-#pragma clang diagnostic ignored "-Wextra-semi-stmt"
-#pragma clang diagnostic ignored "-Wall"
-#pragma clang diagnostic ignored "-Wimplicit-float-conversion"
-#pragma clang diagnostic ignored "-Wundef"
-#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
-#pragma clang diagnostic ignored "-Wshadow-field-in-constructor"
-#pragma clang diagnostic ignored "-Wshadow"
-#pragma clang diagnostic ignored "-Wmissing-noreturn"
-#pragma clang diagnostic ignored "-Wcast-qual"
-#pragma clang diagnostic ignored "-Wcast-align"
-#pragma clang diagnostic ignored "-Wsign-conversion"
-#pragma clang diagnostic ignored "-Wdouble-promotion"
-#pragma clang diagnostic ignored "-Wredundant-parens"
-#pragma clang diagnostic ignored "-Wweak-vtables"
-#pragma clang diagnostic ignored "-Wdeprecated"
-#pragma clang diagnostic ignored "-Wmissing-field-initializers"
-#pragma clang diagnostic ignored "-Wdisabled-macro-expansion"
-#pragma clang diagnostic ignored "-Wdocumentation"
-#pragma clang diagnostic ignored "-Wcomma"
-#pragma clang diagnostic ignored "-Wunused-parameter"
-#pragma clang diagnostic ignored "-Wunused-template"
-
-// Actually for Python headers
-#pragma clang diagnostic ignored "-Wreserved-id-macro"
-#endif
From c1151cbcfa2c0d9b129ae5fc8b966aa8c3896c16 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Wed, 12 Feb 2020 12:08:46 +0100
Subject: [PATCH 23/28] [libcalamares] Update copyright info
---
src/libcalamares/PythonHelper.cpp | 2 +-
src/libcalamares/PythonHelper.h | 2 +-
src/libcalamares/PythonJob.cpp | 4 ++--
src/libcalamares/PythonJob.h | 1 +
src/libcalamares/PythonJobApi.cpp | 2 +-
src/libcalamares/PythonJobApi.h | 2 +-
6 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/libcalamares/PythonHelper.cpp b/src/libcalamares/PythonHelper.cpp
index d08fd66f1..88008692e 100644
--- a/src/libcalamares/PythonHelper.cpp
+++ b/src/libcalamares/PythonHelper.cpp
@@ -1,7 +1,7 @@
/* === This file is part of Calamares - ===
*
* Copyright 2014, Teo Mrnjavac
- * Copyright 2017-2018, Adriaan de Groot
+ * Copyright 2017-2018, 2020, Adriaan de Groot
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libcalamares/PythonHelper.h b/src/libcalamares/PythonHelper.h
index ed1d56151..bb37eb868 100644
--- a/src/libcalamares/PythonHelper.h
+++ b/src/libcalamares/PythonHelper.h
@@ -1,7 +1,7 @@
/* === This file is part of Calamares - ===
*
* Copyright 2014, Teo Mrnjavac
- * Copyright 2018, Adriaan de Groot
+ * Copyright 2018, 2020, Adriaan de Groot
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libcalamares/PythonJob.cpp b/src/libcalamares/PythonJob.cpp
index db14c10f8..d94a20981 100644
--- a/src/libcalamares/PythonJob.cpp
+++ b/src/libcalamares/PythonJob.cpp
@@ -1,7 +1,7 @@
/* === This file is part of Calamares - ===
*
* Copyright 2014-2016, Teo Mrnjavac
- * Copyright 2018, Adriaan de Groot
+ * Copyright 2018, 2020, Adriaan de Groot
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -176,7 +176,7 @@ PythonJob::PythonJob( const ModuleSystem::InstanceKey& instance,
, m_workingPath( workingPath )
, m_description()
, m_configurationMap( moduleConfiguration )
- , m_weight( (instance.module() == QStringLiteral( "unpackfs" )) ? 12.0 : 1.0 )
+ , m_weight( ( instance.module() == QStringLiteral( "unpackfs" ) ) ? 12.0 : 1.0 )
{
}
diff --git a/src/libcalamares/PythonJob.h b/src/libcalamares/PythonJob.h
index 103015932..7cd1b7165 100644
--- a/src/libcalamares/PythonJob.h
+++ b/src/libcalamares/PythonJob.h
@@ -1,6 +1,7 @@
/* === This file is part of Calamares - ===
*
* Copyright 2014, Teo Mrnjavac
+ * Copyright 2020, Adriaan de Groot
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libcalamares/PythonJobApi.cpp b/src/libcalamares/PythonJobApi.cpp
index e0bb686cd..132a9dcf5 100644
--- a/src/libcalamares/PythonJobApi.cpp
+++ b/src/libcalamares/PythonJobApi.cpp
@@ -1,7 +1,7 @@
/* === This file is part of Calamares - ===
*
* Copyright 2014-2016, Teo Mrnjavac
- * Copyright 2017-2019, Adriaan de Groot
+ * Copyright 2017-2020, Adriaan de Groot
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libcalamares/PythonJobApi.h b/src/libcalamares/PythonJobApi.h
index 941527d66..6fb27cd62 100644
--- a/src/libcalamares/PythonJobApi.h
+++ b/src/libcalamares/PythonJobApi.h
@@ -1,7 +1,7 @@
/* === This file is part of Calamares - ===
*
* Copyright 2014-2016, Teo Mrnjavac
- * Copyright 2017-2018, Adriaan de Groot
+ * Copyright 2017-2018, 2020, Adriaan de Groot
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
From 7efed8226cc2854ea9f425222cca78d3712b6bae Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Wed, 12 Feb 2020 12:10:58 +0100
Subject: [PATCH 24/28] [libcalamares] Warnings--, update copyright
---
src/libcalamares/utils/TestPaths.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/libcalamares/utils/TestPaths.cpp b/src/libcalamares/utils/TestPaths.cpp
index 2f9f4e657..da67f9dd2 100644
--- a/src/libcalamares/utils/TestPaths.cpp
+++ b/src/libcalamares/utils/TestPaths.cpp
@@ -1,6 +1,6 @@
/* === This file is part of Calamares - ===
*
- * Copyright 2018, Adriaan de Groot
+ * Copyright 2018, 2020, Adriaan de Groot
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -38,8 +38,8 @@ class TestPaths : public QObject
{
Q_OBJECT
public:
- TestPaths() {};
- virtual ~TestPaths() {};
+ TestPaths() {}
+ virtual ~TestPaths() {}
private Q_SLOTS:
void initTestCase();
From 090716ba4f7ac5220339512ccde15d16a241b158 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Wed, 12 Feb 2020 12:15:13 +0100
Subject: [PATCH 25/28] [libcalamares] Warnings-- in Entropy
- reading a file yields a qint64
- need to mash the unsigned data from twister to signed char data.
---
src/libcalamares/utils/Entropy.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libcalamares/utils/Entropy.cpp b/src/libcalamares/utils/Entropy.cpp
index 643346855..ce1f6ba9d 100644
--- a/src/libcalamares/utils/Entropy.cpp
+++ b/src/libcalamares/utils/Entropy.cpp
@@ -35,7 +35,7 @@ CalamaresUtils::getEntropy( int size, QByteArray& b )
char* buffer = b.data();
std::fill( buffer, buffer + size, 0xcb );
- int readSize = 0;
+ qint64 readSize = 0;
QFile urandom( "/dev/urandom" );
if ( urandom.exists() && urandom.open( QIODevice::ReadOnly ) )
{
@@ -62,7 +62,7 @@ CalamaresUtils::getEntropy( int size, QByteArray& b )
#define GET_ONE_BYTE \
if ( readSize < size ) \
{ \
- buffer[ readSize++ ] = next & 0xff; \
+ buffer[ readSize++ ] = char( next & 0xffU ); \
next = next >> 8; \
}
GET_ONE_BYTE
From a11280b427b8bfb06d8811d59e053aab343955ec Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Wed, 12 Feb 2020 12:22:02 +0100
Subject: [PATCH 26/28] [libcalamares] Expand tests for printable entropy
---
src/libcalamares/utils/Tests.cpp | 27 +++++++++++++++++++++++++++
src/libcalamares/utils/Tests.h | 1 +
2 files changed, 28 insertions(+)
diff --git a/src/libcalamares/utils/Tests.cpp b/src/libcalamares/utils/Tests.cpp
index e39d182ea..34701a940 100644
--- a/src/libcalamares/utils/Tests.cpp
+++ b/src/libcalamares/utils/Tests.cpp
@@ -224,3 +224,30 @@ LibCalamaresTests::testPrintableEntropy()
QVERIFY( c.cell() < 127 );
}
}
+
+void
+LibCalamaresTests::testOddSizedPrintable()
+{
+ QString s;
+ for ( int l = 0; l <= 37; ++l )
+ {
+ auto r = CalamaresUtils::getPrintableEntropy( l, s );
+ if ( l == 0 )
+ {
+ QCOMPARE( r, CalamaresUtils::EntropySource::None );
+ }
+ else
+ {
+ QVERIFY( r != CalamaresUtils::EntropySource::None );
+ }
+ QCOMPARE( s.length(), l );
+
+ for ( QChar c : s )
+ {
+ QVERIFY( c.isPrint() );
+ QCOMPARE( c.row(), 0 );
+ QVERIFY( c.cell() > 32 ); // ASCII SPACE
+ QVERIFY( c.cell() < 127 );
+ }
+ }
+}
diff --git a/src/libcalamares/utils/Tests.h b/src/libcalamares/utils/Tests.h
index d369ed4cb..f9908c74c 100644
--- a/src/libcalamares/utils/Tests.h
+++ b/src/libcalamares/utils/Tests.h
@@ -43,6 +43,7 @@ private Q_SLOTS:
/** @brief Tests the entropy functions. */
void testEntropy();
void testPrintableEntropy();
+ void testOddSizedPrintable();
};
#endif
From ad725b671e1d509cf5172d4a9432ae367c11b398 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Wed, 12 Feb 2020 12:26:55 +0100
Subject: [PATCH 27/28] [hostinfo] Warnings--
- Physical memory can't be negative, so it is reported as
an unsigned long, but the bytes-to-MiB functions do accept
negative amounts. As long as no machine has more than 2**62
bytes of memory, we're good though.
---
src/modules/hostinfo/HostInfoJob.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/modules/hostinfo/HostInfoJob.cpp b/src/modules/hostinfo/HostInfoJob.cpp
index 3e0e4258c..c2959fb6b 100644
--- a/src/modules/hostinfo/HostInfoJob.cpp
+++ b/src/modules/hostinfo/HostInfoJob.cpp
@@ -156,7 +156,8 @@ HostInfoJob::exec()
gs->insert( "hostOSName", hostOSName() );
gs->insert( "hostCPU", hostCPU() );
- auto ram = CalamaresUtils::BytesToMiB( CalamaresUtils::System::instance()->getTotalMemoryB().first );
+ // Memory can't be negative, so it's reported as unsigned long.
+ auto ram = CalamaresUtils::BytesToMiB( qint64( CalamaresUtils::System::instance()->getTotalMemoryB().first ) );
if ( ram )
{
gs->insert( "hostRAMMiB", ram );
From 940860107445dbdc499a4a7f737ba84e40948674 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot
Date: Wed, 12 Feb 2020 12:37:43 +0100
Subject: [PATCH 28/28] [libcalamares] Move Python wrapper
- Take the Python wrapper for GlobalStorage out of the GlobalStorage.h
header and add it to PythonHelper instead, saving some work in
all the cases that only GS is interesting, not the Python bits.
---
src/libcalamares/GlobalStorage.cpp | 77 ------------------------------
src/libcalamares/GlobalStorage.h | 43 -----------------
src/libcalamares/PythonHelper.cpp | 63 ++++++++++++++++++++++++
src/libcalamares/PythonHelper.h | 27 +++++++++++
4 files changed, 90 insertions(+), 120 deletions(-)
diff --git a/src/libcalamares/GlobalStorage.cpp b/src/libcalamares/GlobalStorage.cpp
index 2ccaf79b4..428b01103 100644
--- a/src/libcalamares/GlobalStorage.cpp
+++ b/src/libcalamares/GlobalStorage.cpp
@@ -27,11 +27,6 @@
#include
#include
-#ifdef WITH_PYTHON
-#include "PythonHelper.h"
-namespace bp = boost::python;
-#endif
-
using CalamaresUtils::operator""_MiB;
namespace Calamares
@@ -161,75 +156,3 @@ GlobalStorage::loadYaml( const QString& filename )
} // namespace Calamares
-
-#ifdef WITH_PYTHON
-
-namespace CalamaresPython
-{
-
-Calamares::GlobalStorage* GlobalStoragePythonWrapper::s_gs_instance = nullptr;
-
-// The special handling for nullptr is only for the testing
-// script for the python bindings, which passes in None;
-// normal use will have a GlobalStorage from JobQueue::instance()
-// passed in. Testing use will leak the allocated GlobalStorage
-// object, but that's OK for testing.
-GlobalStoragePythonWrapper::GlobalStoragePythonWrapper( Calamares::GlobalStorage* gs )
- : m_gs( gs ? gs : s_gs_instance )
-{
- if ( !m_gs )
- {
- s_gs_instance = new Calamares::GlobalStorage;
- m_gs = s_gs_instance;
- }
-}
-
-bool
-GlobalStoragePythonWrapper::contains( const std::string& key ) const
-{
- return m_gs->contains( QString::fromStdString( key ) );
-}
-
-
-int
-GlobalStoragePythonWrapper::count() const
-{
- return m_gs->count();
-}
-
-
-void
-GlobalStoragePythonWrapper::insert( const std::string& key, const bp::object& value )
-{
- m_gs->insert( QString::fromStdString( key ), CalamaresPython::variantFromPyObject( value ) );
-}
-
-bp::list
-GlobalStoragePythonWrapper::keys() const
-{
- bp::list pyList;
- const auto keys = m_gs->keys();
- for ( const QString& key : keys )
- {
- pyList.append( key.toStdString() );
- }
- return pyList;
-}
-
-
-int
-GlobalStoragePythonWrapper::remove( const std::string& key )
-{
- return m_gs->remove( QString::fromStdString( key ) );
-}
-
-
-bp::object
-GlobalStoragePythonWrapper::value( const std::string& key ) const
-{
- return CalamaresPython::variantToPyObject( m_gs->value( QString::fromStdString( key ) ) );
-}
-
-} // namespace CalamaresPython
-
-#endif // WITH_PYTHON
diff --git a/src/libcalamares/GlobalStorage.h b/src/libcalamares/GlobalStorage.h
index b070e23f6..bef9ec1cc 100644
--- a/src/libcalamares/GlobalStorage.h
+++ b/src/libcalamares/GlobalStorage.h
@@ -26,20 +26,6 @@
#include
#include
-#ifdef WITH_PYTHON
-namespace boost
-{
-namespace python
-{
-namespace api
-{
-class object;
-}
-class list;
-} // namespace python
-} // namespace boost
-#endif
-
namespace Calamares
{
@@ -106,33 +92,4 @@ private:
} // namespace Calamares
-#ifdef WITH_PYTHON
-namespace CalamaresPython
-{
-
-class GlobalStoragePythonWrapper
-{
-public:
- explicit GlobalStoragePythonWrapper( Calamares::GlobalStorage* gs );
-
- bool contains( const std::string& key ) const;
- int count() const;
- void insert( const std::string& key, const boost::python::api::object& value );
- boost::python::list keys() const;
- int remove( const std::string& key );
- boost::python::api::object value( const std::string& key ) const;
-
- // This is a helper for scripts that do not go through
- // the JobQueue (i.e. the module testpython script),
- // which allocate their own (singleton) GlobalStorage.
- static Calamares::GlobalStorage* globalStorageInstance() { return s_gs_instance; }
-
-private:
- Calamares::GlobalStorage* m_gs;
- static Calamares::GlobalStorage* s_gs_instance; // See globalStorageInstance()
-};
-
-} // namespace CalamaresPython
-#endif
-
#endif // CALAMARES_GLOBALSTORAGE_H
diff --git a/src/libcalamares/PythonHelper.cpp b/src/libcalamares/PythonHelper.cpp
index 88008692e..d9db8581e 100644
--- a/src/libcalamares/PythonHelper.cpp
+++ b/src/libcalamares/PythonHelper.cpp
@@ -19,6 +19,7 @@
#include "PythonHelper.h"
+#include "GlobalStorage.h"
#include "utils/Dirs.h"
#include "utils/Logger.h"
@@ -390,5 +391,67 @@ Helper::handleLastError()
return QString( "%1
" ).arg( msgList.join( "" ) );
}
+Calamares::GlobalStorage* GlobalStoragePythonWrapper::s_gs_instance = nullptr;
+
+// The special handling for nullptr is only for the testing
+// script for the python bindings, which passes in None;
+// normal use will have a GlobalStorage from JobQueue::instance()
+// passed in. Testing use will leak the allocated GlobalStorage
+// object, but that's OK for testing.
+GlobalStoragePythonWrapper::GlobalStoragePythonWrapper( Calamares::GlobalStorage* gs )
+ : m_gs( gs ? gs : s_gs_instance )
+{
+ if ( !m_gs )
+ {
+ s_gs_instance = new Calamares::GlobalStorage;
+ m_gs = s_gs_instance;
+ }
+}
+
+bool
+GlobalStoragePythonWrapper::contains( const std::string& key ) const
+{
+ return m_gs->contains( QString::fromStdString( key ) );
+}
+
+
+int
+GlobalStoragePythonWrapper::count() const
+{
+ return m_gs->count();
+}
+
+
+void
+GlobalStoragePythonWrapper::insert( const std::string& key, const bp::object& value )
+{
+ m_gs->insert( QString::fromStdString( key ), CalamaresPython::variantFromPyObject( value ) );
+}
+
+bp::list
+GlobalStoragePythonWrapper::keys() const
+{
+ bp::list pyList;
+ const auto keys = m_gs->keys();
+ for ( const QString& key : keys )
+ {
+ pyList.append( key.toStdString() );
+ }
+ return pyList;
+}
+
+
+int
+GlobalStoragePythonWrapper::remove( const std::string& key )
+{
+ return m_gs->remove( QString::fromStdString( key ) );
+}
+
+
+bp::object
+GlobalStoragePythonWrapper::value( const std::string& key ) const
+{
+ return CalamaresPython::variantToPyObject( m_gs->value( QString::fromStdString( key ) ) );
+}
} // namespace CalamaresPython
diff --git a/src/libcalamares/PythonHelper.h b/src/libcalamares/PythonHelper.h
index bb37eb868..418c75e5f 100644
--- a/src/libcalamares/PythonHelper.h
+++ b/src/libcalamares/PythonHelper.h
@@ -25,6 +25,11 @@
#include
+namespace Calamares
+{
+class GlobalStorage;
+}
+
namespace CalamaresPython
{
@@ -62,6 +67,28 @@ private:
QStringList m_pythonPaths;
};
+class GlobalStoragePythonWrapper
+{
+public:
+ explicit GlobalStoragePythonWrapper( Calamares::GlobalStorage* gs );
+
+ bool contains( const std::string& key ) const;
+ int count() const;
+ void insert( const std::string& key, const boost::python::api::object& value );
+ boost::python::list keys() const;
+ int remove( const std::string& key );
+ boost::python::api::object value( const std::string& key ) const;
+
+ // This is a helper for scripts that do not go through
+ // the JobQueue (i.e. the module testpython script),
+ // which allocate their own (singleton) GlobalStorage.
+ static Calamares::GlobalStorage* globalStorageInstance() { return s_gs_instance; }
+
+private:
+ Calamares::GlobalStorage* m_gs;
+ static Calamares::GlobalStorage* s_gs_instance; // See globalStorageInstance()
+};
+
} // namespace CalamaresPython
#endif // CALAMARES_PYTHONJOBHELPER_H