root/build-tools/patch_rebase_1
Scott Little d2d96619a2 Shorten "addons/wr-cgcs/layers/cgcs" to just "stx"
Part of the project to remove cgcs references.
Replace and shorten the path the needlessly long and
complex "addons/wr-cgcs/layers/cgcs" path with just "stx".

This update just fixes up paths found in scripts, comments
and config files.

Depends-On: https://review.openstack.org/579954
Depends-On: https://review.openstack.org/579957
Depends-On: https://review.openstack.org/580170
Depends-On: https://review.openstack.org/579984
Change-Id: I04d653f740f17d8a9b2732f26d36907f635d8950
Signed-off-by: Scott Little <scott.little@windriver.com>
2018-07-04 15:12:58 -04:00

131 lines
3.4 KiB
Bash
Executable File

#!/bin/bash
#
# Start an edit session for packages to be upgraded - pre upgrade version
#
usage () {
echo ""
echo "Step 1: Start an edit session for packages to be upgraded - pre upgrade version"
echo ""
echo "Usage: "
echo " patch_rebase_1 [--origin_branch <branch>] [--working_branch <branch>] [--upversion_data <file>]"
echo ""
echo "Assumes cgcs-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/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 $MY_REPO/cgcs-centos-repo
git checkout $WORKING_BRANCH
if [ $? != 0 ]; then
echo "ERROR: Can't checkout branch '$WORKING_BRANCH' in directory '$(pwd)'"
exit 1
fi
git checkout HEAD^
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 --clean $name
if [ $? -ne 0 ]; then
echo "ERROR: failed cmd 'build-pkgs --edit --clean $name'"
FAILED="$name $FAILED"
break
fi
echo "$? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
build-pkgs --edit $name
if [ $? -ne 0 ]; then
echo "ERROR: failed cmd 'build-pkgs --edit $name'"
FAILED="$name $FAILED"
break
fi
echo "$? <=<=<=<=<=<=<=<=<=<=<=<=<=<=<=<="
done
cd $MY_REPO/cgcs-centos-repo
git checkout $WORKING_BRANCH
if [ "$FAILED" != "" ]; then
echo "Failed build-pkgs --edit for ... $FAILED"
exit 1
fi