linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: flake@sedum.tommyk.com
To: linux-kernel@vger.kernel.org
Subject: Patch to add -pre support to scripts/patch-kernel
Date: Fri, 04 Apr 2003 15:31:12 -0500	[thread overview]
Message-ID: <3E8DEB90.nail3XN1CAUHF@sedum.tommyk.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 132 bytes --]

Hope someone finds it usefull.
This is diffed from the script in 2.4.20

flames to jason(at)jasongurtz(dot)com

Cheers,

Jason

-- 

[-- Attachment #2: patch-kernel--with-pre.diff --]
[-- Type: text/plain, Size: 6075 bytes --]

--- patch-kernel	Fri Aug  2 20:39:46 2002
+++ patch-kernel--with-pre	Fri Apr  4 14:41:22 2003
@@ -1,6 +1,7 @@
 #! /bin/sh
 # Script to apply kernel patches.
-#   usage: patch-kernel [ sourcedir [ patchdir [ stopversion ] [ -acxx ] ] ]
+#   usage: patch-kernel [ sourcedir [ patchdir [ stopversion ]...
+#	                    ...[[ -ac[xx] ] || [ -pre[xx] ]] ]
 #     The source directory defaults to /usr/src/linux, and the patch
 #     directory defaults to the current directory.
 # e.g.
@@ -18,6 +19,11 @@
 #   Note: It uses the patches relative to the Linus kernels, not the
 #   ac to ac relative patches
 #
+#   scripts/patch-kernel . .. -pre
+#      Gets latest kernel and patch it with the latest testing patch
+#	Note: testing patches are not incremental. e.g to get 2.4.21-pre6
+#	      you need linux-2.4.20 and patch-2.4.21-pre6
+#
 # It determines the current kernel version from the top-level Makefile.
 # It then looks for patches for the next sublevel in the patch directory.
 # This is applied using "patch -p1 -s" from within the kernel directory.
@@ -40,6 +46,9 @@
 #
 # Added -ac option, use -ac or -ac9 (say) to stop at a particular version
 #       Dave Gilbert <linux@treblig.org>, 29th September 2001.
+#
+# Added -pre option, use like -ac option above
+#		Jason Gurtz <jason@jasongurtz.com>, 4th April 2003.
 
 # Set directories from arguments, or use defaults.
 sourcedir=${1-/usr/src/linux}
@@ -48,20 +57,29 @@
 
 if [ "$1" = -h -o "$1" = --help -o ! -r "$sourcedir/Makefile" ]; then
 cat << USAGE
-usage: patch-kernel [-h] [ sourcedir [ patchdir [ stopversion ] [ -acxx ] ] ]
-  The source directory defaults to /usr/src/linux, and
-  the patch directory defaults to the current directory.
+--------------------------------------------------------------------------------
+usage: patch-kernel [-h] [ sourcedir [ patchdir [ stopversion ]...
+                    ...[[ -ac[xx] ] || [ -pre[xx] ]] ]
+
+	- The source directory defaults to /usr/src/linux, and
+	  the patch directory defaults to the current directory.
+	  
+	- For -ac and -pre, optional "xx" is patch version number to stop at
+--------------------------------------------------------------------------------
 USAGE
 exit 1
 fi
 
-# See if we have any -ac options
+# See if we have any -ac or -pre options
 for PARM in $*
 do
-  case $PARM in
-	  -ac*)
-		  gotac=$PARM;
-
+	case $PARM in
+		-ac*)
+			gotac=$PARM;
+		;;	
+		-pre*)
+			gotpre=$PARM;
+		;;
 	esac;
 done
 
@@ -77,7 +95,7 @@
 		uncomp="gunzip -dc"
   elif [ -r ${filebase}.bz  ]; then
 		ext=".bz"
-    name="bzip"
+	    name="bzip"
 		uncomp="bunzip -dc"
   elif [ -r ${filebase}.bz2 ]; then
 		ext=".bz2"
@@ -128,6 +146,14 @@
 
 # set current VERSION, PATCHLEVEL, SUBLEVEL, EXTERVERSION
 eval `sed -n -e 's/^\([A-Z]*\) = \([0-9]*\)$/\1=\2/p' -e 's/^\([A-Z]*\) = \(-[-a-z0-9]*\)$/\1=\2/p' $sourcedir/Makefile`
+
+# In the case of -pre, we need to pretend we have the next CURRENTFULLVERSION :)
+if [ $gotpre ]
+then
+	echo "Faking Kernel Version so -pre patches work.  Don't be alarmed ;)"
+	(( SUBLEVEL++ ))
+fi
+
 if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ]
 then
     echo "unable to determine current kernel version" >&2
@@ -145,7 +171,8 @@
 while :
 do
     CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
-    if [ $stopvers = $CURRENTFULLVERSION ]
+
+    if [ $stopvers = $CURRENTFULLVERSION ];
     then
         echo "Stoping at $CURRENTFULLVERSION base as requested."
         break
@@ -163,12 +190,13 @@
     applyPatch $patch || break
 done
 
-if [ x$gotac != x ]; then
-  # Out great user wants the -ac patches
-	# They could have done -ac (get latest) or -acxx where xx=version they want
-	if [ $gotac == "-ac" ]
+if [ "$gotac" != "x" ] || [ "$gotpre" != "x" ]
+then
+	# Our great user wants the -ac or -pre patches
+	# They could have done -ac or -pre (get latest) or -acxx or -prexx where xx=version they want
+	if [ "$gotac" == "-ac" ]
 	then
-	  # They want the latest version
+	  # They want the latest -ac version
 		HIGHESTPATCH=0
 		for PATCHNAMES in $patchdir/patch-${CURRENTFULLVERSION}-ac*\.*
 		do
@@ -176,10 +204,10 @@
 			# Check it is actually a recognised patch type
 			findFile $patchdir/patch-${CURRENTFULLVERSION}-ac${ACVALUE} || break
 
-		  if [ $ACVALUE -gt $HIGHESTPATCH ]
+			if [ $ACVALUE -gt $HIGHESTPATCH ]
 			then
-			  HIGHESTPATCH=$ACVALUE
-		  fi
+				HIGHESTPATCH=$ACVALUE
+			fi
 		done
 
 		if [ $HIGHESTPATCH -ne 0 ]
@@ -187,16 +215,46 @@
 			findFile $patchdir/patch-${CURRENTFULLVERSION}-ac${HIGHESTPATCH} || break
 			applyPatch patch-${CURRENTFULLVERSION}-ac${HIGHESTPATCH}
 		else
-		  echo "No ac patches found"
+			echo "No ac patches found"
+		fi
+	elif [ "$gotpre" == "-pre" ]
+	then
+		# They want the latest -pre version
+		HIGHESTPATCH=0
+		for PATCHNAMES in $patchdir/patch-${CURRENTFULLVERSION}-pre*\.*
+		do
+			PREVALUE=`echo $PATCHNAMES | sed -e 's/^.*patch-[0-9.]*-pre\([0-9]*\).*/\1/'`
+			# Check it is actually a recognised patch type
+			findFile $patchdir/patch-${CURRENTFULLVERSION}-pre${PREVALUE} || break
+
+			if [ $PREVALUE -gt $HIGHESTPATCH ]
+			then
+				HIGHESTPATCH=$PREVALUE
+			fi
+		done
+		if [ $HIGHESTPATCH -ne 0 ]
+		then
+			findFile $patchdir/patch-${CURRENTFULLVERSION}-pre${HIGHESTPATCH} || break
+			applyPatch patch-${CURRENTFULLVERSION}-pre${HIGHESTPATCH}
+		else
+		  echo "No pre patches found"
 		fi
-	else
-	  # They want an exact version
+	elif [ $gotac ]
+	then
+		# They want an exact -ac version
 		findFile $patchdir/patch-${CURRENTFULLVERSION}${gotac} || {
-		  echo "Sorry, I couldn't find the $gotac patch for $CURRENTFULLVERSION.  Hohum."
+			echo "Sorry, I couldn't find the $gotac patch for $CURRENTFULLVERSION.  Hohum."
 			exit 1
 		}
 		applyPatch patch-${CURRENTFULLVERSION}${gotac}
+	elif [ $gotpre ]
+	then
+		# They want an exact -pre version
+		findFile $patchdir/patch-${CURRENTFULLVERSION}${gotpre} || {
+			echo "Sorry, I couldn't find the $gotpre patch for $CURRENTFULLVERSION.  Hohum."
+			exit 1
+		}
+		applyPatch patch-${CURRENTFULLVERSION}${gotpre}
 	fi
 fi
-
-
+# EOF

                 reply	other threads:[~2003-04-04 20:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E8DEB90.nail3XN1CAUHF@sedum.tommyk.com \
    --to=flake@sedum.tommyk.com \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: Patch to add -pre support to scripts/patch-kernel' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox