mtd/patches patchin.sh,1.37,1.38

lavinen at infradead.org lavinen at infradead.org
Mon Feb 28 08:10:16 EST 2005


Update of /home/cvs/mtd/patches
In directory phoenix.infradead.org:/tmp/cvs-serv13789/patches

Modified Files:
	patchin.sh 
Log Message:
Added exclude list to avoid copying 2.4 files into 2.6 tree. Added editable locking support for bk files.


Index: patchin.sh
===================================================================
RCS file: /home/cvs/mtd/patches/patchin.sh,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- patchin.sh	17 Dec 2004 17:54:05 -0000	1.37
+++ patchin.sh	28 Feb 2005 13:10:13 -0000	1.38
@@ -136,6 +136,8 @@
 		echo -n "Error: the proper input file $INFILE does not exist";
 		return 1;
 	fi;
+
+	bkeditlock $OUTFILE
 	
 	if [ ! -f $OUTFILE ] || [ ! -r $OUTFILE ] || [ ! -w $OUTFILE ]; then
 		echo -n "Error: the proper output Kconfig file $INFILE does not exist";
@@ -197,6 +199,8 @@
 
 	local TOTAL=`cat $INFILE | wc -l`;
 
+	bkeditlock $INFILE
+	
 	# do not insert pattern if it is already present
 	if [ "x`grep "$NEWLINE" $INFILE`" != "x" ]; then
 		return 0;
@@ -273,6 +277,30 @@
 	exit 1
 }
 
+# Tests if the files is under version control or not
+function sfileexists() {
+    [ -e "`dirname $1`/SCCS/s.`basename $1`" ]
+    return
+}
+
+function bkunedit () {
+    local file
+    [ "$BK" = "yes" ] || return
+    for file in $*; do
+	sfileexists $file && bk unedit -q "$file"
+    done
+}
+
+# Obtain an editable lock of a local file in current directory if it is version
+# controlled under BK.
+function bkeditlock () {
+    local file
+    [ "$BK" = "yes" ] || return
+    for file in $*; do	
+	sfileexists $file && bk edit -q "$file"
+    done
+}
+
 # Function to patch kernel source
 function patchit () {
 	for DIR in $PATCH_DIRS 
@@ -281,12 +309,31 @@
 		mkdir -p $DIR
 		cd $TOPDIR/$DIR
 		FILES=`ls $PATCH_FILES 2>/dev/null`
+
+		# Remove excluded files
+		if [ "$EXCLUDE_FILES" != "" ]; then
+		    local EXLIST=`ls $EXCLUDE_FILES 2>/dev/null`
+		    if [ "$EXLIST" != "" ]; then
+			local FILELIST=""
+			local file
+			for file in $FILES; do
+			    local exclude=no
+			    for exfile in $EXLIST; do
+			        [ "$exfile" = "$file" ] && exclude=yes
+			    done
+			    [ "$exclude" = "no" ] && FILELIST="$FILELIST $file"
+			done
+			FILES=$FILELIST
+		    fi
+		fi
+
 		if [ "$BK" = "yes" -a -d $LINUXDIR/$DIR/SCCS ]; then
 		    pushd $LINUXDIR/$DIR
-		    rm -f $FILES
-		    bk co -ql $FILES
+		    bkunedit $FILES
+		    bkeditlock $FILES
 		    popd
 		fi
+
 		for FILE in $FILES 
 		do
 			# If there's a Makefile.common it goes in place of Makefile
@@ -306,6 +353,7 @@
 		done
 		cd $LINUXDIR
 	done	
+	EXCLUDE_FILES=""
 }
 
 # Preset variables
@@ -326,10 +374,12 @@
 # MTD - files and directories
 MTD_DIRS="drivers/mtd drivers/mtd/chips drivers/mtd/devices drivers/mtd/maps drivers/mtd/nand include/linux/mtd include/mtd"
 MTD_FILES="*.[ch] Makefile Rules.make"
+MTD_FILES_EX26="mtd_blkdevs-24.c blkmtd-24.c integrator-flash-v24.c"
 
 # JFFS2 files and directories
 JFFS2_DIRS="fs/jffs2"
 JFFS2_FILES="*.[ch] Makefile Rules.make"
+JFFS2_FILES_EX26="compr_lzari.c compr_lzo.c crc32.[hc] rbtree.c super-v24.c symlink-v24.c"
 # kernel version < 2.4.20 needs zlib headers
 JFFS2_INC_BEL2420="jffs*.h workqueue.h z*.h rb*.h suspend.h"
 # kernel version < 2.5.x
@@ -500,6 +550,9 @@
 echo "Patching MTD"
 PATCH_DIRS=$MTD_DIRS
 PATCH_FILES=$MTD_FILES
+if test $PATCHLEVEL -ge 6; then
+    EXCLUDE_FILES=$MTD_FILES_EX26;
+fi
 patchit;
 
 # some BUG() definitions were moved to asm/bug.h in the 2.5 kernels
@@ -524,6 +577,7 @@
 	PATCH_FILES=$ZLIB_FILES
 	patchit;
 
+	bkeditlock lib/Makefile
 	patch -p1 -i $TOPDIR/lib/patch-Makefile
 fi
 
@@ -535,6 +589,7 @@
 		patch -p1 -i $TOPDIR/lib/Makefile24-rs.diff
 		patch -p1 -i $TOPDIR/lib/Config.in-rs.diff
 	else
+	        bkeditlock lib/Makefile lib/Kconfig
 		patch -p1 -i $TOPDIR/lib/Makefile26-rs.diff
 		patch -p1 -i $TOPDIR/lib/Kconfig-rs.diff
 	fi
@@ -573,6 +628,7 @@
 echo "Patching Documentation"
 if [ "$DOCPATCH" = "yes" ]
 then
+    bkeditlock $DOC_DIRS/Makefile
     patch -p1 -i $TOPDIR/$DOC_DIRS/Makefile.diff
 fi
 
@@ -587,6 +643,9 @@
 	
 	PATCH_DIRS=$JFFS2_DIRS
 	PATCH_FILES=$JFFS2_FILES
+	if test $PATCHLEVEL -ge 6; then
+	    EXCLUDE_FILES=$JFFS2_FILES_EX26
+	fi
 	patchit;
 
 	PATCH_DIRS=$JFFS2_INC_DIR





More information about the linux-mtd-cvs mailing list