From: Christian Storm <christian.storm@siemens.com>
To: isar-users@googlegroups.com
Subject: Re: [PATCH] dpkg-base: mount git source folder into buildchroot
Date: Fri, 17 Nov 2017 18:05:12 +0100 [thread overview]
Message-ID: <20171117170512.t7qqymvsrh5gf2e6@MD1KR9XC.ww002.siemens.net> (raw)
In-Reply-To: <185f0c4a-d1a9-159c-9852-272c92415615@ilbers.de>
> > 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.
>
> Could you please provide more details regarding where it should be mounted?
Please see below for an explanation.
> > Signed-off-by: Christian Storm <christian.storm@siemens.com>
> > ---
> > meta/classes/dpkg-base.bbclass | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
> > index 35af6d5..a98e690 100644
> > --- a/meta/classes/dpkg-base.bbclass
> > +++ b/meta/classes/dpkg-base.bbclass
> > @@ -20,14 +20,18 @@ dpkg_runbuild() {
> > # Wrap the function dpkg_runbuild with the bind mount for buildroot
> > do_build() {
> > mkdir -p ${BUILDROOT}
> > - sudo mount --bind ${WORKDIR} ${BUILDROOT}
> > + [ ! -d ${BUILDCHROOT_DIR}/${GITDIR} ] && sudo install -d -m 755 ${BUILDCHROOT_DIR}/${GITDIR}
>
> ${GITDIR} - will be expanded to absolute path of your build tree on the
> host. Why this private path is needed in buildchroot? This doesn't look
> correct for me if you need it for build.
>
> Also git repository is already available in buildchroot:
>
> 1. If package is fetched via git repository - it's stored in ${GITDIR}.
> 2. Then task "do_unpack" clones this to ${WORKDIR}/git folder
> 3. During build task, the folder ${WORKDIR} is mounted to ${BUILDROOT}
> 4. So your git repo is in: /home/builder/${PN}/git folder inside chroot.
Well, no. It contains the checkout of the source done by the fetcher.
You'll get a castrated .git/ in the buildchroot, i.e., try to run git
operations in the buildchroot when do_build'ing a particular package and
git complains:
error: object directory /build/tmp/downloads/git/xxxxxx/objects does not exist; check .git/objects/info/alternates.
fatal: bad object HEAD
It tries to resolve the repository "symlink" in
.git/objects/info/alternates which points to the directory the fetcher
has put it in, i.e., <build>/tmp/downloads/git/xxxxxx. This directory,
respectively, <build>/tmp/downloads/git/, however, isn't mounted in the
buildchroot and so git can't do operations.
Hence, source/format "3.0 (git)" fails as it wants to do git operations.
Does this explanation help?
Kind regards,
Christian
--
Dr. Christian Storm
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Otto-Hahn-Ring 6, 81739 M�nchen, Germany
next prev parent reply other threads:[~2017-11-17 17:06 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 [this message]
2017-11-20 9:37 ` Henning Schild
2017-11-20 11:30 ` Christian Storm
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=20171117170512.t7qqymvsrh5gf2e6@MD1KR9XC.ww002.siemens.net \
--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