From e6e214f7081314b1e4d6ef7fc77a06ee301dca2c Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Aug 23 2018 07:27:36 +0000 Subject: [PATCH 1/3] Use python2/3 instead of python in Makefile/spec Fixes: https://pagure.io/koji/issue/1018 --- diff --git a/Makefile b/Makefile index 2db779b..095fc06 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ NAME=koji SPECFILE = $(firstword $(wildcard *.spec)) SUBDIRS = hub builder koji cli util www plugins vm +PYTHON=python2 ifdef DIST DIST_DEFINES := --define "dist $(DIST)" diff --git a/cli/Makefile b/cli/Makefile index c9112f3..fea4906 100644 --- a/cli/Makefile +++ b/cli/Makefile @@ -1,6 +1,5 @@ SUBDIRS=koji_cli -PYTHON=python PACKAGE = $(shell basename `pwd`) PYVER := $(shell $(PYTHON) -c 'import sys; print("%.3s" %(sys.version))') PYSYSDIR := $(shell $(PYTHON) -c 'import sys; print(sys.prefix)') diff --git a/cli/koji_cli/Makefile b/cli/koji_cli/Makefile index 42dcdcf..baf78d3 100644 --- a/cli/koji_cli/Makefile +++ b/cli/koji_cli/Makefile @@ -1,6 +1,5 @@ PYFILES = $(wildcard *.py) -PYTHON=python PACKAGE = $(shell basename `pwd`) PYVER := $(shell $(PYTHON) -c 'import sys; print("%.3s" % (sys.version))') PYSYSDIR := $(shell $(PYTHON) -c 'import sys; print(sys.prefix)') diff --git a/hub/Makefile b/hub/Makefile index f95a173..f5fd3d6 100644 --- a/hub/Makefile +++ b/hub/Makefile @@ -1,4 +1,3 @@ -PYTHON=python PACKAGE = $(shell basename `pwd`) PYFILES = $(wildcard *.py) PYVER := $(shell $(PYTHON) -c 'import sys; print("%.3s" %(sys.version))') diff --git a/koji.spec b/koji.spec index 6f6337b..89ad397 100644 --- a/koji.spec +++ b/koji.spec @@ -268,7 +268,7 @@ koji-web is a web UI to the Koji system. %install rm -rf $RPM_BUILD_ROOT -make DESTDIR=$RPM_BUILD_ROOT %{?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 diff --git a/koji/Makefile b/koji/Makefile index c138231..4abb93b 100644 --- a/koji/Makefile +++ b/koji/Makefile @@ -1,4 +1,3 @@ -PYTHON=python PACKAGE = $(shell basename `pwd`) ifeq ($(PYTHON), python3) # for python3 we fully support only basic library + CLI diff --git a/plugins/Makefile b/plugins/Makefile index cddab66..ff3fe1c 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -1,4 +1,3 @@ -PYTHON=python PYVER := $(shell $(PYTHON) -c 'import sys; print("%.3s" %(sys.version))') PYSYSDIR := $(shell $(PYTHON) -c 'import sys; print(sys.prefix)') PYLIBDIR = $(PYSYSDIR)/lib/python$(PYVER) @@ -29,7 +28,7 @@ install: echo "ERROR: A destdir is required"; \ exit 1; \ fi - if [ "$(PYTHON)" == "python" ] ; then \ + if [ "$(PYTHON)" == "python2" ] ; then \ mkdir -p $(DESTDIR)/$(HUBPLUGINDIR); \ mkdir -p $(DESTDIR)/$(BUILDERPLUGINDIR); \ install -p -m 644 $(HUBFILES) $(DESTDIR)/$(HUBPLUGINDIR); \ diff --git a/www/lib/kojiweb/Makefile b/www/lib/kojiweb/Makefile index 85eb559..84e8b03 100644 --- a/www/lib/kojiweb/Makefile +++ b/www/lib/kojiweb/Makefile @@ -1,4 +1,3 @@ -PYTHON=python PACKAGE = $(shell basename `pwd`) PYFILES = $(wildcard *.py) PYVER := $(shell $(PYTHON) -c 'import sys; print("%.3s" % (sys.version))') From 2d1b13a9c8a38449a9e94e8e37fee796135a74b5 Mon Sep 17 00:00:00 2001 From: Franz Chih-Ping Hsieh Date: Aug 23 2018 07:27:36 +0000 Subject: [PATCH 2/3] use macro to support RHEL8 build Related: #986 --- diff --git a/koji.spec b/koji.spec index 89ad397..907b2d8 100644 --- a/koji.spec +++ b/koji.spec @@ -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 diff --git a/plugins/Makefile b/plugins/Makefile index ff3fe1c..f775bda 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -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); \ From 06efafa8310d51e5094e6bce497bb01ade75a553 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Aug 23 2018 07:27:36 +0000 Subject: [PATCH 3/3] set default python --- diff --git a/Makefile b/Makefile index 095fc06..3ad8354 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,10 @@ NAME=koji SPECFILE = $(firstword $(wildcard *.spec)) SUBDIRS = hub builder koji cli util www plugins vm -PYTHON=python2 + +ifndef PYTHON +export PYTHON=python2 +endif ifdef DIST DIST_DEFINES := --define "dist $(DIST)"