From: "Randy.Dunlap" <rddunlap@osdl.org>
To: Greg Norris <haphazard@kc.rr.com>
Cc: linux-kernel@vger.kernel.org, akpm <akpm@osdl.org>, sam@ravnborg.org
Subject: [PATCH] scripts/patch-kernel: use EXTRAVERSION
Date: Wed, 18 Aug 2004 13:57:51 -0700 [thread overview]
Message-ID: <20040818135751.197ce3c9.rddunlap@osdl.org> (raw)
In-Reply-To: <20040814205707.GA11936@yggdrasil.localdomain>
(was: Re: Linux v2.6.8 - Oops on NFSv3)
On Sat, 14 Aug 2004 15:57:07 -0500 Greg Norris wrote:
| On Sat, Aug 14, 2004 at 08:48:55PM +0800, Nur Hussein wrote:
| > I hear the first victim of the breakage may be the kernel.org front
| > page. 2.6.8.1 is not showing up as "latest".
|
| The `patch-kernel' script needs updating as well.
|
| $ scripts/patch-kernel . ~/kernel/
| Current kernel version is 2.6.0
| Applying patch-2.6.1 (bzip2)... done.
| Applying patch-2.6.2 (bzip2)... done.
| Applying patch-2.6.3 (bzip2)... done.
| Applying patch-2.6.4 (bzip2)... done.
| Applying patch-2.6.5 (bzip2)... done.
| Applying patch-2.6.6 (bzip2)... done.
| Applying patch-2.6.7 (bzip2)... done.
| Applying patch-2.6.8 (bzip2)... done.
Here's a patch for scripts/patch-kernel that uses EXTRAVERSION.
Works for me. Comments/corrections/testing ??
--
Update 'scripts/patch-kernel' to support EXTRAVERSION.
Update usage message text.
Fix some whitespace.
Handle command line arg3 (stop-version) more carefully.
No changes to -ac patch updates.
EXTRAVERSION handling:
any leading '.' and any trailing modifier (beginning with any
punctuation, like "-ac" or "_kexec" or "+mm") are stripped,
trying to get down to just a number.
Then 'patch-kernel' increments EXTRAVERSION as long as it can
apply "patch-V.P.S.X*". When that file isn't found, it resets
EXTRAVERSION to "" and increments SUBLEVEL (as before this patch).
Works for me.
Signed-off-by: Randy Dunlap <rddunlap@osdl.org>
diffstat:=
scripts/patch-kernel | 113 +++++++++++++++++++++++++++++++++++++--------------
1 files changed, 84 insertions(+), 29 deletions(-)
diff -Naurp ./scripts/patch-kernel~all_vers ./scripts/patch-kernel
--- ./scripts/patch-kernel~all_vers 2004-08-14 03:55:09.000000000 -0700
+++ ./scripts/patch-kernel 2004-08-18 12:12:19.358719440 -0700
@@ -40,17 +40,24 @@
#
# Added -ac option, use -ac or -ac9 (say) to stop at a particular version
# Dave Gilbert <linux@treblig.org>, 29th September 2001.
+#
+# Add support for (use of) EXTRAVERSION (to support 2.6.8.x, e.g.);
+# update usage message;
+# fix some whitespace damage;
+# be smarter about stopping when current version is larger than requested;
+# Randy Dunlap <rddunlap@osdl.org>, 2004-AUG-18.
# Set directories from arguments, or use defaults.
sourcedir=${1-/usr/src/linux}
patchdir=${2-.}
-stopvers=${3-imnotaversion}
+stopvers=${3-default}
-if [ "$1" = -h -o "$1" = --help -o ! -r "$sourcedir/Makefile" ]; then
+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.
+ source directory defaults to /usr/src/linux,
+ patch directory defaults to the current directory,
+ stopversion defaults to <all in patchdir>.
USAGE
exit 1
fi
@@ -77,7 +84,7 @@ findFile () {
uncomp="gunzip -dc"
elif [ -r ${filebase}.bz ]; then
ext=".bz"
- name="bzip"
+ name="bzip"
uncomp="bunzip -dc"
elif [ -r ${filebase}.bz2 ]; then
ext=".bz2"
@@ -96,8 +103,8 @@ findFile () {
name="plaintext"
uncomp="cat"
else
- return 1;
- fi
+ return 1;
+ fi
return 0;
}
@@ -126,48 +133,100 @@ applyPatch () {
return 0;
}
-# 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`
+# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION
+TMPFILE=`mktemp .tmpver.XXXXXX` || { echo "cannot make temp file" ; exit 1; }
+grep -E "^(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION)" $sourcedir/Makefile > $TMPFILE
+tr -d [:blank:] < $TMPFILE > $TMPFILE.1
+source $TMPFILE.1
+rm -f $TMPFILE*
if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ]
then
echo "unable to determine current kernel version" >&2
exit 1
fi
-echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION}"
+NAME=`grep ^NAME $sourcedir/Makefile`
+NAME=${NAME##*=}
+echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION} ($NAME)"
+
+# strip EXTRAVERSION to just a number (drop leading '.' and trailing additions)
+EXTRAVER=
if [ x$EXTRAVERSION != "x" ]
then
- echo "I'm sorry but patch-kernel can't work with a kernel source tree that is not a base version"
- exit 1;
+ if [ ${EXTRAVERSION:0:1} == "." ]; then
+ EXTRAVER=${EXTRAVERSION:1}
+ else
+ EXTRAVER=$EXTRAVERSION
+ fi
+ EXTRAVER=${EXTRAVER%%[[:punct:]]*}
+ #echo "patch-kernel: changing EXTRAVERSION from $EXTRAVERSION to $EXTRAVER"
+fi
+
+#echo "stopvers=$stopvers"
+if [ $stopvers != "default" ]; then
+ STOPSUBLEVEL=`echo $stopvers | cut -d. -f3`
+ STOPEXTRA=`echo $stopvers | cut -d. -f4`
+ #echo "STOPSUBLEVEL=$STOPSUBLEVEL, STOPEXTRA=$STOPEXTRA"
+else
+ STOPSUBLEVEL=9999
+ STOPEXTRA=9999
fi
-while :
+while : # incrementing SUBLEVEL (s in v.p.s)
do
- CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
- if [ $stopvers = $CURRENTFULLVERSION ]
- then
- echo "Stoping at $CURRENTFULLVERSION base as requested."
+ if [ x$EXTRAVER != "x" ]; then
+ CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL.$EXTRAVER"
+ else
+ CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
+ fi
+
+ if [ $stopvers == $CURRENTFULLVERSION ]; then
+ echo "Stopping at $CURRENTFULLVERSION base as requested."
break
fi
- SUBLEVEL=`expr $SUBLEVEL + 1`
+ while : # incrementing EXTRAVER (x in v.p.s.x)
+ do
+ EXTRAVER=$((EXTRAVER + 1))
+ FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL.$EXTRAVER"
+ #echo "... trying $FULLVERSION ..."
+
+ patch=patch-$FULLVERSION
+
+ # See if the file exists and find extension
+ findFile $patchdir/${patch} || break
+
+ # Apply the patch and check all is OK
+ applyPatch $patch || break
+
+ continue 2
+ done
+
+ EXTRAVER=
+ SUBLEVEL=$((SUBLEVEL + 1))
FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL"
+ #echo "___ trying $FULLVERSION ___"
+
+ if [ $((SUBLEVEL)) -gt $((STOPSUBLEVEL)) ]; then
+ echo "Stopping since sublevel ($SUBLEVEL) is beyond stop-sublevel ($STOPSUBLEVEL)"
+ exit 1
+ fi
patch=patch-$FULLVERSION
- # See if the file exists and find extension
- findFile $patchdir/${patch} || break
+ # See if the file exists and find extension
+ findFile $patchdir/${patch} || break
# Apply the patch and check all is OK
applyPatch $patch || break
done
+#echo "base all 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" ]
- then
+ if [ $gotac == "-ac" ]; then
# They want the latest version
HIGHESTPATCH=0
for PATCHNAMES in $patchdir/patch-${CURRENTFULLVERSION}-ac*\.*
@@ -176,18 +235,16 @@ if [ x$gotac != x ]; then
# Check it is actually a recognised patch type
findFile $patchdir/patch-${CURRENTFULLVERSION}-ac${ACVALUE} || break
- if [ $ACVALUE -gt $HIGHESTPATCH ]
- then
+ if [ $ACVALUE -gt $HIGHESTPATCH ]; then
HIGHESTPATCH=$ACVALUE
fi
done
- if [ $HIGHESTPATCH -ne 0 ]
- then
+ if [ $HIGHESTPATCH -ne 0 ]; then
findFile $patchdir/patch-${CURRENTFULLVERSION}-ac${HIGHESTPATCH} || break
applyPatch patch-${CURRENTFULLVERSION}-ac${HIGHESTPATCH}
else
- echo "No ac patches found"
+ echo "No -ac patches found"
fi
else
# They want an exact version
@@ -198,5 +255,3 @@ if [ x$gotac != x ]; then
applyPatch patch-${CURRENTFULLVERSION}${gotac}
fi
fi
-
-
next prev parent reply other threads:[~2004-08-18 20:59 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-14 6:05 Linux v2.6.8 Linus Torvalds
2004-08-14 10:10 ` Linux v2.6.8 - Oops on NFSv3 Willy Tarreau
2004-08-14 10:19 ` Willy Tarreau
2004-08-14 10:34 ` Jeff Garzik
2004-08-14 10:41 ` Linus Torvalds
2004-08-14 10:35 ` Willy Tarreau
2004-08-14 10:49 ` Linus Torvalds
2004-08-14 10:55 ` Christoph Hellwig
2004-08-14 11:05 ` Linus Torvalds
2004-08-14 11:18 ` Arjan van de Ven
2004-08-14 11:27 ` Jeff Garzik
2004-08-14 11:31 ` viro
2004-08-14 12:48 ` Nur Hussein
2004-08-14 20:57 ` Greg Norris
2004-08-18 20:57 ` Randy.Dunlap [this message]
2004-08-22 20:40 ` [PATCH] scripts/patch-kernel: use EXTRAVERSION Sam Ravnborg
2005-03-15 16:15 ` [BUG] " David Greaves
2005-03-15 16:25 ` Greg KH
2005-03-15 17:44 ` Greg KH
2005-03-15 17:54 ` Matt Mackall
2005-03-15 19:55 ` Sam Ravnborg
2005-03-15 18:02 ` David Greaves
2005-03-15 18:37 ` Sam Ravnborg
2005-04-12 0:07 ` [PATCH] scripts/patch-kernel: EXTRAVERSION patches are not incremental Randy.Dunlap
2004-08-17 3:13 ` Linux v2.6.8 - Oops on NFSv3 Patrick McFarland
2004-08-14 17:20 ` Matt Mackall
2004-08-15 20:10 ` Marcelo Tosatti
2004-08-16 3:37 ` Han Boetes
2004-08-16 14:06 ` Daniel Jacobowitz
2004-08-16 22:39 ` Bill Davidsen
2004-08-18 8:29 ` Robert Schwebel
2004-08-14 15:33 ` Norman Zhang
2004-08-14 10:19 ` [patch 2.6.8-rc4-mm1] via-velocity: wrong module name in Kconfig documentation Francois Romieu
2004-09-20 18:44 ` Jeff Garzik
2004-08-14 10:30 ` Linux v2.6.8 Jeff Garzik
2004-08-14 11:19 ` Stephan von Krawczynski
2004-08-14 11:38 ` Francois Romieu
2004-08-14 11:16 ` William Lee Irwin III
2004-08-16 17:56 ` Linux v2.6.8 (compile stats) John Cherry
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=20040818135751.197ce3c9.rddunlap@osdl.org \
--to=rddunlap@osdl.org \
--cc=akpm@osdl.org \
--cc=haphazard@kc.rr.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sam@ravnborg.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.