Set amphora-agent build-only packages

A recent change in DIB [1] broke our CentOS 8 amphora image builds only
because we've not been handling package dependencies propertly.

The DIB change now installs package "python3" which provides
/usr/bin/python3 and is a requirement of scripts in later build phases.
It so happens that we are removing package "python3-pip", a dependency
of "python36" too early so builds fail when bin python3 is required.

DIB package-installs element provides property "build-only". When set,
it will cause packages to be added both to the list of packages
installed and list of packages to be uninstalled. This allows expressing
build-time dependencies that should not end up in the final image as is
the case of packages like "build-essential" and "libffi-dev" in our
amphora-agent element.

As for the removal of Git, we do not explicitely install it so we should
not uninstall it either. Git is a fake dependency of source-repositories
element and will be abstent in the final image with [2].

[1] https://review.opendev.org/#/c/741868/
[2] https://review.opendev.org/#/c/745678/

Depends-On: https://review.opendev.org/#/c/745678/

Change-Id: I3b82180c8fcf2e2f053c6bcce405f1ea730f62ba
(cherry picked from commit fa1c5ef6dd)
This commit is contained in:
Carlos Goncalves 2020-08-11 15:55:57 +02:00
parent fcbbfd819d
commit 1955766417
2 changed files with 7 additions and 7 deletions

View File

@ -1,13 +1,13 @@
amphora-agent:
installtype: package
build-essential:
installtype: source
build-only: True
libffi-dev:
installtype: source
build-only: True
libssl-dev:
installtype: source
build-only: True
python-dev:
installtype: source
build-only: True
acl:
# Note: Red Hat family does not currently ship acpid for ppc64le.

View File

@ -9,16 +9,16 @@ set -o pipefail
[ "${DIB_INSTALLTYPE_amphora_agent:-}" = "package" ] && exit 0
git --git-dir=/opt/amphora-agent/.git rev-parse HEAD >> /opt/amphora-agent.gitref
awk 'FNR == 1 {print $1}' /opt/amphora-agent/.git/logs/HEAD >> /opt/amphora-agent.gitref
rm -rf /opt/amphora-agent
case $DISTRO_NAME in
ubuntu | debian )
apt-get --assume-yes purge --auto-remove build-essential libffi-dev libssl-dev python-dev python3-dev git
apt-get --assume-yes purge --auto-remove
;;
fedora | centos* | rhel* )
YUM=${YUM:-yum}
${YUM} -v -y autoremove automake make gcc gcc-c++ kernel-devel libffi-devel openssl-devel python-devel platform-python-devel python{2,3,}-pip git
${YUM} -v -y autoremove
;;
*)
echo "ERROR: Unsupported distribution $DISTRO_NAME"