diff --git a/PackageKit-1.2.6.tar.xz b/PackageKit-1.2.6.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..885625cd7f4cbf87f1a7b330b01b064c840fd45c Binary files /dev/null and b/PackageKit-1.2.6.tar.xz differ diff --git a/PackageKit.spec b/PackageKit.spec new file mode 100644 index 0000000000000000000000000000000000000000..bd094db8734c5bfaac4a0ec33b50f3d357f61d76 --- /dev/null +++ b/PackageKit.spec @@ -0,0 +1,268 @@ +%define anolis_release 1 +%global glib2_version 2.54.0 +%global libdnf_version 0.43.1 + +Summary: Package management service +Name: PackageKit +Version: 1.2.6 +Release: %{anolis_release}%{?dist} +License: GPLv2+ and LGPLv2+ +URL: http://www.freedesktop.org/software/PackageKit/ +Source0: http://www.freedesktop.org/software/PackageKit/releases/%{name}-%{version}.tar.xz + +# https://github.com/PackageKit/PackageKit/pull/404 +Patch1: package-remove-password-prompt.patch + +# https://github.com/PackageKit/PackageKit/pull/578 +# https://github.com/PackageKit/PackageKit/pull/599 +# https://github.com/PackageKit/PackageKit/pull/600 +Patch2: shutdown-on-idle.patch + +BuildRequires: glib2-devel >= %{glib2_version} +BuildRequires: xmlto +BuildRequires: gtk-doc +BuildRequires: sqlite-devel +BuildRequires: polkit-devel >= 0.92 +BuildRequires: gtk3-devel +BuildRequires: docbook-utils +BuildRequires: meson +BuildRequires: gettext +BuildRequires: vala +BuildRequires: gstreamer1-devel +BuildRequires: gstreamer1-plugins-base-devel +BuildRequires: pango-devel +BuildRequires: fontconfig-devel +BuildRequires: libappstream-glib-devel +BuildRequires: libdnf-devel >= %{libdnf_version} +BuildRequires: systemd +BuildRequires: systemd-devel +BuildRequires: gobject-introspection-devel +BuildRequires: bash-completion +BuildRequires: python3-devel + +Requires: %{name}-glib = %{version}-%{release} +Requires: glib2 >= %{glib2_version} +Requires: libdnf >= %{libdnf_version} +Requires: shared-mime-info +Requires: systemd + +# functionality moved to udev itself +Obsoletes: PackageKit-udev-helper < %{version}-%{release} +Obsoletes: udev-packagekit < %{version}-%{release} + +# No more GTK+-2 plugin +Obsoletes: PackageKit-gtk-module < %{version}-%{release} + +# No more zif, smart or yum in Fedora +Obsoletes: PackageKit-smart < %{version}-%{release} +Obsoletes: PackageKit-yum < 0.9.1 +Obsoletes: PackageKit-yum-plugin < 0.9.1 +Obsoletes: PackageKit-zif < 0.8.13-2 + +# components now built-in +Obsoletes: PackageKit-debug-install < 0.9.1 +Obsoletes: PackageKit-hawkey < 0.9.1 +Obsoletes: PackageKit-backend-devel < 0.9.6 + +# Udev no longer provides this functionality +Obsoletes: PackageKit-device-rebind < 0.8.13-2 + +%description +PackageKit is a D-Bus abstraction layer that allows the session user +to manage packages in a secure way using a cross-distro, +cross-architecture API. + +%package glib +Summary: GLib libraries for accessing PackageKit +Requires: dbus >= 1.1.1 +Requires: gobject-introspection +Obsoletes: PackageKit-libs < %{version}-%{release} +Provides: PackageKit-libs = %{version}-%{release} + +%description glib +GLib libraries for accessing PackageKit. + +%package cron +Summary: Cron job and related utilities for PackageKit +Requires: crontabs +Requires: %{name} = %{version}-%{release} + +%description cron +Crontab and utilities for running PackageKit as a cron job. + +%package glib-devel +Summary: GLib Libraries and headers for PackageKit +Requires: %{name}-glib = %{version}-%{release} +Requires: dbus-devel >= 1.1.1 +Requires: sqlite-devel +Obsoletes: PackageKit-devel < %{version}-%{release} +Provides: PackageKit-devel = %{version}-%{release} +Obsoletes: PackageKit-docs < %{version}-%{release} +Provides: PackageKit-docs = %{version}-%{release} + +%description glib-devel +GLib headers and libraries for PackageKit. + +%package gstreamer-plugin +Summary: Install GStreamer codecs using PackageKit +Requires: %{name}-glib = %{version}-%{release} +Obsoletes: codeina < 0.10.1-10 +Provides: codeina = 0.10.1-10 + +%description gstreamer-plugin +The PackageKit GStreamer plugin allows any Gstreamer application to install +codecs from configured repositories using PackageKit. + +%package gtk3-module +Summary: Install fonts automatically using PackageKit +Requires: pango +Requires: %{name}-glib = %{version}-%{release} + +%description gtk3-module +The PackageKit GTK3+ module allows any Pango application to install +fonts from configured repositories using PackageKit. + +%package command-not-found +Summary: Ask the user to install command line programs automatically +Requires: bash +Requires: %{name} = %{version}-%{release} +Requires: %{name}-glib = %{version}-%{release} + +%description command-not-found +A simple helper that offers to install new packages on the command line +using PackageKit. + +%package doc +Summary: Documentation files for %{name} +Requires: %{name} = %{version}-%{release} +BuildArch: noarch + +%description doc +The %{name}-doc package contains documentation files for %{name}. + +%prep +%autosetup -p1 + +%build +%meson \ + -Dgtk_doc=true \ + -Dpython_backend=false \ + -Dpackaging_backend=dnf \ + -Dlocal_checkout=false +%meson_build + +%install +%meson_install + +# Create cache dir +mkdir -p %{buildroot}%{_localstatedir}/cache/PackageKit + +# Create directories for downloaded appstream data +mkdir -p %{buildroot}%{_localstatedir}/cache/app-info/{icons,xmls} + +# create a link that GStreamer will recognise +pushd %{buildroot}%{_libexecdir} > /dev/null +ln -s pk-gstreamer-install gst-install-plugins-helper +popd > /dev/null + +# enable packagekit-offline-updates.service here for now, till we +# decide how to do it upstream after the meson conversion: +# https://github.com/hughsie/PackageKit/issues/401 +mkdir -p %{buildroot}%{_unitdir}/system-update.target.wants/ +ln -sf ../packagekit-offline-update.service %{buildroot}%{_unitdir}/system-update.target.wants/packagekit-offline-update.service +%generate_compatibility_deps + +%find_lang %name + +%post +# Remove leftover symlinks from /etc/systemd; the offline update service is +# instead now hooked into /usr/lib/systemd/system/system-update.target.wants +systemctl disable packagekit-offline-update.service > /dev/null 2>&1 || : + +%files -f %{name}.lang +%license COPYING +%dir %{_datadir}/PackageKit +%dir %{_sysconfdir}/PackageKit +%dir %{_localstatedir}/lib/PackageKit +%dir %{_localstatedir}/cache/app-info +%dir %{_localstatedir}/cache/app-info/icons +%dir %{_localstatedir}/cache/app-info/xmls +%dir %{_localstatedir}/cache/PackageKit +%{_datadir}/bash-completion/completions/pkcon +%dir %{_libdir}/packagekit-backend +%config(noreplace) %{_sysconfdir}/PackageKit/PackageKit.conf +%config(noreplace) %{_sysconfdir}/PackageKit/Vendor.conf +%config %{_sysconfdir}/dbus-1/system.d/* +%{_datadir}/man/man1/pkcon.1* +%{_datadir}/man/man1/pkmon.1* +%{_datadir}/polkit-1/actions/*.policy +%{_datadir}/polkit-1/rules.d/* +%{_datadir}/PackageKit/pk-upgrade-distro.sh +%{_datadir}/PackageKit/helpers/test_spawn/search-name.sh +%{_libexecdir}/packagekitd +%{_libexecdir}/packagekit-direct +%{_bindir}/pkmon +%{_bindir}/pkcon +%exclude %{_libdir}/libpackagekit*.so.* +%{_libdir}/packagekit-backend/libpk_backend_dummy.so +%{_libdir}/packagekit-backend/libpk_backend_test_*.so +%ghost %verify(not md5 size mtime) %attr(0644,-,-) %{_localstatedir}/lib/PackageKit/transactions.db +%{_datadir}/dbus-1/system-services/*.service +%{_datadir}/dbus-1/interfaces/*.xml +%{_unitdir}/packagekit-offline-update.service +%{_unitdir}/packagekit.service +%{_unitdir}/system-update.target.wants/ +%{_libexecdir}/pk-*offline-update +%{_libdir}/packagekit-backend/libpk_backend_dnf.so +%pycached %{python3_sitelib}/dnf-plugins/notify_packagekit.py +%dir %{abidir} +%{abidir}/pkcon-option.list +%{abidir}/pkmon-option.list +%{abidir}/libpk_backend_dummy.dump +%{abidir}/libpk_backend_test_fail.dump +%{abidir}/libpk_backend_test_nop.dump +%{abidir}/libpk_backend_test_spawn.dump +%{abidir}/libpk_backend_test_succeed.dump +%{abidir}/libpk_backend_test_thread.dump +%{abidir}/libpk_backend_dnf.dump + +%files glib +%{_libdir}/*packagekit-glib2.so.* +%{_libdir}/girepository-1.0/PackageKitGlib-1.0.typelib +%{abidir}/libpackagekit-glib2.dump + +%files cron +%config %{_sysconfdir}/cron.daily/packagekit-background.cron +%config(noreplace) %{_sysconfdir}/sysconfig/packagekit-background + +%files gstreamer-plugin +%{_libexecdir}/pk-gstreamer-install +%{_libexecdir}/gst-install-plugins-helper + +%files gtk3-module +%{_libdir}/gtk-3.0/modules/*.so +%{_libdir}/gnome-settings-daemon-3.0/gtk-modules/*.desktop +%{abidir}/libpk-gtk-module.dump + +%files command-not-found +%{_sysconfdir}/profile.d/* +%{_libexecdir}/pk-command-not-found +%config(noreplace) %{_sysconfdir}/PackageKit/CommandNotFound.conf + +%files glib-devel +%{_libdir}/libpackagekit-glib2.so +%{_libdir}/pkgconfig/packagekit-glib2.pc +%dir %{_includedir}/PackageKit +%dir %{_includedir}/PackageKit/packagekit-glib2 +%{_includedir}/PackageKit/packagekit-glib*/*.h +%{_datadir}/gir-1.0/PackageKitGlib-1.0.gir +%{_datadir}/gtk-doc/html/PackageKit +%{_datadir}/vala/vapi/packagekit-glib2.vapi +%{_datadir}/vala/vapi/packagekit-glib2.deps + +%files doc +%doc README AUTHORS NEWS + +%changelog +* Mon Mar 20 2023 happy_orange - 1.2.6-1 +- package init from upstream diff --git a/package-remove-password-prompt.patch b/package-remove-password-prompt.patch new file mode 100644 index 0000000000000000000000000000000000000000..3cda368bf34018a90efa22b6de17075e08a5a6bd --- /dev/null +++ b/package-remove-password-prompt.patch @@ -0,0 +1,32 @@ +From 8914e11968a934faa651311fd98a98a3a19218ae Mon Sep 17 00:00:00 2001 +From: Michael Catanzaro +Date: Wed, 3 Jun 2020 10:45:12 -0500 +Subject: [PATCH] Allow admin users to remove packages without password prompt + +A local, active admin user can install packages without a password +prompt, but has to enter the admin password to remove packages. This +doesn't make much sense. It should be parallel. + +Note that this change has no effect on what users are able to do, +because it only applies to admin users. The password only protects +against unlocked workstation attackers, where an attacker gains physical +access to an unlocked desktop. It's pretty weird to prevent such an +attacker from removing software, but allow installing new stuff. + +https://pagure.io/fedora-workstation/issue/233 +--- + policy/org.freedesktop.packagekit.rules | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/policy/org.freedesktop.packagekit.rules b/policy/org.freedesktop.packagekit.rules +index 6a1c8a701..95d21925f 100644 +--- a/policy/org.freedesktop.packagekit.rules ++++ b/policy/org.freedesktop.packagekit.rules +@@ -1,5 +1,6 @@ + polkit.addRule(function(action, subject) { +- if (action.id == "org.freedesktop.packagekit.package-install" && ++ if ((action.id == "org.freedesktop.packagekit.package-install" || ++ action.id == "org.freedesktop.packagekit.package-remove") && + subject.active == true && subject.local == true && + subject.isInGroup("wheel")) { + return polkit.Result.YES; diff --git a/shutdown-on-idle.patch b/shutdown-on-idle.patch new file mode 100644 index 0000000000000000000000000000000000000000..ec18922c21dc490fa75cff1d83be7cc02df96562 --- /dev/null +++ b/shutdown-on-idle.patch @@ -0,0 +1,156 @@ +From f42096ff2427a758eda9de2e3046714167a38c95 Mon Sep 17 00:00:00 2001 +From: Russell Haley +Date: Mon, 12 Sep 2022 12:36:10 -0500 +Subject: [PATCH] Revert "Revert "Shutdown the daemon on idle by default"" + +This reverts commit dca1f5b2508a4632d0b9fefab771a5a9caf83a5c. + +Which reverted commit 0c84d71509e851db20445c747529bd7d3724f081, +which reverted commit c6eb3555ec5b41e988c111d276764d55fb83bda3. + +Fixes #460. + +The memory usage of packagekitd has been observed growing well beyond +half a GiB. See: + +https://bugzilla.redhat.com/show_bug.cgi?id=1354074 +https://bugzilla.redhat.com/show_bug.cgi?id=1854875 +https://bugzilla.redhat.com/show_bug.cgi?id=1896964 + +As I understand it, this timeout causes some slightly surprising +behavior when users mix command line dnf upgades with GUI PackageKit +upgrades, and do not manually run an update check before rebooting for +update. But that is an edge case, and the price of not having it is too +high. +--- + src/pk-main.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/pk-main.c b/src/pk-main.c +index d372a7456..1de9a1390 100644 +--- a/src/pk-main.c ++++ b/src/pk-main.c +@@ -183,6 +183,11 @@ main (int argc, char *argv[]) + + /* after how long do we timeout? */ + exit_idle_time = g_key_file_get_integer (conf, "Daemon", "ShutdownTimeout", NULL); ++ /* THIS COMMENT IS A TSUNAMI STONE ++ * Before removing the default timeout, please study the git history and ++ * be sure that you are not regressing Redhat bugzilla #1354074 (again). */ ++ if (exit_idle_time == 0) ++ exit_idle_time = 300; + g_debug ("daemon shutdown set to %i seconds", exit_idle_time); + + /* override the backend name */ + +From ba378b8510133bbad081aebd15cfe2ae74fe1e8a Mon Sep 17 00:00:00 2001 +From: Gordon Messmer +Date: Sun, 15 Jan 2023 15:17:45 -0800 +Subject: [PATCH] valgrind warns that a conditional depends on an uninitialized + value. + +--- + src/pk-main.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/pk-main.c b/src/pk-main.c +index d372a7456..43727d206 100644 +--- a/src/pk-main.c ++++ b/src/pk-main.c +@@ -241,6 +241,8 @@ main (int argc, char *argv[]) + helper.loop = loop; + helper.timer_id = g_timeout_add_seconds (5, (GSourceFunc) pk_main_timeout_check_cb, &helper); + g_source_set_name_by_id (helper.timer_id, "[PkMain] main poll"); ++ } else { ++ helper.timer_id = 0; + } + + /* immediatly exit */ + +From 8c22a0e2f3caf7df8728eec0dbf04d9c3c69f32e Mon Sep 17 00:00:00 2001 +From: Gordon Messmer +Date: Tue, 17 Jan 2023 08:45:16 -0800 +Subject: [PATCH] Notify PackageKit when dnf installs or removes packages. + +--- + backends/dnf/meson.build | 13 +++++++++ + backends/dnf/notify_packagekit.py | 45 +++++++++++++++++++++++++++++++ + contrib/PackageKit.spec.in | 2 ++ + 3 files changed, 60 insertions(+) + create mode 100644 backends/dnf/notify_packagekit.py + +diff --git a/backends/dnf/meson.build b/backends/dnf/meson.build +index ac75a1b6c..09718baf1 100644 +--- a/backends/dnf/meson.build ++++ b/backends/dnf/meson.build +@@ -7,6 +7,19 @@ if meson.get_compiler('c').has_function('hy_query_get_advisory_pkgs', prefix: '# + c_args += ['-DHAVE_HY_QUERY_GET_ADVISORY_PKGS'] + endif + ++python = import('python') ++python_exec = python.find_installation() ++python_package_dir = get_option('pythonpackagedir') ++if python_package_dir == '' ++ python_package_dir = python_exec.get_install_dir() ++endif ++python_package_dir = join_paths(python_package_dir, 'dnf-plugins') ++ ++install_data( ++ 'notify_packagekit.py', ++ install_dir: join_paths(python_package_dir), ++) ++ + shared_module( + 'pk_backend_dnf', + 'dnf-backend-vendor-@0@.c'.format(get_option('dnf_vendor')), +diff --git a/backends/dnf/notify_packagekit.py b/backends/dnf/notify_packagekit.py +new file mode 100644 +index 000000000..3be1fadd8 +--- /dev/null ++++ b/backends/dnf/notify_packagekit.py +@@ -0,0 +1,45 @@ ++# -*- coding: utf-8 -*- ++# ++# Copyright (C) 2022 Gordon Messmer ++# ++# Licensed under the GNU Lesser General Public License Version 2.1 ++# ++# This library is free software; you can redistribute it and/or ++# modify it under the terms of the GNU Lesser General Public ++# License as published by the Free Software Foundation; either ++# version 2.1 of the License, or (at your option) any later version. ++# ++# This library 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 ++# Lesser General Public License for more details. ++# ++# You should have received a copy of the GNU Lesser General Public ++# License along with this library; if not, write to the Free Software ++# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ ++""" ++Notify packagekitd when packages are installed, updated, or removed. ++""" ++ ++import dbus ++import dnf ++from dnfpluginscore import _ ++ ++ ++class NotifyPackagekit(dnf.Plugin): ++ name = "notify-packagekit" ++ ++ def __init__(self, base, cli): ++ super(NotifyPackagekit, self).__init__(base, cli) ++ self.base = base ++ self.cli = cli ++ ++ def transaction(self): ++ try: ++ bus = dbus.SystemBus() ++ proxy = bus.get_object('org.freedesktop.PackageKit', '/org/freedesktop/PackageKit') ++ iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.PackageKit') ++ iface.StateHasChanged('posttrans') ++ except: ++ pass