Blame SOURCES/copy-patches.sh

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