From fb70377d73a1c74b8d3e2bbf7c376267ef079097 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 9 Aug 2022 09:50:56 +0100 Subject: [PATCH] Add copy-patches maintainer script from RHEL 9.1 --- copy-patches.sh | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ virt-what.spec | 3 +++ 2 files changed, 64 insertions(+) create mode 100755 copy-patches.sh diff --git a/copy-patches.sh b/copy-patches.sh new file mode 100755 index 0000000..af8f647 --- /dev/null +++ b/copy-patches.sh @@ -0,0 +1,61 @@ +#!/bin/bash - + +set -e + +# Maintainer script to copy patches from the git repo to the current +# directory. It's normally only used downstream (ie. in RHEL). Use +# it like this: +# ./copy-patches.sh + +project=virt-what +rhel_version=9.1 + +# Check we're in the right directory. +if [ ! -f $project.spec ]; then + echo "$0: run this from the directory containing '$project.spec'" + exit 1 +fi + +case `id -un` in + rjones) git_checkout=$HOME/d/$project-rhel-$rhel_version ;; + lacos) git_checkout=$HOME/src/v2v/$project ;; + *) git_checkout=$HOME/d/$project-rhel-$rhel_version ;; +esac +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 "$project release on RHEL." + exit 1 +fi + +# Get the base version of the project. +version=`grep '^Version:' $project.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 -c core.abbrev=9 format-patch -O/dev/null -N --submodule=diff $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 $project.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/virt-what.spec b/virt-what.spec index a3bc1b1..d637037 100644 --- a/virt-what.spec +++ b/virt-what.spec @@ -7,6 +7,9 @@ License: GPLv2+ URL: http://people.redhat.com/~rjones/virt-what/ Source0: http://people.redhat.com/~rjones/virt-what/files/%{name}-%{version}.tar.gz +# Maintainer script which helps with handling patches. +Source1: copy-patches.sh + BuildRequires: make BuildRequires: git BuildRequires: autoconf, automake, libtool