Blame SOURCES/copy-patches.sh

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