Skip to content

[WIP] Manylinux2010 #279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 39 commits into from
Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
7f4765e
Minimal usable merge of markrwilliams:manylinux2 into current pypa:ma…
dolang Apr 13, 2018
2f42b3c
Clean-up and adjustments for manylinux2010
dolang Apr 13, 2018
27e7332
Fix for new release of pip (v10.0.0) breaking the build script
dolang Apr 15, 2018
55f670c
Merge upstream changes (4a20e4b); remove get-pip hack
dolang Apr 16, 2018
54b3c84
Re-add the two /dev/null redirections in build.sh
dolang Apr 16, 2018
dcd4acf
Merge upstream changes (6f3bc0b)
dolang Apr 20, 2018
8f868fb
Merge upstream changes (3dd4551)
dolang Apr 21, 2018
50f4eac
Merge upstream changes (4132165)
dolang Apr 29, 2018
0a6c6ee
Merge upstream changes (0566338)
dolang May 2, 2018
55b3514
Merge upstream changes (9f3b52a)
dolang May 3, 2018
87886d4
Adapt build.sh for the x86_64 two-stage build
dolang May 3, 2018
2664c85
Getting Travis to play along
dolang May 3, 2018
67ef9a0
Merge upstream changes (e893a63)
dolang May 15, 2018
05098c8
Merge upstream changes (d837450)
dolang May 21, 2018
2ec5c38
Merge upstream changes (1971a37)
dolang May 22, 2018
e075849
Merge upstream changes (96b47a2); move libff-devel
dolang Jun 16, 2018
24082fe
Merge upstream changes (46241e9)
dolang Jun 28, 2018
0a31334
Merge a0d46fa; mirror base image change :6.9 -> :6
dolang Jul 4, 2018
e05c365
Merge upstream changes (9e82cb0)
dolang Jul 11, 2018
c39783f
Merge 46e2d66; update to CentOS 6.10
dolang Jul 28, 2018
ca7a542
Merge branch 'master' into manylinux2010
mayeut Feb 14, 2019
2011765
Merge branch 'master' into manylinux2010
mayeut Feb 21, 2019
ca12203
Merge branch 'master' into manylinux2010
mayeut Mar 2, 2019
931aa02
Merge branch 'master' into manylinux2010
mayeut Mar 4, 2019
f2f22d3
Merge branch 'master' into manylinux2010
mayeut Mar 11, 2019
5b12bfe
Merge branch 'master' into manylinux2010
mayeut Mar 22, 2019
f5792ce
Merge branch 'master' into manylinux2010
mayeut Mar 23, 2019
daa1a5f
Drop 32-bit support and upgrade to devtoolset-7
mayeut Mar 22, 2019
4b59d3a
Update README.rst
JonasVautherin Mar 28, 2019
db3b9d3
Add comment regarding MANYLINUX2010_DEPS
mayeut Mar 31, 2019
3d899ab
Add comment for Software collection & EPEL usage
mayeut Mar 31, 2019
20db20d
Move expat-devel to PYTHON_COMPILE_DEPS
mayeut Mar 31, 2019
356df2d
Use local gpgkey for RPM-GPG-KEY-CentOS-6
mayeut Mar 31, 2019
f6fc85a
Merge branch 'master' into manylinux2010
mayeut Apr 1, 2019
39892a0
Update to devtoolset-8
mayeut Apr 2, 2019
bbfe5a4
Merge branch 'master' into manylinux2010
mayeut Apr 4, 2019
6765234
Replace travis wait by custom command
mayeut Apr 5, 2019
0ad07d5
Use travis-ci build stages and cache glibc build
mayeut Apr 5, 2019
bc2ee54
Merge branch 'master' into manylinux2010
mayeut Apr 6, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 30 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,40 @@ branches:
except:
- /^pyup-/

cache:
directories:
- $HOME/docker

env:
global:
# QUAY_USERNAME and QUAY_PASSWORD for docker image upload
- secure: "lKaTzEL6UNiEfp+BWLOUILG9BMtjwEMpwt6Yag0cQGHix7qJ/ElZ0t3oFw6ZwuDmA5qceAXIdxHLUK9HGVI2MloLk8czGhjvtfJ4XhOxtEJRQ0VkDGPsKN4cfhB4ZjGo6GAPtNqStMyNiY7BZuTrZa7coDLCoUeYcOmTpi6pmd1rrkk725B9QCTuhFHb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WzTStNL1sa32RHr6i/9zeFZw1pMD1+eOg9x6fgODfh2sqr/zPbu2oONsHnc4D2jwsEax4o+Dv5QHLvK7jdyWUmu47a9QReoexXK60jZXs3CA="


matrix:
jobs:
include:
- env: PLATFORM="i686"
- env: PLATFORM="x86_64"

script:
- PLATFORM=$PLATFORM TRAVIS_COMMIT=$TRAVIS_COMMIT ./build.sh


deploy:
provider: script
script: docker/deploy.sh
on:
branch: master
repo: pypa/manylinux
- stage: "Patch glibc"
env:
- PLATFORM="x86_64"
before_install:
# Load cached docker images
- if [[ -d $HOME/docker ]]; then ls $HOME/docker/*.tar.gz | xargs -I {file} sh -c "zcat {file} | docker load"; fi
script:
- PLATFORM=$PLATFORM TRAVIS_COMMIT=$TRAVIS_COMMIT ./build.sh glibc_only
before_cache:
# Save tagged docker images
- mkdir -p $HOME/docker && docker images -a --filter='dangling=false' --format '{{.Repository}}:{{.Tag}} {{.ID}}' | grep 'centos-with-vsyscall:latest' | xargs -n 2 -t sh -c 'test -e $HOME/docker/$1.tar.gz || docker save $0 | gzip -2 > $HOME/docker/$1.tar.gz'
- stage: "Build manylinux images"
env:
- PLATFORM="x86_64"
before_install:
# Load cached docker images
- if [[ -d $HOME/docker ]]; then ls $HOME/docker/*.tar.gz | xargs -I {file} sh -c "zcat {file} | docker load"; fi
script:
- PLATFORM=$PLATFORM TRAVIS_COMMIT=$TRAVIS_COMMIT ./build.sh
deploy:
provider: script
script: docker/deploy.sh
on:
branch: master
repo: pypa/manylinux
15 changes: 14 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,18 @@
# Stop at any error, show all commands
set -ex


if [ $PLATFORM == x86_64 ] || [ "$1" == "glibc_only" ]; then
# Output something every 10 minutes or Travis kills the job
while sleep 9m; do echo -n -e " \b"; done &
docker build --rm -t centos-with-vsyscall:latest --cache-from centos-with-vsyscall:latest --target centos-with-vsyscall -f docker/glibc/Dockerfile docker/glibc/
# Killing background sleep loop
kill %1
if [ "$1" == "glibc_only" ]; then
exit 0
fi
docker build --rm -t quay.io/pypa/manylinux2010_centos-6-no-vsyscall --cache-from quay.io/pypa/manylinux2010_centos-6-no-vsyscall:latest --cache-from centos-with-vsyscall:latest -f docker/glibc/Dockerfile docker/glibc/
fi

docker/build_scripts/prefetch.sh openssl curl
docker build --rm -t quay.io/pypa/manylinux1_$PLATFORM:$TRAVIS_COMMIT -f docker/Dockerfile-$PLATFORM docker/
docker build --rm -t quay.io/pypa/manylinux2010_$PLATFORM:$TRAVIS_COMMIT -f docker/Dockerfile-$PLATFORM docker/
20 changes: 0 additions & 20 deletions docker/Dockerfile-i686

This file was deleted.

11 changes: 6 additions & 5 deletions docker/Dockerfile-x86_64
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM centos:5
MAINTAINER The ManyLinux project
# See docker/glibc/
FROM quay.io/pypa/manylinux2010_centos-6-no-vsyscall
LABEL maintainer="The ManyLinux project"

ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
ENV PATH /opt/rh/devtoolset-2/root/usr/bin:$PATH
ENV LD_LIBRARY_PATH /opt/rh/devtoolset-2/root/usr/lib64:/opt/rh/devtoolset-2/root/usr/lib:/usr/local/lib64:/usr/local/lib
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
ENV PATH /opt/rh/devtoolset-8/root/usr/bin:$PATH
ENV LD_LIBRARY_PATH /opt/rh/devtoolset-8/root/usr/lib64:/opt/rh/devtoolset-8/root/usr/lib:/opt/rh/devtoolset-8/root/usr/lib64/dyninst:/opt/rh/devtoolset-8/root/usr/lib/dyninst:/usr/local/lib64:/usr/local/lib
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig

COPY build_scripts /build_scripts
COPY sources /
Expand Down
90 changes: 52 additions & 38 deletions docker/build_scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,25 @@ MY_DIR=$(dirname "${BASH_SOURCE[0]}")

# Dependencies for compiling Python that we want to remove from
# the final image after compiling Python
# GPG installed to verify signatures on Python source tarballs.
PYTHON_COMPILE_DEPS="zlib-devel bzip2-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel gpg libffi-devel"

# Libraries that are allowed as part of the manylinux1 profile
MANYLINUX1_DEPS="glibc-devel libstdc++-devel glib2-devel libX11-devel libXext-devel libXrender-devel mesa-libGL-devel libICE-devel libSM-devel ncurses-devel"

# Centos 5 is EOL and is no longer available from the usual mirrors, so switch
# to http://vault.centos.org
# From: https://github.com/rust-lang/rust/pull/41045
# The location for version 5 was also removed, so now only the specific release
# (5.11) can be referenced.
sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
sed -i 's/mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo
sed -i 's/#\(baseurl.*\)mirror.centos.org\/centos\/$releasever/\1vault.centos.org\/5.11/' /etc/yum.repos.d/*.repo
PYTHON_COMPILE_DEPS="zlib-devel bzip2-devel expat-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel"

# Libraries that are allowed as part of the manylinux2010 profile
# Extract from PEP: https://www.python.org/dev/peps/pep-0571/#the-manylinux2010-policy
# On RPM-based systems, they are provided by these packages:
# Package: Libraries
# glib2: libglib-2.0.so.0, libgthread-2.0.so.0, libgobject-2.0.so.0
# glibc: libresolv.so.2, libutil.so.1, libnsl.so.1, librt.so.1, libcrypt.so.1, libpthread.so.0, libdl.so.2, libm.so.6, libc.so.6
# libICE: libICE.so.6
# libX11: libX11.so.6
# libXext: libXext.so.6
# libXrender: libXrender.so.1
# libgcc: libgcc_s.so.1
# libstdc++: libstdc++.so.6
# mesa: libGL.so.1
#
# PEP is missing the package for libSM.so.6 for RPM based system
# Install development packages (except for libgcc which is provided by gcc install)
MANYLINUX2010_DEPS="glibc-devel libstdc++-devel glib2-devel libX11-devel libXext-devel libXrender-devel mesa-libGL-devel libICE-devel libSM-devel"

# Get build utilities
source $MY_DIR/build_utils.sh
Expand All @@ -41,39 +46,27 @@ echo "multilib_policy=best" >> /etc/yum.conf
# Decided not to clean at this point: https://github.com/pypa/manylinux/pull/129
yum -y update

# EPEL support
yum -y install wget
# https://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
cp $MY_DIR/epel-release-5-4.noarch.rpm .
check_sha256sum epel-release-5-4.noarch.rpm $EPEL_RPM_HASH

# Dev toolset (for LLVM and other projects requiring C++11 support)
wget -q http://people.centos.org/tru/devtools-2/devtools-2.repo
check_sha256sum devtools-2.repo $DEVTOOLS_HASH
mv devtools-2.repo /etc/yum.repos.d/devtools-2.repo
rpm -Uvh --replacepkgs epel-release-5*.rpm
rm -f epel-release-5*.rpm

# from now on, we shall only use curl to retrieve files
yum -y erase wget
# Software collection (for devtoolset-8) and EPEL support (for cmake28 & yasm)
yum -y install centos-release-scl https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

# Development tools and libraries
yum -y install \
automake \
bison \
bzip2 \
cmake28 \
devtoolset-2-binutils \
devtoolset-2-gcc \
devtoolset-2-gcc-c++ \
devtoolset-2-gcc-gfortran \
devtoolset-8-binutils \
devtoolset-8-gcc \
devtoolset-8-gcc-c++ \
devtoolset-8-gcc-gfortran \
diffutils \
expat-devel \
gettext \
kernel-devel-`uname -r` \
file \
kernel-devel-`uname -r` \
libffi-devel \
make \
patch \
perl-devel \
unzip \
which \
yasm \
Expand Down Expand Up @@ -147,18 +140,39 @@ rm -rf patchelf.tar.gz patchelf-$PATCHELF_VERSION

ln -s $PY36_BIN/auditwheel /usr/local/bin/auditwheel

# HACK: The newly compiled and installed curl messes with the system's
# py2.6 installation, on which yum depends. Work around it by
# rewiring libcurl.so specifically for yum. /usr/local/bin/ has higher
# priority on the PATH than /usr/bin/
cat <<'EOF' > /usr/local/bin/yum && chmod +x /usr/local/bin/yum
#!/bin/bash
if [ "x$(arch)" != xi686 ]; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should probably be more specific? So that it fails hard with other arch's like arm32.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's one of the reason I'd like to get #210 merged in, remove this hack once & for all. I'd rather do some rework on #210 which has some added value rather than rework this hack.

LD_PRELOAD=/usr/lib64/libcurl.so.4
else
LD_PRELOAD=/usr/lib/libcurl.so.4
fi
export LD_PRELOAD
/usr/bin/yum "$@"
EOF
# the above might not shadow the real yum just yet, so call hash to be
# sure:
type yum
hash yum


# Clean up development headers and other unnecessary stuff for
# final image
yum -y erase \
avahi \
bitstream-vera-fonts \
freetype \
gettext \
gtk2 \
hicolor-icon-theme \
libX11 \
wireless-tools \
${PYTHON_COMPILE_DEPS} > /dev/null 2>&1
yum -y install ${MANYLINUX1_DEPS}
${PYTHON_COMPILE_DEPS} > /dev/null 2>&1
yum -y install ${MANYLINUX2010_DEPS}
yum -y clean all > /dev/null 2>&1
yum list installed

Expand All @@ -180,7 +194,7 @@ find /opt/_internal -depth \
for PYTHON in /opt/python/*/bin/python; do
# Smoke test to make sure that our Pythons work, and do indeed detect as
# being manylinux compatible:
$PYTHON $MY_DIR/manylinux1-check.py
$PYTHON $MY_DIR/manylinux-check.py
# Make sure that SSL cert checking works
$PYTHON $MY_DIR/ssl-check.py
done
Expand Down
2 changes: 1 addition & 1 deletion docker/build_scripts/build_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ GIT_HASH=ba2fed9d02e424b735e035c4f2b0bdb168ef0df7e35156b5051d900dc7247787
GIT_DOWNLOAD_URL=https://github.com/git/git/archive

GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py
EPEL_RPM_HASH=0dcc89f9bf67a2a515bad64569b7a9615edc5e018f676a578d5fd0f17d3c81d4
EPEL_RPM_HASH=e5ed9ecf22d0c4279e92075a64c757ad2b38049bcf5c16c4f2b75d5f6860dc0d
DEVTOOLS_HASH=a8ebeb4bed624700f727179e6ef771dafe47651131a00a78b342251415646acc
5 changes: 1 addition & 4 deletions docker/build_scripts/build_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ function do_cpython_build {
if [ -e ${prefix}/bin/python3 ]; then
ln -s python3 ${prefix}/bin/python
fi
# --force-reinstall is to work around:
# https://github.com/pypa/pip/issues/5220
# https://github.com/pypa/get-pip/issues/19
${prefix}/bin/python get-pip.py --force-reinstall
${prefix}/bin/python get-pip.py
if [ -e ${prefix}/bin/pip3 ] && [ ! -e ${prefix}/bin/pip ]; then
ln -s pip3 ${prefix}/bin/pip
fi
Expand Down
Binary file removed docker/build_scripts/epel-release-5-4.noarch.rpm
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Logic copied from PEP 513

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this file be named docker/build_scripts/manylinux-check2010.py ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it should be, that just another thing to change on the next update. I'd rather keep it that as it is.

def is_manylinux1_compatible():
def is_manylinux2010_compatible():
# Only Linux, and only x86-64 / i686
from distutils.util import get_platform
if get_platform() not in ["linux-x86_64", "linux-i686"]:
Expand All @@ -14,8 +14,8 @@ def is_manylinux1_compatible():
# Fall through to heuristic check below
pass

# Check glibc version. CentOS 5 uses glibc 2.5.
return have_compatible_glibc(2, 5)
# Check glibc version. CentOS 6 uses glibc 2.12.
return have_compatible_glibc(2, 12)

def have_compatible_glibc(major, minimum_minor):
import ctypes
Expand Down Expand Up @@ -45,9 +45,9 @@ def have_compatible_glibc(major, minimum_minor):
return True

import sys
if is_manylinux1_compatible():
print("%s is manylinux1 compatible" % (sys.executable,))
if is_manylinux2010_compatible():
print("%s is manylinux2010 compatible" % (sys.executable,))
sys.exit(0)
else:
print("%s is NOT manylinux1 compatible" % (sys.executable,))
print("%s is NOT manylinux2010 compatible" % (sys.executable,))
sys.exit(1)
2 changes: 1 addition & 1 deletion docker/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
docker login -u $QUAY_USERNAME -p $QUAY_PASSWORD quay.io
tag="quay.io/pypa/manylinux1_$PLATFORM"
tag="quay.io/pypa/manylinux2010_$PLATFORM"
docker tag ${tag}:${TRAVIS_COMMIT} ${tag}:latest
docker push ${tag}:latest
11 changes: 11 additions & 0 deletions docker/glibc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM centos:6 as centos-with-vsyscall

COPY ./build_scripts /build_scripts
RUN bash /build_scripts/rebuild-glibc-without-vsyscall.sh

FROM centos:6
LABEL maintainer="The Manylinux project"

COPY --from=centos-with-vsyscall /rpms /rpms

RUN yum -y install /rpms/* && rm -rf /rpms
Loading