Blame SOURCES/copy-patches.sh

61e9b3
#!/bin/bash -
61e9b3
61e9b3
set -e
61e9b3
61e9b3
# Maintainer script to copy patches from the git repo to the current
61e9b3
# directory.  Use it like this:
61e9b3
#   ./copy-patches.sh
61e9b3
8984ae
rhel_version=8.7.0
61e9b3
61e9b3
# Check we're in the right directory.
61e9b3
if [ ! -f virt-v2v.spec ]; then
61e9b3
    echo "$0: run this from the directory containing 'virt-v2v.spec'"
61e9b3
    exit 1
61e9b3
fi
61e9b3
61e9b3
git_checkout=$HOME/d/virt-v2v-rhel-$rhel_version
61e9b3
if [ ! -d $git_checkout ]; then
61e9b3
    echo "$0: $git_checkout does not exist"
61e9b3
    echo "This script is only for use by the maintainer when preparing a"
61e9b3
    echo "virt-v2v release on RHEL."
61e9b3
    exit 1
61e9b3
fi
61e9b3
61e9b3
# Get the base version of virt-v2v.
61e9b3
version=`grep '^Version:' virt-v2v.spec | awk '{print $2}'`
61e9b3
tag="v$version"
61e9b3
61e9b3
# Remove any existing patches.
61e9b3
git rm -f [0-9]*.patch ||:
61e9b3
rm -f [0-9]*.patch
61e9b3
61e9b3
# Get the patches.
61e9b3
(cd $git_checkout; rm -f [0-9]*.patch; git format-patch -N --submodule=diff $tag)
61e9b3
mv $git_checkout/[0-9]*.patch .
61e9b3
61e9b3
# Remove any not to be applied.
61e9b3
rm -f *NOT-FOR-RPM*.patch
61e9b3
61e9b3
# Add the patches.
61e9b3
git add [0-9]*.patch
61e9b3
61e9b3
# Print out the patch lines.
61e9b3
echo
61e9b3
echo "--- Copy the following text into virt-v2v.spec file"
61e9b3
echo
61e9b3
61e9b3
echo "# Patches."
61e9b3
for f in [0-9]*.patch; do
61e9b3
    n=`echo $f | awk -F- '{print $1}'`
61e9b3
    echo "Patch$n:     $f"
61e9b3
done
61e9b3
61e9b3
echo
61e9b3
echo "--- End of text"