* [PATCH 1/3] bitbake: fetch2/repo: add support for projects to be fetched simultaneously
@ 2021-05-18 15:35 Sourabh Banerjee
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
0 siblings, 2 replies; 3+ messages in thread
From: Sourabh Banerjee @ 2021-05-18 15:35 UTC (permalink / raw)
To: bitbake-devel; +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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/3] bitbake: fetch2/repo: add support for sync specific projects
2021-05-18 15:35 [PATCH 1/3] bitbake: fetch2/repo: add support for projects to be fetched simultaneously Sourabh Banerjee
@ 2021-05-18 15:35 ` Sourabh Banerjee
2021-05-18 15:35 ` [PATCH 3/3] bitbake: fetch2/repo: add support for --repo-url and --repo-branch Sourabh Banerjee
1 sibling, 0 replies; 3+ messages in thread
From: Sourabh Banerjee @ 2021-05-18 15:35 UTC (permalink / raw)
To: bitbake-devel; +Cc: Sourabh Banerjee
repo tool can fetch projects by name. I.e., if there are
multiple projects listed in the manifest file.
<manifest>
<project name="project1" path="sync path1" revision="sha256" />
<project name="project2" path="sync path2" revision="sha256" />
</manifest>
Documented Usage: repo sync [<project>...]
By supplying project=<project_name> recipe can choose to sync a specific
project.
Example:
SRC_URI = "repo://REPOROOT;protocol=git;branch=main;manifest=default.xml;project=project1"
This is helpful when recipe needs to sync only a specific project
from a manifest that lists multiple projects.
Signed-off-by: Sourabh Banerjee <sbanerje@codeaurora.org>
---
bitbake/lib/bb/fetch2/repo.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/bitbake/lib/bb/fetch2/repo.py b/bitbake/lib/bb/fetch2/repo.py
index 8547b9e..e7c5255 100644
--- a/bitbake/lib/bb/fetch2/repo.py
+++ b/bitbake/lib/bb/fetch2/repo.py
@@ -41,7 +41,10 @@ class Repo(FetchMethod):
if not ud.manifest.endswith('.xml'):
ud.manifest += '.xml'
- ud.localfile = d.expand("repo_%s%s_%s_%s.tar.gz" % (ud.host, ud.path.replace("/", "."), ud.manifest, ud.branch))
+ project = ud.parm.get('project', '')
+ if len(project):
+ project = '_' + project
+ ud.localfile = d.expand("repo_%s%s_%s_%s%s.tar.gz" % (ud.host, ud.path.replace("/", "."), ud.manifest, ud.branch, project.replace("/", ".")))
def download(self, ud, d):
"""Fetch url"""
@@ -52,7 +55,8 @@ class Repo(FetchMethod):
repodir = d.getVar("REPODIR") or (d.getVar("DL_DIR") + "/repo")
gitsrcname = "%s%s" % (ud.host, ud.path.replace("/", "."))
- codir = os.path.join(repodir, gitsrcname, ud.manifest)
+ project = ud.parm.get('project', '')
+ codir = os.path.join(repodir, gitsrcname, ud.manifest, project.replace("/", "."))
if ud.user:
username = ud.user + "@"
@@ -76,7 +80,7 @@ class Repo(FetchMethod):
if jobs:
jobs = '-j' + jobs
bb.fetch2.check_network_access(d, "%s sync %s" % (ud.basecmd, ud.url), ud.url)
- runfetchcmd("%s sync %s" % (ud.basecmd, jobs), d, workdir=repodir)
+ runfetchcmd("%s sync %s %s" % (ud.basecmd, jobs, project), d, workdir=repodir)
scmdata = ud.parm.get("scmdata", "")
if scmdata == "keep":
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 3/3] bitbake: fetch2/repo: add support for --repo-url and --repo-branch
2021-05-18 15:35 [PATCH 1/3] bitbake: fetch2/repo: add support for projects to be fetched simultaneously Sourabh Banerjee
2021-05-18 15:35 ` [PATCH 2/3] bitbake: fetch2/repo: add support for sync specific projects Sourabh Banerjee
@ 2021-05-18 15:35 ` Sourabh Banerjee
1 sibling, 0 replies; 3+ messages in thread
From: Sourabh Banerjee @ 2021-05-18 15:35 UTC (permalink / raw)
To: bitbake-devel; +Cc: Sourabh Banerjee
repo tool provides following options to use a stable or preferred
version of the tool
repo Version options:
--repo-url=URL repo repository location
--repo-branch=REVISION
repo branch or revision
By supplying repo_url=<uri> and repo_branch=<branch> recipe may choose
to sync a specific version of repo tool.
Signed-off-by: Sourabh Banerjee <sbanerje@codeaurora.org>
---
bitbake/lib/bb/fetch2/repo.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/bitbake/lib/bb/fetch2/repo.py b/bitbake/lib/bb/fetch2/repo.py
index e7c5255..902337f 100644
--- a/bitbake/lib/bb/fetch2/repo.py
+++ b/bitbake/lib/bb/fetch2/repo.py
@@ -66,9 +66,15 @@ class Repo(FetchMethod):
repodir = os.path.join(codir, "repo")
bb.utils.mkdirhier(repodir)
if not os.path.exists(os.path.join(repodir, ".repo")):
+ repo_url = ud.parm.get('repo_url', '')
+ if repo_url:
+ repo_url = '--repo-url=' + repo_url
+ repo_branch = ud.parm.get('repo_branch', '')
+ if repo_branch:
+ repo_branch = '--repo-branch=' + repo_branch
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)
+ runfetchcmd("%s init -m %s -b %s -u %s://%s%s%s %s %s" % (ud.basecmd, ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path, repo_url, repo_branch), d, workdir=repodir)
# Projects to fetch simultaneously at time of 'repo sync'.
# If SRC_URI provides parallel jobs parameter as follows:
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-18 15:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 15:35 [PATCH 1/3] bitbake: fetch2/repo: add support for projects to be fetched simultaneously Sourabh Banerjee
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
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.