From 98880666bb3499ab2d07c3e259a527c8bd13e0b6 Mon Sep 17 00:00:00 2001 From: blag Date: Wed, 2 Dec 2020 00:45:56 -0800 Subject: [PATCH 1/6] Build ST2 on Ubuntu 16 with Python 3 --- .circleci/config.yml | 2 +- packages/st2/Makefile | 7 ++++--- packages/st2/debian/control | 2 +- packages/st2/debian/rules | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a321671f..22f1b667 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,7 +14,7 @@ jobs: resource_class: large docker: # The primary container is an instance of the first list image listed. Your build commands run in this container. - - image: circleci/python:2.7 + - image: circleci/python:3.6 working_directory: ~/st2-packages environment: DISTROS: "xenial bionic el7 el8" diff --git a/packages/st2/Makefile b/packages/st2/Makefile index 7e3d2f2c..b37fb035 100644 --- a/packages/st2/Makefile +++ b/packages/st2/Makefile @@ -32,12 +32,12 @@ else ifeq ($(EL_VERSION),7) PIP_BINARY := /usr/local/bin/pip3 PYTHON_ALT_BINARY := python3 else - PYTHON_BINARY := python + PYTHON_BINARY := /usr/bin/python3 PIP_BINARY := pip - PYTHON_ALT_BINARY := python + PYTHON_ALT_BINARY := python3 endif - RUNNERS := $(shell ls ../contrib/runners) +RUNNERS := $(shell ls ../contrib/runners) # Moved from top of file to handle when only py2 or py3 available ST2PKG_VERSION ?= $(shell $(PYTHON_BINARY) -c "from $(ST2_COMPONENT) import __version__; print(__version__),") @@ -63,6 +63,7 @@ info: @echo "EL_VERSION=$(EL_VERSION)" @echo "DEB_DISTRO=$(DEB_DISTRO)" @echo "PYTHON_BINARY=$(PYTHON_BINARY)" + @echo "PIP_BINARY=$(PIP_BINARY)" install: wheelhouse changelog diff --git a/packages/st2/debian/control b/packages/st2/debian/control index 96b1e345..14f72e38 100644 --- a/packages/st2/debian/control +++ b/packages/st2/debian/control @@ -3,7 +3,7 @@ Section: Python Priority: optional Maintainer: StackStorm Engineering Build-Depends: debhelper (>= 9), - python, + python3 (>= 3.6), dh-virtualenv (>= 0.8), libldap2-dev, libsasl2-dev diff --git a/packages/st2/debian/rules b/packages/st2/debian/rules index e494c7ab..b916fc50 100755 --- a/packages/st2/debian/rules +++ b/packages/st2/debian/rules @@ -16,13 +16,13 @@ IS_SYSTEMD = $(shell command -v dh_systemd_enable > /dev/null 2>&1 && echo true) DEB_DISTRO := $(shell lsb_release -cs) # Xenial and Bionic depend on different libraries. -# Most important, Bionic uses Python 3 and others use Python 2.7. +# Most important, Bionic uses Python 3 distutils others use python3-setuptools ifeq ($(DEB_DISTRO),bionic) BUILD_PRE_DEPENDS := python3 (>= 3.6) BUILD_DEPENDS := python3-distutils, python3-dev else - BUILD_PRE_DEPENDS := python2.7 - BUILD_DEPENDS := libpython-dev | python-dev + BUILD_PRE_DEPENDS := python3 (>= 3.6) + BUILD_DEPENDS := python3-setuptools, python3-dev endif %: From b05728ad94fa71fe68f1be4d773b3b8ed1954f7f Mon Sep 17 00:00:00 2001 From: armab Date: Tue, 8 Dec 2020 13:31:41 +0000 Subject: [PATCH 2/6] Instructions for building Ubuntu Xenial on python3 --- packages/st2/Makefile | 6 +++++- packages/st2/debian/control | 2 +- packages/st2/debian/rules | 11 +++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/st2/Makefile b/packages/st2/Makefile index b37fb035..22617cc9 100644 --- a/packages/st2/Makefile +++ b/packages/st2/Makefile @@ -23,6 +23,10 @@ endif ifeq ($(DEB_DISTRO),bionic) PYTHON_BINARY := /usr/bin/python3 PIP_BINARY := pip +else ifeq ($(DEB_DISTRO),xenial) + PYTHON_BINARY := /usr/bin/python3.6 + PIP_BINARY := /usr/local/bin/pip3.6 + PYTHON_ALT_BINARY := python3.6 else ifeq ($(EL_VERSION),8) PYTHON_BINARY := /usr/bin/python3 PIP_BINARY := /usr/local/bin/pip3 @@ -33,7 +37,7 @@ else ifeq ($(EL_VERSION),7) PYTHON_ALT_BINARY := python3 else PYTHON_BINARY := /usr/bin/python3 - PIP_BINARY := pip + PIP_BINARY := pip3 PYTHON_ALT_BINARY := python3 endif diff --git a/packages/st2/debian/control b/packages/st2/debian/control index 14f72e38..96b1e345 100644 --- a/packages/st2/debian/control +++ b/packages/st2/debian/control @@ -3,7 +3,7 @@ Section: Python Priority: optional Maintainer: StackStorm Engineering Build-Depends: debhelper (>= 9), - python3 (>= 3.6), + python, dh-virtualenv (>= 0.8), libldap2-dev, libsasl2-dev diff --git a/packages/st2/debian/rules b/packages/st2/debian/rules index b916fc50..d954c072 100755 --- a/packages/st2/debian/rules +++ b/packages/st2/debian/rules @@ -16,21 +16,20 @@ IS_SYSTEMD = $(shell command -v dh_systemd_enable > /dev/null 2>&1 && echo true) DEB_DISTRO := $(shell lsb_release -cs) # Xenial and Bionic depend on different libraries. -# Most important, Bionic uses Python 3 distutils others use python3-setuptools ifeq ($(DEB_DISTRO),bionic) BUILD_PRE_DEPENDS := python3 (>= 3.6) BUILD_DEPENDS := python3-distutils, python3-dev -else - BUILD_PRE_DEPENDS := python3 (>= 3.6) - BUILD_DEPENDS := python3-setuptools, python3-dev +else ifeq ($(DEB_DISTRO),xenial) + BUILD_PRE_DEPENDS := python3.6 (>= 3.6) + BUILD_DEPENDS := python3.6-dev endif %: # Use Python 3 binary on Ubuntu Bionic ifeq ($(DEB_DISTRO),bionic) dh $@ --with python-virtualenv --python /usr/bin/python3 -else - dh $@ --with python-virtualenv +else ifeq ($(DEB_DISTRO),xenial) + dh $@ --with python-virtualenv --python /usr/bin/python3.6 endif override_dh_installdirs: From 9fa9079d66a135e5a70626cd6212b1cb6fd44edb Mon Sep 17 00:00:00 2001 From: armab Date: Tue, 8 Dec 2020 13:41:48 +0000 Subject: [PATCH 3/6] Remove mistral from fixate-requirements.py --- packages/st2/component.makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/st2/component.makefile b/packages/st2/component.makefile index e2e2a205..c647fbd7 100644 --- a/packages/st2/component.makefile +++ b/packages/st2/component.makefile @@ -62,9 +62,7 @@ populate_version: .stamp-populate_version requirements: .stamp-requirements .stamp-requirements: -# Don't include Mistral runner for now, replace with commented version when mistral removed from st2 -# $(PYTHON_BINARY) ../scripts/fixate-requirements.py -s in-requirements.txt -f ../fixed-requirements.txt - $(PYTHON_BINARY) ../scripts/fixate-requirements.py --skip=stackstorm-runner-mistral-v2,python-mistralclient -s in-requirements.txt -f ../fixed-requirements.txt + $(PYTHON_BINARY) ../scripts/fixate-requirements.py -s in-requirements.txt -f ../fixed-requirements.txt cat requirements.txt wheelhouse: .stamp-wheelhouse From 01ab261645fcdd25d85c2aa7ccf34a580622633e Mon Sep 17 00:00:00 2001 From: armab Date: Tue, 8 Dec 2020 14:03:00 +0000 Subject: [PATCH 4/6] Test if st2 cli is running under the python 3.6 --- rake/spec/default/50-installed-cli-versions_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/rake/spec/default/50-installed-cli-versions_spec.rb b/rake/spec/default/50-installed-cli-versions_spec.rb index 475edd1b..0b3a101f 100644 --- a/rake/spec/default/50-installed-cli-versions_spec.rb +++ b/rake/spec/default/50-installed-cli-versions_spec.rb @@ -3,6 +3,7 @@ describe 'st2 cli version checks' do describe command("st2 --version") do its(:exit_status) { is_expected.to eq 0 } + its(:stderr) { should match /on Python 3.6/ } # show version number in Rspec output after(:all) do puts puts " " + described_class.stderr From 1f1c9a83ddf3a14d4c7da6c665f8895afdca7fad Mon Sep 17 00:00:00 2001 From: armab Date: Tue, 8 Dec 2020 14:22:57 +0000 Subject: [PATCH 5/6] Fix Xenial builds for component.makefile --- packages/st2/Makefile | 1 - packages/st2/component.makefile | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/st2/Makefile b/packages/st2/Makefile index 22617cc9..2cfe9617 100644 --- a/packages/st2/Makefile +++ b/packages/st2/Makefile @@ -26,7 +26,6 @@ ifeq ($(DEB_DISTRO),bionic) else ifeq ($(DEB_DISTRO),xenial) PYTHON_BINARY := /usr/bin/python3.6 PIP_BINARY := /usr/local/bin/pip3.6 - PYTHON_ALT_BINARY := python3.6 else ifeq ($(EL_VERSION),8) PYTHON_BINARY := /usr/bin/python3 PIP_BINARY := /usr/local/bin/pip3 diff --git a/packages/st2/component.makefile b/packages/st2/component.makefile index c647fbd7..7a752f60 100644 --- a/packages/st2/component.makefile +++ b/packages/st2/component.makefile @@ -22,6 +22,9 @@ endif ifeq ($(DEB_DISTRO),bionic) PYTHON_BINARY := /usr/bin/python3 PIP_BINARY := /usr/bin/pip3 +else ifeq ($(DEB_DISTRO),xenial) + PYTHON_BINARY := /usr/bin/python3.6 + PIP_BINARY := /usr/local/bin/pip3.6 else ifeq ($(EL_VERSION),8) PYTHON_BINARY := /usr/bin/python3 PIP_BINARY := /usr/local/bin/pip3 @@ -29,8 +32,9 @@ else ifeq ($(EL_VERSION),7) PYTHON_BINARY := /usr/bin/python3 PIP_BINARY := /usr/local/bin/pip3 else - PYTHON_BINARY := python - PIP_BINARY := pip + PYTHON_BINARY := /usr/bin/python3 + PIP_BINARY := pip3 + PYTHON_ALT_BINARY := python3 endif # Moved from top of file to handle when only py2 or py3 available From 333486b34aa1f50f9d5624d9e88e67dfd5c691c8 Mon Sep 17 00:00:00 2001 From: armab Date: Tue, 8 Dec 2020 14:26:52 +0000 Subject: [PATCH 6/6] Fix python 3.6 st2 cli test --- rake/spec/default/50-installed-cli-versions_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rake/spec/default/50-installed-cli-versions_spec.rb b/rake/spec/default/50-installed-cli-versions_spec.rb index 0b3a101f..2780748b 100644 --- a/rake/spec/default/50-installed-cli-versions_spec.rb +++ b/rake/spec/default/50-installed-cli-versions_spec.rb @@ -3,7 +3,7 @@ describe 'st2 cli version checks' do describe command("st2 --version") do its(:exit_status) { is_expected.to eq 0 } - its(:stderr) { should match /on Python 3.6/ } + its(:stdout) { should match /on Python 3.6/ } # show version number in Rspec output after(:all) do puts puts " " + described_class.stderr