Hey *, I finally got around to working out how to merge ed diffs the other day [0], and thought that might be worth mentioning since it makes it feasible to speed up the rred method significantly, by allowing you to download all the patches first, then apply them all in a single pass reasonably efficiently. However, there's a slight problem -- the format of the .diff/Index files doesn't guarantee you know the entire set of patches that you need to apply upfront, it only tells you the first one explicitly. Of course, since, at present every patch is purely incremental, you de facto just need to get the first patch and every one after that, but I don't think that was ever specified, and I'm not sure if apt's behaviour enforces it. Two approaches seem reasonable to me: - just support incremental patches and concatenate them. implies some redundancy, but not a big deal. formats and archive scripts don't need to change. - add the expected sha for the result for each ed patch to the Index file so apt can calculate a shortest path of patches to apply. something like: SHA1-Current: dbf6e1c44c03f5cf312a857d8baf970fa98f3552 13376352 SHA1-History: 311823818f5f768c68aaf4510f8d018818b966f7 13354326 2009-08-24-1538.16 5a0a9a9613df47c3f7769b9ddf6343f07213537e 13352876 2009-08-24-2150.53 b31835188a594e4cea6bd04f8b6e46f2bf034668 13352875 2009-08-25-0332.54 SHA1-Patches: 1bfc8831b4adfc23416c32e8fc519e9214f17efb 1653 2009-08-24-1538.16 53be1486737e750e04c1ed2db511b64caf0b5a95 78 2009-08-24-2150.53 0128e5f40b537331f7a459018c102b631c546381 57221 2009-08-25-0332.54 SHA1-Target: 5a0a9a9613df47c3f7769b9ddf6343f07213537e 13352876 2009-08-24-1538.16 b31835188a594e4cea6bd04f8b6e46f2bf034668 13352875 2009-08-24-2150.53 dbf6e1c44c03f5cf312a857d8baf970fa98f3552 13376352 2009-08-25-0332.54 so applying patch X takes you from SHA1-History(X) to SHA1-Target(X), and if you do something like as is suggested in [1] you'd end up with: SHA1-Current: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10 12345678 SHA1-History: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa01 10100000 2008-13-01.5 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa02 10200000 2008-13-02.5 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa03 10300000 2008-13-03.5 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa04 10400000 2008-13-04.4 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa05 10500000 2008-13-05.3 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa06 10600000 2008-13-06.2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa07 10700000 2008-13-07.2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa08 10800000 2008-13-08.2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa09 10900000 2008-13-09.1 SHA1-Target: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa06 10600000 2008-13-01.5 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa07 10700000 2008-13-02.5 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa08 10800000 2008-13-03.5 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa08 10800000 2008-13-04.4 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa08 10800000 2008-13-05.3 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa08 10800000 2008-13-06.2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa09 10900000 2008-13-07.2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10 12345678 2008-13-08.2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10 12345678 2008-13-09.1 SHA1-Patches: ... which would mean if you start from: aa..aa01 you need to apply 2008-13-01.5, 2008-13-06.2 and 2008-13-08.2 aa..aa02 you need to apply 2008-13-02.5, 2008-13-07.2 and 2008-13-09.1 aa..aa03 you need to apply 2008-13-03.5 and 2008-13-08.2 aa..aa04 you need to apply 2008-13-04.4 and 2008-13-08.2 aa..aa05 you need to apply 2008-13-05.3 and 2008-13-08.2 aa..aa06 you need to apply 2008-13-06.2 and 2008-13-08.2 aa..aa07 you need to apply 2008-13-07.2 and 2008-13-09.1 aa..aa08 you need to apply 2008-13-08.2 aa..aa09 you need to apply 2008-13-09.1 aa..aa10 you're already done. I'm not sure exactly how/if this is used elsewhere -- afaics, compatability is likely to be the most significant difference between the two approaches. Cheers, aj [0] http://junkcode.erisian.com.au/redcat -- code and description http://junkcode.erisian.com.au/redcat.tangle_raw -- just the code [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=372712#75
Attachment:
signature.asc
Description: Digital signature