Openembedded Core Discussions
 help / color / mirror / Atom feed
* [bitbake][PATCH 1/3] bitbake: fetch2/repo: add support for projects to be fetched simultaneously
@ 2021-05-16 11:23 Sourabh Banerjee
  2021-05-16 11:23 ` [bitbake][PATCH 2/3] bitbake: fetch2/repo: add support for sync specific projects Sourabh Banerjee
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Sourabh Banerjee @ 2021-05-16 11:23 UTC (permalink / raw)
  To: openembedded-core; +Cc: Sourabh Banerjee

repo tool can fetch projects simultaneously.
As per repo sync documentation:
  Usage: repo sync [<project>...]
  Options:
    -j JOBS, --jobs=JOBS  projects to fetch simultaneously (default 1)

By supplying jobs=<some_number> recipe can choose to use the
simultaneous fetch feature of repo tool.
Example:
  SRC_URI = "repo://REPOROOT;protocol=git;branch=main;manifest=default.xml;jobs=8"

Signed-off-by: Sourabh Banerjee <sbanerje@codeaurora.org>
---
 bitbake/lib/bb/fetch2/repo.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/fetch2/repo.py b/bitbake/lib/bb/fetch2/repo.py
index fa4cb81..8547b9e 100644
--- a/bitbake/lib/bb/fetch2/repo.py
+++ b/bitbake/lib/bb/fetch2/repo.py
@@ -62,11 +62,21 @@ class Repo(FetchMethod):
         repodir = os.path.join(codir, "repo")
         bb.utils.mkdirhier(repodir)
         if not os.path.exists(os.path.join(repodir, ".repo")):
+
             bb.fetch2.check_network_access(d, "%s init -m %s -b %s -u %s://%s%s%s" % (ud.basecmd, ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), ud.url)
             runfetchcmd("%s init -m %s -b %s -u %s://%s%s%s" % (ud.basecmd, ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), d, workdir=repodir)
 
+        # Projects to fetch simultaneously at time of 'repo sync'.
+        # If SRC_URI provides parallel jobs parameter as follows:
+        #   SRC_URI = "repo://REPOROOT;branch=some_branch;jobs=8"
+        # Sync is run as 'repo sync -j8'
+        # When jobs parameter is not passed with SRC_URI then
+        # repo tool's default behavior is to fetch 1 project at a time.
+        jobs = ud.parm.get('jobs', '')
+        if jobs:
+            jobs = '-j' + jobs
         bb.fetch2.check_network_access(d, "%s sync %s" % (ud.basecmd, ud.url), ud.url)
-        runfetchcmd("%s sync" % ud.basecmd, d, workdir=repodir)
+        runfetchcmd("%s sync %s" % (ud.basecmd, jobs), d, workdir=repodir)
 
         scmdata = ud.parm.get("scmdata", "")
         if scmdata == "keep":
-- 
2.7.4



-- 
Regards,
Sourabh

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

end of thread, other threads:[~2021-05-16 14:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-16 11:23 [bitbake][PATCH 1/3] bitbake: fetch2/repo: add support for projects to be fetched simultaneously Sourabh Banerjee
2021-05-16 11:23 ` [bitbake][PATCH 2/3] bitbake: fetch2/repo: add support for sync specific projects Sourabh Banerjee
2021-05-16 11:23 ` [bitbake][PATCH 3/3] bitbake: fetch2/repo: add support for --repo-url and --repo-branch Sourabh Banerjee
2021-05-16 12:43   ` [OE-core] " Richard Purdie
2021-05-16 14:10     ` Sourabh Banerjee
2021-05-16 12:40 ` [OE-core] [bitbake][PATCH 1/3] bitbake: fetch2/repo: add support for projects to be fetched simultaneously Richard Purdie
2021-05-16 13:19   ` Sourabh Banerjee

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