devrandom / gitian-builder

Build packages in a secure deterministic fashion inside a VM
https://gitian.org/
Other
400 stars 226 forks source link

Fixes gbuild failure on OSX #221

Closed alpe closed 5 years ago

alpe commented 5 years ago

Problem: Fails on OSX

The current master bin/gbuild fails on OSX (Mojave) when formatting the author_date.

The following error is displayed:

...
date: illegal time format
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
            [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]

bin/gbuild:147:in `block (2 levels) in build_one_configuration': error looking up author date in ... (RuntimeError)

Reason

author_date = `cd inputs/#{dir} && git log --format=@%at -1 | date +"%F %T" -u -f -`.strip

The OSX date does not support the give arguments.

Solution

Instead of working with the date command and incompatibilities, the proposed solution builds on git only:

TZ=UTC git log --date='format-local:%F %T' --format="%ad" -1`

This converts the author date into UTC and the same destination format: 2019-04-30 11:51:51

Tested with

devrandom commented 5 years ago

thank you!

fanquake commented 5 years ago

Nice, I had just been patching to use gdate previously.