Copy mock.cfg.proto and comps.xml files into cgcs-centos-repo

Story: 2002936
Task: 23082

Depends-On: https://review.openstack.org/#/c/584214/
Change-Id: Id1015400b3a68f1447d1690bb19da9abb97d4dc5
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
This commit is contained in:
Erich Cordoba 2018-07-20 17:34:20 -05:00
parent 8d081a2b68
commit 0d1f1f9b9b
1 changed files with 25 additions and 59 deletions

View File

@ -22,7 +22,10 @@ fi
mirror_dir=$1
dest_dir=$MY_REPO/cgcs-centos-repo
timestamp="$(date +%F_%H%M)"
mock_cfg_file=$dest_dir/mock.cfg.proto
mock_cfg_file=$MY_REPO/build-tools/repo_files/mock.cfg.proto
comps_xml_file=$MY_REPO/build-tools/repo_files/comps.xml
mock_cfg_dest_file=$MY_REPO/cgcs-centos-repo/mock.cfg.proto
comps_xml_dest_file=$MY_REPO/cgcs-centos-repo/Binary/comps.xml
if [[ ( ! -d $mirror_dir/Binary ) || ( ! -d $mirror_dir/Source ) ]]; then
echo "The mirror $mirror_dir doesn't has the Binary and Source"
@ -58,64 +61,27 @@ for t in "Binary" "Source" ; do
done
done
read -r -d '' MOCK_CFG <<-EOF
config_opts['root'] = 'BUILD_ENV/mock'
config_opts['target_arch'] = 'x86_64'
config_opts['legal_host_arches'] = ('x86_64',)
config_opts['chroot_setup_cmd'] = 'install @buildsys-build'
config_opts['dist'] = 'el7' # only useful for --resultdir variable subst
config_opts['releasever'] = '7'
config_opts['rpmbuild_networking'] = False
config_opts['yum.conf'] = """
[main]
keepcache=1
debuglevel=2
reposdir=/dev/null
logfile=/var/log/yum.log
retries=20
obsoletes=1
gpgcheck=0
assumeyes=1
syslog_ident=mock
syslog_device=
# repos
[local-std]
name=local-std
baseurl=LOCAL_BASE/MY_BUILD_DIR/std/rpmbuild/RPMS
enabled=1
skip_if_unavailable=1
metadata_expire=0
[local-rt]
name=local-rt
baseurl=LOCAL_BASE/MY_BUILD_DIR/rt/rpmbuild/RPMS
enabled=1
skip_if_unavailable=1
metadata_expire=0
[local-installer]
name=local-installer
baseurl=LOCAL_BASE/MY_BUILD_DIR/installer/rpmbuild/RPMS
enabled=1
skip_if_unavailable=1
metadata_expire=0
[TisCentos7Distro]
name=Tis-Centos-7-Distro
enabled=1
baseurl=LOCAL_BASE/MY_REPO_DIR/cgcs-centos-repo/Binary
failovermethod=priority
exclude=kernel-devel libvirt-devel
"""
EOF
if [ -f "$mock_cfg_file" ]; then
mv "$mock_cfg_file" "$mock_cfg_file-backup-$timestamp"
if [ ! -f "$mock_cfg_file" ]; then
echo "Cannot find mock.cfg.proto file!"
exit 1
fi
echo "Creating mock config file"
echo "$MOCK_CFG" >> "$mock_cfg_file"
if [ ! -f "$comps_xml_file" ]; then
echo "Cannot find comps.xml file!"
exit 1
fi
echo "Copying mock.cfg.proto and comps.xml files."
if [ -f "$mock_cfg_dest_file" ]; then
cp "$mock_cfg_dest_file" "$mock_cfg_dest_file-backup-$timestamp"
fi
cp "$mock_cfg_file" "$mock_cfg_dest_file"
if [ -f "$comps_xml_dest_file" ]; then
cp "$comps_xml_dest_file" "$comps_xml_dest_file-backup-$timestamp"
fi
cp "$comps_xml_file" "$comps_xml_dest_file"
echo "Done"