use macro to support RHEL8 build

Related: #986
This commit is contained in:
Franz Chih-Ping Hsieh 2018-07-09 06:42:06 -04:00 committed by Mike McLean
parent ccdb8ac34c
commit 42f5988dc3
2 changed files with 6 additions and 5 deletions

View file

@ -268,14 +268,14 @@ koji-web is a web UI to the Koji system.
%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT PYTHON=python2 %{?install_opt} install
make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python2} %{?install_opt} install
%if 0%{with python3}
cd koji
make DESTDIR=$RPM_BUILD_ROOT PYTHON=python3 %{?install_opt} install
make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} %{?install_opt} install
cd ../cli
make DESTDIR=$RPM_BUILD_ROOT PYTHON=python3 %{?install_opt} install
make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} %{?install_opt} install
cd ../plugins
make DESTDIR=$RPM_BUILD_ROOT PYTHON=python3 %{?install_opt} install
make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} %{?install_opt} install
# alter python interpreter in koji CLI
sed -i 's/\#\!\/usr\/bin\/python2/\#\!\/usr\/bin\/python3/' $RPM_BUILD_ROOT/usr/bin/koji
%endif

View file

@ -1,3 +1,4 @@
PYMAJORVER := $(shell $(PYTHON) -c 'import sys; print(sys.version_info[0])')
PYVER := $(shell $(PYTHON) -c 'import sys; print("%.3s" %(sys.version))')
PYSYSDIR := $(shell $(PYTHON) -c 'import sys; print(sys.prefix)')
PYLIBDIR = $(PYSYSDIR)/lib/python$(PYVER)
@ -28,7 +29,7 @@ install:
echo "ERROR: A destdir is required"; \
exit 1; \
fi
if [ "$(PYTHON)" == "python2" ] ; then \
if [ "$(PYMAJORVER)" == "2" ] ; then \
mkdir -p $(DESTDIR)/$(HUBPLUGINDIR); \
mkdir -p $(DESTDIR)/$(BUILDERPLUGINDIR); \
install -p -m 644 $(HUBFILES) $(DESTDIR)/$(HUBPLUGINDIR); \