Clean up and simplify spec

- Fix packaging to work properly with EL8+
This commit is contained in:
Neal Gompa 2020-05-05 08:13:39 -04:00
parent 5b3d5f76be
commit ef140e7a70

View File

@ -1,32 +1,16 @@
%global _changelog_trimtime %(date +%s -d "1 year ago")
%global gitdate 20161221
%global bundled_libdnf 0
%global glib2_version 2.54.0
%global libdnf_version 0.22.0
%if 0%{?bundled_libdnf}
%global commit1 fe5a08bca7e2599798af7778917da2cc31f1460e
%global shortcommit1 %(c=%{commit1}; echo ${c:0:7})
%endif
%global libdnf_version 0.43.1
Summary: Package management service
Name: PackageKit
Version: 1.2.0
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+ and LGPLv2+
URL: http://www.freedesktop.org/software/PackageKit/
Source0: http://www.freedesktop.org/software/PackageKit/releases/%{name}-%{version}.tar.xz
%if 0%{?bundled_libdnf}
# https://github.com/rpm-software-management/libdnf
# 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/libdnf/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,7 +19,6 @@ BuildRequires: xmlto
BuildRequires: gtk-doc
BuildRequires: sqlite-devel
BuildRequires: polkit-devel >= 0.92
BuildRequires: libtool
BuildRequires: gtk3-devel
BuildRequires: docbook-utils
BuildRequires: gnome-doc-utils
@ -48,35 +31,14 @@ BuildRequires: gstreamer1-plugins-base-devel
BuildRequires: pango-devel
BuildRequires: fontconfig-devel
BuildRequires: libappstream-glib-devel
%if 0%{?bundled_libdnf}
BuildRequires: check-devel
BuildRequires: cmake
BuildRequires: librepo-devel
BuildRequires: libsolv-devel
BuildRequires: python2-devel
BuildRequires: python2-nose
BuildRequires: python2-sphinx
BuildRequires: rpm-devel
%else
BuildRequires: libdnf-devel >= %{libdnf_version}
%endif
BuildRequires: systemd-devel
BuildRequires: gobject-introspection-devel
%if !0%{?rhel}
BuildRequires: bash-completion
%endif
%if 0%{?bundled_libdnf}
# 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}
%if ! 0%{?bundled_libdnf}
Requires: libdnf%{?_isa} >= %{libdnf_version}
%endif
Requires: shared-mime-info
Requires: systemd
@ -183,59 +145,22 @@ using PackageKit.
%prep
%autosetup -p1
%if 0%{?bundled_libdnf}
# Extract libdnf archive
tar -xf %{S:1}
%endif
%build
%if 0%{?bundled_libdnf}
mkdir -p libdnf-%{commit1}/build
pushd libdnf-%{commit1}/build
%cmake \
-DCMAKE_BUILD_TYPE=Release \
..
%make_build
popd
export DNF_CFLAGS="-I`pwd`/libdnf-%{commit1} `pkg-config --cflags appstream-glib`"
export DNF_LIBS="-L`pwd`/libdnf-%{commit1}/build/libdnf -ldnf -Wl,-rpath=%{_libdir}/PackageKit `pkg-config --libs appstream-glib`"
%endif
%meson \
-Dgtk_doc=true \
-Dpython_backend=false \
%if 0%{?rhel} == 0
-Dpackaging_backend=dnf \
-Dbash_completion=true \
%else
-Dbash_completion=false \
%endif
-Dlocal_checkout=false
%meson_build
%install
%meson_install
%if 0%{?bundled_libdnf}
# Install libdnf to a temporary prefix
make install DESTDIR=`pwd`/libdnf-install -C libdnf-%{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
rm -f $RPM_BUILD_ROOT%{_libdir}/gtk-2.0/modules/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/gtk-3.0/modules/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/polkit-1/extensions/libpackagekit-action-lookup.la
# Create directories for downloaded appstream data
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/cache/app-info/{icons,xmls}
mkdir -p %{buildroot}%{_localstatedir}/cache/app-info/{icons,xmls}
# create a link that GStreamer will recognise
pushd ${RPM_BUILD_ROOT}%{_libexecdir} > /dev/null
pushd %{buildroot}%{_libexecdir} > /dev/null
ln -s pk-gstreamer-install gst-install-plugins-helper
popd > /dev/null
@ -255,9 +180,7 @@ systemctl disable packagekit-offline-update.service > /dev/null 2>&1 || :
%dir %{_localstatedir}/cache/app-info
%dir %{_localstatedir}/cache/app-info/icons
%dir %{_localstatedir}/cache/app-info/xmls
%if !0%{?rhel}
%{_datadir}/bash-completion/completions/pkcon
%endif
%dir %{_libdir}/packagekit-backend
%config(noreplace) %{_sysconfdir}/PackageKit/PackageKit.conf
%config(noreplace) %{_sysconfdir}/PackageKit/Vendor.conf
@ -274,9 +197,6 @@ 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_libdnf}
%{_libdir}/PackageKit/
%endif
%ghost %verify(not md5 size mtime) %attr(0644,-,-) %{_localstatedir}/lib/PackageKit/transactions.db
%{_datadir}/dbus-1/system-services/*.service
%{_datadir}/dbus-1/interfaces/*.xml
@ -284,9 +204,7 @@ systemctl disable packagekit-offline-update.service > /dev/null 2>&1 || :
%{_unitdir}/packagekit.service
#%{_unitdir}/system-update.target.wants/
%{_libexecdir}/pk-*offline-update
%if 0%{?rhel} == 0
%{_libdir}/packagekit-backend/libpk_backend_dnf.so
%endif
%files glib
%{_libdir}/*packagekit-glib2.so.*
@ -321,6 +239,10 @@ systemctl disable packagekit-offline-update.service > /dev/null 2>&1 || :
%{_datadir}/vala/vapi/packagekit-glib2.deps
%changelog
* Tue May 05 2020 Neal Gompa <ngompa13@gmail.com> - 1.2.0-2
- Clean up and simplify spec
- Fix packaging to work properly with EL8+
* Mon May 04 2020 Richard Hughes <rhughes@redhat.com> - 1.2.0-1
- New upstream release
- Do not do failable actions in constructors