public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Alexander Smirnov <asmirnov@ilbers.de>, isar-users@googlegroups.com
Subject: Re: [RFC v2][PATCH 2/3] build-rep: Add helper class
Date: Thu, 11 Jan 2018 16:47:32 +0100	[thread overview]
Message-ID: <b140cc32-70d8-52a9-695a-ce1b0e16cf92@siemens.com> (raw)
In-Reply-To: <20180111111939.25667-3-asmirnov@ilbers.de>

On 2018-01-11 12:19, Alexander Smirnov wrote:
> Add class that helps to implement build reproducibility. It implements
> anonymous function that will get all the Debian dependencies that are
> needed for current Isar tree.
> 
> Until build reproducibility will be fully implemented, it's disabled by
> default. To enable it just set ISAR_BUILD_REP to "1" in local.conf.

"ISAR_REPRODUCIBLE_BUILD" - "REP" could mean anything.

Still feels like this should rather default to "on", so maybe call it
"ISAR_NON_REPRODUCIBLE_BUILD".

Jan

> 
> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
> ---
>  meta-isar/conf/local.conf.sample                 |  6 +++++
>  meta-isar/recipes-app/hello/hello.bb             |  2 ++
>  meta/classes/build-rep.bbclass                   | 32 ++++++++++++++++++++++++
>  meta/classes/dpkg-base.bbclass                   |  2 ++
>  meta/classes/image.bbclass                       |  2 ++
>  meta/recipes-devtools/buildchroot/buildchroot.bb |  2 ++
>  6 files changed, 46 insertions(+)
>  create mode 100644 meta/classes/build-rep.bbclass
> 
> diff --git a/meta-isar/conf/local.conf.sample b/meta-isar/conf/local.conf.sample
> index 660958f..45b8995 100644
> --- a/meta-isar/conf/local.conf.sample
> +++ b/meta-isar/conf/local.conf.sample
> @@ -162,3 +162,9 @@ BB_NUMBER_THREADS = "4"
>  #
>  # Number of attempts to try to get reprepro lock for access to apt cache
>  REPREPRO_LOCK_ATTEMPTS = "16"
> +
> +# Isar build reproducibility feature creates local repository which contains
> +# copies for all the upstream Debian packages that could be used to build
> +# your Isar tree. So fetching them once will guarantee that all the next Isar
> +# builds will be identically.
> +ISAR_BUILD_REP ?= "0"
> diff --git a/meta-isar/recipes-app/hello/hello.bb b/meta-isar/recipes-app/hello/hello.bb
> index 44b8bc3..fafda2e 100644
> --- a/meta-isar/recipes-app/hello/hello.bb
> +++ b/meta-isar/recipes-app/hello/hello.bb
> @@ -16,3 +16,5 @@ SRCREV = "ad7065ecc4840cc436bfcdac427386dbba4ea719"
>  SRC_DIR = "git"
>  
>  inherit dpkg
> +
> +DEBIAN_DEPENDS = "debhelper (>= 9), autotools-dev"
> diff --git a/meta/classes/build-rep.bbclass b/meta/classes/build-rep.bbclass
> new file mode 100644
> index 0000000..ede5a93
> --- /dev/null
> +++ b/meta/classes/build-rep.bbclass
> @@ -0,0 +1,32 @@
> +# This software is a part of ISAR.
> +# Copyright (C) 2017 Siemens AG
> +
> +python __anonymous() {
> +    rep = d.getVar('ISAR_BUILD_REP', True) or "0"
> +    if rep == "0":
> +        return
> +
> +    depsdir = d.getVar('BASE_APT_DIR', True)
> +    if depsdir is None:
> +        return
> +
> +    depsdir += '/deps/'
> +
> +    pn = d.getVar('PN', True)
> +
> +    if not os.path.exists(depsdir):
> +        os.makedirs(depsdir, exist_ok=True)
> +
> +    if d.getVar('DEBIAN_DEPENDS', True):
> +        with open(depsdir + '/' +  pn + '.depends', 'w') as the_file:
> +            the_file.write(d.getVar('DEBIAN_DEPENDS', True))
> +            the_file.close
> +    elif d.getVar('BUILDCHROOT_PREINSTALL', True):
> +        with open(depsdir + '/' +  pn + '.preinst', 'w') as the_file:
> +            the_file.write(d.getVar('BUILDCHROOT_PREINSTALL', True))
> +            the_file.close
> +    elif d.getVar('IMAGE_PREINSTALL', True):
> +        with open(depsdir + '/' +  pn + '.preinst', 'w') as the_file:
> +            the_file.write(d.getVar('IMAGE_PREINSTALL', True))
> +            the_file.close
> +}
> diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
> index 4d220da..bf66e78 100644
> --- a/meta/classes/dpkg-base.bbclass
> +++ b/meta/classes/dpkg-base.bbclass
> @@ -3,6 +3,8 @@
>  
>  DEBIAN_DEPENDS ?= ""
>  
> +inherit build-rep
> +
>  # Add dependency from buildchroot creation
>  do_build[depends] = "buildchroot:do_build"
>  
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index e2cb01b..67f5af8 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -5,6 +5,8 @@ IMAGE_INSTALL ?= ""
>  IMAGE_TYPE    ?= "ext4-img"
>  IMAGE_ROOTFS   = "${WORKDIR}/rootfs"
>  
> +inherit build-rep
> +
>  def get_image_name(d, name_link):
>      S = d.getVar("IMAGE_ROOTFS", True)
>      path_link = os.path.join(S, name_link)
> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb
> index 51f9d5d..da18231 100644
> --- a/meta/recipes-devtools/buildchroot/buildchroot.bb
> +++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
> @@ -16,6 +16,8 @@ SRC_URI = "file://multistrap.conf.in \
>             file://build.sh"
>  PV = "1.0"
>  
> +inherit build-rep
> +
>  BUILDCHROOT_PREINSTALL ?= "gcc \
>                             make \
>                             build-essential \
> 

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

  reply	other threads:[~2018-01-11 15:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11 11:19 [RFC v2][PATCH 0/3] Introduce base-apt Alexander Smirnov
2018-01-11 11:19 ` [RFC v2][PATCH 1/3] dpkg-base: Make DEBIAN_DEPENDS global Alexander Smirnov
2018-01-11 11:19 ` [RFC v2][PATCH 2/3] build-rep: Add helper class Alexander Smirnov
2018-01-11 15:47   ` Jan Kiszka [this message]
2018-01-12 12:32   ` Henning Schild
2018-01-12 13:29     ` Alexander Smirnov
2018-01-12 16:25       ` Henning Schild
2018-01-14 16:53         ` Jan Kiszka
2018-01-19 21:23           ` Benedikt Niedermayr
2018-01-24 18:48             ` Jan Kiszka
2018-01-24 20:53               ` Benedikt Niedermayr
2018-01-24 21:31                 ` Jan Kiszka
2018-01-25 18:52                   ` Benedikt Niedermayr
2018-01-23 11:50           ` Baurzhan Ismagulov
2018-01-23 13:02             ` Jan Kiszka
2018-01-24 13:44               ` Baurzhan Ismagulov
2018-01-23 16:34             ` Christian Storm
2018-01-11 11:19 ` [RFC v2][PATCH 3/3] base-apt: Introduce fetching upstream apt Alexander Smirnov

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=b140cc32-70d8-52a9-695a-ce1b0e16cf92@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=asmirnov@ilbers.de \
    --cc=isar-users@googlegroups.com \
    /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