[offtopic?] xdelta patch format wrapper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is somewhat offtopic but this list is the best-informed crowd on
diff/xdelta matters so here I am, abusing your attention...

I am working on an "incremental content" feature for Moodle - and my
plan is to serve pre-computed "patchfiles" based on the xdelta utility
to the client systems.

Now, I need to provide a wrapper that concats the deltas from the xdelta
utility with a more verbose header - akin to the header in git's unified
diff output. This is because the xdelta utility only handles one file
delta at a time - the file is a pure delta (prefaced with a SHA1 of the
file it applies to, IIRC).

(From xdelta I like that it's one-way-only, and compressed internally --
thus saving a lot of space on large changes. There are small statically
linked binaries for windows, osx and linux. I did consider using git's
own diffs, but it involves significantly more work, and portability to
Win32 is still green for the wide distribution this project is expecting.)

So my question is what is a good format for the header? My thinking sofar:

 - have a prefix to scan for, such as "xdelta" at the beginning of
   the file, or after a newline/whitespace

 - keep the <fromsha1> <tosha1> line

 - \0 delimited filenames

 - filenames as ambiguous bag'o'bytes or utf-8?
   (should we have another flamewar on this? ;-) )

 - keep file modes and perhaps support copy/move headers

 - keep a/ b/ prefixes?

 - last line in the header is length: <length-in-bytes>, followed by
   a newline and the xdelta itself

 - one or more newlines follow the end of the xdelta if there is another
   header coming

Something along the lines of

xdelta d065883..74cd8e5 100644
a/foo.zip\0
b/foo.zip\0
length 1024
<1024 bytes of xdelta data>

xdelta d065883..74cd8e5 100644
a/bar.zip\0
b/bar.zip\0
length 92312

<92312 bytes xdelta data>EOF

  ---

Would the above work as a reasonably solid patch header format? Is there
something else I should be using instead of rolling my own? If there
isn't a more suitable tool,  and I'm hoping to come up with something
unambiguous and reliable that is generally useful.

[ I have to confess, it came as a bit of a surprise that xdelta didn't
support this out of the box. Haven't seen any existing wrapper for it
that covers this either. ]

As a kludge I could tar both sides and xdelta across the tars, but it is
wasteful, and an xdelta-based diff/patch that can handle multiple files
does seem useful. And I don't know how stable the output of tar is (wrt
file ordering for example).

TIA for any feedback :-)


m
-- 

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux