Commit 9a886c4b authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

slapos-node package: fixes for python3

Also adapt build.sh for bootstrapping with python3.

This is a fixup of 4b28ab13. See also nexedi/slapos!1154
parent 94604880
Pipeline #21278 failed with stage
in 0 seconds
......@@ -61,6 +61,7 @@ environment =
DBUS_GLIB_LIBS=-L${dbus-glib:location}/lib -ldbus-glib-1
CPPFLAGS=-I${glib:location}/include/glib-2.0 -I${glib:location}/lib/glib-2.0/include
LDFLAGS=-L${glib:location}/lib -Wl,-rpath=${glib:location}/lib -L${gettext:location}/lib -Wl,-rpath=${gettext:location}/lib
PYTHON=${buildout:executable}
[gobject-introspection]
recipe = slapos.recipe.cmmi
......@@ -79,6 +80,7 @@ environment =
FFI_CFLAGS=-I${libffi:location}/include
FFI_LIBS=-L${libffi:location}/lib -Wl,-rpath=${libffi:location}/lib -lffi
GIR_DIR=${buildout:parts-directory}/${:_buildout_section_name_}/share/gir-1.0
PYTHON=${buildout:executable}
[pygobject3]
recipe = slapos.recipe.cmmi
......@@ -101,6 +103,7 @@ environment =
GIO_LIBS=-L${glib:location}/lib -lgio-2.0
GI_CFLAGS=-I${gobject-introspection:location}/include/gobject-introspection-1.0
GI_LIBS=-L${gobject-introspection:location}/lib -lgirepository-1.0
PYTHON=${buildout:executable}
[trusted-config]
recipe = slapos.recipe.build:download
......@@ -114,13 +117,13 @@ python = ${buildout:bin-directory}/${firewalld-eggs:interpreter}
stop-on-error = True
command =
set -e
sed -i 's#python2.7#${:python}#' ${firewalld:location}/bin/firewall-applet
sed -i 's#python2.7#${:python}#' ${firewalld:location}/bin/firewall-cmd
sed -i 's#python2.7#${:python}#' ${firewalld:location}/bin/firewall-config
sed -i 's#python2.7#${:python}#' ${firewalld:location}/bin/firewall-offline-cmd
sed -i 's#python2.7#${:python}#' ${firewalld:location}/${firewalld:sbin-dir}/firewalld
sed -i 's#python3#${:python}#' ${firewalld:location}/bin/firewall-applet
sed -i 's#python3#${:python}#' ${firewalld:location}/bin/firewall-cmd
sed -i 's#python3#${:python}#' ${firewalld:location}/bin/firewall-config
sed -i 's#python3#${:python}#' ${firewalld:location}/bin/firewall-offline-cmd
sed -i 's#python3#${:python}#' ${firewalld:location}/${firewalld:sbin-dir}/firewalld
sed -i 's#python2.7 /usr/bin/firewall-config#${:python} ${firewalld:location}/bin/firewall-config#' ${firewalld:etc-dir}/lockdown-whitelist.xml
sed -i 's#python3 /usr/bin/firewall-config#${:python} ${firewalld:location}/bin/firewall-config#' ${firewalld:etc-dir}/lockdown-whitelist.xml
sed -i 's#DefaultZone=public#DefaultZone=trusted#' ${firewalld:etc-dir}/firewalld.conf
sed -i 's#FirewallBackend=nftables#FirewallBackend=iptables#' ${firewalld:etc-dir}/firewalld.conf
......
......@@ -49,4 +49,5 @@ configure-options =
--enable-python
--with-json
--without-cli
--with-python-bin=${buildout:executable}
#!/bin/sh -e
#
# This simple script to buildout slapos from source using 1.0 branch on
# /opt/slapos folder, adapt this script as you please.
# This simple script to buildout slapos from source using 1.0 branch on
# /opt/slapos folder, adapt this script as you please.
#
# Be carefull to not run this script were the script is already installed.
#
# Before run this script, ensure dependencies are installed, on debian, you can
# Be carefull to not run this script where slapos-node is already installed.
#
# Before run this script, ensure dependencies are installed, on debian, you can
# use the command bellow:
#
# apt-get install python gcc g++ make uml-utilities bridge-utils patch wget
# apt-get install python3 gcc g++ make patch wget curl
#
# Use sudo or superuser and create slapos directory (you can pick a different directory)
mkdir -p /opt/slapos/log/
mkdir -p /opt/slapos
cd /opt/slapos/
# Create buildout.cfg SlapOS bootstrap file
echo "[buildout]
extends = https://lab.nexedi.com/nexedi/slapos/raw/1.0/component/slapos/buildout.cfg
" > buildout.cfg
mkdir -p eggs log download-cache/dist
# Required in some distros such as Mandriva
unset PYTHONPATH
......@@ -26,17 +22,51 @@ unset PYTHONDONTWRITEBYTECODE
unset CONFIG_SITE
#
# Bootstrap SlapOS, using forked version of buildout.
# Bootstrap buildout.
#
wget https://bootstrap.pypa.io/bootstrap-buildout.py
python -S bootstrap-buildout.py --buildout-version 2.5.2+slapos013 \
-f http://www.nexedi.org/static/packages/source/slapos.buildout/
cat > buildout.cfg <<EOF
[buildout]
extends = https://lab.nexedi.com/nexedi/slapos/raw/1.0/component/slapos/buildout.cfg
download-cache = download-cache
parts =
zc.buildout
[zc.buildout]
recipe = zc.recipe.egg
eggs =
zc.buildout
EOF
rm -f bootstrap.py
wget https://lab.nexedi.com/nexedi/slapos.buildout/raw/master/bootstrap/bootstrap.py
python3 -S bootstrap.py \
--setuptools-version 40.8.0 \
--setuptools-to-dir eggs
sed -i '1s/$/ -S/' bin/buildout
bin/buildout buildout:newest=true -v
# Install slapos.libnetworkcache (outside of system libraries, see python -S)
cat > buildout.cfg <<EOF
[buildout]
extends = https://lab.nexedi.com/nexedi/slapos/raw/1.0/component/slapos/buildout.cfg
download-cache = download-cache
parts =
networkcached
[networkcached]
recipe = zc.recipe.egg
eggs =
slapos.libnetworkcache
zc.buildout
EOF
sed -i '1s/$/ -S/' bin/buildout
bin/buildout buildout:newest=true -v
#
# Warning:Depending on your distribution you might need to
# replace python by python2 in the last command. This happens when your
# distribution considers that the standard python is the 3.x branch.
# Finally start the big build
#
# Finally start to build
bin/buildout -v
echo "[buildout]
extends = https://lab.nexedi.com/nexedi/slapos/raw/1.0/component/slapos/buildout.cfg
download-cache = download-cache
" > buildout.cfg
bin/buildout buildout:newest=true -v
......@@ -19,14 +19,17 @@ parts =
py
firewalld-patch
[python]
part = python3
[environment]
# Note: For now original PATH is appended to the end, as not all tools are
# provided by SlapOS
PATH=${bison:location}/bin:${bzip2:location}/bin:${gettext:location}/bin:${glib:location}/bin:${libxml2:location}/bin:${libxslt:location}/bin:${m4:location}/bin:${ncurses:location}/bin:${openssl:location}/bin:${pkgconfig:location}/bin:${python2.7:location}/bin:${readline:location}/bin:${sqlite3:location}/bin:${swig:location}/bin:${buildout:bin-directory}:${patch:location}/bin:${socat:location}/bin:$PATH
PATH=${bison:location}/bin:${bzip2:location}/bin:${gettext:location}/bin:${glib:location}/bin:${libxml2:location}/bin:${libxslt:location}/bin:${m4:location}/bin:${ncurses:location}/bin:${openssl:location}/bin:${pkgconfig:location}/bin:${python:location}/bin:${readline:location}/bin:${sqlite3:location}/bin:${swig:location}/bin:${buildout:bin-directory}:${patch:location}/bin:${socat:location}/bin:$PATH
CFLAGS=-I${bzip2:location}/include -I${gdbm:location}/include -I${gettext:location}/include -I${glib:location}/include -I${libxml2:location}/include -I${libxslt:location}/include -I${ncurses:location}/include -I${openssl:location}/include -I${readline:location}/include -I${sqlite3:location}/include -I${zlib:location}/include
CPPFLAGS=${:CFLAGS}
LDFLAGS=-L${bzip2:location}/lib -Wl,-rpath=${bzip2:location}/lib -L${gdbm:location}/lib -Wl,-rpath=${gdbm:location}/lib -L${gettext:location}/lib -Wl,-rpath=${gettext:location}/lib -L${glib:location}/lib -Wl,-rpath=${glib:location}/lib -L${libxml2:location}/lib -Wl,-rpath=${libxml2:location}/lib -L${libxslt:location}/lib -Wl,-rpath=${libxslt:location}/lib -L${ncurses:location}/lib -Wl,-rpath=${ncurses:location}/lib -L${openssl:location}/lib -Wl,-rpath=${openssl:location}/lib -L${readline:location}/lib -Wl,-rpath=${readline:location}/lib -L${sqlite3:location}/lib -Wl,-rpath=${sqlite3:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib
PKG_CONFIG_PATH=${glib:location}/lib/pkgconfig:${libxml2:location}/lib/pkgconfig:${libxslt:location}/lib/pkgconfig:${openssl:location}/lib/pkgconfig:${pcre:location}/lib/pkgconfig:${python2.7:location}/lib/pkgconfig:${sqlite3:location}/lib/pkgconfig
PKG_CONFIG_PATH=${glib:location}/lib/pkgconfig:${libxml2:location}/lib/pkgconfig:${libxslt:location}/lib/pkgconfig:${openssl:location}/lib/pkgconfig:${pcre:location}/lib/pkgconfig:${python:location}/lib/pkgconfig:${sqlite3:location}/lib/pkgconfig
LD_LIBRARY_PATH=${bzip2:location}/lib:${gdbm:location}/lib:${gettext:location}/lib:${glib:location}/lib:${libxml2:location}/lib:${libxslt:location}/lib:${ncurses:location}/lib:${openssl:location}/lib:${readline:location}/lib:${sqlite3:location}/lib:${zlib:location}/lib
[cfg-environment]
......
......@@ -26,12 +26,11 @@ extends-cache = extends-cache
download-cache = download-cache
[python]
part = python3
init +=
buildout = self.buildout['buildout']
assert buildout['directory'] == buildout['destdir'] + buildout['rootdir'], (
"Buildout MUST BE launched in destdir/rootdir (currently launched in %s but should be launched in %s)",
buildout['directory'], buildout['destdir'] + buildout['rootdir'])
buildout['directory'], buildout['destdir'] + buildout['rootdir'])
[python3-common]
configure-options +=
......
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