[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [nmh-workers] Reproducible build patch
From: |
Ralph Corderoy |
Subject: |
Re: [nmh-workers] Reproducible build patch |
Date: |
Tue, 24 Jul 2018 13:16:21 +0100 |
Hi Ken,
> We received the following bug report today:
>
> http://savannah.nongnu.org/support/?109535
>
> It seems to me like reproducible builds are probably a pretty good
> idea
Yes.
> and nmh should support them, and the patch looks relatively small.
It tinkers with the hostname too.
$ curl -sSgL
'https://savannah.nongnu.org/support/download.php?file_id=44608' |
> grep host
-host=`uname -n`
+host=${HOSTNAME:-`uname -n`}
char *version_str = "nmh-$version$git built $date on $host";
$
> But to be completely portable the date line should be (from here):
> https://wiki.debian.org/ReproducibleBuilds/TimestampsProposal#Bash_.2F_POSIX_shell
>
> DATE_FMT="%Y-%m-%d %T +0000"
> SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +s)}"
> date=$(TZ=GMT0 date --date="@$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null ||
> date -u -r "$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || date -u
> "+$DATE_FMT")
https://reproducible-builds.org/specs/source-date-epoch/ says
The value MUST be an ASCII representation of an integer with no
fractional component, identical to the output format of date +%s.
If the value is malformed, the build process SHOULD exit with a
non-zero error code.
So I think `:-' is the wrong test, and `:' should be used.
The `+0000' is being hard-coded into date's output, rather than asking
date for the TZ to spot if the attempt to use UTC failed.
I've found some fine documentation.
POSIX https://manned.org/date.1p
Coreutils https://manned.org/date.1
https://www.gnu.org/software/coreutils/manual/coreutils.html#Options-for-date
Plan9 https://manned.org/date.1plan9
OpenBSD https://man.openbsd.org/date
FreeBSD https://www.freebsd.org/cgi/man.cgi?date
macOSĀ¹ https://ss64.com/osx/date.html (Maybe.)
How about
fmt='%Y-%m-%d %T %z'
now="${SOURCE_DATE_EPOCH-$(date +%s)}"
date="$(
exec 2>/dev/null
date -u -d "@$now" +"$fmt" ||
date -u -r "$now" +"$fmt" ||
date -u +"$fmt"
)"
printf '%q\n' "$fmt" "$now" "$date"
Tried with Coreutils and FreeBSD.
I think we should stick with `yyyy-mm-dd' rather than switching to
podium-style, like
https://sources.debian.org/src/nmh/1.7.1-2/debian/patches/11-repro/
--
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy
Re: [nmh-workers] Reproducible build patch, Bakul Shah, 2018/07/23
Re: [nmh-workers] Reproducible build patch,
Ralph Corderoy <=
Re: [nmh-workers] Reproducible build patch, Robert Elz, 2018/07/24
Re: [nmh-workers] Reproducible build patch, valdis . kletnieks, 2018/07/24
Re: [nmh-workers] Reproducible build patch, Robert Elz, 2018/07/24