diff options
author | Gunjan Gupta <viraniac@gmail.com> | 2022-05-08 17:38:04 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-05-10 13:12:42 +0100 |
commit | deb81cbb33e81cea8486d4bd86bc73f7b4b5d91d (patch) | |
tree | 8efe552a71fdcc6878bc245befc3826ec7d00530 /bitbake | |
parent | 21053b2d37e9b5b151dc98d41d83a8ee34fc5154 (diff) | |
download | poky-deb81cbb33e81cea8486d4bd86bc73f7b4b5d91d.tar.gz |
bitbake: fetch2/osc: Small fixes for osc fetcher
The current fetcher seemed to have some issues that made it difficult when
trying to use the same. This patch fixes the following
* Make consistent use of the path that needs to be used as oscdir
* The path mentioned in os.access in download function was not same as
ud.moddir which would result into invoking of fetch command instead of
update command even if directory already existed
* Before creating oscrc, make sure oscdir exists and create it if it does
not exist
* Updated the configuration to use apiurl and added a new parameter to
control whether http or https needs to be used to connect to apiurl
(Bitbake rev: 3ec78686f3c0ea2304097b86a965f9be4b0cb879)
Signed-off-by: Gunjan Gupta <viraniac@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/fetch2/osc.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/bitbake/lib/bb/fetch2/osc.py b/bitbake/lib/bb/fetch2/osc.py index 99a529e5bf..eb0f82c8e6 100644 --- a/bitbake/lib/bb/fetch2/osc.py +++ b/bitbake/lib/bb/fetch2/osc.py | |||
@@ -36,6 +36,7 @@ class Osc(FetchMethod): | |||
36 | # Create paths to osc checkouts | 36 | # Create paths to osc checkouts |
37 | oscdir = d.getVar("OSCDIR") or (d.getVar("DL_DIR") + "/osc") | 37 | oscdir = d.getVar("OSCDIR") or (d.getVar("DL_DIR") + "/osc") |
38 | relpath = self._strip_leading_slashes(ud.path) | 38 | relpath = self._strip_leading_slashes(ud.path) |
39 | ud.oscdir = oscdir | ||
39 | ud.pkgdir = os.path.join(oscdir, ud.host) | 40 | ud.pkgdir = os.path.join(oscdir, ud.host) |
40 | ud.moddir = os.path.join(ud.pkgdir, relpath, ud.module) | 41 | ud.moddir = os.path.join(ud.pkgdir, relpath, ud.module) |
41 | 42 | ||
@@ -49,7 +50,7 @@ class Osc(FetchMethod): | |||
49 | else: | 50 | else: |
50 | ud.revision = "" | 51 | ud.revision = "" |
51 | 52 | ||
52 | ud.localfile = d.expand('%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.path.replace('/', '.'), ud.revision)) | 53 | ud.localfile = d.expand('%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), relpath.replace('/', '.'), ud.revision)) |
53 | 54 | ||
54 | def _buildosccommand(self, ud, d, command): | 55 | def _buildosccommand(self, ud, d, command): |
55 | """ | 56 | """ |
@@ -86,7 +87,7 @@ class Osc(FetchMethod): | |||
86 | 87 | ||
87 | logger.debug2("Fetch: checking for module directory '" + ud.moddir + "'") | 88 | logger.debug2("Fetch: checking for module directory '" + ud.moddir + "'") |
88 | 89 | ||
89 | if os.access(os.path.join(d.getVar('OSCDIR'), ud.path, ud.module), os.R_OK): | 90 | if os.access(ud.moddir, os.R_OK): |
90 | oscupdatecmd = self._buildosccommand(ud, d, "update") | 91 | oscupdatecmd = self._buildosccommand(ud, d, "update") |
91 | logger.info("Update "+ ud.url) | 92 | logger.info("Update "+ ud.url) |
92 | # update sources there | 93 | # update sources there |
@@ -114,20 +115,23 @@ class Osc(FetchMethod): | |||
114 | Generate a .oscrc to be used for this run. | 115 | Generate a .oscrc to be used for this run. |
115 | """ | 116 | """ |
116 | 117 | ||
117 | config_path = os.path.join(d.getVar('OSCDIR'), "oscrc") | 118 | config_path = os.path.join(ud.oscdir, "oscrc") |
119 | if not os.path.exists(ud.oscdir): | ||
120 | bb.utils.mkdirhier(ud.oscdir) | ||
121 | |||
118 | if (os.path.exists(config_path)): | 122 | if (os.path.exists(config_path)): |
119 | os.remove(config_path) | 123 | os.remove(config_path) |
120 | 124 | ||
121 | f = open(config_path, 'w') | 125 | f = open(config_path, 'w') |
126 | proto = ud.parm.get('proto', 'https') | ||
122 | f.write("[general]\n") | 127 | f.write("[general]\n") |
123 | f.write("apisrv = %s\n" % ud.host) | 128 | f.write("apiurl = %s://%s\n" % (proto, ud.host)) |
124 | f.write("scheme = http\n") | ||
125 | f.write("su-wrapper = su -c\n") | 129 | f.write("su-wrapper = su -c\n") |
126 | f.write("build-root = %s\n" % d.getVar('WORKDIR')) | 130 | f.write("build-root = %s\n" % d.getVar('WORKDIR')) |
127 | f.write("urllist = %s\n" % d.getVar("OSCURLLIST")) | 131 | f.write("urllist = %s\n" % d.getVar("OSCURLLIST")) |
128 | f.write("extra-pkgs = gzip\n") | 132 | f.write("extra-pkgs = gzip\n") |
129 | f.write("\n") | 133 | f.write("\n") |
130 | f.write("[%s]\n" % ud.host) | 134 | f.write("[%s://%s]\n" % (proto, ud.host)) |
131 | f.write("user = %s\n" % ud.parm["user"]) | 135 | f.write("user = %s\n" % ud.parm["user"]) |
132 | f.write("pass = %s\n" % ud.parm["pswd"]) | 136 | f.write("pass = %s\n" % ud.parm["pswd"]) |
133 | f.close() | 137 | f.close() |