Add a --dmverity flag to `ctr images build-erofs-cache`. When set, each cached
erofs blob is dm-verity formatted (the hash tree is appended in place) and a
.dmverity sidecar is written alongside it. This is required when the erofs
snapshotter runs with dmverity_mode=on, which rejects cache hits that lack a
sidecar; without it such layers would have to be formatted out-of-band.
Extract the differ's dm-verity formatting into a shared dmverity.FormatLayer so
the differ and the cache builder share one implementation; the differ's
formatDmverityLayer now delegates to it.
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
We need enhance MetadataPath() with checking the layerBlobPath's
suffix to ensure it doesn't end with .dmverity.
And add a unit test asserting that MetadataPath("...dmverity")
returns the path unchanged to lock in the new behavior.
Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>