public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Subject: [PATCH v2] Make sure git repos are usable inside buildchroot
Date: Wed, 14 Feb 2018 20:40:30 +0100	[thread overview]
Message-ID: <cde819c6-38e8-963d-ff29-f84347165e33@siemens.com> (raw)
In-Reply-To: <ee575953-1b0c-72d3-d9dd-5168148df550@siemens.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

bitbake clones git repos into the package workdir in shared mode. This
creates an alternates link to the original download folder. However,
that path is invalid inside buildchroot. This disturbs package builds
which try to derive information from the git repo, such as tags or the
delta to the last release.

Bind-mount the downloads folder and patch the alternates file to restore
the git repo access inside buildchroot.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Changes in v2:
 - set stamp-extra-info properly

 meta/classes/dpkg-base.bbclass                   | 11 +++++++++++
 meta/recipes-devtools/buildchroot/buildchroot.bb |  1 +
 2 files changed, 12 insertions(+)

diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index a4bdf16..98f25b7 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -1,6 +1,16 @@
 # This software is a part of ISAR.
 # Copyright (C) 2017 Siemens AG
 
+do_adjust_git() {
+    if [ -f ${WORKDIR}/${S}/.git/objects/info/alternates ]; then
+        sed -i ${WORKDIR}/${S}/.git/objects/info/alternates \
+            -e 's|${DL_DIR}|/downloads|'
+    fi
+}
+
+addtask adjust_git after do_unpack before do_build
+do_adjust_git[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
+
 # Add dependency from buildchroot creation
 do_build[depends] = "buildchroot:do_build"
 
@@ -30,6 +40,7 @@ do_build() {
     sudo flock ${MOUNT_LOCKFILE} -c ' \
         if ! grep -q ${BUILDCHROOT_DIR}/isar-apt /proc/mounts; then \
             mount --bind ${DEPLOY_DIR_APT}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt; \
+            mount --bind ${DL_DIR} ${BUILDCHROOT_DIR}/downloads; \
             mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev; \
             mount -t proc none ${BUILDCHROOT_DIR}/proc; \
         fi'
diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb
index 504d798..520daf9 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot.bb
+++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
@@ -40,6 +40,7 @@ do_build() {
     # re-building a clean image:
     sudo rm -rf ${BUILDCHROOT_DIR}
     mkdir -p ${BUILDCHROOT_DIR}/isar-apt
+    mkdir -p ${BUILDCHROOT_DIR}/downloads
     mkdir -p ${BUILDCHROOT_DIR}/dev
     mkdir -p ${BUILDCHROOT_DIR}/proc
     mkdir -p ${BUILDCHROOT_DIR}/sys

      parent reply	other threads:[~2018-02-14 19:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-14  9:14 [PATCH] " Jan Kiszka
2018-02-14  9:30 ` Henning Schild
2018-02-14  9:43   ` Alexander Smirnov
2018-02-14  9:59     ` Jan Kiszka
2018-02-14 19:40 ` Jan Kiszka [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=cde819c6-38e8-963d-ff29-f84347165e33@siemens.com \
    --to=jan.kiszka@siemens.com \
    --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