075b71dcf9
Add debian support to wheels scripts. Note: this solution is not fully functional. Remaining issues will be addressed in separate commits. See FIXME file in this patch. * build-wheels: move OS-specific files to subdirectories {dev,stable}-wheels.cfg {dev,stable}-wheels-py2.cfg openstack.cfg Dockerfile * added a copy of openstack/ussuri requirements files under debian/openstack-requirements/ussuri/upstream for reference * added a patched version of openstack/ussuri requirements files based on above. Changes: - added lines for python3.9 - disabled some packages that don't compile on debian (nss, thrift); these will be installed as DEB files into the base image * build-base-wheels.sh: - auto-detect OS & version by default - add local build repo to docker file - define CPUCOUNT=2 when building wheels. Otherwise some wheels run out of RAM when building. * build-wheel-tarball.sh: - auto-detect OS & version - new option: --keep-image - allow openstack URL to be a local file name - assume DEB wheel packages may install wheels at any level, not just under "/wheels". It's not consistent with CentOS, but many DEB packages do it that way now. * get-stx-wheels.sh: - auto-detect OS & version defaults - debian: don't scan 3rd-party libraries for wheels. They don't exist as files within the POD, but only in the repomgr repo. To be addressed later. - debian: don't scan for lower layer wheels. Layered builds are not supported by Debian right now. To be addressed later. - debian: extarct wheels from DEB files CHANGES TO DEBIAN WHEEL VERSIONS COMPARED TO CENTOS =================================================== * Python 3 (stable-wheels.cfg): - libvirt_python 4.7.0 upgraded to 7.0.0. Original version doesn't compile on debian/bullseye. New version matches the SO package included with bullseye - python_nss: removed. This module doesn't compile on bullseye as-is. A patched version is compiled as a DEB package as part of STX [1] - thriftpy: removed. This module doesn't compile on bullseye as-is. A patched version is provided by Debian [2] * Python2 (stable-wheels-py2.cfg): - python-nss: removed. This module doesn't compile on bullseye as-is. A patched version is compiled as a DEB package as part of STX, which also provides the wheel [1] TESTS ===== - Build py2 & py3 wheels on debian & centos REFERENCES ========== [1] Import python-nss package to debian: https://review.opendev.org/c/starlingx/integ/+/837399 [2] Add additional packages to download lists: https://review.opendev.org/c/starlingx/tools/+/837904 Story: 2009897 Task: 44694 Depends-On: https://review.opendev.org/c/starlingx/integ/+/837399 Depends-On: https://review.opendev.org/c/starlingx/tools/+/837904 Signed-off-by: Davlet Panech <davlet.panech@windriver.com> Change-Id: I0889118b9f0125888fb661e58ff41579da7eb3b4
212 lines
5.2 KiB
Bash
Executable File
212 lines
5.2 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Copyright (c) 2018 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# This utility retrieves StarlingX python wheels
|
|
# from the build output
|
|
#
|
|
|
|
# Required env vars
|
|
if [ -z "${MY_WORKSPACE}" -o -z "${MY_REPO}" ]; then
|
|
echo "Environment not setup for builds" >&2
|
|
exit 1
|
|
fi
|
|
|
|
SUPPORTED_OS_ARGS=('centos' 'debian')
|
|
OS=
|
|
BUILD_STREAM=stable
|
|
|
|
function usage {
|
|
cat >&2 <<EOF
|
|
Usage:
|
|
$(basename $0) [ --os <os> ] [ --stream <stable|dev> ]
|
|
|
|
Options:
|
|
--os: Specify base OS (eg. centos)
|
|
--stream: Openstack release (default: stable)
|
|
|
|
EOF
|
|
}
|
|
|
|
OPTS=$(getopt -o h -l help,os:,release:,stream: -- "$@")
|
|
if [ $? -ne 0 ]; then
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
eval set -- "${OPTS}"
|
|
|
|
while true; do
|
|
case $1 in
|
|
--)
|
|
# End of getopt arguments
|
|
shift
|
|
break
|
|
;;
|
|
--os)
|
|
OS=$2
|
|
shift 2
|
|
;;
|
|
--stream)
|
|
BUILD_STREAM=$2
|
|
shift 2
|
|
;;
|
|
--release) # Temporarily keep --release support as an alias for --stream
|
|
BUILD_STREAM=$2
|
|
shift 2
|
|
;;
|
|
-h | --help )
|
|
usage
|
|
exit 1
|
|
;;
|
|
*)
|
|
usage
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Validate the OS option
|
|
if [ -z "$OS" ] ; then
|
|
OS="$(ID= && source /etc/os-release 2>/dev/null && echo $ID || true)"
|
|
if ! [ -n "$OS" ]; then
|
|
echo "Unable to determine OS" >&2
|
|
echo "Re-run with \"--os\" option" >&2
|
|
exit 1
|
|
fi
|
|
fi
|
|
VALID_OS=1
|
|
for supported_os in ${SUPPORTED_OS_ARGS[@]}; do
|
|
if [ "$OS" = "${supported_os}" ]; then
|
|
VALID_OS=0
|
|
break
|
|
fi
|
|
done
|
|
if [ ${VALID_OS} -ne 0 ]; then
|
|
echo "Unsupported OS specified: ${OS}" >&2
|
|
echo "Supported OS options: ${SUPPORTED_OS_ARGS[@]}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
source ${MY_REPO}/build-tools/git-utils.sh
|
|
|
|
# For backward compatibility. Old repo location or new?
|
|
if [ "${OS}" = "centos" ]; then
|
|
CENTOS_REPO=${MY_REPO}/centos-repo
|
|
if [ ! -d ${CENTOS_REPO} ]; then
|
|
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
|
|
if [ ! -d ${CENTOS_REPO} ]; then
|
|
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
|
|
exit 1
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
function get_wheels_files {
|
|
find ${GIT_LIST} -maxdepth 1 -name "${OS}_${BUILD_STREAM}_wheels.inc"
|
|
}
|
|
|
|
function get_lower_layer_wheels_files {
|
|
# FIXME: debian: these are in repomgr pod, can't get to them easily
|
|
if [[ "${OS}" != "centos" ]] ; then
|
|
echo "$OS: lower layer wheels not supported!" >&2
|
|
return 1
|
|
fi
|
|
find ${CENTOS_REPO}/layer_wheels_inc -maxdepth 1 -name "*_${OS}_${BUILD_STREAM}_wheels.inc"
|
|
}
|
|
|
|
function find_wheel_rpm {
|
|
local wheel="$1"
|
|
local repo=
|
|
|
|
for repo in ${MY_WORKSPACE}/std/rpmbuild/RPMS \
|
|
${CENTOS_REPO}/Binary; do
|
|
if [ -d $repo ]; then
|
|
find $repo -name "${wheel}-[^-]*-[^-]*[.][^.]*[.]rpm"
|
|
fi
|
|
done | head -n 1
|
|
}
|
|
|
|
function find_wheel_deb {
|
|
local wheel="$1"
|
|
local repo=
|
|
# FIXME: debian: we should also scan non-stx RPMs, but they are in repomgr
|
|
# pod and we can't easily get to them.
|
|
for repo in ${MY_WORKSPACE}/std ; do
|
|
if [ -d $repo ]; then
|
|
find $repo -name "${wheel}_[^-]*-[^-]*[.][^.]*[.]deb"
|
|
fi
|
|
done | head -n 1
|
|
}
|
|
|
|
declare -a WHEELS_FILES=($(get_wheels_files) $(get_lower_layer_wheels_files))
|
|
if [ ${#WHEELS_FILES[@]} -eq 0 ]; then
|
|
echo "Could not find ${OS} wheels.inc files" >&2
|
|
exit 1
|
|
fi
|
|
|
|
BUILD_OUTPUT_PATH=${MY_WORKSPACE}/std/build-wheels-${OS}-${BUILD_STREAM}/stx
|
|
echo "BUILD_OUTPUT_PATH: $BUILD_OUTPUT_PATH" >&2
|
|
if [ -d ${BUILD_OUTPUT_PATH} ]; then
|
|
# Wipe out the existing dir to ensure there are no stale files
|
|
rm -rf ${BUILD_OUTPUT_PATH}
|
|
fi
|
|
mkdir -p ${BUILD_OUTPUT_PATH}
|
|
cd ${BUILD_OUTPUT_PATH}
|
|
|
|
# Extract the wheels
|
|
declare -a FAILED
|
|
for wheel in $(sed -e 's/#.*//' ${WHEELS_FILES[@]} | sort -u); do
|
|
case $OS in
|
|
centos)
|
|
# Bash globbing does not handle [^\-] well,
|
|
# so use grep instead
|
|
wheelfile="$(find_wheel_rpm ${wheel})"
|
|
|
|
if [ ! -e "${wheelfile}" ]; then
|
|
echo "Could not find ${wheel}" >&2
|
|
FAILED+=($wheel)
|
|
continue
|
|
fi
|
|
|
|
echo Extracting ${wheelfile}
|
|
|
|
rpm2cpio ${wheelfile} | cpio -vidu
|
|
if [ ${PIPESTATUS[0]} -ne 0 -o ${PIPESTATUS[1]} -ne 0 ]; then
|
|
echo "Failed to extract content of ${wheelfile}" >&2
|
|
FAILED+=($wheel)
|
|
fi
|
|
|
|
;;
|
|
debian)
|
|
wheelfile="$(find_wheel_deb ${wheel})"
|
|
if [ ! -e "${wheelfile}" ]; then
|
|
echo "Could not find ${wheel}" >&2
|
|
FAILED+=($wheel)
|
|
continue
|
|
fi
|
|
|
|
echo Extracting ${wheelfile}
|
|
ar p ${wheelfile} data.tar.xz | tar -xJ
|
|
if [ ${PIPESTATUS[0]} -ne 0 -o ${PIPESTATUS[1]} -ne 0 ]; then
|
|
echo "Failed to extract content of ${wheelfile}" >&2
|
|
FAILED+=($wheel)
|
|
fi
|
|
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [ ${#FAILED[@]} -gt 0 ]; then
|
|
echo "Failed to find or extract one or more wheel packages:" >&2
|
|
for wheel in ${FAILED[@]}; do
|
|
echo "${wheel}" >&2
|
|
done
|
|
exit 1
|
|
fi
|
|
|
|
exit 0
|
|
|