diff --git a/AI/manylinux/8.9/Dockerfile b/AI/manylinux/8.9/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..5f668f9cf92fb4351763cc0fbaae19d940fa970d --- /dev/null +++ b/AI/manylinux/8.9/Dockerfile @@ -0,0 +1,91 @@ +# default to latest supported policy, x86_64 +FROM registry.openanolis.cn/openanolis/anolisos:8.9 +ARG POLICY=manylinux_2_28 +ARG PLATFORM=x86_64 +ARG DEVTOOLSET_ROOTPATH=/opt/rh/gcc-toolset-12/root +ARG LD_LIBRARY_PATH_ARG=${DEVTOOLSET_ROOTPATH}/usr/lib64:${DEVTOOLSET_ROOTPATH}/usr/lib:${DEVTOOLSET_ROOTPATH}/usr/lib64/dyninst:${DEVTOOLSET_ROOTPATH}/usr/lib/dyninst +ARG PREPEND_PATH=${DEVTOOLSET_ROOTPATH}/usr/bin: + +ENV AUDITWHEEL_POLICY=${POLICY} AUDITWHEEL_ARCH=${PLATFORM} AUDITWHEEL_PLAT=${POLICY}_${PLATFORM} +ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 + +RUN yum install -y \ + autoconf \ + automake \ + bison \ + bluez-libs-devel \ + bzip2 bzip2-devel \ + cargo \ + cmake \ + curl \ + desktop-file-utils \ + diffutils \ + expat expat-devel \ + file \ + findutils \ + gcc-toolset-12-binutils \ + gcc-toolset-12-gcc \ + gcc-toolset-12-gcc-c++ \ + gdbm \ + git \ + glib2-devel \ + glibc-devel \ + glibc-langpack-en \ + glibc-locale-source \ + gmp-devel \ + gnupg2 \ + hardlink \ + hostname \ + keyutils-libs \ + libappstream-glib \ + libcom_err \ + libdb \ + libffi libffi-devel \ + libICE-devel \ + libidn \ + libGL-devel \ + libkadm5 \ + libnsl2-devel \ + libpcap \ + libSM-devel \ + libstdc++-devel \ + libtirpc-devel \ + libtool \ + libuuid-devel \ + libX11-devel \ + libxcrypt-devel \ + libXext-devel \ + libXrender-devel \ + make \ + mesa-libGL-devel \ + ncurses ncurses-devel \ + ninja-build \ + openssl openssl-devel \ + patch \ + pkgconfig \ + readline readline-devel \ + rust \ + sqlite-devel \ + tcl tcl-devel \ + tk tk-devel \ + tzdata \ + unzip \ + uuid \ + which \ + xz-devel \ + yasm \ + zlib-devel + +RUN git clone https://gitee.com/src-anolis-os/python3.git /tmp/python3 --branch=a23.0 --depth=1 && \ + pushd /tmp/python3 && tar -xaf Python-3.10.13.tar.xz && cd Python-3.10.13 && \ + ./configure --prefix="/opt/_internal/cpython-3.10.13" --disable-shared --with-ensurepip=no && \ + make -j && make install && rm -rf /tmp/python3 + +COPY python-tag-abi-tag.py finalize-python.sh /opt +RUN source /opt/rh/gcc-toolset-12/enable && mkdir /opt/python && \ + for PREFIX in $(find /opt/_internal/ -mindepth 1 -maxdepth 1 \( -name 'cpython*' -o -name 'pypy*' \)); do \ + /opt/finalize-python.sh $PREFIX ;\ + done + +RUN ln -s /opt/_internal/cpython-3.10.13/bin/auditwheel /usr/local/bin/auditwheel && \ + ln -s /opt/_internal/cpython-3.10.13/bin/patchelf /usr/local/bin/patchelf diff --git a/AI/manylinux/8.9/finalize-python.sh b/AI/manylinux/8.9/finalize-python.sh new file mode 100755 index 0000000000000000000000000000000000000000..bd8b2850bd89ec85207e556964c62d80e9b4950d --- /dev/null +++ b/AI/manylinux/8.9/finalize-python.sh @@ -0,0 +1,53 @@ +#!/bin/bash +set -exuo pipefail + +PREFIX=$1 + +function download_gitee_src () { + # arg1: pkg name + # arg2: target dir + cd ${2} + git clone https://gitee.com/src-anolis-os/python-${1}.git --branch=a23.0 --depth=1 && mv python-${1}/*.tar.gz ${2}/ + rm -rf python-${1} +} + +if [ -e ${PREFIX}/bin/python3 ] && [ ! -e ${PREFIX}/bin/python ]; then + ln -s python3 ${PREFIX}/bin/python +fi + +mkdir -p /tmp/python_srcs +${PREFIX}/bin/python -m ensurepip + +# download python basic package sources +# these are temporary +for pkg in pip build packaging pyproject-hooks tomli wheel setuptools; do + download_gitee_src $pkg /tmp/python_srcs +done + +${PREFIX}/bin/python -m pip install -U /tmp/python_srcs/*.tar.gz \ + https://files.pythonhosted.org/packages/88/56/0f2d69ed9a0060da009f672ddec8a71c041d098a66f6b1d80264bf6bbdc0/pyelftools-0.31.tar.gz \ + https://files.pythonhosted.org/packages/62/6c/0a99a7df52487bd2204a1b8ba56cd90f6f651d23027dc355e0e21b7b0492/auditwheel-6.0.0.tar.gz \ + https://files.pythonhosted.org/packages/83/ec/ac383eb82792e092d8037649b382cf78a7b79c2ce4e5b861f61519b9b14e/patchelf-0.17.2.1.tar.gz && rm -rf /tmp/python_srcs + +if [ -e ${PREFIX}/bin/pip3 ] && [ ! -e ${PREFIX}/bin/pip ]; then + ln -s pip3 ${PREFIX}/bin/pip +fi + +cat << ! > /etc/pip.conf +[global] +index-url = https://mirrors.aliyun.com/pypi/simple/ + +[install] +trusted-host=mirrors.aliyun.com +! + +ABI_TAG=$(${PREFIX}/bin/python3 /opt/python-tag-abi-tag.py) +ln -s ${PREFIX} /opt/python/${ABI_TAG} + +# Make versioned python commands available directly in environment. +PY_VER=$(${PREFIX}/bin/python -c "import sys; print('.'.join(str(v) for v in sys.version_info[:2]))") +PY_IMPL=$(${PREFIX}/bin/python -c "import sys; print(sys.implementation.name)") +if [[ "${PY_IMPL}" == "cpython" ]]; then + ln -s ${PREFIX}/bin/python /usr/local/bin/python${PY_VER} +fi +ln -s ${PREFIX}/bin/python /usr/local/bin/${PY_IMPL}${PY_VER} diff --git a/AI/manylinux/8.9/python-tag-abi-tag.py b/AI/manylinux/8.9/python-tag-abi-tag.py new file mode 100644 index 0000000000000000000000000000000000000000..c3ce1f11d681843adfa97678b224738bb747dfa1 --- /dev/null +++ b/AI/manylinux/8.9/python-tag-abi-tag.py @@ -0,0 +1,10 @@ +# Utility script to print the python tag + the abi tag for a Python +# See PEP 425 for exactly what these are, but an example would be: +# cp27-cp27mu + +from packaging.tags import sys_tags + + +# first tag is always the more specific tag +tag = next(sys_tags()) +print("{0}-{1}".format(tag.interpreter, tag.abi)) diff --git a/AI/manylinux/buildspec.yml b/AI/manylinux/buildspec.yml new file mode 100644 index 0000000000000000000000000000000000000000..b970ae76d97e09ca80a9552f047d56cc29ed8dd5 --- /dev/null +++ b/AI/manylinux/buildspec.yml @@ -0,0 +1,30 @@ +name: &NAME +version: &VERSION +image_type: &IMAGE_TYPE +baseos_version: &BASEOS_VERSION + +# 定义镜像仓库信息 +repository_info: + acr_anolis: &ACR_ANOLIS anolis-registry.cn-zhangjiakou.cr.aliyuncs.com/openanolis + +t-one: + workspace: &WORKSPACE container_ci_test + project: &PROJECT default_container_ci_test + test_suite: &TEST_SUITE image-ci-test + test_conf: &TEST_CONF group=language_container + test_case: &TEST_CASE golang_language_container + cloud_server_tag: &CLOUD_SERVER_TAG [anolis-container-ci-x86, anolis-container-ci-arm] + +images: + BuildPythonManylinuxDockerImage: + build: true + docker_file: + path: AI/manylinux/8.9/Dockerfile + variable: + scene: + args: [] + tags: [8.9] + platform: [linux/amd64] + registry: [*ACR_ANOLIS] + test_config: + - [*WORKSPACE, *PROJECT, *TEST_SUITE, *TEST_CONF, *TEST_CASE, *CLOUD_SERVER_TAG[0], ''] diff --git a/AI/manylinux/version.yml b/AI/manylinux/version.yml new file mode 100644 index 0000000000000000000000000000000000000000..198aea665667fe59fb344e81501d735ab89b5cb2 --- /dev/null +++ b/AI/manylinux/version.yml @@ -0,0 +1,8 @@ +# 版本关系依赖表,默认继承 version-base.yml 配置,可重写覆盖 +BaseDependency: ../version-base.yml +Dependency: + name: python + image_type: language + versions: + 3.8: + baseos_version: [[ignored]]