public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v2 1/3] fetch/git: add support for disabling shared clones on unpack
@ 2021-04-13 15:02 Henning Schild
  2021-04-13 15:02 ` [PATCH v2 2/3] tests/fetch: deduplicate local git testing code Henning Schild
  2021-04-13 15:02 ` [PATCH v2 3/3] tests/fetch: add tests for local and remote "noshared" git fetching Henning Schild
  0 siblings, 2 replies; 5+ messages in thread
From: Henning Schild @ 2021-04-13 15:02 UTC (permalink / raw)
  To: bitbake-devel
  Cc: isar-users, Richard Purdie, Cedric Hombourger, Chris Larson,
	Henning Schild

By default the unpacker will create a "shared" clone when cloning from
the DL_DIR to the WORKDIR. This patch introduces an option to control
that behaviour.

Imagine some recipe steps are executed in a namespace that is different
from the one your downloader and unpacker ran in. (chroot) Because a
"shared" clone has an absolute reference to its "alternate" you now
have to make that "alternate" visible in that new namespace (chroot) at
the exact place.

With this patch you can unpack "noshared" and get a stand-alone copy.
This copy will also work if the "alternate" is not visible or existant.

The switch is a global bitbake switch and will affect all git urls.
Build systems that need "noshared" most likely need it for everything
they do with git.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 lib/bb/fetch2/git.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index e3ba80a3f52a..3e25b4b6047c 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -168,7 +168,11 @@ class Git(FetchMethod):
         if len(branches) != len(ud.names):
             raise bb.fetch2.ParameterError("The number of name and branch parameters is not balanced", ud.url)
 
-        ud.cloneflags = "-s -n"
+        ud.noshared = d.getVar("BB_GIT_NOSHARED") == "1"
+
+        ud.cloneflags = "-n"
+        if not ud.noshared:
+            ud.cloneflags += " -s"
         if ud.bareclone:
             ud.cloneflags += " --mirror"
 
-- 
2.26.3


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-14  9:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13 15:02 [PATCH v2 1/3] fetch/git: add support for disabling shared clones on unpack Henning Schild
2021-04-13 15:02 ` [PATCH v2 2/3] tests/fetch: deduplicate local git testing code Henning Schild
2021-04-13 21:37   ` Richard Purdie
2021-04-14  6:33     ` Henning Schild
2021-04-13 15:02 ` [PATCH v2 3/3] tests/fetch: add tests for local and remote "noshared" git fetching Henning Schild

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox