[OE-core] [oe-commits] [openembedded-core] 02/03: reproducible_build_simple.bbclass: simple environment for reproducible binaries

Bystricky, Juro juro.bystricky at intel.com
Mon Mar 19 17:38:35 UTC 2018


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 [martin.jansa at gmail.com]
Sent: Sunday, March 18, 2018 7:22 AM
To: Bystricky, Juro; Patches and discussions about the oe-core layer
Cc: openembedded-commits at lists.openembedded.org
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 <martin.jansa at gmail.com<mailto:martin.jansa at gmail.com>> 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 <martin.jansa at gmail.com<mailto:martin.jansa at gmail.com>> 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, <git at git.openembedded.org<mailto:git at git.openembedded.org>> 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 <juro.bystricky at intel.com<mailto:juro.bystricky at intel.com>>
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.

    Signed-off-by: Juro Bystricky <juro.bystricky at intel.com<mailto:juro.bystricky at intel.com>>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org<mailto:richard.purdie at linuxfoundation.org>>
---
 meta/classes/reproducible_build_simple.bbclass | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/meta/classes/reproducible_build_simple.bbclass b/meta/classes/reproducible_build_simple.bbclass
new file mode 100644
index 0000000..dd11cd9
--- /dev/null
+++ b/meta/classes/reproducible_build_simple.bbclass
@@ -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
Openembedded-commits at lists.openembedded.org<mailto:Openembedded-commits at lists.openembedded.org>
http://lists.openembedded.org/mailman/listinfo/openembedded-commits



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20180319/319f060c/attachment-0002.html>


More information about the Openembedded-core mailing list