Commit 35d18e0a authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

obs/slapos: bootstrap only in python3

For OSes with python3 older than 3.7, we build python3.7 to bootstrap
buildout.
parent 95f24d40
......@@ -4,7 +4,11 @@ Section: net
Priority: optional
Build-Depends: debhelper,
chrpath,
python3 (>=3.7) | python
python3,
libffi-dev,
liblzma-dev,
libz-dev,
libbz2-dev
Homepage: https://slapos.nexedi.com
Package: slapos-node
......
......@@ -2,7 +2,8 @@
# -*- makefile -*-
build:
make -C slapos build SLAPOS_BOOTSTRAP_SYSTEM_PYTHON=$(shell which python3 2> /dev/null || echo python2.7)
$(eval SLAPOS_BOOTSTRAP_PYTHON := $(shell ./build_python3_if_needed.bash))
make -C slapos build SLAPOS_BOOTSTRAP_PYTHON=$(SLAPOS_BOOTSTRAP_PYTHON)
all: build
......
#!/bin/bash
# This script compiles python3.7 if current python3 is older than this
# It returns the path of the python3 executable to use
version=$(python3 --version | sed 's/Python 3.//' | sed 's/\..*//')
if [ $version -ge 7 ]
then
echo $(which python3)
exit 0
fi
build_dir=.build
# TODO:how to get this from buildout ?
python3_url=https://www.python.org/ftp/python/3.7.17/Python-3.7.17.tar.xz
md5sum=$(echo -n $python3_url | md5sum | cut -d ' ' -f 1)
mkdir -p $build_dir
cp slapos/build/opt/slapos/download-cache/$md5sum $build_dir/$(basename $python3_url)
cd $build_dir
tar -xJf $(basename $python3_url)
rm $(basename $python3_url)
cd Python*
sh configure &> /dev/null
make -j 4 &> /dev/null
echo $(readlink -f python)
......@@ -23,11 +23,11 @@ build-stamp:
@echo "Bootstrapping buildout"
cd $(BUILD_DIRECTORY) && \
$(SLAPOS_BOOTSTRAP_SYSTEM_PYTHON) ./bootstrap-dir/bin/buildout buildout:install-from-cache=true bootstrap
$(SLAPOS_BOOTSTRAP_PYTHON) ./bootstrap-dir/bin/buildout buildout:install-from-cache=true bootstrap
@echo 'Preparing source tarball (recipe version: $(RECIPE_VERSION))'
cd $(BUILD_DIRECTORY) && \
$(SLAPOS_BOOTSTRAP_SYSTEM_PYTHON) ./bin/buildout -v
$(SLAPOS_BOOTSTRAP_PYTHON) ./bin/buildout -v
@touch build-stamp
......
......@@ -6,7 +6,7 @@ Version: %VERSION%+%RECIPE_VERSION%+%RELEASE%-1
Maintainer: Thomas Gambier <thomas.gambier@nexedi.com>
Homepage: http://slapos.nexedi.com
Standards-Version: 3.9.2
Build-Depends: debhelper (>= 4.1.16), chrpath, po-debconf, wget, python3 (>= 3.7) | python, python3-dev (>= 3.7) | python-dev, libssl-dev
Build-Depends: debhelper (>= 4.1.16), chrpath, po-debconf, wget, python3, python3-dev, libssl-dev, libffi-dev, liblzma-dev, libz-dev, libbz2-dev
Files:
1c2803e4693c74042985d753c9c3ba53 73736102 %SLAPOS_DIRECTORY%.orig.tar.gz
1c2803e4693c74042985d753c9c3ba53 6102 %SLAPOS_DIRECTORY%-1.diff.tar.gz
......@@ -50,13 +50,14 @@ BuildRequires: patch
BuildRequires: wget
BuildRequires: chrpath
BuildRequires: openssl-devel
%if 0%{?centos_version} <= 700 || 0%{?rhel_version} <= 700 || 0%{?suse_version} < 1300 || 0%{?sle_version} < 130000
BuildRequires: python
BuildRequires: python-devel
%else
BuildRequires: python3
BuildRequires: python3-devel
%endif
# dependencies for compilation of python3
BuildRequires: libffi-devel
BuildRequires: (lzma-devel or liblzma-devel or xz-devel)
BuildRequires: zlib-devel
BuildRequires: (libbz2-devel or bzip2-devel)
Requires: gcc-c++
Requires: make
Requires: patch
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment