[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Quilt-dev] [PATCH] Add refresh hook quilt_refresh_check()
From: |
Jan Blunck |
Subject: |
[Quilt-dev] [PATCH] Add refresh hook quilt_refresh_check() |
Date: |
Wed, 10 Dec 2008 16:26:09 +0100 |
User-agent: |
Mutt/1.5.9i |
This patch adds a hook function that is called during refresh. At that point
in time an user specified script can be called. If the hook function signals
no error the refresh is permitted.
Here is an example from my ~/.quiltrc:
function quilt_refresh_check () {
local oldpatch=$1
local newpatch=$2
# Run scripts/checkpatch.pl
if [ -f scripts/checkpatch.pl ]
then
perl -w scripts/checkpatch.pl --no-tree $newpatch | \
grep -v "has no obvious"
fi
# Check if somebody from SUSE signed of this patch
if ! grep -Eiqe
"^(From|Signed-off-by|Acked-by):.*@(suse\.(de|com|cz)|novell.com)\>" $newpatch;
then
local ACKED_BY=$(git var GIT_COMMITTER_IDENT | \
sed -e 's/>.*/>/')
local LAST_SIGNED_OFF=$(cat $newpatch | \
sed -ne '/^Signed-off-by: /p' | sed -ne '$p')
local tmpfile=$(gen_tempfile)
if [ -n "$LAST_SIGNED_OFF" ] ; then
cat_file $newpatch | sed -e
"/^$LAST_SIGNED_OFF$/a\Acked-by: $ACKED_BY" > $tmpfile
else
cat_file $newpatch | sed -e "/^---$/i\Acked-by:
$ACKED_BY" > $tmpfile
fi
cat_to_new_file $newpatch < $tmpfile
rm -f $tmpfile
fi
return 0
}
---
quilt/refresh.in | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Index: b/quilt/refresh.in
===================================================================
--- a/quilt/refresh.in
+++ b/quilt/refresh.in
@@ -312,7 +312,11 @@ cat $tmp_patch >> $tmp_result
mkdir -p $(dirname $patch_file)
-if [ -e $patch_file ] && \
+if ( [ "$(type -t quilt_refresh_check 2> /dev/null)" = function ] && \
+ ! quilt_refresh_check $patch_file $tmp_result )
+then
+ printf $"Patch %s failed check\n" "$(print_patch $patch)"
+elif [ -e $patch_file ] && \
diff -q $patch_file $tmp_result > /dev/null
then
printf $"Patch %s is unchanged\n" "$(print_patch $patch)"
- [Quilt-dev] [PATCH] Add refresh hook quilt_refresh_check(),
Jan Blunck <=