public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: claudius.heine.ext@siemens.com
To: isar-users@googlegroups.com
Cc: Claudius Heine <ch@denx.de>
Subject: [RFC PATCH v2 3/3] meta/isar-bootstrap: add 'do_restore_from_tarball' task
Date: Wed, 23 May 2018 15:26:09 +0200	[thread overview]
Message-ID: <20180523132609.408-4-claudius.heine.ext@siemens.com> (raw)
In-Reply-To: <20180523132609.408-1-claudius.heine.ext@siemens.com>
In-Reply-To: <3467a5ec-182e-8c9a-cd19-7ad898323be7@siemens.com>

From: Claudius Heine <ch@denx.de>

This new task 'do_restore_from_tarball' is deactivated by default
("noexec" flag is set) and is only activated if the
'ISAR_BOOTSTRAP_TARBALL' variable is set.

The 'ISAR_BOOTSTRAP_TARBALL' variable should point the the
isar-bootstrap tarball generated by a image-recipe.

If this variable is set, tasks that are normally creating the
isar-bootstrap root file system are deactivated and instead the
'do_restore_from_tarball' task is activated and restores the
isar-bootstrap root file system from the tarball.

Signed-off-by: Claudius Heine <ch@denx.de>
---
 .../isar-bootstrap/isar-bootstrap.bb          | 28 ++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb b/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb
index bb3992b..02c09aa 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb
@@ -239,12 +239,38 @@ do_apt_update() {
 }
 addtask apt_update before do_build after do_apt_config_install do_set_locale
 
+python() {
+    if d.getVar("ISAR_BOOTSTRAP_TARBALL", True):
+        d.setVarFlag("do_generate_keyring", "noexec", "1")
+        d.setVarFlag("do_apt_config_prepare", "noexec", "1")
+        d.setVarFlag("do_set_locale", "noexec", "1")
+        d.setVarFlag("do_bootstrap", "noexec", "1")
+        d.setVarFlag("do_apt_config_install", "noexec", "1")
+        d.setVarFlag("do_apt_update", "noexec", "1")
+        d.delVarFlag("do_restore_from_tarball", "noexec")
+}
+
+do_restore_from_tarball[noexec] = "1"
+do_restore_from_tarball[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
+do_restore_from_tarball() {
+    if [ -e "${ROOTFSDIR}" ]; then
+       sudo umount -l "${ROOTFSDIR}/dev" || true
+       sudo umount -l "${ROOTFSDIR}/proc" || true
+       sudo rm -rf "${ROOTFSDIR}"
+    fi
+    sudo mkdir -p "${ROOTFSDIR}"
+    sudo tar xf "${ISAR_BOOTSTRAP_TARBALL}" -C "${ROOTFSDIR}" 
+    sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${ROOTFSDIR}/dev
+    sudo mount -t proc none ${ROOTFSDIR}/proc
+}
+addtask restore_from_tarball before do_build after do_unpack
+
 do_deploy[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
 do_deploy[dirs] = "${DEPLOY_DIR_IMAGE}"
 do_deploy() {
     ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_DIR_IMAGE}/${PN}-${DISTRO}-${DISTRO_ARCH}"
 }
-addtask deploy before do_build after do_apt_update
+addtask deploy before do_build after do_apt_update do_restore_from_tarball
 
 CLEANFUNCS = "clean_deploy"
 clean_deploy() {
-- 
2.17.0


      parent reply	other threads:[~2018-05-23 13:26 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-22 11:55 Idea for implementing reproducible builds Claudius Heine
2018-05-22 13:47 ` Andreas Reichel
2018-05-22 14:24   ` Claudius Heine
2018-05-22 22:32 ` Baurzhan Ismagulov
2018-05-23  8:22   ` Claudius Heine
2018-05-23 11:34     ` Claudius Heine
2018-06-04 11:48     ` Baurzhan Ismagulov
2018-05-23  6:32 ` [RFC PATCH 0/3] Reproducible build claudius.heine.ext
2018-05-23  6:32   ` [RFC PATCH 1/3] meta/isar-bootstrap-helper+dpkg.bbclass: bind mount /var/cache/apt/archives claudius.heine.ext
2018-05-23  6:32   ` [RFC PATCH 2/3] meta/classes/image: added isar_bootstrap_tarball task claudius.heine.ext
2018-05-23  6:32   ` [RFC PATCH 3/3] meta/isar-bootstrap: add 'do_restore_from_tarball' task claudius.heine.ext
2018-05-23 14:30   ` [RFC PATCH 0/3] Reproducible build Maxim Yu. Osipov
2018-05-23 15:20     ` Claudius Heine
2018-05-24 16:00   ` Henning Schild
2018-05-25  8:10     ` Claudius Heine
2018-05-25 11:57       ` Maxim Yu. Osipov
2018-05-25 17:04         ` Claudius Heine
2018-06-04 11:37           ` Baurzhan Ismagulov
2018-06-04 16:05             ` Claudius Heine
2018-06-05 10:42               ` Claudius Heine
2018-06-06  9:17                 ` Claudius Heine
2018-06-06 14:20                   ` Claudius Heine
2018-06-07  8:50                     ` Baurzhan Ismagulov
2018-06-07  8:08                 ` Maxim Yu. Osipov
2018-06-11  8:45                   ` Claudius Heine
2018-06-11 13:51                     ` Claudius Heine
2018-06-14  8:50                       ` Claudius Heine
2018-06-20  4:20                         ` Maxim Yu. Osipov
2018-06-20  8:12                           ` Claudius Heine
2018-05-23 13:26 ` [RFC PATCH v2 " claudius.heine.ext
2018-05-23 13:26 ` [RFC PATCH v2 1/3] meta/isar-bootstrap-helper+dpkg.bbclass: bind mount /var/cache/apt/archives claudius.heine.ext
2018-05-23 13:26 ` [RFC PATCH v2 2/3] meta/classes/image: added isar_bootstrap_tarball task claudius.heine.ext
2018-05-23 13:26 ` claudius.heine.ext [this message]

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=20180523132609.408-4-claudius.heine.ext@siemens.com \
    --to=claudius.heine.ext@siemens.com \
    --cc=ch@denx.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