IMPALA-13223: Fix bootstrap-build.sh for platforms without Python2

bin/bootstrap-build.sh did not distinguish between various version of
the Ubuntu platform, and attempted to install unversioned Python
packages (python-dev and python-setuptools) even on newer versions
that don't support Python 2 any longer (e.g. Ubuntu 22.04 and 24.04).
On older Ubuntu versions these packages are still useful, so at this
point it is not feasible just to drop them.

This patch makes these packages optional: they are added to the list of
packages to be installed only if they actually exist for the platform.

The patch also extends the package list with some basic packages that
are needed when bin/bootstrap_build.sh is run inside an Ubuntu 22.04
Docker container.

Tests: ran a compile-only build on Ubuntu 20.04 (still has Python 2) and
on Ubuntu 22.04 (does not support Python 2 any more).

Change-Id: I94ade35395afded4e130b79eab8c27c6171b50d6
Reviewed-on: http://gerrit.cloudera.org:8080/21800
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
Laszlo Gaal
2024-07-14 22:15:41 +02:00
committed by Impala Public Jenkins
parent 3910e924d4
commit ad7888898b

View File

@@ -17,8 +17,8 @@
# specific language governing permissions and limitations
# under the License.
# This script builds Impala from scratch. It is known to work on Ubuntu 16.04. To run it
# you need to have:
# This script builds Impala from scratch. It is known to work on Ubuntu versions 16.04,
# 18.04, 20.04, and 22.04. To run it you need to have:
#
# 1. At least 8GB of free disk space
# 4. A connection to the internet (parts of the build download dependencies)
@@ -33,10 +33,19 @@ set -euxo pipefail
# Kerberos setup would pop up dialog boxes without this
export DEBIAN_FRONTEND=noninteractive
sudo -E apt-get --quiet update
sudo -E apt-get --yes --quiet install \
g++ gcc git libsasl2-dev libssl-dev make python-dev \
python-setuptools python3-dev python3-setuptools python3-venv libffi-dev \
libkrb5-dev krb5-admin-server krb5-kdc krb5-user libxml2-dev libxslt-dev
# unversioned python-dev and python-setuptools are not available on newer releases
# that don't support Python 2. Add them only when they exist for the platform,
# otherwise set Python 3 to be the default Python version.
PACKAGES='g++ gcc git libsasl2-dev libssl-dev make
python3-dev python3-setuptools python3-venv libffi-dev language-pack-en
libkrb5-dev krb5-admin-server krb5-kdc krb5-user libxml2-dev libxslt-dev wget'
if sudo apt-get --quiet install -s python-dev python-setuptools > /dev/null 2>&1; then
PACKAGES="${PACKAGES} python-dev python-setuptools"
else
PACKAGES="${PACKAGES} python-is-python3 python-dev-is-python3"
fi
sudo -E apt-get --yes --quiet install ${PACKAGES}
source /etc/lsb-release