[Rpm-metadata] [PATCH] Add delta metadata generator to createrepo
Zdenek Pavlas
zpavlas at redhat.com
Tue Jul 23 15:05:15 UTC 2013
> Hmm, I'm don't think I get that. Do you have an example repository
> with deltas somewhere?
It looks like this:
...
<data type="primary">
<checksum type="sha256">2dc1c40c274ce4312b16bd561d150000e38bda4f466ed806a2b33ac9659e32a5</checksum>
<open-checksum type="sha256">2715c291f0026399843c1e2d26b61d87eff411d90bd080b41a6cb00a83c80a85</open-checksum>
<location href="repodata/2dc1c40c274ce4312b16bd561d150000e38bda4f466ed806a2b33ac9659e32a5-primary.xml.gz"/>
<timestamp>1374588898</timestamp>
<size>10424</size>
<open-size>74586</open-size>
<delta>
<checksum type="sha256">2dc955f583dbfb8143cf7738a985ffca540d1b4c7f37eedd0ddc9a10a38a50b4</checksum>
<location href="repodata/2dc955f583dbfb8143cf7738a985ffca540d1b4c7f37eedd0ddc9a10a38a50b4-primary.xml.delta0.bz2"/>
<timestamp>1374583294</timestamp>
<size>39</size>
</delta>
<delta>
<checksum type="sha256">c1e7d179854a9d5871e2b5db50c6b4e8f80cede0ee86f5492be77fcf7f72fed2</checksum>
<location href="repodata/c1e7d179854a9d5871e2b5db50c6b4e8f80cede0ee86f5492be77fcf7f72fed2-primary.xml.delta1.bz2"/>
<timestamp>1374583246</timestamp>
<size>2095</size>
</delta>
</data>
...
Assuming the client already has primary.xml with timestamp T:
delta0 updates to 1374588898 from 1374583294 <= T < 1374588898
delta1 updates to 1374588898 from 1374583246 <= T < 1374583294
I split every source/target file at "<package " boundary, and at the last closing XML tag,
so metadata file with N packages yields N+2 chunks (header + footer). Chunks are sha1 hashed,
and assumed to be unique (with minor tweaks it could work with duped chunks too, but it's better
to keep things simple.
The delta format is a sequence of \n terminated tokens, either +<size> followed by data literals
(handling these is trivial) or a hash prefix. Handling such is quite simple, too- just skip
chunks from the old version until the hash starts with given prefix.
More information about the Rpm-metadata
mailing list