Blame SOURCES/copy-patches.sh

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