From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Henning Schild <henning.schild@siemens.com>
Subject: [PATCH] Make sure git repos are usable inside buildchroot
Date: Wed, 14 Feb 2018 10:14:18 +0100 [thread overview]
Message-ID: <ee575953-1b0c-72d3-d9dd-5168148df550@siemens.com> (raw)
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
next reply other threads:[~2018-02-14 9:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-14 9:14 Jan Kiszka [this message]
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
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=ee575953-1b0c-72d3-d9dd-5168148df550@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=henning.schild@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