automatic version update by autodist [release 1.3.1-1mamba;Mon Jun 30 2025]

This commit is contained in:
2025-07-05 13:09:14 +02:00
parent fb89032f2b
commit 73492bd702
3 changed files with 37 additions and 187 deletions

View File

@@ -1,183 +0,0 @@
From a22125a7562a685c3b7dff900fe3ed87ac7a6401 Mon Sep 17 00:00:00 2001
From: Alessandro Astone <ales.astone@gmail.com>
Date: Thu, 18 Jan 2024 21:41:15 +0100
Subject: [PATCH] Add dnf5 posttrans notify plugin
Just like #600, we should do the same for dnf5
---
backends/dnf/meson.build | 22 +++++++
backends/dnf/notify_packagekit.conf | 3 +
backends/dnf/notify_packagekit.cpp | 90 +++++++++++++++++++++++++++++
tests/ci/Dockerfile-fedora | 5 +-
4 files changed, 119 insertions(+), 1 deletion(-)
create mode 100644 backends/dnf/notify_packagekit.conf
create mode 100644 backends/dnf/notify_packagekit.cpp
diff --git a/backends/dnf/meson.build b/backends/dnf/meson.build
index 814b0d932..fab5fb57c 100644
--- a/backends/dnf/meson.build
+++ b/backends/dnf/meson.build
@@ -1,6 +1,8 @@
appstream_dep = dependency('appstream', version: '>=0.14.0')
dnf_dep = dependency('libdnf', version: '>=0.43.1')
+dnf5_dep = dependency('libdnf5').partial_dependency(includes: true, compile_args: true)
rpm_dep = dependency('rpm')
+sdbus_cpp_dep = dependency('sdbus-c++')
c_args = ['-DG_LOG_DOMAIN="PackageKit-DNF"']
if meson.get_compiler('c').has_function('hy_query_get_advisory_pkgs', prefix: '#include <libdnf/hy-query.h>', dependencies: dnf_dep)
@@ -20,6 +22,26 @@ install_data(
install_dir: join_paths(python_package_dir),
)
+add_languages('cpp')
+shared_module(
+ 'notify_packagekit',
+ 'notify_packagekit.cpp',
+ cpp_args: '-std=c++20',
+ include_directories: packagekit_glib2_includes,
+ dependencies: [
+ dnf5_dep,
+ sdbus_cpp_dep,
+ ],
+ name_prefix: '',
+ install: true,
+ install_dir: get_option('libdir') / 'libdnf5/plugins/',
+)
+
+install_data(
+ 'notify_packagekit.conf',
+ install_dir: get_option('sysconfdir') / 'dnf/libdnf5-plugins/'
+)
+
shared_module(
'pk_backend_dnf',
'dnf-backend-vendor-@0@.c'.format(get_option('dnf_vendor')),
diff --git a/backends/dnf/notify_packagekit.conf b/backends/dnf/notify_packagekit.conf
new file mode 100644
index 000000000..80b956b1a
--- /dev/null
+++ b/backends/dnf/notify_packagekit.conf
@@ -0,0 +1,3 @@
+[main]
+name = notify_packagekit
+enabled = yes
diff --git a/backends/dnf/notify_packagekit.cpp b/backends/dnf/notify_packagekit.cpp
new file mode 100644
index 000000000..f7a538765
--- /dev/null
+++ b/backends/dnf/notify_packagekit.cpp
@@ -0,0 +1,90 @@
+// Copyright (C) 2024 Alessandro Astone <ales.astone@gmail.com>
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+#include <libdnf5/base/base.hpp>
+#include <libdnf5/common/exception.hpp>
+
+#include <sdbus-c++/sdbus-c++.h>
+
+#include <algorithm>
+#include <cstdlib>
+
+#include <packagekit-glib2/pk-version.h>
+
+using namespace libdnf5;
+
+namespace {
+
+constexpr const char * PLUGIN_NAME{"notify_packagekit"};
+
+constexpr plugin::Version PLUGIN_VERSION{.major = PK_MAJOR_VERSION, .minor = PK_MINOR_VERSION, .micro = PK_MICRO_VERSION};
+
+constexpr const char * attrs[]{"author.name", "author.email", "description", nullptr};
+constexpr const char * attrs_value[]{"Alessandro Astone", "ales.astone@gmail.com",
+ "Notify packagekitd when packages are installed, updated, or removed."};
+
+class NotifyPackagekitPlugin : public plugin::IPlugin {
+public:
+ NotifyPackagekitPlugin(libdnf5::Base & base, libdnf5::ConfigParser &) : IPlugin(base) {}
+
+ const char * get_name() const noexcept override { return PLUGIN_NAME; }
+
+ plugin::Version get_version() const noexcept override { return PLUGIN_VERSION; }
+
+ PluginAPIVersion get_api_version() const noexcept override { return PLUGIN_API_VERSION; }
+
+ /// Add custom attributes, such as information about yourself and a description of the plugin.
+ /// These can be used to query plugin-specific data through the API.
+ /// Optional to override.
+ const char * const * get_attributes() const noexcept override { return attrs; }
+ const char * get_attribute(const char * attribute) const noexcept override {
+ for (size_t i = 0; attrs[i]; ++i) {
+ if (std::strcmp(attribute, attrs[i]) == 0) {
+ return attrs_value[i];
+ }
+ }
+ return nullptr;
+ }
+
+ void post_transaction(const libdnf5::base::Transaction & transaction) override;
+};
+
+void NotifyPackagekitPlugin::post_transaction(const libdnf5::base::Transaction & transaction) {
+ auto packagekitProxy = sdbus::createProxy("org.freedesktop.PackageKit", "/org/freedesktop/PackageKit");
+ auto method = packagekitProxy->createMethodCall("org.freedesktop.PackageKit", "StateHasChanged");
+ method << "posttrans";
+ packagekitProxy->callMethod(method);
+}
+
+} // namespace
+
+/// Below is a block of functions with C linkage used for loading the plugin binaries from disk.
+/// All of these are MANDATORY to implement.
+
+/// Return plugin's API version.
+PluginAPIVersion libdnf_plugin_get_api_version(void) {
+ return PLUGIN_API_VERSION;
+}
+
+/// Return plugin's name.
+const char * libdnf_plugin_get_name(void) {
+ return PLUGIN_NAME;
+}
+
+/// Return plugin's version.
+plugin::Version libdnf_plugin_get_version(void) {
+ return PLUGIN_VERSION;
+}
+
+/// Return the instance of the implemented plugin.
+plugin::IPlugin * libdnf_plugin_new_instance(
+ [[maybe_unused]] LibraryVersion library_version, libdnf5::Base & base, libdnf5::ConfigParser & parser) try {
+ return new NotifyPackagekitPlugin(base, parser);
+} catch (...) {
+ return nullptr;
+}
+
+/// Delete the plugin instance.
+void libdnf_plugin_delete_instance(plugin::IPlugin * plugin_object) {
+ delete plugin_object;
+}
diff --git a/tests/ci/Dockerfile-fedora b/tests/ci/Dockerfile-fedora
index 3b1fc0ffc..c53a65c91 100644
--- a/tests/ci/Dockerfile-fedora
+++ b/tests/ci/Dockerfile-fedora
@@ -1,14 +1,17 @@
-FROM fedora:38
+FROM fedora:40
RUN dnf -y update
RUN dnf -y install \
dnf-plugins-core \
libdnf-devel \
+ libdnf5-devel \
redhat-rpm-config \
meson \
gcc \
+ gcc-c++ \
ninja-build \
dbus-daemon \
+ sdbus-cpp-devel \
appstream \
appstream-devel
RUN dnf -y builddep PackageKit

View File

@@ -0,0 +1,15 @@
--- PackageKit-1.3.1/backends/dnf/notify_packagekit.cpp.orig 2025-06-27 00:24:37.555001167 +0200
+++ PackageKit-1.3.1/backends/dnf/notify_packagekit.cpp 2025-06-27 00:33:12.993762868 +0200
@@ -55,8 +55,10 @@
};
void NotifyPackagekitPlugin::post_transaction(const libdnf5::base::Transaction & transaction) {
- auto packagekitProxy = sdbus::createProxy("org.freedesktop.PackageKit", "/org/freedesktop/PackageKit");
- auto method = packagekitProxy->createMethodCall("org.freedesktop.PackageKit", "StateHasChanged");
+ auto packagekitProxy = sdbus::createProxy(sdbus::ServiceName("org.freedesktop.PackageKit"),
+ sdbus::ObjectPath("/org/freedesktop/PackageKit"));
+ auto method = packagekitProxy->createMethodCall(sdbus::InterfaceName("org.freedesktop.PackageKit"),
+ sdbus::MethodName("StateHasChanged"));
method << "posttrans";
packagekitProxy->callMethod(method);
}

View File

@@ -1,5 +1,5 @@
Name: PackageKit
Version: 1.3.0
Version: 1.3.1
Release: 1mamba
Summary: A system designed to make installing and updating software on your computer easier
Group: System/Management
@@ -13,20 +13,23 @@ Patch2: PackageKit-1.2.8-dnf-openmamba.patch
Patch3: PackageKit-1.1.12-dnf-disable-trusted-packages-check.patch
Patch4: PackageKit-1.2.6-enable-ShutdownTimeout.patch
Patch5: PackageKit-1.2.8-dnf-set_cache_age-300-seconds.patch
Patch6: PackageKit-1.3.0-revert-add-notifications-to-dnf5.patch
Patch6: PackageKit-1.3.1-sdbus-cpp-2.1.0.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libappstream-devel
BuildRequires: libdnf-devel
BuildRequires: libfontconfig-devel
BuildRequires: libgcc
BuildRequires: libglib-devel
BuildRequires: libgstreamer-devel
BuildRequires: libpango-devel
BuildRequires: libpolkit-devel
BuildRequires: libpython311-devel
BuildRequires: librpm-devel
BuildRequires: libsdbus-cpp-devel
BuildRequires: libsqlite-devel
BuildRequires: libstdc++6-devel
BuildRequires: libsystemd-devel
## AUTOBUILDREQ-END
BuildRequires: librpm-devel >= 4.19.1.1-2mamba
@@ -81,7 +84,14 @@ Obsoletes: PackageKit-gtk2 < 1.2.6
PackageKit is a system designed to make installing and updating software on your computer easier. The primary design goal is to unify all the software graphical tools used in different distributions, and use some of the latest technology like PolicyKit to make the process suck less.
This package contains the Gtk interface library for %{name}.
%debug_package
%package dnf5
Summary: DNF5 notification plugin for %{name}
Group: System/Libraries
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
%description dnf5
PackageKit is a system designed to make installing and updating software on your computer easier. The primary design goal is to unify all the software graphical tools used in different distributions, and use some of the latest technology like PolicyKit to make the process suck less.
This package contains the DNF5 notification plugin for %{name}.
%prep
%setup -q
@@ -90,7 +100,7 @@ This package contains the Gtk interface library for %{name}.
%patch 3 -p1
%patch 4 -p1
%patch 5 -p1
%patch 6 -p1 -R -b .revert-add-notifications-to-dnf5
%patch 6 -p1
sed -i "s|openmandriva|openmamba|" meson_options.txt
@@ -163,6 +173,11 @@ sed -i "s|wheel|sysadmin|" %{buildroot}%{_datadir}/polkit-1/rules.d/org.freedesk
%{_mandir}/man1/pkmon.1*
%doc AUTHORS COPYING
%files dnf5
%defattr(-,root,root)
%{_sysconfdir}/dnf/libdnf5-plugins/notify_packagekit.conf
%{_libdir}/libdnf5/plugins/notify_packagekit.so
%files gtk
%defattr(-,root,root)
%{_libdir}/gtk-3.0/modules/libpk-gtk-module.*
@@ -184,6 +199,9 @@ sed -i "s|wheel|sysadmin|" %{buildroot}%{_datadir}/polkit-1/rules.d/org.freedesk
%doc NEWS README.md
%changelog
* Mon Jun 30 2025 Automatic Build System <autodist@openmamba.org> 1.3.1-1mamba
- automatic version update by autodist
* Sat Sep 07 2024 Automatic Build System <autodist@openmamba.org> 1.3.0-1mamba
- automatic version update by autodist