[neon/backports-jammy/packagekit-qt/Neon/unstable] /: New upstream version 1.1.1

Matthias Klumpp null at kde.org
Wed Mar 15 04:29:33 GMT 2023


Git commit c3c7dc796b43222828fca543c8fa2f5b7ca97558 by Matthias Klumpp.
Committed on 10/03/2023 at 17:47.
Pushed by carlosdem into branch 'Neon/unstable'.

New upstream version 1.1.1

M  +3    -3    .github/workflows/main.yml
M  +33   -4    CMakeLists.txt
M  +13   -0    NEWS
M  +4    -0    README.md
M  +0    -2    src/CMakeLists.txt
M  +4    -4    src/daemon.cpp
M  +1    -1    src/daemonprivate.h
M  +6    -0    src/transaction.cpp
M  +11   -1    src/transaction.h
M  +6    -1    src/transactionprivate.cpp
M  +4    -1    src/transactionprivate.h
R  +1    -1    tests/ci/build-and-test.sh [from: tests/ci/build_and_test.sh - 079% similarity]

https://invent.kde.org/neon/backports-jammy/packagekit-qt/commit/c3c7dc796b43222828fca543c8fa2f5b7ca97558

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 790ae2e..23d3e0a 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -3,7 +3,7 @@ name: Build and Test
 on: [push, pull_request]
 
 jobs:
-  build_and_test:
+  build-test:
     runs-on: ubuntu-latest
 
     strategy:
@@ -16,7 +16,7 @@ jobs:
     steps:
       - uses: actions/checkout at v2
       - run: docker build -t packagekitqt-${{ matrix.distro }} -f tests/ci/Dockerfile-${{ matrix.distro }} .
-      - run: docker run -t -v `pwd`:/build packagekitqt-${{ matrix.distro }} ./tests/ci/build_and_test.sh
+      - run: docker run -t -v `pwd`:/build packagekitqt-${{ matrix.distro }} ./tests/ci/build-and-test.sh
         if: ${{ matrix.distro == 'fedora' }}
-      - run: docker run -t -v `pwd`:/build packagekitqt-${{ matrix.distro }} ./tests/ci/build_and_test.sh
+      - run: docker run -t -v `pwd`:/build packagekitqt-${{ matrix.distro }} ./tests/ci/build-and-test.sh
         if: ${{ matrix.distro == 'debian' }}
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 091d0bf..cd7aa20 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ if (POLICY CMP0063)
   cmake_policy(SET CMP0063 NEW)
 endif()
 
-project(packagekit-qt VERSION 1.0.3)
+project(packagekit-qt VERSION 1.1.1)
 
 # Used to set installation paths
 set(CMAKE_AUTOMOC ON)
@@ -19,7 +19,15 @@ include(GNUInstallDirs)
 
 set(QPACKAGEKIT_API_LEVEL "1")
 
-find_package(QT NAMES Qt6 Qt5 NO_MODULE REQUIRED COMPONENTS Core DBus)
+option(BUILD_WITH_QT6 "Use Qt6 instead of Qt5" OFF)
+
+if(BUILD_WITH_QT6)
+  set(QT_VERSION_MAJOR 6)
+else()
+  set(QT_VERSION_MAJOR 5)
+endif()
+
+find_package(Qt${QT_VERSION_MAJOR} 5.10 REQUIRED COMPONENTS Core DBus)
 
 add_definitions(
     -DQT_NO_KEYWORDS
@@ -65,11 +73,32 @@ configure_file(config.h.in ${CMAKE_BINARY_DIR}/config.h)
 #
 # Custom C flags
 #
+add_definitions(
+  "-Wformat"
+  "-Wno-unused-parameter"
+  "-Werror=empty-body"
+  "-Werror=pointer-arith"
+  "-Werror=init-self"
+  "-Werror=missing-declarations"
+  "-Werror=return-type"
+  "-Werror=misleading-indentation"
+  "-Werror=format-security"
+)
 option (MAINTAINER "Enable maintainer CFlags" OFF)
 if (MAINTAINER)
-    set (MAINTAINER_CFLAGS "-Werror -Wall -Wcast-align -Wno-uninitialized -Wempty-body -Wformat-security -Winit-self")
+    set(MAINTAINER_CFLAGS
+      "-Werror"
+      "-Wall"
+      "-Wcast-align"
+      "-Wno-uninitialized"
+      "-Wempty-body"
+      "-Winit-self"
+      "-Wnull-dereference"
+      "-Wfloat-equal"
+      "-Winline"
+    )
     add_definitions(${MAINTAINER_CFLAGS})
-endif ()
+endif()
 
 add_subdirectory(src)
 
diff --git a/NEWS b/NEWS
index be91108..a00cb73 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,16 @@
+Version 1.1.1
+~~~~~~~~~~~~~
+Released: 2023-03-10
+
+Features:
+ * Add explicit CMake option to control Qt major version (Nicolas Fella)
+
+Bugfixes:
+ * Return if we can't handle the transaction role (Cat Ericka)
+ * Transaction: Implement all methods (Aleix Pol)
+ * Read the Sender transaction property (Matthias Klumpp)
+ * Apply stricter compiler flags when building the library (Matthias Klumpp)
+
 Version 1.1.0
 ~~~~~~~~~~~~~
 Released: 2022-12-01
diff --git a/README.md b/README.md
index 338f13f..3a15b07 100644
--- a/README.md
+++ b/README.md
@@ -6,3 +6,7 @@ PackageKit is a DBUS abstraction layer that allows the session user to manage
 packages in a secure way using a cross-distro, cross-architecture API.
 
 For more information, please see https://www.freedesktop.org/software/PackageKit/
+
+## Releases
+
+You can find published releases here: https://www.freedesktop.org/software/PackageKit/releases/
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6e523b8..dac2104 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,7 +1,5 @@
 # CMakeLists for PackageKit-Qt library
 
-find_package(Qt${QT_VERSION_MAJOR} 5.10 REQUIRED COMPONENTS Core DBus)
-
 set(packagekitqt_HEADERS
     Daemon
     Transaction
diff --git a/src/daemon.cpp b/src/daemon.cpp
index 0cb921e..31ebc6d 100644
--- a/src/daemon.cpp
+++ b/src/daemon.cpp
@@ -34,7 +34,7 @@ Q_DECLARE_METATYPE(QList<PackageKit::PkPackage>);
 Q_DECLARE_METATYPE(PackageKit::PkDetail);
 Q_DECLARE_METATYPE(QList<PackageKit::PkDetail>);
 
-const QDBusArgument &operator<<(QDBusArgument &argument, const PackageKit::PkPackage &pkg)
+static const QDBusArgument &operator<<(QDBusArgument &argument, const PackageKit::PkPackage &pkg)
 {
     argument.beginStructure();
     argument << pkg.info;
@@ -44,7 +44,7 @@ const QDBusArgument &operator<<(QDBusArgument &argument, const PackageKit::PkPac
     return argument;
 }
 
-const QDBusArgument &operator>>(const QDBusArgument &argument, PackageKit::PkPackage &pkg)
+static const QDBusArgument &operator>>(const QDBusArgument &argument, PackageKit::PkPackage &pkg)
 {
     argument.beginStructure();
     argument >> pkg.info;
@@ -54,7 +54,7 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, PackageKit::PkPac
     return argument;
 }
 
-const QDBusArgument &operator>>(const QDBusArgument &argument, PackageKit::PkDetail &detail)
+static const QDBusArgument &operator>>(const QDBusArgument &argument, PackageKit::PkDetail &detail)
 {
     argument.beginStructure();
     argument >> detail.package_id;
@@ -73,7 +73,7 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, PackageKit::PkDet
     return argument;
 }
 
-const QDBusArgument &operator<<(QDBusArgument &argument, const PackageKit::PkDetail &detail)
+static const QDBusArgument &operator<<(QDBusArgument &argument, const PackageKit::PkDetail &detail)
 {
     argument.beginStructure();
     argument << detail.package_id;
diff --git a/src/daemonprivate.h b/src/daemonprivate.h
index 9bf794c..729e3ec 100644
--- a/src/daemonprivate.h
+++ b/src/daemonprivate.h
@@ -28,8 +28,8 @@
 #include "daemon.h"
 #include "offline.h"
 
-Q_DECLARE_LOGGING_CATEGORY(PACKAGEKITQT_TRANSACTION)
 Q_DECLARE_LOGGING_CATEGORY(PACKAGEKITQT_DAEMON)
+Q_DECLARE_LOGGING_CATEGORY(PACKAGEKITQT_OFFLINE)
 
 class OrgFreedesktopPackageKitInterface;
 
diff --git a/src/transaction.cpp b/src/transaction.cpp
index b256daf..9c733aa 100644
--- a/src/transaction.cpp
+++ b/src/transaction.cpp
@@ -353,6 +353,12 @@ uint Transaction::uid() const
     return d->uid;
 }
 
+QString Transaction::senderName() const
+{
+    Q_D(const Transaction);
+    return d->senderName;
+}
+
 QString Transaction::cmdline() const
 {
     Q_D(const Transaction);
diff --git a/src/transaction.h b/src/transaction.h
index 6461df5..46a2fac 100644
--- a/src/transaction.h
+++ b/src/transaction.h
@@ -74,6 +74,7 @@ class PACKAGEKITQT_LIBRARY Transaction : public QObject
     Q_PROPERTY(uint duration READ duration)
     Q_PROPERTY(QString data READ data)
     Q_PROPERTY(uint uid READ uid NOTIFY uidChanged)
+    Q_PROPERTY(QString senderName READ senderName NOTIFY senderNameChanged)
     Q_PROPERTY(QString cmdline READ cmdline)
 public:
     /**
@@ -612,6 +613,13 @@ public:
      */
     uint uid() const;
 
+    /**
+     * Returns the D-Bus name of the calling process
+     * \return the unique D-Bus name of the calling process
+     * \note This function only returns a usable value for ongoing transactions
+     */
+    QString senderName() const;
+
     /**
      * Returns the command line for the calling process
      * \return a string of the command line for the calling process
@@ -697,6 +705,8 @@ Q_SIGNALS:
 
     void uidChanged();
 
+    void senderNameChanged();
+
     /**
      * \brief Sends a category
      *
@@ -861,7 +871,7 @@ private:
     Q_PRIVATE_SLOT(d_func(), void ItemProgress(const QString &itemID, uint status, uint percentage))
     Q_PRIVATE_SLOT(d_func(), void RepoSignatureRequired(const QString &pid, const QString &repoName, const QString &keyUrl, const QString &keyUserid, const QString &keyId, const QString &keyFingerprint, const QString &keyTimestamp, uint type))
     Q_PRIVATE_SLOT(d_func(), void requireRestart(uint type, const QString &pid))
-    Q_PRIVATE_SLOT(d_func(), void transaction(const QDBusObjectPath &oldTid, const QString &timespec, bool succeeded, uint role, uint duration, const QString &data, uint uid, const QString &cmdline))
+    Q_PRIVATE_SLOT(d_func(), void transaction(const QDBusObjectPath &oldTid, const QString &timespec, bool succeeded, uint role, uint duration, const QString &data, uint uid, const QString &senderName, const QString &cmdline))
     Q_PRIVATE_SLOT(d_func(), void UpdateDetail(const QString &package_id, const QStringList &updates, const QStringList &obsoletes, const QStringList &vendor_urls, const QStringList &bugzilla_urls, const QStringList &cve_urls, uint restart, const QString &update_text, const QString &changelog, uint state, const QString &issued, const QString &updated))
     Q_PRIVATE_SLOT(d_func(), void UpdateDetails(const QList<PackageKit::PkDetail> &dets))
     Q_PRIVATE_SLOT(d_func(), void destroy())
diff --git a/src/transactionprivate.cpp b/src/transactionprivate.cpp
index ae0c367..b4b44b7 100644
--- a/src/transactionprivate.cpp
+++ b/src/transactionprivate.cpp
@@ -185,7 +185,7 @@ void TransactionPrivate::runQueuedTransaction()
         reply = p->UpgradeSystem(transactionFlags, upgradeDistroId, upgradeKind);
         break;
     default:
-        break;
+        return;
     }
 
     if (reply.isFinished() && reply.isError()) {
@@ -325,6 +325,9 @@ void TransactionPrivate::updateProperties(const QVariantMap &properties)
         } else if (property == QLatin1String("Uid")) {
             uid = value.toUInt();
             QMetaObject::invokeMethod(q, &Transaction::uidChanged, Qt::QueuedConnection);
+        } else if (property == QLatin1String("Sender")) {
+            senderName = value.toString();
+            QMetaObject::invokeMethod(q, &Transaction::senderNameChanged, Qt::QueuedConnection);
         } else {
             qCWarning(PACKAGEKITQT_TRANSACTION) << "Unknown Transaction property:" << property << value;
         }
@@ -390,6 +393,7 @@ void TransactionPrivate::transaction(const QDBusObjectPath &oldTid,
                                      uint duration,
                                      const QString &data,
                                      uint uid,
+                                     const QString &senderName,
                                      const QString &cmdline)
 {
     Q_Q(Transaction);
@@ -402,6 +406,7 @@ void TransactionPrivate::transaction(const QDBusObjectPath &oldTid,
     priv->duration = duration;
     priv->data = data;
     priv->uid = uid;
+    priv->senderName = senderName;
     priv->cmdline = cmdline;
 
     auto transaction = new Transaction(priv);
diff --git a/src/transactionprivate.h b/src/transactionprivate.h
index ee5daac..69217a8 100644
--- a/src/transactionprivate.h
+++ b/src/transactionprivate.h
@@ -30,6 +30,8 @@
 #include "transaction.h"
 #include "transactionproxy.h"
 
+Q_DECLARE_LOGGING_CATEGORY(PACKAGEKITQT_TRANSACTION)
+
 namespace PackageKit {
 
 struct PkPackage {
@@ -78,6 +80,7 @@ protected:
     uint speed = 0;
     Transaction::Status status = Transaction::StatusUnknown;
     uint uid = 0;
+    QString senderName;
     bool sentFinished = false;
     bool allowCancel = false;
     bool callerActive = false;
@@ -135,7 +138,7 @@ protected Q_SLOTS:
                                const QString &keyTimestamp,
                                uint type);
     void requireRestart(uint type, const QString &pid);
-    void transaction(const QDBusObjectPath &oldTid, const QString &timespec, bool succeeded, uint role, uint duration, const QString &data, uint uid, const QString &cmdline);
+    void transaction(const QDBusObjectPath &oldTid, const QString &timespec, bool succeeded, uint role, uint duration, const QString &data, uint uid, const QString &senderName, const QString &cmdline);
     void UpdateDetail(const QString &package_id, const QStringList &updates, const QStringList &obsoletes, const QStringList &vendor_urls, const QStringList &bugzilla_urls, const QStringList &cve_urls, uint restart, const QString &update_text, const QString &changelog, uint state, const QString &issued, const QString &updated);
     void UpdateDetails(const QList<PackageKit::PkDetail> &details);
     void destroy();
diff --git a/tests/ci/build_and_test.sh b/tests/ci/build-and-test.sh
similarity index 79%
rename from tests/ci/build_and_test.sh
rename to tests/ci/build-and-test.sh
index d127de7..0c28137 100755
--- a/tests/ci/build_and_test.sh
+++ b/tests/ci/build-and-test.sh
@@ -4,7 +4,7 @@ set -e
 if [ -d "build" ]; then
   rm build -rf
 fi
-cmake -S . -B build -GNinja -DMAINTAINER=1 $@
+cmake -S . -B build -GNinja -DMAINTAINER:BOOL=ON $@
 
 # Build, Test & Install
 cmake --build build



More information about the Neon-commits mailing list