From ccdb8ac34cb0cbb41896e72641ac9ba3c4260afe Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Wed, 1 Aug 2018 13:43:08 +0200 Subject: [PATCH 1/3] Use python2/3 instead of python in Makefile/spec Fixes: https://pagure.io/koji/issue/1018 --- Makefile | 1 + cli/Makefile | 1 - cli/koji_cli/Makefile | 1 - hub/Makefile | 1 - koji.spec | 2 +- koji/Makefile | 1 - plugins/Makefile | 3 +-- www/lib/kojiweb/Makefile | 1 - 8 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 2db779b5..095fc062 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 c9112f3d..fea4906b 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 42dcdcf9..baf78d37 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 f95a1737..f5fd3d6c 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 6f6337be..89ad397d 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 c1382315..4abb93ba 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 cddab666..ff3fe1c6 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 85eb5596..84e8b033 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 42f5988dc38541fc1a7b2366969dd19ac59e32d2 Mon Sep 17 00:00:00 2001 From: Franz Chih-Ping Hsieh Date: Mon, 9 Jul 2018 06:42:06 -0400 Subject: [PATCH 2/3] use macro to support RHEL8 build Related: #986 --- koji.spec | 8 ++++---- plugins/Makefile | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/koji.spec b/koji.spec index 89ad397d..907b2d89 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 ff3fe1c6..f775bda4 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 b2230b9510e29abf5a0126ee6429047a07524731 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Tue, 21 Aug 2018 12:11:26 +0200 Subject: [PATCH 3/3] set default python --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 095fc062..3ad83543 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)"