mrc0mmand / rpms / libguestfs

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