From c16fb05d2d0e58d829c0b597a9da75c3b3b05937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Thu, 29 Oct 2020 22:54:57 +0100 Subject: [PATCH] dnf-plugin: restrict to only version provided by plateform-python Fix multiple indentations --- package-managers/Makefile | 12 +++++++++++- rpm_spec/core-agent.spec.in | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/package-managers/Makefile b/package-managers/Makefile index 6aa42e0..e282082 100644 --- a/package-managers/Makefile +++ b/package-managers/Makefile @@ -2,7 +2,10 @@ LIBDIR ?= /usr/lib STATEDIR ?= /var/lib SYSCONFDIR ?= /etc PYTHON2_SITELIB = $(shell python2 -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib()') -PYTHON3_SITELIB = $(shell python3 -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())') +PYTHON3_SITELIB = $(shell $(PYTHON) -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())') +ifeq ($(shell rpm --eval %{centos_ver} 2>/dev/null),8) +PLATEFORM_PYTHON3_SITELIB = $(shell /usr/libexec/platform-python -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())') +endif APTCONFDIR = $(SYSCONFDIR)/apt YUMCONFDIR = $(SYSCONFDIR)/yum.conf.d QUBESLIBDIR = $(LIBDIR)/qubes @@ -36,8 +39,15 @@ install-apt: install-dnf: install-rpm install -D -m 0644 dnf-qubes-hooks.py \ $(DESTDIR)$(PYTHON2_SITELIB)/dnf-plugins/qubes-hooks.py +ifeq ($(shell rpm --eval %{centos_ver} 2>/dev/null),8) +# we need to stick to related DNF python version +# which is given by platform-python + install -D -m 0644 dnf-qubes-hooks.py \ + $(DESTDIR)$(PLATEFORM_PYTHON3_SITELIB)/dnf-plugins/qubes-hooks.py +else install -D -m 0644 dnf-qubes-hooks.py \ $(DESTDIR)$(PYTHON3_SITELIB)/dnf-plugins/qubes-hooks.py +endif install -D -m 0644 dnf-qubes-hooks.conf $(DESTDIR)$(SYSCONFDIR)/dnf/plugins/qubes-hooks.conf install-yum: install-rpm diff --git a/rpm_spec/core-agent.spec.in b/rpm_spec/core-agent.spec.in index 6b0b90c..81d05be 100644 --- a/rpm_spec/core-agent.spec.in +++ b/rpm_spec/core-agent.spec.in @@ -30,6 +30,10 @@ %define with_sysvinit 1 %endif +%if 0%{?rhel} == 8 +%define plateform_python3_sitelib %(/usr/libexec/platform-python -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())') +%endif + %define scriptletfuns is_static() { \ [ -f "%{_unitdir}/$1" ] && ! grep -q '^[[].nstall]' "%{_unitdir}/$1" \ } \ @@ -144,8 +148,14 @@ Requires: dconf Requires: qubes-core-qrexec-vm Requires: qubes-libvchan Requires: qubes-db-vm +%if 0%{?rhel} == 8 +# we need to stick to related DNF python version +# which is python3.6 by default +Requires: python3-dnf-plugins-qubes-hooks +%else Requires: python%{python3_pkgversion}-dnf-plugins-qubes-hooks -Requires: python%{python3_pkgversion}-setuptools +%endif +Requires: python%{python3_pkgversion}-setuptools # for qubes.ResizeDisk Requires: parted Obsoletes: qubes-core-vm-kernel-placeholder <= 1.0 @@ -170,7 +180,7 @@ Source0: %{name}-%{version}.tar.gz The Qubes core files for installation inside a Qubes VM. %package -n python2-dnf-plugins-qubes-hooks -Summary: DNF plugin for Qubes specific post-installation actions +Summary: DNF plugin for Qubes specific post-installation actions BuildRequires: python2-devel %{?python_provide:%python_provide python2-dnf-plugins-qubes-hooks} @@ -179,8 +189,18 @@ DNF plugin for Qubes specific post-installation actions: * notify dom0 that updates were installed * refresh applications shortcut list +%if 0%{?rhel} == 8 +%package -n python3-dnf-plugins-qubes-hooks +Summary: DNF plugin for Qubes specific post-installation actions +BuildRequires: python3-devel + +%description -n python3-dnf-plugins-qubes-hooks +DNF plugin for Qubes specific post-installation actions: + * notify dom0 that updates were installed + * refresh applications shortcut list +%else %package -n python%{python3_pkgversion}-dnf-plugins-qubes-hooks -Summary: DNF plugin for Qubes specific post-installation actions +Summary: DNF plugin for Qubes specific post-installation actions BuildRequires: python%{python3_pkgversion}-devel %{?python_provide:%python_provide python%{python3_pkgversion}-dnf-plugins-qubes-hooks} @@ -188,6 +208,7 @@ BuildRequires: python%{python3_pkgversion}-devel DNF plugin for Qubes specific post-installation actions: * notify dom0 that updates were installed * refresh applications shortcut list +%endif %package nautilus Summary: Qubes integration for Nautilus @@ -300,7 +321,7 @@ usermod -L root %install -make install-vm DESTDIR=$RPM_BUILD_ROOT +make install-vm PYTHON=%{__python3} DESTDIR=$RPM_BUILD_ROOT make -C app-menu DESTDIR=$RPM_BUILD_ROOT install make -C boot/redhat DESTDIR=$RPM_BUILD_ROOT install make -C config-overrides DESTDIR=$RPM_BUILD_ROOT install @@ -313,7 +334,7 @@ make -C qubes-rpc/kde DESTDIR=$RPM_BUILD_ROOT install make -C qubes-rpc/nautilus DESTDIR=$RPM_BUILD_ROOT install make -C qubes-rpc/thunar DESTDIR=$RPM_BUILD_ROOT install -make -C package-managers DESTDIR=$RPM_BUILD_ROOT install install-dnf +make -C package-managers PYTHON=%{__python3} DESTDIR=$RPM_BUILD_ROOT install install-dnf %if 0%{?rhel} == 7 make -C package-managers DESTDIR=$RPM_BUILD_ROOT install-yum %endif @@ -735,8 +756,13 @@ rm -f %{name}-%{version} %files -n python2-dnf-plugins-qubes-hooks %{python2_sitelib}/dnf-plugins/* +%if 0%{?rhel} == 8 +%files -n python3-dnf-plugins-qubes-hooks +%{plateform_python3_sitelib}/dnf-plugins/* +%else %files -n python%{python3_pkgversion}-dnf-plugins-qubes-hooks %{python3_sitelib}/dnf-plugins/* +%endif %files nautilus /usr/lib/qubes/qvm-copy-to-vm.gnome