drbd/suse-coccinelle.patch
2025-01-08 07:34:16 +00:00

72 lines
2.5 KiB
Diff

diff -Nupr a/drbd/drbd-kernel-compat/gen_compat_patch.sh b/drbd/drbd-kernel-compat/gen_compat_patch.sh
--- a/drbd/drbd-kernel-compat/gen_compat_patch.sh 2024-09-16 10:24:47.044861735 +0800
+++ b/drbd/drbd-kernel-compat/gen_compat_patch.sh 2024-09-16 10:32:03.256040980 +0800
@@ -43,9 +43,19 @@ fi
if hash spatch && spatch_is_recent; then
K=$(cat $incdir/kernelrelease.txt || echo unknown kernel release)
+
+ echo " compat.h content ";
+ cat $incdir/compat.h;
+ echo " ------------------- ";
+
echo " GENPATCHNAMES "$K
gcc -I $incdir -o $incdir/gen_patch_names -std=c99 drbd-kernel-compat/gen_patch_names.c
$incdir/gen_patch_names > $incdir/applied_cocci_files.txt
+
+ echo " APPLIED_COCCI_FILES ";
+ cat $incdir/applied_cocci_files.txt;
+ echo " ------------------- ";
+
rm $incdir/gen_patch_names
# truncat them all
: > $incdir/.compat.cocci
@@ -72,15 +82,28 @@ if hash spatch && spatch_is_recent; then
>> $incdir/.compat.cocci.tmp
done
+ coccilibpath=$(rpm -ql coccinelle|grep standard.h|xargs dirname);
+ echo " SPATCH_SOURCES: "$*;
+ echo " COCCI_LIBPATH: "$coccilibpath;
+
mv $incdir/.compat.cocci.tmp $incdir/.compat.cocci
mv $incdir/.compat.patch.tmp $incdir/.compat.patch
if [ -s $incdir/.compat.cocci ]; then
+ echo " GENCOCCIRULES .compat.cocci";
+ cat $incdir/.compat.cocci;
+
# sources=( ... ) passed in via environment
echo " SPATCH $chksum "$K
set +e
+
+ command="spatch --sp-file $incdir/.compat.cocci $@ --macro-file drbd-kernel-compat/cocci_macros.h --macro-file-builtins $coccilibpath/standard.h --iso-file $coccilibpath/standard.iso --very-quiet --all-includes > $compat_patch.tmp 2> $incdir/.spatch.stderr"
+ echo " SPATCH COMMAND $command ";
+
spatch --sp-file "$incdir/.compat.cocci" "${sources[@]}" \
--macro-file drbd-kernel-compat/cocci_macros.h \
+ --macro-file-builtins $coccilibpath/standard.h \
+ --iso-file $coccilibpath/standard.iso \
--very-quiet \
--all-includes \
${SPATCH_DEBUG:+ --debug} \
@@ -101,8 +124,18 @@ if hash spatch && spatch_is_recent; then
echo " SPATCH $chksum "$K" - nothing to do"
fi
+ echo " GENSPATCHFILE $compat_patch.tmp ";
+ cat $compat_patch.tmp;
+
if [ -s $incdir/.compat.patch ]; then
+ echo " EXIST $incdir/.compat.patch ";
cat $incdir/.compat.patch >> $compat_patch.tmp
+ cat $compat_patch.tmp;
+ fi
+
+ if [ -e $incdir/.spatch.stderr ]; then
+ echo " GENSPATCHERR .spatch.stderr";
+ cat $incdir/.spatch.stderr;
fi
if [ -s $compat_patch.tmp ]; then