Commit b832147b authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

Allow to build either with python2 or python3 so that package can be built anywhere

WARNING: Do not use PYTHON make variable since it messes up with compilation. Instead
use SLAPOS_BOOTSTRAP_SYSTEM_PYTHON which explains the idea of the variable
and does not overrides make's PYTHON variable in other places.
parent e36d3205
......@@ -4,7 +4,7 @@ Section: net
Priority: optional
Build-Depends: debhelper,
chrpath,
python3
python3 (>=3.7) | python
Homepage: https://slapos.nexedi.com
Package: slapos-node
......
......@@ -2,12 +2,12 @@
# -*- makefile -*-
build:
cd slapos; make build PYTHON=python3
make -C slapos build SLAPOS_BOOTSTRAP_SYSTEM_PYTHON=$(shell which python2.7 2> /dev/null || echo python3)
all: build
install: all
cd slapos; make install
make -C slapos install
mkdir -p $(DESTDIR)/usr/bin/
mkdir -p $(DESTDIR)/usr/sbin/
sed -i "s/\/opt\/slapos\/rebootstrap\/parts/\/opt\/slapos\/parts/g" $(DESTDIR)/opt/slapos/bin/*
......
......@@ -4,7 +4,6 @@
VERSION = %VERSION%
RECIPE_VERSION = %RECIPE_VERSION%
PY = $(PYTHON)
INSTALL_DIRECTORY = $(DESTDIR)/opt/slapos
TARGET_DIRECTORY = /opt/slapos
BUILD_ROOT_DIRECTORY := $(shell pwd)/build
......@@ -24,11 +23,11 @@ build-stamp:
@echo "Bootstrapping buildout"
cd $(BUILD_DIRECTORY) && \
$(PY) ./bootstrap
$(SLAPOS_BOOTSTRAP_SYSTEM_PYTHON) ./bootstrap
@echo 'Preparing source tarball (recipe version: $(RECIPE_VERSION))'
cd $(BUILD_DIRECTORY) && \
$(PY) ./bin/buildout -v
$(SLAPOS_BOOTSTRAP_SYSTEM_PYTHON) ./bin/buildout -v
@touch build-stamp
......
# Maintainer: Rafael Monnerat <rafael@nexedi.com>
# Maintainer: Thomas Gambier <thomas.gambier@nexedi.com>
pkgname=slapos-node
pkgver=%VERSION%+%RECIPE_VERSION%+%RELEASE%
pkgdesc="Slapos node"
......@@ -6,15 +6,15 @@ pkgrel=1
arch=('x86_64' 'i686')
url="http://www.slapos.org"
license=('GPL')
depends=(python3 python3-distribute iptables iproute2)
makedepends=(patch wget chrpath inetutils)
depends=(iptables iproute2)
makedepends=(patch wget chrpath inetutils python3)
install='slapos-node.install'
source=(${pkgname}_${pkgver}.tar.gz)
md5sums=(%SOURCEMD5%)
build() {
cd "${srcdir}/${pkgname}_${pkgver}"
make PYTHON=python3
make
}
package() {
......
......@@ -3,10 +3,10 @@ Source: slapos-node
Binary: slapos-node
Architecture: any
Version: %VERSION%+%RECIPE_VERSION%+%RELEASE%-1
Maintainer: Rafael Monnerat <rafael@nexedi.com>
Homepage: http://community.slapos.org
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, python3-dev, libssl-dev
Build-Depends: debhelper (>= 4.1.16), chrpath, po-debconf, wget, python3 (>= 3.7) | python, python3-dev (>= 3.7) | python-dev, libssl-dev
Files:
1c2803e4693c74042985d753c9c3ba53 73736102 slapos-node_%VERSION%+%RECIPE_VERSION%+%RELEASE%.orig.tar.gz
1c2803e4693c74042985d753c9c3ba53 6102 slapos-node_%VERSION%+%RECIPE_VERSION%+%RELEASE%-1.diff.tar.gz
......@@ -44,11 +44,22 @@ Group: Application/Network
Source0: slapos-node_%{unmangled_version}+%{slapversion}+%{release_number}.tar.gz
URL: http://community.slapos.org/
Vendor: Vifib
Packager: Rafael Monnerat <rafael@nexedi.com>
BuildRequires: gcc-c++, make, patch, wget, python3, chrpath, openssl-devel
Requires: bridge-utils, gcc-c++, make, patch, wget, lm_sensors
Packager: Thomas Gambier <thomas.gambier@nexedi.com>
BuildRequires: gcc-c++
BuildRequires: make
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
Requires: gcc-c++, make, patch, wget, lm_sensors
AutoReqProv: no
......@@ -77,7 +88,7 @@ zcat $RPM_SOURCE_DIR/slapos-node_%{unmangled_version}+%{slapversion}+%{release_n
%build
cd $RPM_BUILD_DIR/slapos-node_%{unmangled_version}+%{slapversion}+%{release_number}
make PYTHON=python3
make
%install
cd $RPM_BUILD_DIR/slapos-node_%{unmangled_version}+%{slapversion}+%{release_number}/
......
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