01c5009d7d
I want the build to work with either centos-repo or cgcs-centos-repo. In many places we will be testing for the existance centos-repo as the prefered path, then fall back to cgcs-centos-repo as an alternative. If neither are present, either exit or continue but assuming the new path is intended. NOTE: The patch_rebase_1/2/3/4 scripts remain broken, but I hope to salvage them one day. The current coding assumes content under centos-repo/cgcs-centos-repo is managed by a git, which is not currently true. Story: 2006387 Task: 36912 Change-Id: I8f694814c41957c5b37eb2e64b653b7d42f2e2c9 Signed-off-by: Scott Little <scott.little@windriver.com>
83 lines
2.2 KiB
Bash
Executable File
83 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
#
|
|
# usage: create-yum-conf [<layer>]
|
|
#
|
|
|
|
LAYER=${1:-$LAYER}
|
|
|
|
if [ "$MY_WORKSPACE" == "" ]; then
|
|
echo "ERROR: MY_WORKSPACE not defined"
|
|
exit 1;
|
|
fi
|
|
|
|
if [ "$MY_REPO" == "" ]; then
|
|
echo "ERROR: MY_REPO not defined"
|
|
exit 1;
|
|
fi
|
|
|
|
if [ "$MY_BUILD_ENVIRONMENT" == "" ]; then
|
|
echo "ERROR: MY_BUILD_ENVIRONMENT not defined"
|
|
exit 1;
|
|
fi
|
|
|
|
if [ "$MY_BUILD_DIR" == "" ]; then
|
|
echo "ERROR: MY_BUILD_DIR not defined"
|
|
exit 1;
|
|
fi
|
|
|
|
MY_YUM_CONF="$MY_WORKSPACE/yum.conf"
|
|
YUM_DIR="$MY_WORKSPACE/yum"
|
|
YUM_CACHE="$YUM_DIR/cache"
|
|
|
|
# For backward compatibility. Old repo location or new?
|
|
CENTOS_REPO=${MY_REPO}/centos-repo
|
|
if [ ! -d ${CENTOS_REPO} ]; then
|
|
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
|
|
if [ ! -d ${CENTOS_REPO} ]; then
|
|
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Try to find a layer specific mock.cfg.proto
|
|
MOCK_CFG_PROTO="${CENTOS_REPO}/mock.cfg.${LAYER}.proto"
|
|
if [ ! -f "$MOCK_CFG_PROTO" ]; then
|
|
# Not present, Use default mock.cfg.proto
|
|
MOCK_CFG_PROTO="${CENTOS_REPO}/mock.cfg.proto"
|
|
fi
|
|
|
|
|
|
if [ -f "$MOCK_CFG_PROTO" ]; then
|
|
if [ -f "$MY_YUM_CONF" ]; then
|
|
N=$(find $MOCK_CFG_PROTO $MY_REPO/build-tools/create-yum-conf -cnewer $MY_YUM_CONF | wc -l)
|
|
if [ $N -gt 0 ]; then
|
|
# New inputs, remove to force regeneration of yum.conf
|
|
\rm -f "$MY_YUM_CONF"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
if [ ! -f "$MY_YUM_CONF" ]; then
|
|
if [ -f "$MOCK_CFG_PROTO" ]; then
|
|
mock_cfg_to_yum_conf.py "$MOCK_CFG_PROTO" > "$MY_YUM_CONF"
|
|
sed -i "s%\[main\]%&\ncachedir=$YUM_CACHE%" "$MY_YUM_CONF"
|
|
sed -i "s%logfile=.*%logfile=$YUM_DIR/yum.log%" "$MY_YUM_CONF"
|
|
sed -i "s%LOCAL_BASE%file://%g" "$MY_YUM_CONF"
|
|
sed -i "s%MIRROR_BASE%file:///import/mirrors%g" "$MY_YUM_CONF"
|
|
sed -i "s%BUILD_ENV%$MY_BUILD_ENVIRONMENT%g" "$MY_YUM_CONF"
|
|
sed -i "s%/MY_BUILD_DIR%$MY_BUILD_DIR%g" "$MY_YUM_CONF"
|
|
sed -i "s%/MY_REPO_DIR%$MY_REPO%g" "$MY_YUM_CONF"
|
|
else
|
|
echo "ERROR: Could not find yum.conf or MOCK_CFG_PROTO"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if [ ! -d "$YUM_CACHE" ]; then
|
|
mkdir -p "$YUM_CACHE"
|
|
fi
|
|
|
|
echo "$MY_YUM_CONF"
|
|
exit 0
|