2004-03-03 02:24:51

by Matt Mackall

[permalink] [raw]
Subject: [ANNOUNCE] kpatchup 0.02 kernel patching script

This is the first release of kpatchup, a script for managing switching
between kernel releases via patches with some smarts:

- understands -pre and -rc version numbering
- aware of various external trees
- automatically patch between any tree in an x.y release
- automatically download and cache patches on demand
- automatically determine the latest patch in various series
- optionally print version strings or URLs for patches

Currently it knows about 2.4, 2.4-pre, 2.6, 2.6-pre, 2.6-bk, 2.6-mm,
and 2.6-tiny.

Example usage:

$ head Makefile
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 2
EXTRAVERSION =-rc2
[...]
$ kpatchup 2.6-mm
2.6.2-rc2 -> 2.6.4-rc1-mm1
Applying patch-2.6.2-rc2.bz2 -R
Applying patch-2.6.2.bz2
Applying patch-2.6.3.bz2
Downloading patch-2.6.4-rc1.bz2...
Applying patch-2.6.4-rc1.bz2
Downloading 2.6.4-rc1-mm1.bz2...
Applying 2.6.4-rc1-mm1.bz2
$ head Makefile
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 4
EXTRAVERSION =-rc1-mm1
NAME=Feisty Dunnart
[...]
$ kpatchup -q 2.6.3-rc1
$ head Makefile
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 3
EXTRAVERSION =-rc1
NAME=Feisty Dunnart
[...]
$ kpatchup -s 2.6-bk
2.6.4-rc1-bk3
$ kpatchup -u 2.4-pre
http://www.kernel.org/pub/linux/kernel/v2.4/testing/patch-2.4.26-pre1.bz2


This is an alpha release for people to experiment with. Feedback and
patches encouraged. Grab your copy today at:

http://selenic.com/kpatchup/

--
Matt Mackall : http://www.selenic.com : Linux development and consulting


2004-03-03 05:51:35

by Zwane Mwaikambo

[permalink] [raw]
Subject: Re: [ANNOUNCE] kpatchup 0.02 kernel patching script

On Tue, 2 Mar 2004, Matt Mackall wrote:

> This is the first release of kpatchup, a script for managing switching
> between kernel releases via patches with some smarts:
>
> - understands -pre and -rc version numbering
> - aware of various external trees
> - automatically patch between any tree in an x.y release
> - automatically download and cache patches on demand
> - automatically determine the latest patch in various series
> - optionally print version strings or URLs for patches
>
> Currently it knows about 2.4, 2.4-pre, 2.6, 2.6-pre, 2.6-bk, 2.6-mm,
> and 2.6-tiny.

Oh i definitely owe you one now, this is replacing the ugly shell script i
had before, i'm mostly using this now to download and patch up trees
before cvs import'ing them.

Thanks!

2004-03-04 01:41:43

by Rusty Russell

[permalink] [raw]
Subject: Re: [ANNOUNCE] kpatchup 0.02 kernel patching script

On Wed, 2004-03-03 at 13:24, Matt Mackall wrote:
> This is the first release of kpatchup, a script for managing switching
> between kernel releases via patches with some smarts:

Hi Matt!

Please find below my grab_kernel, latest-kernel-version and lkvercmp
scripts, in case they are useful for you to merge. Kinda
rough, like any unexposed code...

Rusty


--
Anyone who quotes me in their signature is an idiot -- Rusty Russell


Attachments:
lkvercmp (2.58 kB)
latest-kernel-version (1.59 kB)
grab-kernel (5.33 kB)
Download all attachments

2004-03-04 17:23:16

by Dave Hansen

[permalink] [raw]
Subject: Re: [ANNOUNCE] kpatchup 0.02 kernel patching script

On Tue, 2004-03-02 at 18:24, Matt Mackall wrote:
> This is an alpha release for people to experiment with. Feedback and
> patches encouraged. Grab your copy today at:

First of all, very nice script.

But, it doesn't look like it properly handles empty directories. I
tried this command, this morning, and it blew up. I think it's because
this directory http://www.kernel.org/pub/linux/kernel/v2.6/snapshots/ is
empty because of last night's 2.6.4-rc2 release. I don't grok python
very well but is the "return p[-1]" there just to cause a fault like
this? Would it be better if it just returned a "no version of that
patch right now" message and exited nicely?

[dave@nighthawk linux-2.6]$ kpatchup-0.02 2.6-bk
"Traceback (most recent call last):
File "/home/dave/bin/kpatchup-0.02", line 283, in ?
b = find_ver(args[0])
File "/home/dave/bin/kpatchup-0.02", line 240, in find_ver
return v[0](os.path.dirname(v[1]), v[2])
File "/home/dave/bin/kpatchup-0.02", line 147, in latest_dir
return p[-1]
IndexError: list index out of range

I think your script, combined with Rusty's latest-kernel-version could
make me a very happy person.

-- dave

2004-03-04 18:36:30

by Matt Mackall

[permalink] [raw]
Subject: Re: [ANNOUNCE] kpatchup 0.02 kernel patching script

On Thu, Mar 04, 2004 at 09:22:02AM -0800, Dave Hansen wrote:
> On Tue, 2004-03-02 at 18:24, Matt Mackall wrote:
> > This is an alpha release for people to experiment with. Feedback and
> > patches encouraged. Grab your copy today at:
>
> First of all, very nice script.
>
> But, it doesn't look like it properly handles empty directories. I
> tried this command, this morning, and it blew up. I think it's because
> this directory http://www.kernel.org/pub/linux/kernel/v2.6/snapshots/ is
> empty because of last night's 2.6.4-rc2 release. I don't grok python
> very well but is the "return p[-1]" there just to cause a fault like
> this? Would it be better if it just returned a "no version of that
> patch right now" message and exited nicely?

Python does a good job at falling over loudly whenever anything
unexpected happens. I hadn't noticed that the snapshot directory got
purged. Hmmm. The right thing is to make it fall back to checking old/
where the most recent -bk is to be found. Like this:

$ kpatchup -s 2.6-pre
2.6.4-rc2
$ kpatchup -s 2.6-bk
2.6.4-rc1-bk4

New version at http://selenic.com/kpatchup/kpatchup-0.03

I've added a couple other niceties for scripting purposes: a -p option
which will report the "base" version for a given version, -m which
will parse Makefile and print the version therein.

> I think your script, combined with Rusty's latest-kernel-version could
> make me a very happy person.

I skimmed latest-kernel-version, is it doing something my -s option
doesn't do yet?

--
Matt Mackall : http://www.selenic.com : Linux development and consulting

2004-03-04 18:56:22

by Dave Hansen

[permalink] [raw]
Subject: Re: [ANNOUNCE] kpatchup 0.02 kernel patching script

On Thu, 2004-03-04 at 10:35, Matt Mackall wrote:
> I skimmed latest-kernel-version, is it doing something my -s option
> doesn't do yet?

$ ./kpatchup-0.03 -s 2.6-bk
2.6.4-rc1-bk4
$ ./kpatchup-0.03 -s 2.6
2.6.3
$ ./kpatchup-0.03 -s 2.6-pre
2.6.4-rc2
$ latest-kernel-version --probe
2.6.4-rc2

I might be misunderstanding the options, but 'kpatchup -s' I think is
limited to giving the latest version of a single tree, while
'latest-kernel-version' will look at several different trees. This is a
tiny problem for kpatchup because it treats 2.6, 2.6-bk, and 2.6-pre as
separate trees. For my use, I just want the latest snapshot, whether
it's a bk snapshot, or one of the real point releases.

What I'm doing to work around it is this:
kpatchup `latest-kernel-version --probe`

-- dave

2004-03-04 19:09:36

by Matt Mackall

[permalink] [raw]
Subject: Re: [ANNOUNCE] kpatchup 0.02 kernel patching script

On Thu, Mar 04, 2004 at 10:50:10AM -0800, Dave Hansen wrote:
> On Thu, 2004-03-04 at 10:35, Matt Mackall wrote:
> > I skimmed latest-kernel-version, is it doing something my -s option
> > doesn't do yet?
>
> $ ./kpatchup-0.03 -s 2.6-bk
> 2.6.4-rc1-bk4

This is actually broken at the moment as it won't know how to fetch
stuff from old/ when it's given a non-current bk version. I have a
design assumption that I can go from a version name to a URL without
any lookups, which the snapshot dir purging breaks.

ISTR Jeff maintains the snapshot scripts. Jeff, could you possibly
have it put a copy of the each snapshot in old/ at creation time
rather than moving stuff there at a later point? This will make URLs
pointing to old/ for -bk patches stable but shouldn't break anything
else.

> $ ./kpatchup-0.03 -s 2.6
> 2.6.3
> $ ./kpatchup-0.03 -s 2.6-pre
> 2.6.4-rc2
> $ latest-kernel-version --probe
> 2.6.4-rc2
>
> I might be misunderstanding the options, but 'kpatchup -s' I think is
> limited to giving the latest version of a single tree, while
> 'latest-kernel-version' will look at several different trees. This is a
> tiny problem for kpatchup because it treats 2.6, 2.6-bk, and 2.6-pre as
> separate trees. For my use, I just want the latest snapshot, whether
> it's a bk snapshot, or one of the real point releases.

I suppose I could add a 2.6-tip, which will return the greatest of
2.6, 2.6-pre, and 2.6-bk. Like this:

$ kpatchup -s 2.6-tip
2.6.4-rc2
$ kpatchup -u 2.6-tip
http://www.kernel.org/pub/linux/kernel/v2.6/testing/patch-2.6.4-rc2.bz2

--
Matt Mackall : http://www.selenic.com : Linux development and consulting

2004-03-04 19:14:14

by Dave Hansen

[permalink] [raw]
Subject: Re: [ANNOUNCE] kpatchup 0.02 kernel patching script

On Thu, 2004-03-04 at 11:09, Matt Mackall wrote:
> I suppose I could add a 2.6-tip, which will return the greatest of
> 2.6, 2.6-pre, and 2.6-bk. Like this:
>
> $ kpatchup -s 2.6-tip
> 2.6.4-rc2
> $ kpatchup -u 2.6-tip
> http://www.kernel.org/pub/linux/kernel/v2.6/testing/patch-2.6.4-rc2.bz2

That would at least keep me from mixing different tools like I am now.
It's not too big of a deal.

-- dave