Blame SOURCES/copy-patches.sh

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