From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Uladzimir Bely <ubely@ilbers.de>,
Henning Schild <henning.schild@siemens.com>
Subject: Re: [PATCH 3/3] Rework do_adjust_git to support inside and outside usage
Date: Thu, 12 Aug 2021 12:31:35 +0200 [thread overview]
Message-ID: <e16361c7-090d-13c2-341e-2a7a5c70fb12@siemens.com> (raw)
In-Reply-To: <52c19135f0fcab888b1c0190876516c25cea71a1.1628760208.git.jan.kiszka@siemens.com>
On 12.08.21 11:23, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> Rewrite the alternates entry to use a relative path outside of the
> workdir. That linke can then be created independently of the outer build
> environment as well as inside the buildchroot.
>
> We use ${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/.git-downloads outside
> and /home/.git-downloads inside the buildchroot.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> meta/classes/dpkg-base.bbclass | 8 +++++++-
> meta/conf/bitbake.conf | 1 +
> meta/recipes-devtools/buildchroot/buildchroot.inc | 2 ++
> 3 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
> index a4c8663..cd6c649 100644
> --- a/meta/classes/dpkg-base.bbclass
> +++ b/meta/classes/dpkg-base.bbclass
> @@ -19,6 +19,12 @@ python do_adjust_git() {
>
> rootdir = d.getVar('WORKDIR', True)
>
> + git_link = os.path.join(d.getVar('GIT_DL_LINK_DIR'), '.git-downloads')
> + git_dl = os.path.join(d.getVar("DL_DIR"), "git")
> +
> + if not os.path.exists(git_link) or os.path.realpath(git_link) != git_dl:
> + os.symlink(git_dl, git_link)
> +
> for src_uri in (d.getVar("SRC_URI", True) or "").split():
> try:
> fetcher = bb.fetch2.Fetch([src_uri], d)
> @@ -48,7 +54,7 @@ python do_adjust_git() {
>
> if os.path.exists(alternates):
> cmd = ["sed", "-i", alternates, "-e",
> - "s|{}|/downloads|".format(d.getVar("DL_DIR"))]
> + "s|{}|../../../../../.git-downloads|".format(git_dl)]
Hmm, this does not yet account for the case that the repo is placed in
some subdir under workdir. Will make this more general.
I also forgot to fix the task dependencies - devshell is not pulling
adjust_git.
Jan
> bb.note(' '.join(cmd))
> if subprocess.call(cmd) != 0:
> bb.fatal("git alternates adjustment failed")
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index 9859456..7f5901d 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -48,6 +48,7 @@ GITPKGV = "${@bb.fetch2.get_srcrev(d, 'gitpkgv_revision')}"
>
> # isar specific config
> WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}/${PV}-${PR}"
> +GIT_DL_LINK_DIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}"
> DEPLOY_DIR_BOOTSTRAP = "${DEPLOY_DIR}/bootstrap"
> DEPLOY_DIR_BUILDCHROOT = "${DEPLOY_DIR}/buildchroot"
> DEPLOY_DIR_SDKCHROOT = "${DEPLOY_DIR}/sdkchroot"
> diff --git a/meta/recipes-devtools/buildchroot/buildchroot.inc b/meta/recipes-devtools/buildchroot/buildchroot.inc
> index 0c1fb7f..52a5f1c 100644
> --- a/meta/recipes-devtools/buildchroot/buildchroot.inc
> +++ b/meta/recipes-devtools/buildchroot/buildchroot.inc
> @@ -67,6 +67,8 @@ buildchroot_install_files() {
> sudo install -m 755 ${WORKDIR}/common.sh ${BUILDCHROOT_DIR}/isar/
> sudo install -m 755 ${WORKDIR}/deps.sh ${BUILDCHROOT_DIR}/isar/
>
> + sudo ln -s /downloads/git "${BUILDCHROOT_DIR}/home/.git-downloads"
> +
> # Configure root filesystem
> sudo install -m 755 ${WORKDIR}/configscript.sh ${BUILDCHROOT_DIR}
> USER_ID=$(id -u)
>
--
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
prev parent reply other threads:[~2021-08-12 10:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-12 9:23 [PATCH 0/3] Make adjust_git work in both worlds Jan Kiszka
2021-08-12 9:23 ` [PATCH 1/3] dpkg-base: Lock do_adjust_git against each other Jan Kiszka
2021-08-12 9:23 ` [PATCH 2/3] dpkg-base: Make mirror link relative Jan Kiszka
2021-08-12 9:23 ` [PATCH 3/3] Rework do_adjust_git to support inside and outside usage Jan Kiszka
2021-08-12 10:31 ` 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=e16361c7-090d-13c2-341e-2a7a5c70fb12@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=ubely@ilbers.de \
/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