coccicheck: use $KBUILD_EXTMOD when available
Subsystems (2)
PATCH 1/1 coccicheck: use $KBUILD_EXTMOD when available
Use $KBUILD_EXTMOD instead of $srctree when the latter is not null to use make M=somedir.
--- scripts/coccicheck | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
scripts/coccicheck +7 -1
@@ -1,5 +1,11 @@ #!/bin/sh +if [ -n "$KBUILD_EXTMOD" ]; then + CHECK_DIR="$KBUILD_EXTMOD" +else + CHECK_DIR="$srctree" +fi + SPATCH="`which ${SPATCH:=spatch}`" if [ "$C" = "1" -o "$C" = "2" ]; then
@@ -64,7 +70,7 @@ coccinelle () { echo ' http://coccinelle.lip6.fr/' echo '' - $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $srctree || exit 1 + $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $CHECK_DIR || exit 1 else $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 fi
Signature · 1 line
1.7.0.4
Hi,
Quoted 26 lines · On Saturday 03 July 2010 17:20:34 Kulikov Vasiliy wrote:
Use $KBUILD_EXTMOD instead of $srctree when the latter is not null to use make M=somedir.
Signed-off-by Kulikov Vasiliy <[email protected]>--- scripts/coccicheck | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)scripts/coccicheck +6
-0@@ -1,5 +1,11 @@ #!/bin/sh +if [ -n "$KBUILD_EXTMOD" ]; then + CHECK_DIR="$KBUILD_EXTMOD" +else + CHECK_DIR="$srctree" +fi + SPATCH="`which ${SPATCH:=spatch}`" if [ "$C" = "1" -o "$C" = "2" ]; then
scripts/coccicheck coccinelle () { · line 76
Quoted 8 lines
scripts/coccicheck +1
-1@@ -64,7 +70,7 @@ coccinelle () { echo ' http://coccinelle.lip6.fr/' echo '' - $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $srctree || exit 1 + $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $CHECK_DIR || exit 1 else $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 fi
In doing so, the output of the patch mode will produce patches relative to $KBUILD_EXTMOD. I am not sure of what most of developers want but if the patches must be relative to the Linux kernel root, the following patch must be used.
Any preference ?
scripts/coccicheck +10 -3
@@ -1,5 +1,12 @@ #!/bin/sh +if [ -n "$KBUILD_EXTMOD" ]; then + CHECK_DIR="$srctree/$KBUILD_EXTMOD" + FLAGS="-patch $srctree" +else + CHECK_DIR="$srctree" +fi + SPATCH="`which ${SPATCH:=spatch}`" if [ "$C" = "1" -o "$C" = "2" ]; then
@@ -10,12 +17,12 @@ if [ "$C" = "1" -o "$C" = "2" ]; then # OPTIONS=$* # Workaround for Coccinelle < 0.2.3 - FLAGS="-I $srctree/include -very_quiet" + FLAGS="-I $srctree/include -very_quiet $FLAGS" shift $(( $# - 1 )) OPTIONS=$1 else ONLINE=0 - FLAGS="-very_quiet" + FLAGS="-very_quiet $FLAGS" fi if [ ! -x "$SPATCH" ]; then
@@ -64,7 +71,7 @@ coccinelle () { echo ' http://coccinelle.lip6.fr/' echo '' - $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $srctree || exit 1 + $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $CHECK_DIR || exit 1 else $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 fi
--
Nicolas Palix
Web: http://www.diku.dk/~npalix/
Hi,
Quoted 50 lines · Nicolas Palix
Hi,
Quoted 26 lines · On Saturday 03 July 2010 17:20:34 Kulikov Vasiliy wrote:
Use $KBUILD_EXTMOD instead of $srctree when the latter is not null to use make M=somedir.
Signed-off-by Kulikov Vasiliy <[email protected]>--- scripts/coccicheck | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)scripts/coccicheck +6
-0@@ -1,5 +1,11 @@ #!/bin/sh +if [ -n "$KBUILD_EXTMOD" ]; then + CHECK_DIR="$KBUILD_EXTMOD" +else + CHECK_DIR="$srctree" +fi + SPATCH="`which ${SPATCH:=spatch}`" if [ "$C" = "1" -o "$C" = "2" ]; thenscripts/coccicheck coccinelle () { · line 76
Quoted 8 lines
scripts/coccicheck +1
-1@@ -64,7 +70,7 @@ coccinelle () { echo ' http://coccinelle.lip6.fr/' echo '' - $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $srctree || exit 1 + $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $CHECK_DIR || exit 1 else $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 fiIn doing so, the output of the patch mode will produce patches relative to $KBUILD_EXTMOD. I am not sure of what most of developers want but if the patches must be relative to the Linux kernel root, the following patch must be used.
Any preference ?
scripts/coccicheck +0
-0
scripts/coccicheck line 5
Quoted 5 lines
scripts/coccicheck +3
-0@@ -1,5 +1,12 @@ #!/bin/sh +if [ -n "$KBUILD_EXTMOD" ]; then + CHECK_DIR="$srctree/$KBUILD_EXTMOD" + FLAGS="-patch $srctree"
$KBUILD_EXTMOD may be fullpath, e.g.:
make -C ../../.. M=$PWD
^^^^^^
So, I've got an error:
ERROR: File /home/vasya/dev/linux-next//home/vasya/linux/drivers/staging/sep does not exist: No such file or directory
With
CHECK_DIR="$KBUILD_EXTMOD"
FLAGS="-patch $srctree"
I've got such diff lines:
--- /home/vasya/linux/drivers/staging/spectra/flash.c 2010-07-02 17:38:48.764253994 +0400
+++ /tmp/nothing
It is not good too.
Quoted 31 lines · Nicolas Palix
Hi,
Quoted 28 lines · On Saturday 03 July 2010 17:20:34 Kulikov Vasiliy wrote:
Use $KBUILD_EXTMOD instead of $srctree when the latter is not null to use make M=somedir.
Signed-off-by Kulikov Vasiliy <[email protected]>--- scripts/coccicheck | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)scripts/coccicheck +6
-0@@ -1,5 +1,11 @@ #!/bin/sh +if [ -n "$KBUILD_EXTMOD" ]; then + CHECK_DIR="$KBUILD_EXTMOD" +else + CHECK_DIR="$srctree" +fi + SPATCH="`which ${SPATCH:=spatch}`" if [ "$C" = "1" -o "$C" = "2" ]; then@@ -64,7 +70,7 @@ coccinelle () { echo ' http://coccinelle.lip6.fr/' echo ''
Quoted 10 lines
scripts/coccicheck coccinelle () { · line 77
Quoted 6 lines
scripts/coccicheck +1
-1- $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $srctree || exit 1 + $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $CHECK_DIR || exit 1 else $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 fiIn doing so, the output of the patch mode will produce patches relative to $KBUILD_EXTMOD. I am not sure of what most of developers want but if the patches must be relative to the Linux kernel root, the following patch must be used.
If you are checking your out-of-tree module, then you're probably not going to send the resulting patch to lkml.
Michal
Hi,
Quoted 43 lines · On Wednesday 07 July 2010 13:04:36 Michal Marek wrote:
Quoted 31 lines · Nicolas Palix
Hi,
Quoted 28 lines · On Saturday 03 July 2010 17:20:34 Kulikov Vasiliy wrote:
Use $KBUILD_EXTMOD instead of $srctree when the latter is not null to use make M=somedir.
Signed-off-by Kulikov Vasiliy <[email protected]>--- scripts/coccicheck | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)scripts/coccicheck +6
-0@@ -1,5 +1,11 @@ #!/bin/sh +if [ -n "$KBUILD_EXTMOD" ]; then + CHECK_DIR="$KBUILD_EXTMOD" +else + CHECK_DIR="$srctree" +fi + SPATCH="`which ${SPATCH:=spatch}`" if [ "$C" = "1" -o "$C" = "2" ]; then@@ -64,7 +70,7 @@ coccinelle () { echo ' http://coccinelle.lip6.fr/' echo ''Quoted 10 lines
scripts/coccicheck coccinelle () { · line 77
Quoted 6 lines
scripts/coccicheck +1
-1- $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $srctree || exit 1 + $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $CHECK_DIR || exit 1 else $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 fiIn doing so, the output of the patch mode will produce patches relative to $KBUILD_EXTMOD. I am not sure of what most of developers want but if the patches must be relative to the Linux kernel root, the following patch must be used.
Quoted 3 lines
If you are checking your out-of-tree module, then you're probably not going to send the resulting patch to lkml.
Indeed. I thus acked the original patch last Monday [1].
Thanks.
[1] http://lkml.org/lkml/2010/7/5/136
Quoted 2 lines
Michal
Signature · 4 lines
Nicolas Palix Tel: (+33) 1 44 27 87 25 Tel: (+33) 6 81 07 91 72 Web: http://www.diku.dk/~npalix/
Quoted 26 lines · On Saturday 03 July 2010 17:20:34 Kulikov Vasiliy wrote:
Use $KBUILD_EXTMOD instead of $srctree when the latter is not null to use make M=somedir.
Signed-off-by Kulikov Vasiliy <[email protected]>--- scripts/coccicheck | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)scripts/coccicheck +6
-0@@ -1,5 +1,11 @@ #!/bin/sh +if [ -n "$KBUILD_EXTMOD" ]; then + CHECK_DIR="$KBUILD_EXTMOD" +else + CHECK_DIR="$srctree" +fi + SPATCH="`which ${SPATCH:=spatch}`" if [ "$C" = "1" -o "$C" = "2" ]; then
scripts/coccicheck coccinelle () { · line 76
Quoted 8 lines
scripts/coccicheck +1
-1@@ -64,7 +70,7 @@ coccinelle () { echo ' http://coccinelle.lip6.fr/' echo '' - $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $srctree || exit 1 + $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $CHECK_DIR || exit 1 else $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 fi
Signature · 2 lines
Nicolas Palix Web: http://www.diku.dk/~npalix/