Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
To: Juro Bystricky <juro.bystricky@intel.com>
Cc: jurobystricky@hotmail.com, openembedded-core@lists.openembedded.org
Subject: Re: [PATCH v3 08/11] python2.7: improve reproducibility
Date: Thu, 17 Aug 2017 14:39:06 -0500	[thread overview]
Message-ID: <1502998746.28682.17.camel@linux.intel.com> (raw)
In-Reply-To: <1502300913-40295-9-git-send-email-juro.bystricky@intel.com>

On Wed, 2017-08-09 at 10:48 -0700, Juro Bystricky wrote:
> The compiled .pyc files contain time stamp corresponding to the compile time.
> This prevents binary reproducibility. This patch allows to achieve binary
> reproducibility by overriding the build time stamp by the value
> exported via SOURCE_DATE_EPOCH.
> 
> Patch by Bernhard M. Wiedemann, backported from https://github.com/python/cpython/pull/296
> 
> [YOCTO#11241]
> 
> Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
> ---
>  .../python/python-native_2.7.13.bb                 |  1 +
>  .../python/python/reproducible.patch               | 34 ++++++++++++++++++++++
>  meta/recipes-devtools/python/python_2.7.13.bb      |  1 +
>  3 files changed, 36 insertions(+)
>  create mode 100644 meta/recipes-devtools/python/python/reproducible.patch
> 
> diff --git a/meta/recipes-devtools/python/python-native_2.7.13.bb b/meta/recipes-devtools/python/python-native_2.7.13.bb
> index 7edf153..a82b7bb 100644
> --- a/meta/recipes-devtools/python/python-native_2.7.13.bb
> +++ b/meta/recipes-devtools/python/python-native_2.7.13.bb
> @@ -17,6 +17,7 @@ SRC_URI += "\
>              file://builddir.patch \
>              file://parallel-makeinst-create-bindir.patch \
>              file://revert_use_of_sysconfigdata.patch \
> +            file://reproducible.patch \


Not really important but it would be better to rename the patch to
something more specific
('repoducible-build-time-override-by-source-date-epoch.path'), allowing
future patches in this area. Besides a better name, it helps to quickly
identify the patch purpose without looking at the code itself.



>             "
>  
>  S = "${WORKDIR}/Python-${PV}"
> diff --git a/meta/recipes-devtools/python/python/reproducible.patch b/meta/recipes-devtools/python/python/reproducible.patch
> new file mode 100644
> index 0000000..1265179
> --- /dev/null
> +++ b/meta/recipes-devtools/python/python/reproducible.patch
> @@ -0,0 +1,34 @@
> +The compiled .pyc files contain time stamp corresponding to the compile time.
> +This prevents binary reproducibility. This patch allows to achieve binary
> +reproducibility by overriding the build time stamp by the value 
> +exported via SOURCE_DATE_EPOCH. 
> +
> +Patch by Bernhard M. Wiedemann
> +
> +Upstream-Status: Backport
> +
> +Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
> +
> +Fri Feb 24 17:08:25 UTC 2017 - bwiedemann@suse.com
> +
> +- Add reproducible.patch to allow reproducible builds of various
> +  python packages like python-amqp
> +  Upstream: https://github.com/python/cpython/pull/296
> +
> +
> +@@ -0,0 +1,15 @@
> +Index: Python-2.7.13/Lib/py_compile.py
> +===================================================================
> +--- Python-2.7.13.orig/Lib/py_compile.py
> ++++ Python-2.7.13/Lib/py_compile.py
> +@@ -108,6 +108,10 @@ def compile(file, cfile=None, dfile=None
> +             timestamp = long(os.fstat(f.fileno()).st_mtime)
> +         except AttributeError:
> +             timestamp = long(os.stat(file).st_mtime)
> ++        sde = os.environ.get('SOURCE_DATE_EPOCH')
> ++        if sde and timestamp > int(sde):
> ++            timestamp = int(sde)
> ++            os.utime(file, (timestamp, timestamp))
> +         codestring = f.read()
> +     try:
> +         codeobject = __builtin__.compile(codestring, dfile or file,'exec')
> diff --git a/meta/recipes-devtools/python/python_2.7.13.bb b/meta/recipes-devtools/python/python_2.7.13.bb
> index 4ef9952..96c3ab2 100644
> --- a/meta/recipes-devtools/python/python_2.7.13.bb
> +++ b/meta/recipes-devtools/python/python_2.7.13.bb
> @@ -27,6 +27,7 @@ SRC_URI += "\
>    file://use_sysroot_ncurses_instead_of_host.patch \
>    file://add-CROSSPYTHONPATH-for-PYTHON_FOR_BUILD.patch \
>    file://Don-t-use-getentropy-on-Linux.patch \
> +  file://reproducible.patch \
>  "
>  
>  S = "${WORKDIR}/Python-${PV}"
> -- 
> 2.7.4
> 




  reply	other threads:[~2017-08-17 19:30 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09 17:48 [PATCH v3 00/11] Reproducible binaries Juro Bystricky
2017-08-09 17:48 ` [PATCH v3 01/11] reproducible_build.bbclass: initial support for binary reproducibility Juro Bystricky
2017-08-19  8:25   ` Martin Jansa
2017-08-19 16:08     ` Bystricky, Juro
2017-08-09 17:48 ` [PATCH v3 02/11] image-prelink.bbclass: support " Juro Bystricky
2017-08-17 19:54   ` Leonardo Sandoval
2017-08-09 17:48 ` [PATCH v3 03/11] rootfs-postcommands.bbclass: " Juro Bystricky
2017-08-09 17:48 ` [PATCH v3 04/11] busybox.inc: improve reproducibility Juro Bystricky
2017-08-09 17:48 ` [PATCH v3 05/11] image.bbclass: support binary reproducibility Juro Bystricky
2017-08-09 17:48 ` [PATCH v3 06/11] cpio: provide cpio-replacement-native Juro Bystricky
2017-08-09 17:48 ` [PATCH v3 07/11] image_types.bbclass: improve cpio image reproducibility Juro Bystricky
2017-08-09 18:06   ` Andre McCurdy
2017-08-10 19:35     ` Bystricky, Juro
2017-08-10 20:06       ` Andre McCurdy
2017-08-10 20:36         ` Bystricky, Juro
2017-08-09 17:48 ` [PATCH v3 08/11] python2.7: improve reproducibility Juro Bystricky
2017-08-17 19:39   ` Leonardo Sandoval [this message]
2017-08-19 16:39     ` Bystricky, Juro
2017-08-09 17:48 ` [PATCH v3 09/11] python3: " Juro Bystricky
2017-08-09 17:48 ` [PATCH v3 10/11] kernel.bbclass: " Juro Bystricky
2017-08-17 16:14   ` Christopher Larson
2017-08-17 18:18     ` Bystricky, Juro
2017-08-09 17:48 ` [PATCH v3 11/11] poky-reproducible.conf: Initial version Juro Bystricky
2017-08-09 19:09   ` Andre McCurdy
2017-08-18 18:11 ` [PATCH v3 00/11] Reproducible binaries Martin Jansa
2017-08-18 18:27   ` Bystricky, Juro
2017-08-18 20:32     ` Martin Jansa
2017-08-18 20:42       ` Bystricky, Juro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1502998746.28682.17.camel@linux.intel.com \
    --to=leonardo.sandoval.gonzalez@linux.intel.com \
    --cc=juro.bystricky@intel.com \
    --cc=jurobystricky@hotmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox