public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] Make sure git repos are usable inside buildchroot
@ 2018-02-14  9:14 Jan Kiszka
  2018-02-14  9:30 ` Henning Schild
  2018-02-14 19:40 ` [PATCH v2] " Jan Kiszka
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Kiszka @ 2018-02-14  9:14 UTC (permalink / raw)
  To: isar-users; +Cc: Henning Schild

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>
---

Applies on top of "Move buildchroot mounts into dpkg-base class", v3.

This obsoletes the bitbake patch Henning developed to disable sharing.

Tested via jailhouse-images (required changes not yet pushed) where the
Jailhouse recipe makes use of this.

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

diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 895ff26..241dc2c 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -1,6 +1,15 @@
 # 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
+
 # Add dependency from buildchroot creation
 do_build[depends] = "buildchroot:do_build"
 
@@ -30,6 +39,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 62979f5..9b4e7d3 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot.bb
+++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
@@ -38,6 +38,7 @@ do_build() {
 
     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
-- 
2.13.6

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-14 19:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-14  9:14 [PATCH] Make sure git repos are usable inside buildchroot 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 ` [PATCH v2] " Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox