From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6509751388101148672 X-Received: by 10.28.21.66 with SMTP id 63mr103028wmv.22.1515669608127; Thu, 11 Jan 2018 03:20:08 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 10.28.241.3 with SMTP id p3ls248124wmh.8.canary-gmail; Thu, 11 Jan 2018 03:20:07 -0800 (PST) X-Google-Smtp-Source: ACJfBotZ8xCv+RsHL1evGCk/4hHfrggy/CIj8sllLFnMuqu9D+XnxPzgftypZT73ctibCpsgnAZ3 X-Received: by 10.28.116.7 with SMTP id p7mr104516wmc.29.1515669607625; Thu, 11 Jan 2018 03:20:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515669607; cv=none; d=google.com; s=arc-20160816; b=ZvlG+j0vjeFf9Vkz7VcFd+oxME+1MIzUB5vv20nfRFF5ekaZPAgniQLEAQO0n5n5NH ljmW6XsPOG2gNIuPmPiZHF1n1J9apP0DYqPc3/uSwmXCFVIjCet667Z12kuwvtPLo1y1 D4eWV08SaggnOYkQqlx7PamCylpNXy6XoxuZnAJYyBq46eQu0R6415pucHxDo1gKyYcq 5AekKm2xA3qN4XX1HcUOCnda1+rzIrx9XW6QO1BQKE0ceKH1cP7X82OjZZ+PFCxk5Qgs K5vhgOsWMVMUX+rNXlp1LySwkan8D33vFGUEkjOVZuyhgRVph99B1OOKztvZJBTdocL1 NJvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=qy3mO8TPxPLpmgQlebK5trUXxmnWHOIaYAS9UhwYrEc=; b=THZg6fvOnzLX3CSDVzjy9Ud+YgKaxlWHPRkXlPlahuwL8c2MTN73Jk3BG4JuicmiL5 5G0orQtJw/HFTg+ldjlq1j0hssTj/xzOqE5Q3iwgQ6DIMel8fiqpBWYzdkff2ELTb8T0 HmgzAafAvtNRZtoNFCr/c9+Y7F3pNkpkPsyocB8lK3p1ieiu1JkK4JFCjnWHc8OEbeCZ v1/ou4lr6Gm9PIQhflvbWXwFUSTCHCM3+vCddTDaXUM1tFWM93dNQws0nKSrWB0nylbH xX6jZ5VB4HyPMsv+grvWlL7S8pVZk5UE3O+goJBxqCSOv54ktLYZnRSO4ZO95KVLiYEe 0fxQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Return-Path: Received: from aqmola.ilbers.de (aqmola.ilbers.de. [85.214.62.211]) by gmr-mx.google.com with ESMTPS id b123si55161wmf.1.2018.01.11.03.20.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jan 2018 03:20:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) client-ip=85.214.62.211; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Received: from localhost.localdomain ([188.227.110.165]) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id w0BBJkjc018555 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Jan 2018 12:19:55 +0100 From: Alexander Smirnov To: isar-users@googlegroups.com Cc: Alexander Smirnov Subject: [RFC v2][PATCH 2/3] build-rep: Add helper class Date: Thu, 11 Jan 2018 14:19:38 +0300 Message-Id: <20180111111939.25667-3-asmirnov@ilbers.de> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180111111939.25667-1-asmirnov@ilbers.de> References: <20180111111939.25667-1-asmirnov@ilbers.de> X-TUID: 0Zn3VBLn9o8n 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. Signed-off-by: Alexander Smirnov --- 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 \ -- 2.1.4