mrc0mmand / rpms / libguestfs

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