public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Christian Storm <christian.storm@siemens.com>
To: isar-users@googlegroups.com
Cc: Christian Storm <christian.storm@siemens.com>
Subject: [PATCH] dpkg-base: mount git source folder into buildchroot
Date: Mon, 20 Nov 2017 12:30:28 +0100	[thread overview]
Message-ID: <20171120113028.18897-1-christian.storm@siemens.com> (raw)
In-Reply-To: <20171120103728.08714150@md1em3qc>

When building a Debian source package with source/format "3.0 (git)",
the git binary is used to bundle the source. For being able to do so,
<build>/tmp/downloads/git/<git_repo> needs to be mounted into the
buildchroot as .git/objects/info/alternates refers to it.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 meta/classes/dpkg-base.bbclass                   | 5 ++++-
 meta/recipes-devtools/buildchroot/buildchroot.bb | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 35af6d5..3235ebf 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -20,14 +20,17 @@ dpkg_runbuild() {
 # Wrap the function dpkg_runbuild with the bind mount for buildroot
 do_build() {
     mkdir -p ${BUILDROOT}
-    sudo mount --bind ${WORKDIR} ${BUILDROOT}
     _do_build_cleanup() {
         ret=$?
         sudo umount ${BUILDROOT} 2>/dev/null || true
         sudo rmdir ${BUILDROOT} 2>/dev/null || true
+        sudo umount ${BUILDCHROOT_DIR}/${GITDIR} 2>/dev/null || true
+        sudo rmdir ${BUILDCHROOT_DIR}/${GITDIR} 2>/dev/null || true
         (exit $ret) || bb_exit_handler
     }
     trap '_do_build_cleanup' EXIT
+    sudo mount --bind ${WORKDIR} ${BUILDROOT}
+    sudo mount --bind ${GITDIR} ${BUILDCHROOT_DIR}/${GITDIR}
     dpkg_runbuild
     _do_build_cleanup
 }
diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb
index 6a94733..8652cf1 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot.bb
+++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
@@ -32,6 +32,7 @@ WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
 do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
 do_build[dirs] = "${WORKDIR}/hooks_multistrap"
 
+do_build[dirs] = "${BUILDCHROOT_DIR}/${GITDIR}"
 do_build() {
     chmod +x "${WORKDIR}/setup.sh"
     chmod +x "${WORKDIR}/configscript.sh"
-- 
2.15.0


  reply	other threads:[~2017-11-20 11:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14 16:48 Christian Storm
2017-11-17 15:17 ` Alexander Smirnov
2017-11-17 17:05   ` Christian Storm
2017-11-20  9:37 ` Henning Schild
2017-11-20 11:30   ` Christian Storm [this message]
2017-11-20 15:06   ` [PATCH] Map git objects to buildchroot Alexander Smirnov
2017-11-20 15:32     ` Henning Schild
2017-11-20 15:54       ` Alexander Smirnov
2017-11-21  8:14         ` Christian Storm
2017-11-21 14:52           ` Alexander Smirnov
2017-11-21  8:20         ` Henning Schild
2017-11-21  8:57           ` Alexander Smirnov
2017-11-21  9:07             ` Henning Schild

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=20171120113028.18897-1-christian.storm@siemens.com \
    --to=christian.storm@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