2020-12-16 21:58:33 +00:00
|
|
|
#!/bin/bash -
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Maintainer script to copy patches from the git repo to the current
|
|
|
|
# directory. Use it like this:
|
|
|
|
# ./copy-patches.sh
|
|
|
|
|
2021-12-02 10:46:00 +00:00
|
|
|
project=virt-v2v
|
2023-11-10 15:21:13 +00:00
|
|
|
rhel_version=9.4
|
2020-12-16 21:58:33 +00:00
|
|
|
|
|
|
|
# Check we're in the right directory.
|
2021-12-02 10:46:00 +00:00
|
|
|
if [ ! -f $project.spec ]; then
|
|
|
|
echo "$0: run this from the directory containing '$project.spec'"
|
2020-12-16 21:58:33 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-12-02 10:46:00 +00:00
|
|
|
case `id -un` in
|
|
|
|
rjones) git_checkout=$HOME/d/$project-rhel-$rhel_version ;;
|
2021-12-13 12:18:07 +00:00
|
|
|
lacos) git_checkout=$HOME/src/v2v/$project ;;
|
2021-12-02 10:46:00 +00:00
|
|
|
*) git_checkout=$HOME/d/$project-rhel-$rhel_version ;;
|
|
|
|
esac
|
2020-12-16 21:58:33 +00:00
|
|
|
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"
|
2021-12-02 10:46:00 +00:00
|
|
|
echo "$project release on RHEL."
|
2020-12-16 21:58:33 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-12-02 10:46:00 +00:00
|
|
|
# Get the base version of the project.
|
|
|
|
version=`grep '^Version:' $project.spec | awk '{print $2}'`
|
2020-12-16 21:58:33 +00:00
|
|
|
tag="v$version"
|
|
|
|
|
|
|
|
# Remove any existing patches.
|
|
|
|
git rm -f [0-9]*.patch ||:
|
|
|
|
rm -f [0-9]*.patch
|
|
|
|
|
|
|
|
# Get the patches.
|
2022-07-29 13:23:37 +00:00
|
|
|
(
|
|
|
|
cd $git_checkout
|
|
|
|
rm -f [0-9]*.patch
|
|
|
|
git -c core.abbrev=8 format-patch -O/dev/null --subject-prefix=PATCH -N \
|
|
|
|
--submodule=diff --no-signature --patience $tag
|
|
|
|
)
|
2020-12-16 21:58:33 +00:00
|
|
|
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
|
2021-12-02 10:46:00 +00:00
|
|
|
echo "--- Copy the following text into $project.spec file"
|
2020-12-16 21:58:33 +00:00
|
|
|
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"
|