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>
130 lines
3.4 KiB
Bash
Executable File
130 lines
3.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
#
|
|
# Start an edit session for packages to be upgraded - post upgrade version
|
|
#
|
|
|
|
# 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
|
|
|
|
usage () {
|
|
echo ""
|
|
echo "Step 3: Start an edit session for packages to be upgraded - post upgrade version"
|
|
echo ""
|
|
echo "Usage: "
|
|
echo " patch_rebase_3 [--origin_branch <branch>] [--working_branch <branch>] [--upversion_data <file>]"
|
|
echo ""
|
|
echo "Assumes $(basename ${CENTOS_REPO}) already has a working_branch commit that sets the new symlinks."
|
|
echo ""
|
|
echo "The upversion_data file has data on all the src.rpm being updated in the format:"
|
|
echo " export UPVERSION_DATA=$MY_WORKSPACE/upversion.log"
|
|
echo " PKG=lighttpd"
|
|
echo " OLD_SRC_RPM=lighttpd-1.4.41-1.el7.src.rpm"
|
|
echo " NEW_SRC_RPM=lighttpd-1.4.41-2.el7.src.rpm"
|
|
echo " SRPM_PATH=$MY_REPO/stx/integ/extended/lighttpd/centos/srpm_path"
|
|
echo " echo \"\$PKG#\$SRPM_PATH##\$OLD_SRC_RPM#\$NEW_SRC_RPM\" > UPVERSION_DATA"
|
|
echo ""
|
|
}
|
|
|
|
|
|
TEMP=`getopt -o h --long origin_branch:,working_branch:,upversion_data:,help -n 'test.sh' -- "$@"`
|
|
eval set -- "$TEMP"
|
|
|
|
ORIGIN_BRANCH=""
|
|
WORKING_BRANCH=""
|
|
UPVERSION_LOG=""
|
|
HELP=0
|
|
|
|
while true ; do
|
|
case "$1" in
|
|
--origin_branch) shift ; ORIGIN_BRANCH="$1" ; shift ;;
|
|
--working_branch) shift ; WORKING_BRANCH="$1" ; shift ;;
|
|
--upversion_data) shift ; UPVERSION_LOG="$1" ; shift ;;
|
|
-h|--help) HELP=1 ; shift ;;
|
|
--) shift ; break ;;
|
|
*) usage; exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
if [ $HELP -eq 1 ]; then
|
|
usage
|
|
exit 0
|
|
fi
|
|
|
|
if [ "$UPVERSION_LOG" == "" ]; then
|
|
UPVERSION_LOG=$UPVERSION_DATA
|
|
fi
|
|
|
|
if [ "$UPVERSION_LOG" == "" ]; then
|
|
echo "ERROR: please specify location of upversion data"
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "$UPVERSION_LOG" ]; then
|
|
echo "File not found: '$UPVERSION_LOG'"
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$ORIGIN_BRANCH" == "" ] && [ "$WORKING_BRANCH" == "" ]; then
|
|
ORIGIN_BRANCH=$PATCH_SOURCE_BRANCH
|
|
WORKING_BRANCH=$MY_PATCH_BRANCH
|
|
fi
|
|
|
|
if [ "$ORIGIN_BRANCH" == "" ] && [ "$WORKING_BRANCH" == "" ]; then
|
|
ORIGIN_BRANCH=$SOURCE_BRANCH
|
|
WORKING_BRANCH=$MY_BRANCH
|
|
fi
|
|
|
|
if [ "$ORIGIN_BRANCH" == "" ]; then
|
|
echo "ERROR: please specify a origin branch"
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$WORKING_BRANCH" == "" ]; then
|
|
echo "ERROR: please specify a working branch"
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
# One step back to see the old symlinks
|
|
cd ${CENTOS_REPO}
|
|
git checkout $WORKING_BRANCH
|
|
if [ $? != 0 ]; then
|
|
echo "ERROR: Can't checkout branch '$WORKING_BRANCH' in directory '${CENTOS_REPO}'"
|
|
exit 1
|
|
fi
|
|
|
|
FAILED=""
|
|
for dat in $(cat $UPVERSION_LOG); do
|
|
name=$(echo $dat | awk -F '#' '{print $1}')
|
|
srpm_path=$(echo $dat | awk -F '#' '{print $2}')
|
|
old_src_rpm=$(echo $dat | awk -F '#' '{print $4}')
|
|
new_src_rpm=$(echo $dat | awk -F '#' '{print $5}')
|
|
|
|
echo "$name $old_src_rpm $new_src_rpm"
|
|
|
|
build-pkgs --edit $name --no-meta-patch
|
|
if [ $? -ne 0 ]; then
|
|
echo "ERROR: failed cmd 'build-pkgs --edit $name'"
|
|
FAILED="$name $FAILED"
|
|
break
|
|
fi
|
|
echo "$? <=<=<=<=<=<=<=<=<=<=<=<=<=<=<=<="
|
|
done
|
|
|
|
if [ "$FAILED" != "" ]; then
|
|
echo "Failed build-pkgs --edit for ... $FAILED"
|
|
exit 1
|
|
fi
|
|
|
|
|