From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6995471841453146112 X-Received: by 2002:a17:906:b0d1:: with SMTP id bk17mr3232593ejb.59.1629969782062; Thu, 26 Aug 2021 02:23:02 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a17:906:7047:: with SMTP id r7ls2515208ejj.5.gmail; Thu, 26 Aug 2021 02:23:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgA7G5GjSK/2MT7cHyM/50Ss11ayoSGghI9BQzWxMU0NPCYsMZuJi6bwd6lbmN4xPYM32B X-Received: by 2002:a17:906:6d9:: with SMTP id v25mr3317076ejb.192.1629969781023; Thu, 26 Aug 2021 02:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629969781; cv=none; d=google.com; s=arc-20160816; b=0Wy5hs1okHYGBSr14y8EUU5NmelQkzz1LkY/l8VpOmBSbPPEDqkaNGNswhLUgdiDSJ beNSAyrnS9Rb5C1BeNC6amByBg70ibHAN0vrzaIGSXN0wjRxFiPftLkH6XxHMUdH2P1g VEDCn6LqbCf0YncMHWfVtKL3WAkBl0yJSoBfNPxI2isha2QBi7y0nXQoKAGcDRqjr3aI bLQMXVx5Rw17giSDpsAAGfk8WYz31dzxZlPRCQTj4d7tni3Tu+rV8exlYcp73E4xzFW+ 90uiH+1B+A4SOZYQEjzvxeGkGMQEtGmt5f/PA4Wl/cRTcPnPe7/FfzDII0cfGkpmD9bA /Bcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=rWSobqwjukSI8G4ApX/QFfIaDUcr81p69i2x3Zf5LGU=; b=hZa9Y9sugPCGqoTotQ3Z583z+0f9IQyzel6ssjQxIBpeWfI7t1hajGvLKg49yPP0Bw /fdDYEXlV/RtVuE6+ji9AaylCg7Mzx+sB+u2+D14EEH1SpMvGUYFa0pUZzYde5ZJuHzU womZIBg+e63MK2XvtuSG+flb8lLyJqbNHea7uf8FL82ytMP9QXtu5O8+BWwQB1zbELQ8 qNO6g8Bv1TQ+60MAQinaQod92NVsy2XU+gi4kUesR6K1wBkOSgHiraMCnFDOeAmYSbp9 /TIhhabY+q0LRmQsp21sFvVYFOr6hxadYzsDa+Zo9cWlBQ+ay4hoB1AvpZI3HaiMHiV1 tTCg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from lizzard.sbs.de (lizzard.sbs.de. [194.138.37.39]) by gmr-mx.google.com with ESMTPS id dy22si144210edb.2.2021.08.26.02.23.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Aug 2021 02:23:00 -0700 (PDT) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.39 as permitted sender) client-ip=194.138.37.39; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by lizzard.sbs.de (8.15.2/8.15.2) with ESMTPS id 17Q9N026020716 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Aug 2021 11:23:00 +0200 Received: from md1f2u6c.ad001.siemens.net ([167.87.32.3]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id 17Q9MxuL029140; Thu, 26 Aug 2021 11:23:00 +0200 From: Jan Kiszka To: isar-users Cc: Uladzimir Bely , Henning Schild Subject: [PATCH v3 3/4] Rework do_adjust_git to support inside and outside usage Date: Thu, 26 Aug 2021 11:22:58 +0200 Message-Id: <4e97ea09e60757ca9e1a2c7ac3076e013d3fc312.1629969778.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: CxTpxjYVGlDB From: Jan Kiszka 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 --- meta/classes/dpkg-base.bbclass | 11 ++++++++++- meta/conf/bitbake.conf | 1 + meta/recipes-devtools/buildchroot/buildchroot.inc | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass index ca1dccf..9a18acb 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) @@ -44,11 +50,14 @@ python do_adjust_git() { destsuffix = ud.parm.get("destsuffix", def_destsuffix) destdir = ud.destdir = os.path.join(rootdir, destsuffix) + git_link_rel = os.path.relpath(git_link, + os.path.join(destdir, ".git/objects")) + alternates = os.path.join(destdir, ".git/objects/info/alternates") if os.path.exists(alternates): cmd = ["sed", "-i", alternates, "-e", - "s|{}|/downloads|".format(d.getVar("DL_DIR"))] + "s|{}|{}|".format(git_dl, git_link_rel)] 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) -- 2.31.1