Support different mock.cfg.proto files for CentOS-7 vs CentOS-8
We'll be supporting CentOS-7 vs CentOS-8 based build environments concurrently for a time. The two distros require slightly different content in the mock.cfg. Modify generate-centos-repo.sh to determine which distribution we are building under, and select the correct mock.cfg prototype(s). It will look for files names mock.cfg.$DISTRO.$LAYER.proto and if found, substitute them for mock.cfg.$LAYER.proto. There will be a matching change in the 'root' git to introduce separate CentOS-7 and CentOS-8 mock prototypes. Story: 2006729 Change-Id: Ibf610bcd82b447b8ffeecd86595b19280106e458 Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
parent
33648c9b34
commit
fcf41fb57b
|
@ -125,7 +125,12 @@ echo
|
|||
dest_dir=$MY_REPO/centos-repo
|
||||
timestamp="$(date +%F_%H%M)"
|
||||
|
||||
mock_cfg_proto_default=mock.cfg.proto
|
||||
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_dir=$MY_REPO/build-tools/repo_files
|
||||
mock_cfg_dest_dir=$MY_REPO/centos-repo
|
||||
comps_xml_file=$MY_REPO/build-tools/repo_files/comps.xml
|
||||
|
@ -384,6 +389,17 @@ process_lst_file () {
|
|||
done
|
||||
}
|
||||
|
||||
#
|
||||
# copy_with_backup: Copy a file to a directory or file.
|
||||
# If the file already exists at the destination,
|
||||
# a timestamped backup is created of the
|
||||
# prior file content by adding a
|
||||
# -backup-<timestamp> suffic to the file name.
|
||||
#
|
||||
# Usage:
|
||||
# copy_with_backup <src-file> <dest-dir>
|
||||
# copy_with_backup <src-file> <dest-file>
|
||||
#
|
||||
copy_with_backup () {
|
||||
local src_file="$1"
|
||||
local dest_dir="$2"
|
||||
|
@ -395,8 +411,12 @@ copy_with_backup () {
|
|||
fi
|
||||
|
||||
if [ ! -d ${dest_dir} ]; then
|
||||
echo "destination directory '${dest_dir}' does not exist!"
|
||||
exit 1
|
||||
dest_file="$2"
|
||||
dest_dir=$(dir_name ${dest_file})
|
||||
if [ ! -d ${dest_dir} ]; then
|
||||
echo "destination directory '${dest_dir}' does not exist!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f "${dest_file}" ]; then
|
||||
|
@ -448,14 +468,14 @@ done
|
|||
echo "Copying mock.cfg.proto file."
|
||||
|
||||
# First look for layer specific file to copy.
|
||||
mock_cfg_file="${mock_cfg_dir}/mock.cfg.${layer}.proto"
|
||||
mock_cfg_file="${mock_cfg_dir}/${mock_cfg_prefix}.${layer}.${mock_cfg_suffix}"
|
||||
if [ -f "$mock_cfg_file" ]; then
|
||||
copy_with_backup ${mock_cfg_file} ${mock_cfg_dest_dir}
|
||||
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_proto_default}
|
||||
copy_with_backup ${mock_cfg_file} ${mock_cfg_dest_dir}
|
||||
mock_cfg_file=${mock_cfg_dir}/${mock_cfg_prefix}.${mock_cfg_suffix}
|
||||
copy_with_backup ${mock_cfg_file} ${mock_cfg_dest_dir}/${mock_cfg_prefix}.${mock_cfg_default_suffix}
|
||||
|
||||
|
||||
echo "Copying contents from other list files."
|
||||
|
|
Loading…
Reference in New Issue