nmh-workers
[Top] [All Lists]

Re: [nmh-workers] Reproducible build patch

2018-07-24 17:54:45
On Tue, 24 Jul 2018 16:40:48 +0100, Ralph Corderoy said:

How about

    +fmt='%Y-%m-%d %T %z'
    +now=${SOURCE_DATE_EPOCH-$(date +%s)}
    +if date -u -d @42 +"$fmt" >/dev/null 2>&1; then   # Coreutils.
    +    date=$(date -u -d "@$now" +"$fmt")
    +elif date -u -r 42 +"$fmt" >/dev/null 2>&1; then   # BSD.
    +    date=$(date -u -r "$now" +"$fmt")
    +else   # Posix, ignoring SOURCE_DATE_EPOCH.
    +    date=$(date -u +"$fmt")
    +fi

Oh, much better than that date || date || date monstrosity - I was
unable to figure out that the second one was intended for a different
date binary than the first one

Attachment: pgpbru7HT3P3g.pgp
Description: PGP signature

-- 
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers
<Prev in Thread] Current Thread [Next in Thread>