Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v4 13/18] python2: generate reproducible .pyc
Date: Wed, 23 Nov 2016 23:05:39 +0100	[thread overview]
Message-ID: <20161123230539.4762ebcd@free-electrons.com> (raw)
In-Reply-To: <1479905937-17241-14-git-send-email-jezz@sysmic.org>

Hello,

On Wed, 23 Nov 2016 13:58:52 +0100, J?r?me Pouiller wrote:
> .pyc files contain modification time of .py source. In order to make
> build reproducible, we fix modification time of all .py before to
> compile .pyc files.

"before to compile" -> "before compiling".

> diff --git a/package/python/python.mk b/package/python/python.mk
> index cc65376..c17b267 100644
> --- a/package/python/python.mk
> +++ b/package/python/python.mk
> @@ -226,10 +226,18 @@ PYTHON_PATH = $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/sysconfigdata/
>  $(eval $(autotools-package))
>  $(eval $(host-autotools-package))
>  
> +ifeq ($(BR2_REPRODUCIBLE),y)
> +define PYTHON_FIX_TIME
> +find $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR) -name '*.py' -print0 | \
> +		xargs -0 --no-run-if-empty touch -d @$(SOURCE_DATE_EPOCH)
> +endef
> +PYTHON_TARGET_FINALIZE_HOOKS += PYTHON_FIX_TIME
> +endif
> +
>  define PYTHON_CREATE_PYC_FILES
>  	PYTHONPATH="$(PYTHON_PATH)" \

It would make more sense to just do:

	$(PYTHON_FIX_TIME)

here, rather than registering it as a PYTHON_TARGET_FINALIZE_HOOKS.
Also, maybe it should be named PYTHON_SET_PY_FILES_TIME.

>  	$(HOST_DIR)/usr/bin/python$(PYTHON_VERSION_MAJOR) \
> -		support/scripts/pycompile.py \
> +		support/scripts/pycompile.py $(if $(BR2_REPRODUCIBLE),--force) \

Why do we need to force?

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2016-11-23 22:05 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-23 12:58 [Buildroot] [PATCH v4 00/18] Reproducible builds Jérôme Pouiller
2016-11-23 12:58 ` [Buildroot] [PATCH v4 01/18] reproducibility: generate SOURCE_DATE_EPOCH Jérôme Pouiller
2016-11-23 21:49   ` Thomas Petazzoni
2016-11-23 12:58 ` [Buildroot] [PATCH v4 02/18] reproducible: fix DATE/TIME macros in toolchain-wrapper Jérôme Pouiller
2016-11-23 12:58 ` [Buildroot] [PATCH v4 03/18] reproducible: add '-n' to gzip invocations Jérôme Pouiller
2016-11-23 21:49   ` Thomas Petazzoni
2016-11-23 12:58 ` [Buildroot] [PATCH v4 04/18] fs/tar: make results reproducible Jérôme Pouiller
2016-11-23 21:56   ` Thomas Petazzoni
2016-11-23 12:58 ` [Buildroot] [PATCH v4 05/18] reproducibility/linux: override build timestamp Jérôme Pouiller
2016-11-23 21:56   ` Thomas Petazzoni
2016-11-23 12:58 ` [Buildroot] [PATCH v4 06/18] reproducibility/linux: inhibit build-id Jérôme Pouiller
2016-11-23 12:58 ` [Buildroot] [PATCH v4 07/18] reproducibility/busybox: disable build timestamps Jérôme Pouiller
2016-11-23 21:57   ` Thomas Petazzoni
2016-11-23 12:58 ` [Buildroot] [PATCH v4 08/18] reproducible: lock modification times in $TARGET_DIR Jérôme Pouiller
2016-11-23 21:59   ` Thomas Petazzoni
2016-11-23 12:58 ` [Buildroot] [PATCH v4 09/18] fakedate: new package Jérôme Pouiller
2016-11-23 12:58 ` [Buildroot] [PATCH v4 10/18] core: do not reset DEPENDENCIES_HOST_PREREQ in dependencies.mk Jérôme Pouiller
2016-11-23 12:58 ` [Buildroot] [PATCH v4 11/18] reproducible: enable fakedate Jérôme Pouiller
2016-11-23 12:58 ` [Buildroot] [PATCH v4 12/18] pycompile: allow to force compilation Jérôme Pouiller
2016-11-23 22:03   ` Thomas Petazzoni
2016-11-23 12:58 ` [Buildroot] [PATCH v4 13/18] python2: generate reproducible .pyc Jérôme Pouiller
2016-11-23 22:05   ` Thomas Petazzoni [this message]
2016-11-24 19:06     ` Arnout Vandecappelle
2016-11-26 16:00       ` Jérôme Pouiller
2016-11-23 12:58 ` [Buildroot] [PATCH v4 14/18] python3: " Jérôme Pouiller
2016-11-23 22:09   ` Thomas Petazzoni
2016-11-26 16:20     ` Jérôme Pouiller
2016-11-23 12:58 ` [Buildroot] [PATCH v4 15/18] python2: remove full path from .pyc Jérôme Pouiller
2016-11-23 12:58 ` [Buildroot] [PATCH v4 16/18] python3: " Jérôme Pouiller
2016-11-23 12:58 ` [Buildroot] [PATCH v4 17/18] reproducible: improve help text Jérôme Pouiller
2016-11-23 22:09   ` Thomas Petazzoni
2016-11-23 12:58 ` [Buildroot] [PATCH v4 18/18] reproducible: fix coding style Jérôme Pouiller
2016-11-23 22:10   ` Thomas Petazzoni

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=20161123230539.4762ebcd@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /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