From f4afecbdd5352cd6fe52595b2e53ece0d0b8c8dd Mon Sep 17 00:00:00 2001 From: Alessandro Astone Date: Thu, 27 Jul 2023 21:48:04 +0200 Subject: [PATCH] Add patches for distro upgrade --- PackageKit-Qt.spec | 7 ++- offline-ask-authorization.patch | 78 ++++++++++++++++++++++++ set-hints-before-transaction.patch | 96 ++++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+), 1 deletion(-) create mode 100644 offline-ask-authorization.patch create mode 100644 set-hints-before-transaction.patch diff --git a/PackageKit-Qt.spec b/PackageKit-Qt.spec index c96bccf..fb40829 100644 --- a/PackageKit-Qt.spec +++ b/PackageKit-Qt.spec @@ -4,7 +4,7 @@ Summary: Qt support library for PackageKit Name: PackageKit-Qt Version: 1.1.1 -Release: 1%{?dist} +Release: 2%{?dist} License: LGPLv2+ URL: http://www.packagekit.org/ @@ -12,6 +12,8 @@ URL: http://www.packagekit.org/ Source0: https://github.com/hughsie/PackageKit-Qt/archive/v%{version}.tar.gz # Upstream patches +Patch0: offline-ask-authorization.patch +Patch1: set-hints-before-transaction.patch BuildRequires: cmake BuildRequires: cmake(Qt5DBus) @@ -73,6 +75,9 @@ Requires: PackageKit-Qt5%{?_isa} = %{version}-%{release} %changelog +* Sat Jul 22 2023 Alessandro Astone - 1.1.1-2 +- Backport fixes for Discover distro upgrade + * Sat Jul 22 2023 Alessandro Astone - 1.1.1-1 - Update to 1.1.1 diff --git a/offline-ask-authorization.patch b/offline-ask-authorization.patch new file mode 100644 index 0000000..f50075d --- /dev/null +++ b/offline-ask-authorization.patch @@ -0,0 +1,78 @@ +From 60ba050ce7c0bf650d23d597f7a11217213b5e48 Mon Sep 17 00:00:00 2001 +From: Aleix Pol +Date: Thu, 16 Mar 2023 17:14:31 +0100 +Subject: [PATCH] offline: Make sure we allow for interactive authorization + +Otherwise it might result in +org.freedesktop.DBus.Error.InteractiveAuthorizationRequired +which PackageKit already contemplates. +--- + src/offline.cpp | 40 ++++++++++++++++++++++++++++++++++------ + 1 file changed, 34 insertions(+), 6 deletions(-) + +diff --git a/src/offline.cpp b/src/offline.cpp +index 01d0986..b28ccb7 100644 +--- a/src/offline.cpp ++++ b/src/offline.cpp +@@ -92,7 +92,15 @@ QDBusPendingReply<> Offline::trigger(Action action) + }; + Q_ASSERT(!actionStr.isEmpty()); + +- return d->iface.Trigger(actionStr); ++ // Manually invoke dbus because the qdbusxml2cpp does not allow ++ // setting the ALLOW_INTERACTIVE_AUTHORIZATION flag ++ auto msg = QDBusMessage::createMethodCall(PK_NAME, ++ PK_PATH, ++ PK_OFFLINE_INTERFACE, ++ QStringLiteral("Trigger")); ++ msg << actionStr; ++ msg.setInteractiveAuthorizationAllowed(true); ++ return QDBusConnection::systemBus().asyncCall(msg); + } + + QDBusPendingReply<> Offline::triggerUpgrade(Action action) +@@ -112,19 +120,39 @@ QDBusPendingReply<> Offline::triggerUpgrade(Action action) + }; + Q_ASSERT(!actionStr.isEmpty()); + +- return d->iface.TriggerUpgrade(actionStr); ++ // Manually invoke dbus because the qdbusxml2cpp does not allow ++ // setting the ALLOW_INTERACTIVE_AUTHORIZATION flag ++ auto msg = QDBusMessage::createMethodCall(PK_NAME, ++ PK_PATH, ++ PK_OFFLINE_INTERFACE, ++ QStringLiteral("TriggerUpgrade")); ++ msg << actionStr; ++ msg.setInteractiveAuthorizationAllowed(true); ++ return QDBusConnection::systemBus().asyncCall(msg, 24 * 60 * 1000 * 1000); + } + + QDBusPendingReply<> Offline::cancel() + { +- Q_D(Offline); +- return d->iface.Cancel(); ++ // Manually invoke dbus because the qdbusxml2cpp does not allow ++ // setting the ALLOW_INTERACTIVE_AUTHORIZATION flag ++ auto msg = QDBusMessage::createMethodCall(PK_NAME, ++ PK_PATH, ++ PK_OFFLINE_INTERFACE, ++ QStringLiteral("Cancel")); ++ msg.setInteractiveAuthorizationAllowed(true); ++ return QDBusConnection::systemBus().asyncCall(msg); + } + + QDBusPendingReply<> Offline::clearResults() + { +- Q_D(Offline); +- return d->iface.ClearResults(); ++ // Manually invoke dbus because the qdbusxml2cpp does not allow ++ // setting the ALLOW_INTERACTIVE_AUTHORIZATION flag ++ auto msg = QDBusMessage::createMethodCall(PK_NAME, ++ PK_PATH, ++ PK_OFFLINE_INTERFACE, ++ QStringLiteral("ClearResults")); ++ msg.setInteractiveAuthorizationAllowed(true); ++ return QDBusConnection::systemBus().asyncCall(msg); + } + + void Offline::getPrepared() diff --git a/set-hints-before-transaction.patch b/set-hints-before-transaction.patch new file mode 100644 index 0000000..94ad503 --- /dev/null +++ b/set-hints-before-transaction.patch @@ -0,0 +1,96 @@ +From 40b24cb41e3a16cf68b664f212837eb26d7e1a27 Mon Sep 17 00:00:00 2001 +From: Alessandro Astone +Date: Mon, 28 Aug 2023 16:39:09 +0200 +Subject: [PATCH] Allow Transaction::setHints before the transaction has + started + +--- + CMakeLists.txt | 2 +- + src/transaction.cpp | 1 + + src/transaction.h | 7 +++++-- + src/transactionprivate.cpp | 2 +- + src/transactionprivate.h | 2 ++ + 5 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 69c22f7..92c7d72 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -66,7 +66,7 @@ set (LOCALSTATEDIR "/var") + set (CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/packagekitqt${QT_VERSION_MAJOR}/") + + add_definitions("-DLOCALSTATEDIR=\"${LOCALSTATEDIR}\"") +-set (CMAKE_CXX_STANDARD 11) ++set (CMAKE_CXX_STANDARD 17) + + configure_file(config.h.in ${CMAKE_BINARY_DIR}/config.h) + +diff --git a/src/transaction.cpp b/src/transaction.cpp +index 9c733aa..48f07ed 100644 +--- a/src/transaction.cpp ++++ b/src/transaction.cpp +@@ -300,6 +300,7 @@ Transaction::Role Transaction::role() const + QDBusPendingReply<> Transaction::setHints(const QStringList &hints) + { + Q_D(Transaction); ++ d->hints = hints; + if (d->p) { + return d->p->SetHints(hints); + } +diff --git a/src/transaction.h b/src/transaction.h +index 46a2fac..510773e 100644 +--- a/src/transaction.h ++++ b/src/transaction.h +@@ -634,11 +634,14 @@ public: + * the package manager which can change as the transaction runs. + * + * This method can be sent before the transaction has been run +- * (by using Daemon::setHints) or whilst it is running +- * (by using Transaction::setHints). ++ * or whilst it is running. If it is used before the transaction has ++ * been run, the return value is meaningless: the \p hints will be ++ * applied upon starting the transaction. + * There is no limit to the number of times this + * method can be sent, although some backends may only use the values + * that were set before the transaction was started. ++ * This method will override the global hints previously set by ++ * Daemon::setHints, that are otherwise used by default. + * + * The \p hints can be filled with entries like these + * ('locale=en_GB.utf8','idle=true','interactive=false'). +diff --git a/src/transactionprivate.cpp b/src/transactionprivate.cpp +index b4b44b7..550e0ab 100644 +--- a/src/transactionprivate.cpp ++++ b/src/transactionprivate.cpp +@@ -49,7 +49,7 @@ void TransactionPrivate::setup(const QDBusObjectPath &transactionId) + tid.path(), + QDBusConnection::systemBus(), + q); +- QStringList hints = Daemon::global()->hints(); ++ QStringList hints = this->hints ? *this->hints : Daemon::global()->hints(); + hints << QStringLiteral("supports-plural-signals=true"); + q->setHints(hints); + +diff --git a/src/transactionprivate.h b/src/transactionprivate.h +index 69217a8..01463c7 100644 +--- a/src/transactionprivate.h ++++ b/src/transactionprivate.h +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + #include "transaction.h" + #include "transactionproxy.h" +@@ -84,6 +85,7 @@ protected: + bool sentFinished = false; + bool allowCancel = false; + bool callerActive = false; ++ std::optional hints; + + // Queue params + QString eulaId; +-- +2.41.0 +