Single repositories containing multiple independent origin commits are
becoming more common. For example the rt development repo has patches
as "raw" format-patch output in a patch series, and also for ease of
automated testing, them all pre-applied (ff and non-ff) to the original
baseline (v5.10.8 in this case):
linux-rt-devel$ git merge-base linux-5.10.y-rt linux-5.10.y-rt-rebase
7a1519a74f3d0b06598fb95387688cde41e465d8
linux-rt-devel$ git describe 7a1519a74f3d0b06598fb95387688cde41e465d8
v5.10.8
linux-rt-devel$ git merge-base linux-5.10.y-rt linux-5.10.y-rt-patches
linux-rt-devel$
linux-rt-devel$ git log --oneline linux-5.10.y-rt | tail -n1
1da177e4c3f4 Linux-2.6.12-rc2
linux-rt-devel$ git log --oneline linux-5.10.y-rt-patches | tail -n1
96f1ac50158c [ANNOUNCE] 4.1.2-rt1
As can be seen, there are two different "epoch" commits and no history
or shared objects exist between the patches branch and the applied
branches (on the linux-stable baseline).
Since we construct the download directory name based on the server name
and the server's path to the repository, we currently can't refactor that
content into two locally independent paths/repositories in the download
dir for efficiency, ease of use and tarball/MIRROR handling.
To resolve this, we allow the recipe to optionally specify the path
component of the download dir name, so that a server with a repo of N
independent branches/histories can be used in N different recipes (or N
different SRC_URI lines) without overlap or name space collision in the
download dir. Continuing with the above example, we could have:
RT_REPO =
"git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git"
SRC_URI = "${RT_REPO};name=applied;dlname=.preempt-rt.linux-5.10.y \
${RT_REPO};name=patches;dlname=.preempt-rt.patches-5.10"
...resulting in the following independent repository dirs:
downloads/git2/git.kernel.org.preempt-rt.linux-5.10.y
downloads/git2/git.kernel.org.preempt-rt.patches-5.10
If the new "dlname" parameter is not specified, then the automatic name
generation functions just as it always has done and this change has no
effect on any existing download dirs.
Signed-off-by: Paul Gortmaker <[email protected]>
---
.../bitbake-user-manual-fetching.rst | 6 ++++++
bitbake/lib/bb/fetch2/git.py | 15 ++++++++++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
index e9a5f336dfd2..0f12eaa3a81f 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
@@ -417,6 +417,12 @@ This fetcher supports the following parameters:
is assumed to be "master". The number of branch parameters much match
the number of name parameters.
+- *"dlname":* The download name used in downloads/git2 (or GITDIR). If
+ specified, this will override the automatically constructed name
+ component from "thispath" for the URL git://some.host/thispath to the
+ user specified value. The component from "some.host" remains unaffected.
+ Allows splitting of one repo into multiple independent download dirs.
+
- *"rev":* The revision to use for the checkout. The default is
"master".
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index b54ec76d7174..de698a3d9f24 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -18,6 +18,13 @@ Supported SRC_URI options are:
SRCREV_nameX = "xxxxxxxxxxxxxxxxxxxx"
SRCREV_nameY = "YYYYYYYYYYYYYYYYYYYY"
+- dlname
+ The download name used in downloads/git2 (or GITDIR). This will override
+ the automatically constructed name component from "thispath" for the URL
+ git://some.host/thispath to the user specified value. The component from
+ "some.host" remains unaffected. Allows splitting of one repo into multiple
+ independent download dirs.
+
- tag
The git tag to retrieve. The default is "master"
@@ -151,6 +158,8 @@ class Git(FetchMethod):
ud.nobranch = ud.parm.get("nobranch","0") == "1"
+ ud.dlname = ud.parm.get("dlname","")
+
# usehead implies nobranch
ud.usehead = ud.parm.get("usehead","0") == "1"
if ud.usehead:
@@ -242,7 +251,11 @@ class Git(FetchMethod):
ud.unresolvedrev[name] = ud.revisions[name]
ud.revisions[name] = self.latest_revision(ud, d, name)
- gitsrcname = '%s%s' % (ud.host.replace(':', '.'), ud.path.replace('/',
'.').replace('*', '.').replace(' ','_'))
+ if ud.dlname:
+ gitdlname = ud.dlname.replace('/', '.').replace('*',
'.').replace(' ','_')
+ else:
+ gitdlname = ud.path.replace('/', '.').replace('*', '.').replace('
','_')
+ gitsrcname = '%s%s' % (ud.host.replace(':', '.'), gitdlname)
if gitsrcname.startswith('.'):
gitsrcname = gitsrcname[1:]
--
2.25.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9638):
https://lists.yoctoproject.org/g/linux-yocto/message/9638
Mute This Topic: https://lists.yoctoproject.org/mt/81808155/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-