Fix selection of a release specific mock prototype

Commit https://review.opendev.org/c/starlingx/root/+/762700
was intended to include the code to select the release specific
mock config prototype.

    e.g. mock.cfg.centos7.proto

As delivered, it would always select the default.

    e.g. mock.cfg.proto

When combined with a change in
https://review.opendev.org/c/starlingx/root/+/762701
that prematurely set the default mock cfg prototype
to the Centos 8 version while leaving the build
container at Centos 7, we created a build failure.

Closes-Bug: 1906547
Signed-off-by: Scott Little <scott.little@windriver.com>
Change-Id: If484b1b942d3a4febe5dee0afa01aaf0c00a4a1b
Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
Scott Little 2020-12-02 12:08:27 -05:00
parent 1506352c85
commit 72d1905384
1 changed files with 11 additions and 6 deletions

View File

@ -128,11 +128,16 @@ timestamp="$(date +%F_%H%M)"
mock_cfg_prefix="mock.cfg"
mock_cfg_default_suffix="proto"
mock_cfg_suffix="${mock_cfg_default_suffix}"
if [ -f /etc/os-release ]; then
mock_cfg_distro="$(source /etc/os-release; echo ${ID}${VERSION_ID}.proto)"
fi
mock_cfg_distro=""
mock_cfg_src_prefix=${mock_cfg_prefix}
mock_cfg_dir=$MY_REPO/build-tools/repo_files
mock_cfg_dest_dir=$MY_REPO/centos-repo
if [ -f /etc/os-release ]; then
mock_cfg_distro="$(source /etc/os-release; echo ${ID}${VERSION_ID})"
if [ ! -z "${mock_cfg_distro}" ]; then
mock_cfg_src_prefix=${mock_cfg_prefix}.${mock_cfg_distro}
fi
fi
comps_xml_file=$MY_REPO/build-tools/repo_files/comps.xml
comps_xml_dest_dir=$MY_REPO/centos-repo/Binary
@ -412,7 +417,7 @@ copy_with_backup () {
if [ ! -d ${dest_dir} ]; then
dest_file="$2"
dest_dir=$(dir_name ${dest_file})
dest_dir=$(dirname ${dest_file})
if [ ! -d ${dest_dir} ]; then
echo "destination directory '${dest_dir}' does not exist!"
exit 1
@ -468,13 +473,13 @@ done
echo "Copying mock.cfg.proto file."
# First look for layer specific file to copy.
mock_cfg_file="${mock_cfg_dir}/${mock_cfg_prefix}.${layer}.${mock_cfg_suffix}"
mock_cfg_file="${mock_cfg_dir}/${mock_cfg_src_prefix}.${layer}.${mock_cfg_suffix}"
if [ -f "$mock_cfg_file" ]; then
copy_with_backup ${mock_cfg_file} ${mock_cfg_dest_dir}/${mock_cfg_prefix}.${layer}.${mock_cfg_default_suffix}
fi
# Always copy the default
mock_cfg_file=${mock_cfg_dir}/${mock_cfg_prefix}.${mock_cfg_suffix}
mock_cfg_file=${mock_cfg_dir}/${mock_cfg_src_prefix}.${mock_cfg_suffix}
copy_with_backup ${mock_cfg_file} ${mock_cfg_dest_dir}/${mock_cfg_prefix}.${mock_cfg_default_suffix}