It would be nice if 'darcs dist' supported creating reproducible .tar.gz
files, when given suitable options. At the moment, what I do is this:
(1) get the xml-formatted data of the tag, grep it for the timestamp and
convert it to format suitable for touch:
timestamp=$(darcs changes --no-interactive --xml-output --matches
'exact "TAG <tag>"'\
| perl -ne 'print "$1.$2" if /date=.(\d{12})(\d{2})/')
(2) touch every source file with this timestamp:
darcs show files | xargs touch -t "$timestamp"
(3) darcs dist -d <project-name>-<tag> -t <tag>
This is a step in the right direction and seems to work in simple cases,
but is far from ideal. For instance, what if a file that belongs to an
old tag has been removed later? Since 'darcs show files' has no --tag
option, such a file will not get the same timestamp as the other files.
A work-around would be to 'darcs get --tag="^<tag>$"' to a temporary
location and perform the above actions there.
I assume that the order in which the files are stored in the tar is
deterministic; if this is not the case, then darcs should be modified to
support that.
A side note: the code above demonstrates the hoops one has to go through
just to get the exact timestamp of a patch. It would be nice if the UI
offered more direct ways to get at the low-level meta data of a patch.
Also note that the method above is not reliable, since tag names are not
enforced to be unique per repo. However, these are separate issues.
|