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 = ...@@ -61,6 +61,7 @@ environment =
DBUS_GLIB_LIBS=-L${dbus-glib:location}/lib -ldbus-glib-1 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 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 LDFLAGS=-L${glib:location}/lib -Wl,-rpath=${glib:location}/lib -L${gettext:location}/lib -Wl,-rpath=${gettext:location}/lib
PYTHON=${buildout:executable}
[gobject-introspection] [gobject-introspection]
recipe = slapos.recipe.cmmi recipe = slapos.recipe.cmmi
...@@ -79,6 +80,7 @@ environment = ...@@ -79,6 +80,7 @@ environment =
FFI_CFLAGS=-I${libffi:location}/include FFI_CFLAGS=-I${libffi:location}/include
FFI_LIBS=-L${libffi:location}/lib -Wl,-rpath=${libffi:location}/lib -lffi FFI_LIBS=-L${libffi:location}/lib -Wl,-rpath=${libffi:location}/lib -lffi
GIR_DIR=${buildout:parts-directory}/${:_buildout_section_name_}/share/gir-1.0 GIR_DIR=${buildout:parts-directory}/${:_buildout_section_name_}/share/gir-1.0
PYTHON=${buildout:executable}
[pygobject3] [pygobject3]
recipe = slapos.recipe.cmmi recipe = slapos.recipe.cmmi
...@@ -101,6 +103,7 @@ environment = ...@@ -101,6 +103,7 @@ environment =
GIO_LIBS=-L${glib:location}/lib -lgio-2.0 GIO_LIBS=-L${glib:location}/lib -lgio-2.0
GI_CFLAGS=-I${gobject-introspection:location}/include/gobject-introspection-1.0 GI_CFLAGS=-I${gobject-introspection:location}/include/gobject-introspection-1.0
GI_LIBS=-L${gobject-introspection:location}/lib -lgirepository-1.0 GI_LIBS=-L${gobject-introspection:location}/lib -lgirepository-1.0
PYTHON=${buildout:executable}
[trusted-config] [trusted-config]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
...@@ -114,13 +117,13 @@ python = ${buildout:bin-directory}/${firewalld-eggs:interpreter} ...@@ -114,13 +117,13 @@ python = ${buildout:bin-directory}/${firewalld-eggs:interpreter}
stop-on-error = True stop-on-error = True
command = command =
set -e set -e
sed -i 's#python2.7#${:python}#' ${firewalld:location}/bin/firewall-applet sed -i 's#python3#${:python}#' ${firewalld:location}/bin/firewall-applet
sed -i 's#python2.7#${:python}#' ${firewalld:location}/bin/firewall-cmd sed -i 's#python3#${:python}#' ${firewalld:location}/bin/firewall-cmd
sed -i 's#python2.7#${:python}#' ${firewalld:location}/bin/firewall-config sed -i 's#python3#${:python}#' ${firewalld:location}/bin/firewall-config
sed -i 's#python2.7#${:python}#' ${firewalld:location}/bin/firewall-offline-cmd sed -i 's#python3#${: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}/${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#DefaultZone=public#DefaultZone=trusted#' ${firewalld:etc-dir}/firewalld.conf
sed -i 's#FirewallBackend=nftables#FirewallBackend=iptables#' ${firewalld:etc-dir}/firewalld.conf sed -i 's#FirewallBackend=nftables#FirewallBackend=iptables#' ${firewalld:etc-dir}/firewalld.conf
......
...@@ -49,4 +49,5 @@ configure-options = ...@@ -49,4 +49,5 @@ configure-options =
--enable-python --enable-python
--with-json --with-json
--without-cli --without-cli
--with-python-bin=${buildout:executable}
...@@ -3,22 +3,18 @@ ...@@ -3,22 +3,18 @@
# This simple script to buildout slapos from source using 1.0 branch on # This simple script to buildout slapos from source using 1.0 branch on
# /opt/slapos folder, adapt this script as you please. # /opt/slapos folder, adapt this script as you please.
# #
# Be carefull to not run this script were the script is already installed. # 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 # Before run this script, ensure dependencies are installed, on debian, you can
# use the command bellow: # 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) # 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/ cd /opt/slapos/
mkdir -p eggs log download-cache/dist
# Create buildout.cfg SlapOS bootstrap file
echo "[buildout]
extends = https://lab.nexedi.com/nexedi/slapos/raw/1.0/component/slapos/buildout.cfg
" > buildout.cfg
# Required in some distros such as Mandriva # Required in some distros such as Mandriva
unset PYTHONPATH unset PYTHONPATH
...@@ -26,17 +22,51 @@ unset PYTHONDONTWRITEBYTECODE ...@@ -26,17 +22,51 @@ unset PYTHONDONTWRITEBYTECODE
unset CONFIG_SITE unset CONFIG_SITE
# #
# Bootstrap SlapOS, using forked version of buildout. # Bootstrap buildout.
# #
wget https://bootstrap.pypa.io/bootstrap-buildout.py cat > buildout.cfg <<EOF
python -S bootstrap-buildout.py --buildout-version 2.5.2+slapos013 \ [buildout]
-f http://www.nexedi.org/static/packages/source/slapos.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 # Finally start the big build
# 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 to build echo "[buildout]
extends = https://lab.nexedi.com/nexedi/slapos/raw/1.0/component/slapos/buildout.cfg
bin/buildout -v download-cache = download-cache
" > buildout.cfg
bin/buildout buildout:newest=true -v
...@@ -19,14 +19,17 @@ parts = ...@@ -19,14 +19,17 @@ parts =
py py
firewalld-patch firewalld-patch
[python]
part = python3
[environment] [environment]
# Note: For now original PATH is appended to the end, as not all tools are # Note: For now original PATH is appended to the end, as not all tools are
# provided by SlapOS # 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 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} 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 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 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] [cfg-environment]
......
...@@ -26,7 +26,6 @@ extends-cache = extends-cache ...@@ -26,7 +26,6 @@ extends-cache = extends-cache
download-cache = download-cache download-cache = download-cache
[python] [python]
part = python3
init += init +=
buildout = self.buildout['buildout'] buildout = self.buildout['buildout']
assert buildout['directory'] == buildout['destdir'] + buildout['rootdir'], ( assert buildout['directory'] == buildout['destdir'] + buildout['rootdir'], (
......
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