6.9.6. Script kpatchup

section id="fragment.section_template" condition="author"

kpatchup je skript jenž se stará o záplatování jádra. Dozvěděl jsem so o něm z Kernel Traffic #256 This is the first release of kpatchup, a script for managing switching between kernel releases via patches with some smarts:

Currently it knows about 2.4, 2.4-pre, 2.6, 2.6-pre, 2.6-bk, 2.6-mm, and 2.6-tiny. Příklad použití:

$ 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/

Zwane Mwaikambo was very excited by this, saying, "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." Rusty
Russell was also happy to see this, and offered his own scripts in case they
had anything worth merging. Dave Hansen also liked Matt's script, but said:

    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.

They debugged for a bit, and the thread ended.