[pacman-dev] [PATCH] Add a timestamp file into repo tarballs

Morten Linderud foxboron at archlinux.org
Tue Nov 5 14:16:27 UTC 2019


On Wed, Nov 06, 2019 at 12:03:17AM +1000, Allan McRae wrote:
> On 5/11/19 11:58 pm, Morten Linderud wrote:
> > On Tue, Nov 05, 2019 at 11:54:34PM +1000, Allan McRae wrote:
> >> When creating or modifying repo tarballs, place a .TIMESTAMP file with
> >> seconds since epoch in it.  This will be used in the future to enable
> >> rejecting databases older that a given threshold.
> >>
> >> Also skip reading the .TIMESTAMP file in sync_db_populate().
> >>
> >> Signed-off-by: Allan McRae <allan at archlinux.org>
> >> ---
> >>
> 
> <snip>
> 
> >> diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
> >> index caf1232d..c87409f1 100644
> >> --- a/scripts/repo-add.sh.in
> >> +++ b/scripts/repo-add.sh.in
> >> @@ -526,6 +526,7 @@ create_db() {
> >>  	TAR_OPT=$(verify_repo_extension "$REPO_DB_FILE")
> >>  	# $LOCKFILE is already guaranteed to be absolute so this is safe
> >>  	dirname=${LOCKFILE%/*}
> >> +	timestamp=$(date +%s)
> > 
> > This should probably utilize SOURCE_DATE_EPOCH or something equivalent?
> > 
> > timestamp=$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%s))
> 
> Why?  I can see no reason why it should...

If you wan't to write tests for `repo-add` in the future, I think it will be
beneficial to be able to create consistent databases.

Outside of pacman I believe being able to reproduce any artifact produced is
desireable. Enables us to not run through hoops recreating past database files
given the correct packages.

-- 
Morten Linderud
PGP: 9C02FF419FECBE16
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20191105/d09bccd1/attachment-0001.sig>


More information about the pacman-dev mailing list