diff --git a/.gitignore b/.gitignore index af09d13..8f4f1c6 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,4 @@ PackageKit-0.6.7.tar.bz2 /PackageKit-1.1.2.tar.xz /PackageKit-1.1.3.tar.xz /PackageKit-1.1.4-20160805.tar.xz +/libdnf-c0a107b.tar.gz diff --git a/PackageKit.spec b/PackageKit.spec index e1b5dfa..59cc8bf 100644 --- a/PackageKit.spec +++ b/PackageKit.spec @@ -1,9 +1,15 @@ %global _changelog_trimtime %(date +%s -d "1 year ago") %global gitdate 20160805 +%global bundled_libhif 1 %global glib2_version 2.46.0 -%global libhif_version 0.2.3 +%global libdnf_version 0.7.0 + +%if 0%{?bundled_libhif} +%global commit1 c0a107bc7ccc82dced93382bc55ff254944fdb21 +%global shortcommit1 %(c=%{commit1}; echo ${c:0:7}) +%endif Summary: Package management service Name: PackageKit @@ -14,6 +20,14 @@ URL: http://www.freedesktop.org/software/PackageKit/ #Source0: http://www.freedesktop.org/software/PackageKit/releases/%{name}-%{version}.tar.xz Source0: %{name}-%{version}-%{gitdate}.tar.xz +%if 0%{?bundled_libhif} +# https://github.com/rpm-software-management/libhif +# Bundled because the library is API/ABI unstable, and we're trying to +# avoid being version locked with rpm-ostree/dnf right now. +Source1: https://github.com/rpm-software-management/libhif/archive/%{commit1}/libdnf-%{shortcommit1}.tar.gz +Provides: bundled(libdnf) = 0.7.0 +%endif + # Fedora-specific: set Vendor.conf up for Fedora. Patch0: PackageKit-0.3.8-Fedora-Vendor.conf.patch @@ -35,16 +49,26 @@ BuildRequires: gstreamer1-plugins-base-devel BuildRequires: pango-devel BuildRequires: fontconfig-devel BuildRequires: libappstream-glib-devel +%if ! 0%{?bundled_libhif} +BuildRequires: libdnf-devel >= %{libdnf_version} +%endif BuildRequires: systemd-devel BuildRequires: gobject-introspection-devel -BuildRequires: libhif-devel >= %{libhif_version} %if !0%{?rhel} BuildRequires: bash-completion %endif +%if 0%{?bundled_libhif} +# Filter private libraries +%global __provides_exclude ^libdnf[.]so[.].*$ +%global __requires_exclude ^libdnf[.]so[.].*$ +%endif + Requires: %{name}-glib%{?_isa} = %{version}-%{release} Requires: glib2%{?_isa} >= %{glib2_version} -Requires: libhif%{?_isa} >= %{libhif_version} +%if ! 0%{?bundled_libhif} +Requires: libdnf%{?_isa} >= %{libdnf_version} +%endif Requires: shared-mime-info Requires: comps-extras Requires: systemd @@ -151,13 +175,31 @@ using PackageKit. %prep #setup -q %setup -q -n %{name}-%{version}-%{gitdate} + +%if 0%{?bundled_libhif} +# Extract libdnf archive +tar -xf %{S:1} +%endif + %patch0 -p1 -b .fedora %build +%if 0%{?bundled_libhif} +mkdir -p libhif-%{commit1}/build +pushd libhif-%{commit1}/build +%cmake \ + -DCMAKE_BUILD_TYPE=Release \ + .. +%make_build +popd + +export DNF_CFLAGS="-I`pwd`/libhif-%{commit1} `pkg-config --cflags appstream-glib`" +export DNF_LIBS="-L`pwd`/libhif-%{commit1}/build/libdnf -ldnf -Wl,-rpath=%{_libdir}/PackageKit `pkg-config --libs appstream-glib`" +%endif %configure \ --disable-static \ %if 0%{?rhel} == 0 - --enable-hif \ + --enable-dnf \ --enable-introspection \ --enable-bash-completion \ %else @@ -171,6 +213,14 @@ make %{?_smp_mflags} V=1 %install make install DESTDIR=$RPM_BUILD_ROOT +%if 0%{?bundled_libhif} +# Install libdnf to a temporary prefix +make install DESTDIR=`pwd`/libdnf-install -C libhif-%{commit1}/build +# Cherry pick the shared library +mkdir -p $RPM_BUILD_ROOT%{_libdir}/PackageKit +cp -a libdnf-install%{_libdir}/libdnf*.so.* $RPM_BUILD_ROOT%{_libdir}/PackageKit +%endif + rm -f $RPM_BUILD_ROOT%{_libdir}/libpackagekit*.la rm -f $RPM_BUILD_ROOT%{_libdir}/packagekit-backend/*.la rm -f $RPM_BUILD_ROOT%{_libdir}/mozilla/plugins/packagekit-plugin.la @@ -235,6 +285,9 @@ systemctl disable packagekit-offline-update.service > /dev/null 2>&1 || : %exclude %{_libdir}/libpackagekit*.so.* %{_libdir}/packagekit-backend/libpk_backend_dummy.so %{_libdir}/packagekit-backend/libpk_backend_test_*.so +%if 0%{?bundled_libhif} +%{_libdir}/PackageKit/ +%endif %ghost %verify(not md5 size mtime) %{_localstatedir}/lib/PackageKit/transactions.db %{_datadir}/dbus-1/system-services/*.service %{_datadir}/dbus-1/interfaces/*.xml @@ -243,7 +296,7 @@ systemctl disable packagekit-offline-update.service > /dev/null 2>&1 || : %{_unitdir}/system-update.target.wants/ %{_libexecdir}/pk-*offline-update %if 0%{?rhel} == 0 -%{_libdir}/packagekit-backend/libpk_backend_hif.so +%{_libdir}/packagekit-backend/libpk_backend_dnf.so %endif %files glib @@ -281,6 +334,7 @@ systemctl disable packagekit-offline-update.service > /dev/null 2>&1 || : %changelog * Fri Aug 05 2016 Kalev Lember - 1.1.4-0.1.20160805 - Update to today's git snapshot +- Switch to new libdnf based backend * Wed Jul 27 2016 Kalev Lember - 1.1.3-2 - engine: Don't crash when emitting PropertiesChanged for NULL values diff --git a/sources b/sources index a29040a..c3668bd 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ 3dc899370870b6b90711aee60ae8a0a1 PackageKit-1.1.4-20160805.tar.xz +3231c394ea6e577e9c04f0ddabcf3908 libdnf-c0a107b.tar.gz