Name:           PackageKit
Version:        1.2.8
Release:        3
License:        GPLv2+ and LGPLv2+
Summary:        Package management service
URL:            https://www.freedesktop.org/software/PackageKit/
Source0:        https://www.freedesktop.org/software/PackageKit/releases/%{name}-%{version}.tar.xz

Patch6000:      backport-pkcon-Use-appropriate-callbacks-for-client-task-asyn.patch
Patch6001:      Revert-PkClient-Replace-the-GSimpleAsyncResult-with-.patch

BuildRequires:  glib2-devel xmlto gtk-doc sqlite-devel polkit-devel libtool gtk2-devel gtk3-devel docbook-utils
BuildRequires:  gnome-doc-utils intltool gettext vala gstreamer1-devel gstreamer1-plugins-base-devel pango-devel
BuildRequires:  fontconfig-devel libappstream-glib-devel libdnf-devel systemd-devel gobject-introspection-devel bash-completion
BuildRequires:  meson appstream-devel

Requires:       glib2 libdnf shared-mime-info systemd gobject-introspection crontabs pango

Obsoletes:      PackageKit-udev-helper < %{version}-%{release}
Obsoletes:      udev-packagekit < %{version}-%{release}
Obsoletes:      PackageKit-gtk-module < %{version}-%{release}
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
Obsoletes:      PackageKit-cached-metadata < 1.0.10-2
Obsoletes:      PackageKit-browser-plugin < 1.0.11-3
Obsoletes:      PackageKit-debug-install < 0.9.1
Obsoletes:      PackageKit-hawkey < 0.9.1
Obsoletes:      PackageKit-backend-devel < 0.9.6
Obsoletes:      PackageKit-device-rebind < 0.8.13-2
Provides:       PackageKit-debug-install = %{version}-%{release}
Provides:       PackageKit-device-rebind = %{version}-%{release}
Provides:       PackageKit-hawkey = %{version}-%{release}
Provides:       PackageKit-yum = %{version}-%{release}
Provides:       PackageKit-yum-plugin = %{version}-%{release}
Provides:       PackageKit-zif = %{version}-%{release}
Obsoletes:      PackageKit-gstreamer-plugin
Provides:       PackageKit-gstreamer-plugin
Obsoletes:      PackageKit-glib
Provides:       PackageKit-glib
Obsoletes:      PackageKit-libs < %{version}-%{release}
Provides:       PackageKit-libs = %{version}-%{release}
Obsoletes:      PackageKit-cron
Provides:       PackageKit-cron
Obsoletes:      codeina < 0.10.1-10
Provides:       codeina = 0.10.1-10

%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        devel
Summary:        Libraries and headers for PackageKit
Requires:       %{name} = %{version}-%{release}
Requires:       dbus-devel >= 1.1.1 sqlite-devel pango
Obsoletes:      PackageKit-glib-devel < %{version}-%{release}
Provides:       PackageKit-glib-devel = %{version}-%{release}
Obsoletes:      PackageKit-docs < %{version}-%{release}
Provides:       PackageKit-docs = %{version}-%{release}
Obsoletes:      PackageKit-gtk3-module
Provides:       PackageKit-gtk3-module

%description    devel
headers and libraries for PackageKit.

%package_help

%package        command-not-found
Summary:        Ask the user to install command line programs automatically
Requires:       bash

%description    command-not-found

A simple helper that offers to install new packages on the command line
using PackageKit.

%prep
%autosetup -p1

%build
%meson \
    -Dgtk_doc=true \
    -Dpython_backend=false \
    -Dpackaging_backend=dnf \
    -Dlocal_checkout=false
%meson_build

%install
%meson_install

mkdir -p %{buildroot}%{_localstatedir}/cache/PackageKit
mkdir -p %{buildroot}%{_localstatedir}/cache/app-info/{icons,xmls}

pushd %{buildroot}%{_libexecdir} > /dev/null
ln -s pk-gstreamer-install gst-install-plugins-helper
popd > /dev/null

mkdir -p %{buildroot}%{_unitdir}/system-update.target.wants/
ln -sf ../Packagekit-offline.service %{buildroot}%{_unitdir}/system-update.target.wants/packagekit-offline-update.service

%find_lang %name

%post
systemctl disable packagekit-offline-update.service > /dev/null 2>&1 || :

%files -f %{name}.lang
%license COPYING
%doc AUTHORS README NEWS
%dir %{_datadir}/PackageKit
%dir %{_sysconfdir}/PackageKit
%dir %{_localstatedir}/lib/PackageKit
%dir %{_localstatedir}/cache/app-info/icons
%dir %{_localstatedir}/cache/app-info/xmls
%dir %{_localstatedir}/cache/PackageKit
%ghost %verify(not md5 size mtime) %{_localstatedir}/cache/PackageKit/groups.sqlite
%config(noreplace) %{_sysconfdir}/PackageKit/PackageKit.conf
%config(noreplace) %{_sysconfdir}/PackageKit/Vendor.conf
%config(noreplace) %{_sysconfdir}/sysconfig/packagekit-background
%config %{_sysconfdir}/cron.daily/packagekit-background.cron
##%config %{_sysconfdir}/dbus-1/system.d/*
%{_metainfodir}/org.freedesktop.packagekit.metainfo.xml
%{_libexecdir}/packagekitd
%{_libexecdir}/packagekit-direct
%{_libexecdir}/pk-offline-update
%{_libexecdir}/pk-gstreamer-install
%{_libexecdir}/gst-install-plugins-helper
%{_bindir}/pk*
%{_libdir}/*packagekit-glib2.so.*
%{_libdir}/packagekit-backend/libpk_backend_*.so
%{_libdir}/packagekit-backend/libpk_backend_test_*.so
%{_libdir}/girepository-1.0/PackageKitGlib-1.0.typelib
%{_datadir}/locale/*
%{_datadir}/PackageKit/helpers/test_spawn/*
%{_datadir}/polkit-1/*/*
%{_datadir}/PackageKit/pk-upgrade-distro.sh
%{_datadir}/bash-completion/completions/pkcon
%ghost %verify(not md5 size mtime) %{_localstatedir}/lib/PackageKit/transactions.db
%{_datadir}/dbus-1/system-services/*.service
%{_unitdir}/packagekit-offline-update.service
%{_unitdir}/packagekit.service
%{_unitdir}/system-update.target.wants/
%{python3_sitelib}/dnf-plugins/
%{_libexecdir}/packagekit-dnf-refresh-repo
%{_datadir}/dbus-1/system.d/org.freedesktop.PackageKit.conf
%{_datadir}/vala/vapi/packagekit-glib2.deps


%files devel
%defattr(-,root,root)
%{_libdir}/*.so
##%{_libdir}/gtk-2.0/modules/*.so
%{_libdir}/gtk-3.0/modules/*.so
%{_libdir}/gnome-settings-daemon-3.0/gtk-modules/*.desktop
%{_libdir}/pkgconfig/*.pc
%{_includedir}/PackageKit/packagekit-glib*/*.h
%{_datadir}/gir-1.0/PackageKitGlib-1.0.gir
%{_datadir}/vala/vapi/packagekit-glib2.vapi

%files help
%defattr(-,root,root)
%doc NEWS README
%{_datadir}/man/man1/*.1.gz
%{_datadir}/gtk-doc/html/PackageKit
%{_datadir}/dbus-1/interfaces/*.xml

%files command-not-found
%defattr(-,root,root)
%{_libexecdir}/pk-command-not-found
%{_sysconfdir}/profile.d/*
%config(noreplace) %{_sysconfdir}/PackageKit/CommandNotFound.conf

%changelog
* Fri Aug 23 2024 lingsheng <lingsheng1@h-partners.com> - 1.2.8-3
- Type: bugfix
- ID: NA
- SUG: NA
- DESC: Revert PkClient: Replace the GSimpleAsyncResult with the GTask API

* Tue Jul 23 2024 zhouyihang <zhouyihang3@h-partners.com> - 1.2.8-2
- Type: bugfix
- ID: NA
- SUG: NA
- DESC: pkcon: Use appropriate callbacks for client / task async calls

* Tue Feb 06 2024 zhouwenpei <zhouwenpei1@h-partners.com> - 1.2.8-1
- Type: update
- ID: NA
- SUG: NA
- DESC: update to version 1.2.8

* Fri Oct 20 2023 li weigang <weigangli99@gmail.com> - 1.2.7-1
- Type: update
- ID: NA
- SUG: NA
- DESC: update to version 1.2.7

* Tue Sep 28 2021 yangcheng <yangcheng87@huawei.com> - 1.1.12-10
- Type:CVE
- ID:cve-2020-16121
- SUG:NA
- DESC:fix CVE-2020-16121

* Tue Mar 10 2020 chengguipeng <chengguipeng1@huawei.com> - 1.1.12-9
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:solove the problem that no message is displayed when running a uninstalled command.

* Tue Mar 10 2020 openEuler Buildteam <buildteam@openeuler.org> - 1.1.12-8
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:remove unnecessary link file

* Sun Dec 29 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.1.12-7
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:modify support URL

* Wed Dec 25 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.1.12-6
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:optimization the spec

* Tue Dec 24 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.1.12-5
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:move some .so to main package

* Fri Dec 20 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.1.12-4
- patch rename

* Fri Nov 22 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.1.12-3
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:Unpack command-not-found for PackageKit

* Tue Sep 24 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.1.12-2
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:Add PackageKit.so file for PackageKit

* Fri Sep 20 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.1.12-1
- Package init
