On 14 March 2015 at 02:28, Marc Espie <es...@nerim.net> wrote: > On Fri, Mar 13, 2015 at 01:13:39PM -0700, Constantine A. Murenin wrote: >> Hello, >> >> The commit below from 2014-09-16 must have broken the snapshot time >> detection on http://ports.su/ , which must have been broken since >> 2014-09-21. >> >> Is there a cross-platform way to best get it back from the package file? > Yes, parse the +CONTENTS file and restore the associated @ts. > > Any tool that reads files can do so easily. In perl, > perl -ne '$seen = 1 if m/sqlports-compact/; if ($seen == 1 && m/\@ts\s+(.*)/) > { system("date -r $1"); exit 0; }' /var/db/pkg/sqlports-compact-*/+CONTENTS > will retrieve and display the timestamp.
May I also ask why is it necessary to remove the timestamp information from the tar archives themselves? I can think of at least one other scenario where the files from the package might be of interest without http://mdoc.su/o/pkg_add.1 -- harvesting the man-pages from the packages. Perhaps the change of deleting mtime from tar could be undone going forward? Especially since mtime already appears to be required as part of the header of the tar format, http://mdoc.su/f/tar.5, thus not even occupying any extra space at all, apart from the possible compression considerations. What do we gain by losing the ability to use the normal and interoperable UNIX tools to examine the archive files of the packages? > > Something similar can be easily cobbled using any kind of sed/awk/grep > > >> I guess the easiest way would be to fix the date with the snippet as >> follows; or is there a better way? >> >> %sh -c 'touch -d $(env TZ=GMT date -r $(stat -f"%m" +CONTENTS) >> +%FT%TZ) share/sqlports-compact' > > You assume sqlports-compacts should/can have the snapshots of +CONTENTS... > this is not quite true. Would any difference be material here? It seems that it's basically the same date, as far as estimating the time of the snapshot is concerned, which in reality is more of an undefined period of multiple hours anyways. Cheers, Constantine.