Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>,
	"openembedded-core@lists.openembedded.org"
	<openembedded-core@lists.openembedded.org>
Subject: RE: [OE-core] [PATCH 3/5] image-artifact-names: Use SOURCE_DATE_EPOCH when making reproducible builds
Date: Sun, 3 Oct 2021 02:09:22 +0000	[thread overview]
Message-ID: <76b81ffd58674f24a568247e02697846@axis.com> (raw)
In-Reply-To: <20211002221803.2283254-3-richard.purdie@linuxfoundation.org>

> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-
> core@lists.openembedded.org> On Behalf Of Richard Purdie
> Sent: den 3 oktober 2021 00:18
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [PATCH 3/5] image-artifact-names: Use SOURCE_DATE_EPOCH
> when making reproducible builds
> 
> Using DATETIME means the deploy output is not deterministic. Use SDE
> when using reproducible builds since it is consistent for given input
> data.
> 
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  meta/classes/image-artifact-names.bbclass | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/image-artifact-names.bbclass
> b/meta/classes/image-artifact-names.bbclass
> index 3ac8dd731a6..df9e17c6b0f 100644
> --- a/meta/classes/image-artifact-names.bbclass
> +++ b/meta/classes/image-artifact-names.bbclass
> @@ -4,7 +4,7 @@
> 
>  IMAGE_BASENAME ?= "${PN}"
>  IMAGE_VERSION_SUFFIX ?= "-${DATETIME}"
> -IMAGE_VERSION_SUFFIX[vardepsexclude] += "DATETIME"
> +IMAGE_VERSION_SUFFIX[vardepsexclude] += "DATETIME SOURCE_DATE_EPOCH"
>  IMAGE_NAME ?= "${IMAGE_BASENAME}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
>  IMAGE_LINK_NAME ?= "${IMAGE_BASENAME}-${MACHINE}"
> 
> @@ -13,3 +13,10 @@ IMAGE_LINK_NAME ?= "${IMAGE_BASENAME}-${MACHINE}"
>  # by default) followed by additional suffices which describe the format (.ext4,
>  # .ext4.xz, etc.).
>  IMAGE_NAME_SUFFIX ??= ".rootfs"
> +
> +python () {
> +    if bb.data.inherits_class('reproducible_build', d):

This needs to be something like:

    if bb.data.inherits_class('reproducible_build', d) and d.getVar("IMAGE_VERSION_SUFFIX", False) == "-${DATETIME}":

otherwise it will be impossible to change IMAGE_VERSION_SUFFIX if one also
has reproducible builds enabled.

//Peter

> +        import datetime
> +        d.setVar("IMAGE_VERSION_SUFFIX", "-" + datetime.datetime.fromtimestamp(int(d.getVar("SOURCE_DATE_EPOCH")), datetime.timezone.utc).strftime('%Y%m%d%H%M%S'))
> +        d.setVarFlag("IMAGE_VERSION_SUFFIX", "vardepvalue", "")
> +}
> --
> 2.32.0



  reply	other threads:[~2021-10-03  2:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-02 22:17 [PATCH 1/5] externalsrc: Fix a source date epoch race in reproducible builds Richard Purdie
2021-10-02 22:18 ` [PATCH 2/5] sstatesig: Add processing for full build paths in sysroot files Richard Purdie
2021-10-02 22:18 ` [PATCH 3/5] image-artifact-names: Use SOURCE_DATE_EPOCH when making reproducible builds Richard Purdie
2021-10-03  2:09   ` Peter Kjellerstedt [this message]
2021-10-02 22:18 ` [PATCH 4/5] abi_version/sstate: Bump HASH_VERSION and SSTATE_VERSION Richard Purdie
2021-10-03  9:59   ` [OE-core] " Jose Quaresma
2021-10-03 10:28     ` Richard Purdie
2021-10-03 21:47       ` Jose Quaresma
2021-10-02 22:18 ` [PATCH 5/5] python3: Drop broken pyc files Richard Purdie
     [not found] ` <16AA56A68DAA9487.23650@lists.openembedded.org>
2021-10-03 13:35   ` [OE-core] [PATCH 3/5] image-artifact-names: Use SOURCE_DATE_EPOCH when making reproducible builds Richard Purdie

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=76b81ffd58674f24a568247e02697846@axis.com \
    --to=peter.kjellerstedt@axis.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.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