root/build-tools/patch_rebase_1
Scott Little 83d4446d74 Prepare the build tools for code restucturing
Build tools need to be made ready for the code
restructuring:

1) new repos
2) relocation of release-info.inc and bsp files
3) Removal of the stx- prefix from sub-repos.

Changes:
1) Create new functions to find the release-info.inc and
bsp file under both pre and post restructure paths.

2) Update .gitignore to ignore all the new repos that
are to be created.

3) Remove an argument sanity check from build-helm-charts.sh.
It is making invalid assumptions about where applications
can be found in the directory structure.

4) build-iso will need to look to additional repos to find
packages from lower layers.

Change-Id: If62444390d0a5a363974c6ff8cdaceca35978bda
Story: 2006166
Task: 35687
Signed-off-by: Scott Little <scott.little@windriver.com>
2019-09-05 15:18:10 -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/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