Skip to contentSkip to conversation

02/03: reproducible_build_simple.bbclass: simple environment for reproducible binaries

oe-commits Martin Jansa 2 participants 4 messages Mar 18, 2018 – Mar 19, 2018 2 messages not in the archive

lore
Share & tools
lore
#2 lore raw
In reply to a message not in the archive

Hi,

There seems to be small issue when people set BUILD_REPRODUCIBLE_BINARIES = "1" without exporting SOURCE_DATE_EPOCH like this .bbclass does

In kernel.bbclass change from:
http://git.openembedded.org/openembedded-core/commit/meta/classes/kernel.bbclass?id=012a70da7ae0617740cd0cf807d01c3cd912c823

you're comparing SOURCE_DATE_EPOCH with 0 which doesn't seem to be set anywhere, so by default it's empty which leads to kernel build failure like this:

DEBUG: Executing shell function do_compile
date: invalid date '@'
WARNING: exit code 1 from a shell command.

because empty SOURCE_DATE_EPOCH is used in "ts=LC_ALL=C date -d @$SOURCE_DATE_EPOCH". Testing SOURCE_DATE_EPOCH for empty or "0" allows to use REPRODUCIBLE_TIMESTAMP_ROOTFS as a default value again.

These build failures seem to be triggered in all my builds since kernel.bbclass was fixed to respect BUILD_REPRODUCIBLE_BINARIES in:
http://git.openembedded.org/openembedded-core/commit/meta/classes/kernel.bbclass?id=27f87bbc8395a2481ef808465a62d213a6b678ac

One way to fit it would be to inherit reproducible_build_simple.bbclass, but this requirement to set exported SOURCE_DATE_EPOCH doesn't seem to be documented anywhere and looking at kernel.bbclass changes it probably wasn't even intended like that.

Thanks

Quoted 56 lines · On Mon, Mar 12, 2018 at 11:06 PM, <[email protected]> wrote:

This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 5c2685c5ee2f8210a36b9a8591491b6af0482084
Author: Juro Bystricky <[email protected]>
AuthorDate: Sat Mar 10 10:57:49 2018 -0800

reproducible_build_simple.bbclass: simple environment for
reproducible binaries

Export environmental variables needed for binary reproducibility with
consistent values.

This class can be used either directly via:
INHERIT += "reproducible_build_simple"

or can be inherited by a more complex/complete bbclass, for example a
bblass which
will crack SOURCE_DATE_EPOCH for each recipe.

---
 meta/classes/reproducible_build_simple.bbclass | 11 +++++++++++
 1 file changed, 11 insertions(+)
meta/classes/reproducible_build_simple.bbclass new file +11 -1
new file mode 100644
index 0000000..dd11cd9
@@ -0,0 +1,11 @@
+# Setup default environment for reproducible builds.
+
+BUILD_REPRODUCIBLE_BINARIES = "1"
+
+export PYTHONHASHSEED = "0"
+export PERL_HASH_SEED = "0"
+export TZ = 'UTC'
+export SOURCE_DATE_EPOCH ??= "1520598896"
+
+REPRODUCIBLE_TIMESTAMP_ROOTFS ??= "1520598896"
+
 
--

To stop receiving notification emails like this one, please contact the administrator of this repository.
--
_______________________________________________
Openembedded-commits mailing list [email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-commits

#3 lore raw

I've also noticed that the kernel.bbclass says:

                # kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH
may not
                # be set....

but with git grep SOURCE_DATE_EPOCH I don't see any code in bitbake or oe-core where this would be set in do_unpack (in oe-core/master and oe-core/rocko). Is this part still only in one of your contrib branches for reproducible?

Regards,

Quoted 93 lines · Martin Jansa

Hi,

There seems to be small issue when people set BUILD_REPRODUCIBLE_BINARIES = "1" without exporting SOURCE_DATE_EPOCH like this .bbclass does

In kernel.bbclass change from:
http://git.openembedded.org/openembedded-core/commit/meta/
classes/kernel.bbclass?id=012a70da7ae0617740cd0cf807d01c3cd912c823

you're comparing SOURCE_DATE_EPOCH with 0 which doesn't seem to be set anywhere, so by default it's empty which leads to kernel build failure like this:

DEBUG: Executing shell function do_compile
date: invalid date '@'
WARNING: exit code 1 from a shell command.

because empty SOURCE_DATE_EPOCH is used in "ts=LC_ALL=C date -d @$SOURCE_DATE_EPOCH". Testing SOURCE_DATE_EPOCH for empty or "0" allows to use REPRODUCIBLE_TIMESTAMP_ROOTFS as a default value again.

These build failures seem to be triggered in all my builds since kernel.bbclass was fixed to respect BUILD_REPRODUCIBLE_BINARIES in:
http://git.openembedded.org/openembedded-core/commit/meta/
classes/kernel.bbclass?id=27f87bbc8395a2481ef808465a62d213a6b678ac

One way to fit it would be to inherit reproducible_build_simple.bbclass, but this requirement to set exported SOURCE_DATE_EPOCH doesn't seem to be documented anywhere and looking at kernel.bbclass changes it probably wasn't even intended like that.

Thanks

Quoted 56 lines · On Mon, Mar 12, 2018 at 11:06 PM, <[email protected]> wrote:

This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 5c2685c5ee2f8210a36b9a8591491b6af0482084
Author: Juro Bystricky <[email protected]>
AuthorDate: Sat Mar 10 10:57:49 2018 -0800

reproducible_build_simple.bbclass: simple environment for
reproducible binaries

Export environmental variables needed for binary reproducibility with
consistent values.

This class can be used either directly via:
INHERIT += "reproducible_build_simple"

or can be inherited by a more complex/complete bbclass, for example a
bblass which
will crack SOURCE_DATE_EPOCH for each recipe.

---
 meta/classes/reproducible_build_simple.bbclass | 11 +++++++++++
 1 file changed, 11 insertions(+)
meta/classes/reproducible_build_simple.bbclass new file +11 -1
new file mode 100644
index 0000000..dd11cd9
@@ -0,0 +1,11 @@
+# Setup default environment for reproducible builds.
+
+BUILD_REPRODUCIBLE_BINARIES = "1"
+
+export PYTHONHASHSEED = "0"
+export PERL_HASH_SEED = "0"
+export TZ = 'UTC'
+export SOURCE_DATE_EPOCH ??= "1520598896"
+
+REPRODUCIBLE_TIMESTAMP_ROOTFS ??= "1520598896"
+
 
--

To stop receiving notification emails like this one, please contact the administrator of this repository.
--
_______________________________________________
Openembedded-commits mailing list [email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-commits

#4 lore raw

SOURCE_DATE_EPOCH was supposed to be exported in this review:
https://patchwork.openembedded.org/patch/139558/
but it wasn't merged to master nor rocko.

Quoted 110 lines · Martin Jansa

I've also noticed that the kernel.bbclass says:

                # kernel sources do not use do_unpack, so
SOURCE_DATE_EPOCH may not
                # be set....

but with git grep SOURCE_DATE_EPOCH I don't see any code in bitbake or oe-core where this would be set in do_unpack (in oe-core/master and oe-core/rocko). Is this part still only in one of your contrib branches for reproducible?

Regards,

Quoted 93 lines · Martin Jansa

Hi,

There seems to be small issue when people set BUILD_REPRODUCIBLE_BINARIES = "1" without exporting SOURCE_DATE_EPOCH like this .bbclass does

In kernel.bbclass change from:
http://git.openembedded.org/openembedded-core/commit/meta/cl
asses/kernel.bbclass?id=012a70da7ae0617740cd0cf807d01c3cd912c823

you're comparing SOURCE_DATE_EPOCH with 0 which doesn't seem to be set anywhere, so by default it's empty which leads to kernel build failure like this:

DEBUG: Executing shell function do_compile
date: invalid date '@'
WARNING: exit code 1 from a shell command.

because empty SOURCE_DATE_EPOCH is used in "ts=LC_ALL=C date -d @$SOURCE_DATE_EPOCH". Testing SOURCE_DATE_EPOCH for empty or "0" allows to use REPRODUCIBLE_TIMESTAMP_ROOTFS as a default value again.

These build failures seem to be triggered in all my builds since kernel.bbclass was fixed to respect BUILD_REPRODUCIBLE_BINARIES in:
http://git.openembedded.org/openembedded-core/commit/meta/cl
asses/kernel.bbclass?id=27f87bbc8395a2481ef808465a62d213a6b678ac

One way to fit it would be to inherit reproducible_build_simple.bbclass, but this requirement to set exported SOURCE_DATE_EPOCH doesn't seem to be documented anywhere and looking at kernel.bbclass changes it probably wasn't even intended like that.

Thanks

Quoted 56 lines · On Mon, Mar 12, 2018 at 11:06 PM, <[email protected]> wrote:

This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 5c2685c5ee2f8210a36b9a8591491b6af0482084
Author: Juro Bystricky <[email protected]>
AuthorDate: Sat Mar 10 10:57:49 2018 -0800

reproducible_build_simple.bbclass: simple environment for
reproducible binaries

Export environmental variables needed for binary reproducibility
with consistent values.

This class can be used either directly via:
INHERIT += "reproducible_build_simple"

or can be inherited by a more complex/complete bbclass, for example
a bblass which
will crack SOURCE_DATE_EPOCH for each recipe.

---
 meta/classes/reproducible_build_simple.bbclass | 11 +++++++++++
 1 file changed, 11 insertions(+)
meta/classes/reproducible_build_simple.bbclass new file +11 -1
new file mode 100644
index 0000000..dd11cd9
@@ -0,0 +1,11 @@
+# Setup default environment for reproducible builds.
+
+BUILD_REPRODUCIBLE_BINARIES = "1"
+
+export PYTHONHASHSEED = "0"
+export PERL_HASH_SEED = "0"
+export TZ = 'UTC'
+export SOURCE_DATE_EPOCH ??= "1520598896"
+
+REPRODUCIBLE_TIMESTAMP_ROOTFS ??= "1520598896"
+
 
--

To stop receiving notification emails like this one, please contact the administrator of this repository.
--
_______________________________________________
Openembedded-commits mailing list [email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-commits

#5 lore raw

Hi Martin,
thanks for your feedback.
I will send to ML a new version of the patch within a day or two. The patch you mentioned (v2) had a few short-comings, hopefully fixed in the next one (currently being tested). Meanwhile, you may want to have a look at the recently updated wiki page (and it will be updated again) how to build reproducible builds with "hard-coded" SOURCE_DATE_EPOCH:
https://wiki.yoctoproject.org/wiki/Reproducible_Builds

Thanks
________________________________
From: Martin Jansa [[email protected]]
Sent: Sunday, March 18, 2018 7:22 AM
To: Bystricky, Juro; Patches and discussions about the oe-core layer
Cc: [email protected]
Subject: Re: [oe-commits] [openembedded-core] 02/03: reproducible_build_simple.bbclass: simple environment for reproducible binaries

SOURCE_DATE_EPOCH was supposed to be exported in this review:
https://patchwork.openembedded.org/patch/139558/
but it wasn't merged to master nor rocko.

On Sun, Mar 18, 2018 at 3:13 PM, Martin Jansa <[email protected]<mailto:[email protected]>> wrote:
I've also noticed that the kernel.bbclass says:

                # kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not
                # be set....

but with git grep SOURCE_DATE_EPOCH I don't see any code in bitbake or oe-core where this would be set in do_unpack (in oe-core/master and oe-core/rocko). Is this part still only in one of your contrib branches for reproducible?

Regards,

On Sun, Mar 18, 2018 at 3:06 PM, Martin Jansa <[email protected]<mailto:[email protected]>> wrote:
Hi,

There seems to be small issue when people set BUILD_REPRODUCIBLE_BINARIES = "1" without exporting SOURCE_DATE_EPOCH like this .bbclass does

In kernel.bbclass change from:
http://git.openembedded.org/openembedded-core/commit/meta/classes/kernel.bbclass?id=012a70da7ae0617740cd0cf807d01c3cd912c823

you're comparing SOURCE_DATE_EPOCH with 0 which doesn't seem to be set anywhere, so by default it's empty which leads to kernel build failure like this:

DEBUG: Executing shell function do_compile
date: invalid date '@'
WARNING: exit code 1 from a shell command.

because empty SOURCE_DATE_EPOCH is used in "ts=LC_ALL=C date -d @$SOURCE_DATE_EPOCH". Testing SOURCE_DATE_EPOCH for empty or "0" allows to use REPRODUCIBLE_TIMESTAMP_ROOTFS as a default value again.

These build failures seem to be triggered in all my builds since kernel.bbclass was fixed to respect BUILD_REPRODUCIBLE_BINARIES in:
http://git.openembedded.org/openembedded-core/commit/meta/classes/kernel.bbclass?id=27f87bbc8395a2481ef808465a62d213a6b678ac

One way to fit it would be to inherit reproducible_build_simple.bbclass, but this requirement to set exported SOURCE_DATE_EPOCH doesn't seem to be documented anywhere and looking at kernel.bbclass changes it probably wasn't even intended like that.

Thanks

On Mon, Mar 12, 2018 at 11:06 PM, <[email protected]<mailto:[email protected]>> wrote:
This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 5c2685c5ee2f8210a36b9a8591491b6af0482084
Author: Juro Bystricky <[email protected]<mailto:[email protected]>>
AuthorDate: Sat Mar 10 10:57:49 2018 -0800

reproducible_build_simple.bbclass: simple environment for reproducible binaries

Export environmental variables needed for binary reproducibility with consistent values.

This class can be used either directly via:
INHERIT += "reproducible_build_simple"

or can be inherited by a more complex/complete bbclass, for example a bblass which will crack SOURCE_DATE_EPOCH for each recipe.

---
 meta/classes/reproducible_build_simple.bbclass | 11 +++++++++++
 1 file changed, 11 insertions(+)
meta/classes/reproducible_build_simple.bbclass new file +11 -0
new file mode 100644
index 0000000..dd11cd9
@@ -0,0 +1,11 @@
+# Setup default environment for reproducible builds.
+
+BUILD_REPRODUCIBLE_BINARIES = "1"
+
+export PYTHONHASHSEED = "0"
+export PERL_HASH_SEED = "0"
+export TZ = 'UTC'
+export SOURCE_DATE_EPOCH ??= "1520598896"
+
+REPRODUCIBLE_TIMESTAMP_ROOTFS ??= "1520598896"
+

--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
--
_______________________________________________
Openembedded-commits mailing list [email protected]<mailto:[email protected]>
http://lists.openembedded.org/mailman/listinfo/openembedded-commits