All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Sourabh Banerjee" <sbanerje@codeaurora.org>
To: bitbake-devel@lists.openembedded.org
Cc: Sourabh Banerjee <sbanerje@codeaurora.org>
Subject: [PATCH 1/3] bitbake: fetch2/repo: add support for projects to be fetched simultaneously
Date: Tue, 18 May 2021 21:05:22 +0530	[thread overview]
Message-ID: <1621352124-27088-1-git-send-email-sbanerje@codeaurora.org> (raw)

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


             reply	other threads:[~2021-05-18 15:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 15:35 Sourabh Banerjee [this message]
2021-05-18 15:35 ` [PATCH 2/3] bitbake: fetch2/repo: add support for sync specific projects Sourabh Banerjee
2021-05-18 15:35 ` [PATCH 3/3] bitbake: fetch2/repo: add support for --repo-url and --repo-branch Sourabh Banerjee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1621352124-27088-1-git-send-email-sbanerje@codeaurora.org \
    --to=sbanerje@codeaurora.org \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.