sonic-buildimage/scripts/prepare_slave_container_buildinfo.sh
xumia 32dbd3da04 [Build]: Fix host image debian package version issue (#10358)
Why I did it
Fix host image debian package version issue.
The package dependencies may have issue, when some of debian packages of the base image are upgraded. For example, libc is installed in base image, but if the mirror has new version, when running "apt-get upgrade", the package will be upgraded unexpected. To avoid such issue, need to add the versions when building the host image.

How I did it
The package versions of host-image should contain host-base-image.
2022-04-28 03:26:49 +00:00

33 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
SLAVE_DIR=$1
ARCH=$2
DISTRO=$3
# Install the latest debian package sonic-build-hooks in the slave container
sudo dpkg -i --force-overwrite $SLAVE_DIR/buildinfo/sonic-build-hooks_*.deb > /dev/null
# Enable the build hooks
symlink_build_hooks
# Enable reproducible mirrors
set_reproducible_mirrors
apt-get update > /dev/null 2>&1
# Build the slave running config
cp -rf $SLAVE_DIR/buildinfo/* /usr/local/share/buildinfo/
. /usr/local/share/buildinfo/scripts/buildinfo_base.sh
# Enable reproducible mirrors
set_reproducible_mirrors
apt-get update > /dev/null 2>&1
# Build the slave version config
[ -d /usr/local/share/buildinfo/versions ] && rm -rf /usr/local/share/buildinfo/versions
scripts/versions_manager.py generate -t "/usr/local/share/buildinfo/versions" -n "build-${SLAVE_DIR}" -d "$DISTRO" -a "$ARCH"
touch ${BUILDINFO_PATH}/versions/versions-deb
rm -f /etc/apt/preferences.d/01-versions-deb
([ "$ENABLE_VERSION_CONTROL_DEB" == "y" ] && [ -f $VERSION_DEB_PREFERENCE ]) && cp -f $VERSION_DEB_PREFERENCE /etc/apt/preferences.d/
exit 0