From 1854f3665b03a39e0bd81848c86e3a31014d6212 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 3 Dec 2020 13:35:45 +0000 Subject: [PATCH] Add copy-patches.sh maintainer script from RHEL. --- copy-patches.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ nbdkit.spec | 3 +++ 2 files changed, 58 insertions(+) create mode 100755 copy-patches.sh diff --git a/copy-patches.sh b/copy-patches.sh new file mode 100755 index 0000000..2682a17 --- /dev/null +++ b/copy-patches.sh @@ -0,0 +1,55 @@ +#!/bin/bash - + +set -e + +# Maintainer script to copy patches from the git repo to the current +# directory. Use it like this: +# ./copy-patches.sh + +rhel_version=8.3 + +# Check we're in the right directory. +if [ ! -f nbdkit.spec ]; then + echo "$0: run this from the directory containing 'nbdkit.spec'" + exit 1 +fi + +git_checkout=$HOME/d/nbdkit-rhel-$rhel_version +if [ ! -d $git_checkout ]; then + echo "$0: $git_checkout does not exist" + echo "This script is only for use by the maintainer when preparing a" + echo "nbdkit release on RHEL." + exit 1 +fi + +# Get the base version of nbdkit. +version=`grep '^Version:' nbdkit.spec | awk '{print $2}'` +tag="v$version" + +# Remove any existing patches. +git rm -f [0-9]*.patch ||: +rm -f [0-9]*.patch + +# Get the patches. +(cd $git_checkout; rm -f [0-9]*.patch; git format-patch -N $tag) +mv $git_checkout/[0-9]*.patch . + +# Remove any not to be applied. +rm -f *NOT-FOR-RPM*.patch + +# Add the patches. +git add [0-9]*.patch + +# Print out the patch lines. +echo +echo "--- Copy the following text into nbdkit.spec file" +echo + +echo "# Patches." +for f in [0-9]*.patch; do + n=`echo $f | awk -F- '{print $1}'` + echo "Patch$n: $f" +done + +echo +echo "--- End of text" diff --git a/nbdkit.spec b/nbdkit.spec index 46cfc44..28692ff 100644 --- a/nbdkit.spec +++ b/nbdkit.spec @@ -64,6 +64,9 @@ Source1: http://libguestfs.org/download/nbdkit/%{source_directory}/%{name Source2: libguestfs.keyring %endif +# Maintainer script which helps with handling patches. +Source3: copy-patches.sh + %if 0%{patches_touch_autotools} BuildRequires: autoconf, automake, libtool %endif