Hello,

attached is a small patch that adds an option to perform a dry run with
spatchall.pl. The diff with the changes that would be made is printed
out, but the changes are not actually applied. Useful for testing new
scripts.


Regards,
Daniel Willmann
>From 83c52446070e95cc0b0e3c0d6436cc092be828b8 Mon Sep 17 00:00:00 2001
From: Daniel Willmann <d.willm...@samsung.com>
Date: Thu, 18 Oct 2012 14:28:56 +0100
Subject: [PATCH] spatchall.pl: Add -d - dry run option which only outputs the
 diff

This is useful when testing new coccinelle scripts.

Signed-off-by: Daniel Willmann <d.willm...@samsung.com>
---
 trunk/SCRIPTS/coccinelle/spatchall.sh |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/trunk/SCRIPTS/coccinelle/spatchall.sh b/trunk/SCRIPTS/coccinelle/spatchall.sh
index 29486bb..497450d 100755
--- a/trunk/SCRIPTS/coccinelle/spatchall.sh
+++ b/trunk/SCRIPTS/coccinelle/spatchall.sh
@@ -18,13 +18,15 @@ OPTIONS:
 	            spatchall.sh -t "ecore TMP/st/elementary" myscript.cocci
 
 	-q       Use very quiet spatch output
+	-d       Dry run (show diff, don't apply)
 
         -h       Show this help
 EOF
 }
 
+DRY_RUN="-in_place"
 
-while getopts "at:qh" flag
+while getopts "at:qdh" flag
 do
 	case "$flag" in
 	a)
@@ -36,6 +38,9 @@ do
 	q)
 		QUIET="-very_quiet"
 		;;
+	d)
+		DRY_RUN=""
+		;;
 	h)
 		usage
 		exit 0
@@ -69,7 +74,7 @@ function call_spatch {
 	spatch -sp-file $SCRIPT -macro_file_builtins ${TOPDIR}/SCRIPTS/coccinelle/ecocci.h \
 	       -I /usr/include/ -I /usr/local/include/ \
 	       $includes \
-	       $QUIET -all_includes -include_headers -relax_include_path -in_place $ARGS -dir ./
+	       $QUIET -all_includes -include_headers -relax_include_path $DRY_RUN $ARGS -dir ./
 	popd
 }
 
-- 
1.7.9.5

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to