StarlingX mirror bug fixes

1) Can't checkout in a bare repository.

2) typo, reposdir, not repodir.

3) Failed to replace 'cengn' with 'stx_mirror' in utils.sh.

4) 'stx_mirror' should use 'L1' matching

5) Fix up, and comment, the logic in download_mirror.sh
   that processes various combinations of
   [-c <yum.conf>] and [-s|-S|-u|-U] flags.

Change-Id: I4d2a89efc049f62e7815a9d9ec8383edcde80367
Story: 2003906
Task: 26785
Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
Scott Little 2018-11-02 17:12:57 -04:00
parent 51976e3b31
commit f10be3d161
3 changed files with 40 additions and 34 deletions

View File

@ -189,7 +189,10 @@ fi
if [ $use_system_yum_conf -eq 0 ]; then
need_file "${alternate_yum_conf}"
if [ "$alternate_repo_dir" == "" ]; then
alternate_repo_dir=$(grep '^repodir=' "${alternate_yum_conf}" | cut -d '=' -f 2)
alternate_repo_dir=$(grep '^reposdir=' "${alternate_yum_conf}" | cut -d '=' -f 2)
if [ "$alternate_repo_dir" == "" ]; then
alternate_repo_dir="$(dirname "${alternate_yum_conf}"/yum.repos.d)"
fi
need_dir "${alternate_repo_dir}"
fi
fi
@ -197,38 +200,49 @@ fi
TEMP_DIR=""
rpm_downloader_extra_args="${rpm_downloader_extra_args} -D $distro"
if [ "$dl_flag" == "" ]; then
if [ "$dl_flag" != "" ]; then
# Pass dl_flag on to the rpm_downloader script
rpm_downloader_extra_args="${rpm_downloader_extra_args} $dl_flag"
fi
if ! dl_from_stx; then
# Not using stx mirror
if [ $use_system_yum_conf -eq 0 ]; then
# Use provided yum.conf unaltered.
rpm_downloader_extra_args="${rpm_downloader_extra_args} -c ${alternate_yum_conf}"
fi
else
rpm_downloader_extra_args="${rpm_downloader_extra_args} $dl_flag"
# We want to use stx mirror, so we need to create a new, modified yum.conf and yum.repos.d.
# The modifications will add or substitute repos pointing to the StralingX mirror.
TEMP_DIR=$(mktemp -d /tmp/stx_mirror_XXXXXX)
TEMP_CONF="$TEMP_DIR/yum.conf"
need_file ${make_stx_mirror_yum_conf}
need_dir ${TEMP_DIR}
if ! dl_from_stx; then
if [ $use_system_yum_conf -eq 0 ]; then
rpm_downloader_extra_args="${rpm_downloader_extra_args} -c ${alternate_yum_conf}"
if [ $use_system_yum_conf -eq 0 ]; then
# Modify user provided yum.conf. We expect ir to have a 'reposdir=' entry to
# point to the repos that need to be modified as well.
if dl_from_upstream; then
# add
${make_stx_mirror_yum_conf} -R -d $TEMP_DIR -y $alternate_yum_conf -r $alternate_repo_dir -D $distro
else
# substitute
${make_stx_mirror_yum_conf} -d $TEMP_DIR -y $alternate_yum_conf -r $alternate_repo_dir -D $distro
fi
else
TEMP_DIR=$(mktemp -d /tmp/stx_mirror_XXXXXX)
TEMP_CONF="$TEMP_DIR/yum.conf"
need_file ${make_stx_mirror_yum_conf}
need_dir ${TEMP_DIR}
if [ $use_system_yum_conf -eq 0 ]; then
if dl_from_upstream; then
${make_stx_mirror_yum_conf} -R -d $TEMP_DIR -y $alternate_yum_conf -r $alternate_repo_dir -D $distro
else
${make_stx_mirror_yum_conf} -d $TEMP_DIR -y $alternate_yum_conf -r $alternate_repo_dir -D $distro
fi
rpm_downloader_extra_args="${rpm_downloader_extra_args} -c $TEMP_CONF"
# Modify system yum.conf and yum.repos.d. Remember that we expect to run this
# inside a container, and the system yum.conf has like been modified else where
# in these scripts.
if dl_from_upstream; then
# add
${make_stx_mirror_yum_conf} -R -d $TEMP_DIR -y /etc/yum.conf -r /etc/yum.repos.d -D $distro
else
if dl_from_upstream; then
${make_stx_mirror_yum_conf} -R -d $TEMP_DIR -y /etc/yum.conf -r /etc/yum.repos.d -D $distro
else
${make_stx_mirror_yum_conf} -d $TEMP_DIR -y /etc/yum.conf -r /etc/yum.repos.d -D $distro
fi
rpm_downloader_extra_args="${rpm_downloader_extra_args} -c $TEMP_CONF"
# substitute
${make_stx_mirror_yum_conf} -d $TEMP_DIR -y /etc/yum.conf -r /etc/yum.repos.d -D $distro
fi
fi
rpm_downloader_extra_args="${rpm_downloader_extra_args} -c $TEMP_CONF"
fi
list=${rpms_from_3rd_parties}

View File

@ -171,15 +171,6 @@ dl_git_from_url () {
return 1
fi
CMD="git checkout '$BRANCH'"
echo "$CMD"
eval $CMD
if [ $? -ne 0 ]; then
echo "Error: $CMD"
cd "$SAVE_DIR"
return 1
fi
cd "$SAVE_DIR"
return 0
}

View File

@ -40,10 +40,11 @@ get_rpm_level_name() {
local _level=$2
if [ $_level == "L1" ]; then
SFILE=`echo $_rpm_name | rev | cut -d'.' -f3- | rev`
elif [ $_level == "$dl_from_stx_mirror" ];then
# stx mirror uses L1 matches
SFILE=`echo $_rpm_name | rev | cut -d'.' -f3- | rev`
elif [ $_level == "L2" ];then
SFILE=`echo $_rpm_name | rev | cut -d'-' -f2- | rev`
elif [ $_level == "cengn" ];then
SFILE=`echo $_rpm_name | rev | cut -d'-' -f2- | rev`
else
SFILE=`echo $_rpm_name | rev | cut -d'-' -f3- | rev`
fi