Matt Mackall, maintainer of the -tiny [1] patchset [story [2]], announced version 0.7 of his 'ketchup [3]' script. Written in Python [4], the script automates the process of patching from one version of the Linux kernel to another. It caches the various patches, only downloading what's required to get you to the version you specify, also automatically verifying the kernel's gpg signature [5].
Matt's handy script supports both the 2.4 and the 2.6 mainline kernels, as well as the -mm [story [6]], -tiny [story [7]] and -mjb [story [7]] patchsets. You can specify a specific version, or simply ask it to patch you up to the latest. For example, to get the latest official 2.6 release source, you would type, ketchup 2.6. To get the latest 2.6-pre or -rc, you would simply type. ketchup 2.6-pre. To be completely up to date, getting the latest snapshot (including -bk snapshots), you can type, ketchup 2.6-tip. Read on for Matt's announcement, as well as a few of my own examples demonstrating this handy script in action.
Before you'll be able to use 'ketchup', you'll first need to be sure that you have gpg [8] properly installed and configured, and the kernel.org signature [9] properly imported into your keyring.
For my first test, I created a new directory for 2.6.6-rc2 and typed 'ketchup 2.6.6-rc2':
[jandrews@papaya _kernel]$ mkdir linux-2.6.6-rc2
[jandrews@papaya _kernel]$ cd linux-2.6.6-rc2
[jandrews@papaya linux-2.6.6-rc2]$ ketchup 2.6.6-rc2
None -> 2.6.6-rc2
Downloading linux-2.6.5.tar.bz2
--20:37:23-- http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.5.tar.bz2 [10]
=> `/home/jandrews/.ketchup/linux-2.6.5.tar.bz2.partial'
Resolving www.kernel.org [11]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 34,684,611 [application/x-bzip2]
100%[====================================>] 34,684,611 152.39K/s ETA 00:00
20:41:06 (152.39 KB/s) - `/home/jandrews/.ketchup/linux-2.6.5.tar.bz2.partial' saved [34684611/34684611]
Downloading linux-2.6.5.tar.bz2.sign
--20:41:06-- http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.5.tar.bz2.sign [12]
=> `/home/jandrews/.ketchup/linux-2.6.5.tar.bz2.sign.partial'
Resolving www.kernel.org [13]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 248 [application/pgp-signature]
100%[====================================>] 248 242.19K/s ETA 00:00
20:41:06 (242.19 KB/s) - `/home/jandrews/.ketchup/linux-2.6.5.tar.bz2.sign.partial' saved [248/248]
Verifying signature...
gpg: Signature made Sat 03 Apr 2004 11:30:02 PM EST using DSA key ID 517D0F0E
gpg: Good signature from "Linux Kernel Archives Verification Key "
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: C75D C40A 11D7 AF88 9981 ED5B C86B A06A 517D 0F0E
Unpacking linux-2.6.5.tar.bz2
Downloading patch-2.6.6-rc2.bz2
--20:41:35-- http://www.kernel.org/pub/linux/kernel/v2.6/testing/patch-2.6.6-rc2.bz2 [14]
=> `/home/jandrews/.ketchup/patch-2.6.6-rc2.bz2.partial'
Resolving www.kernel.org [15]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,948,496 [application/x-bzip2]
100%[====================================>] 1,948,496 149.02K/s ETA 00:00
20:41:48 (149.02 KB/s) - `/home/jandrews/.ketchup/patch-2.6.6-rc2.bz2.partial' saved [1948496/1948496]
Downloading patch-2.6.6-rc2.bz2.sign
--20:41:48-- http://www.kernel.org/pub/linux/kernel/v2.6/testing/patch-2.6.6-rc2.bz2.... [16]
=> `/home/jandrews/.ketchup/patch-2.6.6-rc2.bz2.sign.partial'
Resolving www.kernel.org [17]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 248 [application/pgp-signature]
100%[====================================>] 248 242.19K/s ETA 00:00
20:41:49 (242.19 KB/s) - `/home/jandrews/.ketchup/patch-2.6.6-rc2.bz2.sign.partial' saved [248/248]
Verifying signature...
gpg: Signature made Tue 20 Apr 2004 06:29:52 PM EDT using DSA key ID 517D0F0E
gpg: Good signature from "Linux Kernel Archives Verification Key "
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: C75D C40A 11D7 AF88 9981 ED5B C86B A06A 517D 0F0E
Applying patch-2.6.6-rc2.bz2
[jandrews@papaya linux-2.6.6-rc2]$
Worked like a charm! At that point, I could copy in my old .config, run make oldconfig, and I'm set...
The various patches that were downloaded above are stored in ~/.ketchup. As a test, I deleted all files in there, then moved in an old copy I had of linux-2.6.1.tar.bz2. I repeated the test above, and sure enough it intelligently patched me from 2.6.1 up to 2.6.6-rc2:
[jandrews@papaya _kernel]$ mkdir linux-2.6.6-rc2
[jandrews@papaya _kernel]$ cd linux-2.6.6-rc2
[jandrews@papaya linux-2.6.6-rc2]$ ketchup 2.6.6-rc2
None -> 2.6.6-rc2
Unpacking linux-2.6.1.tar.bz2
Downloading patch-2.6.2.bz2
--20:46:06-- http://www.kernel.org/pub/linux/kernel/v2.6/patch-2.6.2.bz2 [18]
=> `/home/jandrews/.ketchup/patch-2.6.2.bz2.partial'
Resolving www.kernel.org [19]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2,322,327 [application/x-bzip2]
100%[====================================>] 2,322,327 145.56K/s ETA 00:00
20:46:22 (145.56 KB/s) - `/home/jandrews/.ketchup/patch-2.6.2.bz2.partial' saved [2322327/2322327]
Downloading patch-2.6.2.bz2.sign
--20:46:22-- http://www.kernel.org/pub/linux/kernel/v2.6/patch-2.6.2.bz2.sign [20]
=> `/home/jandrews/.ketchup/patch-2.6.2.bz2.sign.partial'
Resolving www.kernel.org [21]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 248 [application/pgp-signature]
100%[====================================>] 248 242.19K/s ETA 00:00
20:46:22 (242.19 KB/s) - `/home/jandrews/.ketchup/patch-2.6.2.bz2.sign.partial' saved [248/248]
Verifying signature...
gpg: Signature made Tue 03 Feb 2004 11:15:50 PM EST using DSA key ID 517D0F0E
gpg: Good signature from "Linux Kernel Archives Verification Key "
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: C75D C40A 11D7 AF88 9981 ED5B C86B A06A 517D 0F0E
Applying patch-2.6.2.bz2
Downloading patch-2.6.3.bz2
--20:46:26-- http://www.kernel.org/pub/linux/kernel/v2.6/patch-2.6.3.bz2 [22]
=> `/home/jandrews/.ketchup/patch-2.6.3.bz2.partial'
Resolving www.kernel.org [23]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2,053,488 [application/x-bzip2]
100%[====================================>] 2,053,488 143.86K/s ETA 00:00
20:46:40 (143.86 KB/s) - `/home/jandrews/.ketchup/patch-2.6.3.bz2.partial' saved [2053488/2053488]
Downloading patch-2.6.3.bz2.sign
--20:46:40-- http://www.kernel.org/pub/linux/kernel/v2.6/patch-2.6.3.bz2.sign [24]
=> `/home/jandrews/.ketchup/patch-2.6.3.bz2.sign.partial'
Resolving www.kernel.org [25]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 248 [application/pgp-signature]
100%[====================================>] 248 242.19K/s ETA 00:00
20:46:40 (242.19 KB/s) - `/home/jandrews/.ketchup/patch-2.6.3.bz2.sign.partial' saved [248/248]
Verifying signature...
gpg: Signature made Tue 17 Feb 2004 11:43:48 PM EST using DSA key ID 517D0F0E
gpg: Good signature from "Linux Kernel Archives Verification Key "
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: C75D C40A 11D7 AF88 9981 ED5B C86B A06A 517D 0F0E
Applying patch-2.6.3.bz2
Downloading patch-2.6.4.bz2
--20:46:44-- http://www.kernel.org/pub/linux/kernel/v2.6/patch-2.6.4.bz2 [26]
=> `/home/jandrews/.ketchup/patch-2.6.4.bz2.partial'
Resolving www.kernel.org [27]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2,262,429 [application/x-bzip2]
100%[====================================>] 2,262,429 133.58K/s ETA 00:00
20:47:00 (133.58 KB/s) - `/home/jandrews/.ketchup/patch-2.6.4.bz2.partial' saved [2262429/2262429]
Downloading patch-2.6.4.bz2.sign
--20:47:00-- http://www.kernel.org/pub/linux/kernel/v2.6/patch-2.6.4.bz2.sign [28]
=> `/home/jandrews/.ketchup/patch-2.6.4.bz2.sign.partial'
Resolving www.kernel.org [29]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 248 [application/pgp-signature]
100%[====================================>] 248 242.19K/s ETA 00:00
20:47:01 (242.19 KB/s) - `/home/jandrews/.ketchup/patch-2.6.4.bz2.sign.partial' saved [248/248]
Verifying signature...
gpg: Signature made Wed 10 Mar 2004 10:38:16 PM EST using DSA key ID 517D0F0E
gpg: Good signature from "Linux Kernel Archives Verification Key "
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: C75D C40A 11D7 AF88 9981 ED5B C86B A06A 517D 0F0E
Applying patch-2.6.4.bz2
Downloading patch-2.6.5.bz2
--20:47:05-- http://www.kernel.org/pub/linux/kernel/v2.6/patch-2.6.5.bz2 [30]
=> `/home/jandrews/.ketchup/patch-2.6.5.bz2.partial'
Resolving www.kernel.org [31]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,420,240 [application/x-bzip2]
100%[====================================>] 1,420,240 79.48K/s ETA 00:00
20:47:22 (79.48 KB/s) - `/home/jandrews/.ketchup/patch-2.6.5.bz2.partial' saved [1420240/1420240]
Downloading patch-2.6.5.bz2.sign
--20:47:22-- http://www.kernel.org/pub/linux/kernel/v2.6/patch-2.6.5.bz2.sign [32]
=> `/home/jandrews/.ketchup/patch-2.6.5.bz2.sign.partial'
Resolving www.kernel.org [33]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 248 [application/pgp-signature]
100%[====================================>] 248 242.19K/s ETA 00:00
20:47:23 (242.19 KB/s) - `/home/jandrews/.ketchup/patch-2.6.5.bz2.sign.partial' saved [248/248]
Verifying signature...
gpg: Signature made Sat 03 Apr 2004 11:27:25 PM EST using DSA key ID 517D0F0E
gpg: Good signature from "Linux Kernel Archives Verification Key "
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: C75D C40A 11D7 AF88 9981 ED5B C86B A06A 517D 0F0E
Applying patch-2.6.5.bz2
Downloading patch-2.6.6-rc2.bz2
--20:47:27-- http://www.kernel.org/pub/linux/kernel/v2.6/testing/patch-2.6.6-rc2.bz2 [34]
=> `/home/jandrews/.ketchup/patch-2.6.6-rc2.bz2.partial'
Resolving www.kernel.org [35]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,948,496 [application/x-bzip2]
100%[====================================>] 1,948,496 150.92K/s ETA 00:00
20:47:40 (150.92 KB/s) - `/home/jandrews/.ketchup/patch-2.6.6-rc2.bz2.partial' saved [1948496/1948496]
Downloading patch-2.6.6-rc2.bz2.sign
--20:47:40-- http://www.kernel.org/pub/linux/kernel/v2.6/testing/patch-2.6.6-rc2.bz2.... [36]
=> `/home/jandrews/.ketchup/patch-2.6.6-rc2.bz2.sign.partial'
Resolving www.kernel.org [37]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 248 [application/pgp-signature]
100%[====================================>] 248 242.19K/s ETA 00:00
20:47:40 (242.19 KB/s) - `/home/jandrews/.ketchup/patch-2.6.6-rc2.bz2.sign.partial' saved [248/248]
Verifying signature...
gpg: Signature made Tue 20 Apr 2004 06:29:52 PM EDT using DSA key ID 517D0F0E
gpg: Good signature from "Linux Kernel Archives Verification Key "
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: C75D C40A 11D7 AF88 9981 ED5B C86B A06A 517D 0F0E
Applying patch-2.6.6-rc2.bz2
[jandrews@papaya linux-2.6.6-rc2]$
Another quick test, I asked it to get me the absolute latest version of 2.6:
[jandrews@papaya _kernel]$ mkdir linux-tip
[jandrews@papaya _kernel]$ cd linux-tip
[jandrews@papaya linux-tip]$ ketchup 2.6-tip
None -> 2.6.6-rc2-bk3
Unpacking linux-2.6.1.tar.bz2
Applying patch-2.6.2.bz2
Applying patch-2.6.3.bz2
Applying patch-2.6.4.bz2
Applying patch-2.6.5.bz2
Applying patch-2.6.6-rc2.bz2
Downloading patch-2.6.6-rc2-bk3.bz2
--20:54:47-- http://www.kernel.org/pub/linux/kernel/v2.6/snapshots/patch-2.6.6-rc2-bk... [38]
=> `/home/jandrews/.ketchup/patch-2.6.6-rc2-bk3.bz2.partial'
Resolving www.kernel.org [39]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 103,407 [application/x-bzip2]
100%[====================================>] 103,407 227.44K/s ETA 00:00
20:54:53 (227.44 KB/s) - `/home/jandrews/.ketchup/patch-2.6.6-rc2-bk3.bz2.partial' saved [103407/103407]
Downloading patch-2.6.6-rc2-bk3.bz2.sign
--20:54:53-- http://www.kernel.org/pub/linux/kernel/v2.6/snapshots/patch-2.6.6-rc2-bk... [40]
=> `/home/jandrews/.ketchup/patch-2.6.6-rc2-bk3.bz2.sign.partial'
Resolving www.kernel.org [41]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 248 [application/pgp-signature]
100%[====================================>] 248 242.19K/s ETA 00:00
20:54:53 (242.19 KB/s) - `/home/jandrews/.ketchup/patch-2.6.6-rc2-bk3.bz2.sign.partial' saved [248/248]
Verifying signature...
gpg: Signature made Sat 24 Apr 2004 07:47:17 AM EDT using DSA key ID 517D0F0E
gpg: Good signature from "Linux Kernel Archives Verification Key "
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: C75D C40A 11D7 AF88 9981 ED5B C86B A06A 517D 0F0E
Applying patch-2.6.6-rc2-bk3.bz2
[jandrews@papaya linux-tip]$
Finally, I asked it to patch the current directory from 2.6.6-rc2-bk3 to the latest -mm patchset:
[jandrews@papaya linux-tip]$ ketchup 2.6-mm
2.6.6-rc2-bk3 -> 2.6.6-rc2-mm1
Applying patch-2.6.6-rc2-bk3.bz2 -R
Downloading 2.6.6-rc2-mm1.bz2
--21:14:01-- http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.6-rc2... [42]
2.6.6-rc2-mm1/2.6.6-rc2-mm1.bz2
=> `/home/jandrews/.ketchup/2.6.6-rc2-mm1.bz2.partial'
Resolving www.kernel.org [43]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 358,646 [application/x-bzip2]
100%[====================================>] 358,646 142.14K/s ETA 00:00
21:14:03 (142.14 KB/s) - `/home/jandrews/.ketchup/2.6.6-rc2-mm1.bz2.partial' saved [358646/358646]
Downloading 2.6.6-rc2-mm1.bz2.sign
--21:14:03-- http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.6-rc2... [44]
2.6.6-rc2-mm1/2.6.6-rc2-mm1.bz2.sign
=> `/home/jandrews/.ketchup/2.6.6-rc2-mm1.bz2.sign.partial'
Resolving www.kernel.org [45]... done.
Connecting to www.kernel.org[204.152.189.116]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 248 [application/pgp-signature]
100%[====================================>] 248 242.19K/s ETA 00:00
21:14:04 (242.19 KB/s) - `/home/jandrews/.ketchup/2.6.6-rc2-mm1.bz2.sign.partial' saved [248/248]
Verifying signature...
gpg: Signature made Wed 21 Apr 2004 04:40:06 AM EDT using DSA key ID 517D0F0E
gpg: Good signature from "Linux Kernel Archives Verification Key "
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: C75D C40A 11D7 AF88 9981 ED5B C86B A06A 517D 0F0E
Applying 2.6.6-rc2-mm1.bz2
[jandrews@papaya linux-tip]$
After the above tests, the following files were cached in ~/.ketchup:
[jandrews@papaya linux-tip]$ ls -l ~/.ketchup/ total 42792 -rw-rw-r-- 1 jandrews jandrews 358646 Apr 21 04:25 2.6.6-rc2-mm1.bz2 -rw-rw-r-- 1 jandrews jandrews 248 Apr 21 04:25 2.6.6-rc2-mm1.bz2.sign -rw------- 1 jandrews jandrews 33240033 Jan 30 00:31 linux-2.6.1.tar.bz2 -rw-rw-r-- 1 jandrews jandrews 2322327 Feb 3 23:02 patch-2.6.2.bz2 -rw-rw-r-- 1 jandrews jandrews 248 Feb 3 23:02 patch-2.6.2.bz2.sign -rw-rw-r-- 1 jandrews jandrews 2053488 Feb 17 23:36 patch-2.6.3.bz2 -rw-rw-r-- 1 jandrews jandrews 248 Feb 17 23:36 patch-2.6.3.bz2.sign -rw-rw-r-- 1 jandrews jandrews 2262429 Mar 10 22:16 patch-2.6.4.bz2 -rw-rw-r-- 1 jandrews jandrews 248 Mar 10 22:16 patch-2.6.4.bz2.sign -rw-rw-r-- 1 jandrews jandrews 1420240 Apr 3 23:17 patch-2.6.5.bz2 -rw-rw-r-- 1 jandrews jandrews 248 Apr 3 23:17 patch-2.6.5.bz2.sign -rw-rw-r-- 1 jandrews jandrews 103407 Apr 24 07:45 patch-2.6.6-rc2-bk3.bz2 -rw-rw-r-- 1 jandrews jandrews 248 Apr 24 07:45 patch-2.6.6-rc2-bk3.bz2.sign -rw-rw-r-- 1 jandrews jandrews 1948496 Apr 20 18:17 patch-2.6.6-rc2.bz2 -rw-rw-r-- 1 jandrews jandrews 248 Apr 20 18:17 patch-2.6.6-rc2.bz2.sign [jandrews@papaya linux-tip]$
From: Matt Mackall [email blocked] To: linux-kernel [email blocked] Subject: [ANNOUNCE] ketchup 0.7 Date: Sat, 24 Apr 2004 16:17:32 -0500 ketchup is a script that automatically patches between kernel versions, downloading and caching patches as needed, and automatically determining the latest versions of several trees. Available at: http://selenic.com/ketchup/ketchup-0.7 [46] New in this version by popular demand: - handles empty directories: if you run ketchup in an empty directory, it'll search its cache for a tarball nearest to the version specified and unpack that before patching, downloading a new tarball if none is available - uses wget if available, with resume support - uses gpg if available (disable with -G) - archive, kernel-url, and work directory command line parameters - cleaned up option parsing - elimination of more Python 2.3isms (tested against 2.1) - support for Martin Bligh's -mjb tree Example usage: $ ketchup 2.6-mm 2.6.3-rc1-mm1 -> 2.6.5-mm4 Applying 2.6.3-rc1-mm1.bz2 -R Applying patch-2.6.3-rc1.bz2 -R Applying patch-2.6.3.bz2 Applying patch-2.6.4.bz2 Applying patch-2.6.5.bz2 Downloading 2.6.5-mm4.bz2 Downloading 2.6.5-mm4.bz2.sign Verifying signature... gpg: Signature made Sat Apr 10 21:55:36 2004 CDT using DSA key ID 517D0F0E gpg: Good signature from "Linux Kernel Archives Verification Key [email blocked]" gpg: aka "Linux Kernel Archives Verification Key [email blocked]" owner. gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the Primary key fingerprint: C75D C40A 11D7 AF88 9981 ED5B C86B A06A 517D 0F0E Applying 2.6.5-mm4.bz2 -- Matt Mackall : http://www.selenic.com [47] : Linux development and consulting
Related Links:
- Archive of above thread [48]