[pypy-commit] buildbot default: tweaks to get started, add 32 bit dockerfile

Matti Picus pypy.commits at gmail.com
Thu Nov 28 03:37:14 EST 2019


Author: Matti Picus
Branch: 
Changeset: r1107:39d00880d7ef
Date: 2019-11-28 09:36 +0100
http://bitbucket.org/pypy/buildbot/changeset/39d00880d7ef/

Log:	tweaks to get started, add 32 bit dockerfile

diff --git a/docker/Dockerfile b/docker/Dockerfile
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -5,7 +5,7 @@
 # docker build -t buildslave -f docker/Dockerfile random_name 
 #
 # To create the buildslave configuration, call
-# docker run --rm --user $UID -v<abspath/to/builder/dir>:/build_dir> \
+# docker run --rm --user buildslave -v<abspath/to/builder/dir>:/build_dir> \
 #    -eSLAVENAME=<name> -ePASSWORD=<password> buildslave
 # Then you can examine the <build_dir>/buildbot.tac file.
 #
@@ -20,54 +20,56 @@
 # Use PYPY_MAKE_PORTABLE to package a built PyPy in a portable fashion (that
 # is the motivation for doing this in the first place, right?)
 #
-# docker run --rm --user $UID -v<abspath/to/builder/dir>:/build_dir> \
+# docker run --rm --user buildslave -v<abspath/to/builder/dir>:/build_dir> \
 #     -ePYPY_MAKE_PORTABLE=1 buildslave
 #
+# Use HOME since the default for docker is /, which
+# is not avaialbe to the buildslave user
+#
 # You might want to keep the PYPY_USESSION_DIR where the testing/building
 # artifacts are. Docker will not do this for you, so do something like this
 # to save the files outside the docker
 #
 # mkdir -p build_dir/tmp
-# docker run --rm --user $UID -v<abspath/to/builder/dir>:/build_dir> \
-#     -ePYPY_USESSION_DIR=/build_dir/tmp -ePYPY_MAKE_PORTABLE=1 buildslave
+# docker run --rm --user buildslave -v<abspath/to/builder/dir>:/build_dir> \
+#     -ePYPY_USESSION_DIR=/build_dir/tmp -ePYPY_MAKE_PORTABLE=1 \
+#     -eHOME=/buildslave_home -v/home/buildslave:/buildslave_home buildslave
 #
 # To enter the buildslave image, add a shell command to the end
 #
-# docker run -it --user $UID -v<abspath/to/builder/dir>:/build_dir> \
+# docker run -it --user buildslave -v<abspath/to/builder/dir>:/build_dir> \
 #     -ePYPY_USESSION_DIR=/build_dir/tmp buildslave /bin/bash
 #
 
-#FROM quay.io/pypa/manylinux2010_i686:latest
 FROM quay.io/pypa/manylinux2010_x86_64:latest
 WORKDIR /root
 
 RUN yum -y update
 RUN yum install -y wget bzip2-devel zlib-devel glibc-devel libX11-devel \
    libXt-devel patch expat-devel libXft-devel tk-devel gdbm-devel \
-   perl xz-devel ncurses-devel sqlite-devel prelink
-
-# get a pypy for translation
-RUN wget -q https://bitbucket.org/squeaky/portable-pypy/downloads/pypy-7.0.0-linux_x86_64-portable.tar.bz2 -O - | tar -C /opt -xj
-RUN ln -s /opt/pypy-7.0.0-linux_x86_64-portable/bin/pypy /usr/local/bin/pypy
+   perl xz-devel ncurses-devel sqlite-devel prelink python-virtualenv pypy
 
 # Taken from pyca/infra/cryptography-manylinux
 # centos6 libffi is buggy, download and use a newer one
 # also use the version of openssl that latests pyca/cryptography uses
+ENV PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig
+ADD install_openssl.sh /root/install_openssl.sh
 ADD install_libffi.sh /root/install_libffi.sh
-ADD install_openssl.sh /root/install_openssl.sh
 RUN sh install_libffi.sh manylinux2010 2>&1 | tee /root/install_libffi.log
 RUN sh install_openssl.sh manylinux2010 2>&1 | tee /root/install_openssl.log
 
-RUN yum install -y python-virtualenv
+# get a pypy for translation. On x86_64 we can use portable pypy
+RUN wget -q https://bitbucket.org/squeaky/portable-pypy/downloads/pypy-7.0.0-linux_x86_64-portable.tar.bz2 -O - | tar -C /opt -xj
+RUN ln -s /opt/pypy-7.0.0-linux_x86_64-portable/bin/pypy /usr/local/bin/pypy
+
 RUN yum clean packages
 
-# build a python 2.7 virtualenv, use the /opt/python/cp27-cp27m/bin/python
+# build a python 2.7 virtualenv, use the /opt/python/cp27-cp27mu/bin/python
 # since centos6 itself has python2.6
-RUN virtualenv -p /opt/python/cp27-cp27m/bin/python /python27_virt
+RUN virtualenv -p /opt/python/cp27-cp27mu/bin/python /python27_virt
 ENV PATH=/python27_virt/bin:$PATH
 RUN pip install --upgrade pip setuptools
-RUN pip install buildbot-slave pytest hypothesis cffi vmprof mercurial
-ENV PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig
+RUN pip install buildbot-slave pytest hypothesis cffi vmprof mercurial virtualenv
 
 CMD if [ -e /build_dir/buildbot.tac ]; then \
     buildslave start --nodaemon /build_dir; \
diff --git a/docker/Dockerfile32 b/docker/Dockerfile32
new file mode 100644
--- /dev/null
+++ b/docker/Dockerfile32
@@ -0,0 +1,79 @@
+# Build with something like this, where
+#  -t is the name of the image
+#  -f is this file
+#  the random_name is a random directory
+# linux32 docker build -t buildslave -f docker/Dockerfile random_name 
+#
+# To create the buildslave configuration, call
+# docker run --rm --user buildslave -v<abspath/to/builder/dir>:/build_dir> \
+#    -eSLAVENAME=<name> -ePASSWORD=<password> buildslave
+# Then you can examine the <build_dir>/buildbot.tac file.
+#
+# To run the buildslave (after the stage above succeeds) you no longer need the
+# SLAVENAME and PASSWORD. The slave will run non-deamonized, which will appear
+# to "hang" the console running the slave. To stop the slave, simply CTRL-C or
+# kill the process.
+#
+# Don't forget to `docker container prune` once in a while to reclaim disk
+# space from stopped containers.
+#
+# Use PYPY_MAKE_PORTABLE to package a built PyPy in a portable fashion (that
+# is the motivation for doing this in the first place, right?)
+#
+# linux32 docker run --rm --user buildslave -v<abspath/to/builder/dir>:/build_dir> \
+#     -ePYPY_MAKE_PORTABLE=1 buildslave
+#
+# Use HOME since the default for docker is /, which
+# is not avaialbe to the buildslave user
+#
+# You might want to keep the PYPY_USESSION_DIR where the testing/building
+# artifacts are. Docker will not do this for you, so do something like this
+# to save the files outside the docker
+#
+# mkdir -p build_dir/tmp
+# linux32 docker run --rm --user buildslave -v<abspath/to/builder/dir>:/build_dir> \
+#     -ePYPY_USESSION_DIR=/build_dir/tmp -ePYPY_MAKE_PORTABLE=1 \
+#     -eHOME=/buildslave_home -v/home/buildslave:/buildslave_home buildslave
+#
+# To enter the buildslave image, add a shell command to the end
+#
+# linux32 docker run -it --user buildslave -v<abspath/to/builder/dir>:/build_dir> \
+#     -ePYPY_USESSION_DIR=/build_dir/tmp buildslave /bin/bash
+#
+
+FROM quay.io/pypa/manylinux2010_i686:latest
+WORKDIR /root
+
+RUN yum -y update
+RUN yum install -y wget bzip2-devel zlib-devel glibc-devel libX11-devel \
+   libXt-devel patch expat-devel libXft-devel tk-devel gdbm-devel \
+   perl xz-devel ncurses-devel sqlite-devel prelink python-virtualenv pypy
+
+# Taken from pyca/infra/cryptography-manylinux
+# centos6 libffi is buggy, download and use a newer one
+# also use the version of openssl that latests pyca/cryptography uses
+ENV PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig
+ADD install_openssl.sh /root/install_openssl.sh
+ADD install_libffi.sh /root/install_libffi.sh
+RUN sh install_libffi.sh manylinux2010 m32 2>&1 | tee /root/install_libffi.log
+RUN sh install_openssl.sh manylinux2010 m32 2>&1 | tee /root/install_openssl.log
+
+# get a pypy for translation. On x86_64 we can use portable pypy
+# on i686 we use the old one provided by yum
+# RUN wget -q https://bitbucket.org/squeaky/portable-pypy/downloads/pypy-7.0.0-linux_x86_64-portable.tar.bz2 -O - | tar -C /opt -xj
+# RUN ln -s /opt/pypy-7.0.0-linux_x86_64-portable/bin/pypy /usr/local/bin/pypy
+
+RUN yum clean packages
+
+# build a python 2.7 virtualenv, use the /opt/python/cp27-cp27mu/bin/python
+# since centos6 itself has python2.6
+RUN virtualenv -p /opt/python/cp27-cp27mu/bin/python /python27_virt
+ENV PATH=/python27_virt/bin:$PATH
+RUN pip install --upgrade pip setuptools
+RUN pip install buildbot-slave pytest hypothesis cffi vmprof mercurial virtualenv
+
+CMD if [ -e /build_dir/buildbot.tac ]; then \
+    buildslave start --nodaemon /build_dir; \
+  else \
+    buildslave create-slave /build_dir buildbot.pypy.org:10407 $SLAVENAME $PASSWORD; \
+  fi
diff --git a/docker/install_libffi.sh b/docker/install_libffi.sh
--- a/docker/install_libffi.sh
+++ b/docker/install_libffi.sh
@@ -12,7 +12,7 @@
     rm "${fname}.sha256"
 }
 
-curl -#O "https://mirrors.ocf.berkeley.edu/debian/pool/main/libf/libffi/libffi_${LIBFFI_VERSION}.orig.tar.gz"
+curl -q -#O "https://mirrors.ocf.berkeley.edu/debian/pool/main/libf/libffi/libffi_${LIBFFI_VERSION}.orig.tar.gz"
 check_sha256sum "libffi_${LIBFFI_VERSION}.orig.tar.gz" ${LIBFFI_SHA256}
 tar zxf libffi*.orig.tar.gz
 PATH=/opt/perl/bin:$PATH
@@ -22,7 +22,11 @@
 else
   STACK_PROTECTOR_FLAGS="-fstack-protector-strong"
 fi
-./configure --prefix=/usr/local CFLAGS="-g -O2 $STACK_PROTECTOR_FLAGS -Wformat -Werror=format-security"
+if [ "$2" == "m32" ]; then
+  setarch i386 ./configure --prefix=/usr/local CFLAGS="-m32 -g -O2 $STACK_PROTECTOR_FLAGS -Wformat -Werror=format-security"
+else
+  ./configure --prefix=/usr/local CFLAGS="-g -O2 $STACK_PROTECTOR_FLAGS -Wformat -Werror=format-security"
+fi
 make install
 popd
 rm -rf libffi*
diff --git a/docker/install_openssl.sh b/docker/install_openssl.sh
--- a/docker/install_openssl.sh
+++ b/docker/install_openssl.sh
@@ -13,12 +13,16 @@
     rm "${fname}.sha256"
 }
 
-curl -#O "${OPENSSL_URL}/${OPENSSL_NAME}.tar.gz"
+curl -q -#O "${OPENSSL_URL}/${OPENSSL_NAME}.tar.gz"
 check_sha256sum ${OPENSSL_NAME}.tar.gz ${OPENSSL_SHA256}
 tar zxf ${OPENSSL_NAME}.tar.gz
 PATH=/opt/perl/bin:$PATH
 pushd ${OPENSSL_NAME}
-./config no-comp enable-ec_nistp_64_gcc_128 no-shared no-dynamic-engine --prefix=/usr/local --openssldir=/usr/local
+if [ "$2" == "m32" ]; then
+  setarch i386 ./config no-comp no-shared no-dynamic-engine -m32 --prefix=/usr/local --openssldir=/usr/local
+else
+  ./config no-comp enable-ec_nistp_64_gcc_128 no-shared no-dynamic-engine --prefix=/usr/local --openssldir=/usr/local
+fi
 make depend
 make -j4
 # avoid installing the docs


More information about the pypy-commit mailing list