* [PATCH] dpkg-base: Expand adjust_git to all git SRC_URIs
@ 2019-11-22 12:05 Jan Kiszka
2019-11-28 15:25 ` Baurzhan Ismagulov
0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2019-11-22 12:05 UTC (permalink / raw)
To: isar-users
From: Jan Kiszka <jan.kiszka@siemens.com>
Make sure that not only the first git SRC_URI is adjusted in case a
package builds from multiple repos. That's a common case for modern
U-Boot (ATF, OP-TEE...).
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta/classes/dpkg-base.bbclass | 36 +++++++++++++++++++++++++++++++-----
1 file changed, 31 insertions(+), 5 deletions(-)
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 0be1627..af9c984 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -10,11 +10,37 @@ inherit terminal
DEPENDS ?= ""
-do_adjust_git() {
- if [ -f ${S}/.git/objects/info/alternates ]; then
- sed -i ${S}/.git/objects/info/alternates \
- -e 's|${DL_DIR}|/downloads|'
- fi
+python do_adjust_git() {
+ import subprocess
+
+ rootdir = d.getVar('WORKDIR', True)
+
+ for src_uri in (d.getVar("SRC_URI", True) or "").split():
+ try:
+ fetcher = bb.fetch2.Fetch([src_uri], d)
+ ud = fetcher.ud[src_uri]
+ if ud.type != 'git':
+ continue
+
+ subdir = ud.parm.get("subpath", "")
+ if subdir != "":
+ def_destsuffix = "%s/" % os.path.basename(subdir.rstrip('/'))
+ else:
+ def_destsuffix = "git/"
+
+ destsuffix = ud.parm.get("destsuffix", def_destsuffix)
+ destdir = ud.destdir = os.path.join(rootdir, destsuffix)
+
+ 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"))]
+ bb.note(' '.join(cmd))
+ if subprocess.call(cmd) != 0:
+ bb.fatal("git alternates adjustment failed")
+ except bb.fetch2.BBFetchException as e:
+ raise bb.build.FuncFailed(e)
}
addtask adjust_git after do_unpack before do_patch
--
2.16.4
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] dpkg-base: Expand adjust_git to all git SRC_URIs
2019-11-22 12:05 [PATCH] dpkg-base: Expand adjust_git to all git SRC_URIs Jan Kiszka
@ 2019-11-28 15:25 ` Baurzhan Ismagulov
0 siblings, 0 replies; 2+ messages in thread
From: Baurzhan Ismagulov @ 2019-11-28 15:25 UTC (permalink / raw)
To: isar-users
On Fri, Nov 22, 2019 at 01:05:06PM +0100, Jan Kiszka wrote:
> Make sure that not only the first git SRC_URI is adjusted in case a
> package builds from multiple repos. That's a common case for modern
> U-Boot (ATF, OP-TEE...).
Applied to next, thanks.
With kind regards,
Baurzhan.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-28 15:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22 12:05 [PATCH] dpkg-base: Expand adjust_git to all git SRC_URIs Jan Kiszka
2019-11-28 15:25 ` Baurzhan Ismagulov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox