summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorAndre McCurdy <armccurdy@gmail.com>2018-06-05 12:13:50 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-06-15 17:57:30 +0100
commit783829427157b82dd021be345fe00afdf4d84a68 (patch)
tree46f95f4f37aabbcb5dc6101f222469cd25c914b6 /bitbake
parentb054015357b2b03f308af00a41b29c649cbca171 (diff)
downloadpoky-783829427157b82dd021be345fe00afdf4d84a68.tar.gz
bitbake: fetch2: unify the way fetchers determine DL_DIR and FETCHCMD
Currently there is quite some variation between the fetchers in terms of how they determine the subdirectory within DL_DIR and the base fetch command to run. Some rely on variables being set externally (e.g. from bitbake.conf in oe-core), some respect these external variables but provide fallback defaults and some use only hardcoded internal values. Try to unify the approach used across the various fetchers. (Bitbake rev: efd5e35af4b08501c67e8b30f30d9457f6fdf610) Signed-off-by: Andre McCurdy <armccurdy@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/bzr.py5
-rw-r--r--bitbake/lib/bb/fetch2/cvs.py5
-rw-r--r--bitbake/lib/bb/fetch2/git.py2
-rw-r--r--bitbake/lib/bb/fetch2/hg.py2
-rw-r--r--bitbake/lib/bb/fetch2/osc.py5
-rw-r--r--bitbake/lib/bb/fetch2/perforce.py8
-rw-r--r--bitbake/lib/bb/fetch2/repo.py12
-rw-r--r--bitbake/lib/bb/fetch2/svn.py5
8 files changed, 23 insertions, 21 deletions
diff --git a/bitbake/lib/bb/fetch2/bzr.py b/bitbake/lib/bb/fetch2/bzr.py
index 16123f8af9..658502f9a6 100644
--- a/bitbake/lib/bb/fetch2/bzr.py
+++ b/bitbake/lib/bb/fetch2/bzr.py
@@ -41,8 +41,9 @@ class Bzr(FetchMethod):
41 init bzr specific variable within url data 41 init bzr specific variable within url data
42 """ 42 """
43 # Create paths to bzr checkouts 43 # Create paths to bzr checkouts
44 bzrdir = d.getVar("BZRDIR") or (d.getVar("DL_DIR") + "/bzr")
44 relpath = self._strip_leading_slashes(ud.path) 45 relpath = self._strip_leading_slashes(ud.path)
45 ud.pkgdir = os.path.join(d.expand('${BZRDIR}'), ud.host, relpath) 46 ud.pkgdir = os.path.join(bzrdir, ud.host, relpath)
46 47
47 ud.setup_revisions(d) 48 ud.setup_revisions(d)
48 49
@@ -57,7 +58,7 @@ class Bzr(FetchMethod):
57 command is "fetch", "update", "revno" 58 command is "fetch", "update", "revno"
58 """ 59 """
59 60
60 basecmd = d.expand('${FETCHCMD_bzr}') 61 basecmd = d.getVar("FETCHCMD_bzr") or "/usr/bin/env bzr"
61 62
62 proto = ud.parm.get('protocol', 'http') 63 proto = ud.parm.get('protocol', 'http')
63 64
diff --git a/bitbake/lib/bb/fetch2/cvs.py b/bitbake/lib/bb/fetch2/cvs.py
index 490c954718..0e0a3196f8 100644
--- a/bitbake/lib/bb/fetch2/cvs.py
+++ b/bitbake/lib/bb/fetch2/cvs.py
@@ -110,7 +110,7 @@ class Cvs(FetchMethod):
110 if ud.tag: 110 if ud.tag:
111 options.append("-r %s" % ud.tag) 111 options.append("-r %s" % ud.tag)
112 112
113 cvsbasecmd = d.getVar("FETCHCMD_cvs") 113 cvsbasecmd = d.getVar("FETCHCMD_cvs") or "/usr/bin/env cvs"
114 cvscmd = cvsbasecmd + " '-d" + cvsroot + "' co " + " ".join(options) + " " + ud.module 114 cvscmd = cvsbasecmd + " '-d" + cvsroot + "' co " + " ".join(options) + " " + ud.module
115 cvsupdatecmd = cvsbasecmd + " '-d" + cvsroot + "' update -d -P " + " ".join(options) 115 cvsupdatecmd = cvsbasecmd + " '-d" + cvsroot + "' update -d -P " + " ".join(options)
116 116
@@ -121,7 +121,8 @@ class Cvs(FetchMethod):
121 # create module directory 121 # create module directory
122 logger.debug(2, "Fetch: checking for module directory") 122 logger.debug(2, "Fetch: checking for module directory")
123 pkg = d.getVar('PN') 123 pkg = d.getVar('PN')
124 pkgdir = os.path.join(d.getVar('CVSDIR'), pkg) 124 cvsdir = d.getVar("CVSDIR") or (d.getVar("DL_DIR") + "/cvs")
125 pkgdir = os.path.join(cvsdir, pkg)
125 moddir = os.path.join(pkgdir, localdir) 126 moddir = os.path.join(pkgdir, localdir)
126 workdir = None 127 workdir = None
127 if os.access(os.path.join(moddir, 'CVS'), os.R_OK): 128 if os.access(os.path.join(moddir, 'CVS'), os.R_OK):
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index b733be9f38..612aac4353 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -261,7 +261,7 @@ class Git(FetchMethod):
261 gitsrcname = gitsrcname + '_' + ud.revisions[name] 261 gitsrcname = gitsrcname + '_' + ud.revisions[name]
262 262
263 dl_dir = d.getVar("DL_DIR") 263 dl_dir = d.getVar("DL_DIR")
264 gitdir = d.getVar("GITDIR") or (dl_dir + "/git2/") 264 gitdir = d.getVar("GITDIR") or (dl_dir + "/git2")
265 ud.clonedir = os.path.join(gitdir, gitsrcname) 265 ud.clonedir = os.path.join(gitdir, gitsrcname)
266 ud.localfile = ud.clonedir 266 ud.localfile = ud.clonedir
267 267
diff --git a/bitbake/lib/bb/fetch2/hg.py b/bitbake/lib/bb/fetch2/hg.py
index d0857e63f7..936d043112 100644
--- a/bitbake/lib/bb/fetch2/hg.py
+++ b/bitbake/lib/bb/fetch2/hg.py
@@ -80,7 +80,7 @@ class Hg(FetchMethod):
80 ud.fullmirror = os.path.join(d.getVar("DL_DIR"), mirrortarball) 80 ud.fullmirror = os.path.join(d.getVar("DL_DIR"), mirrortarball)
81 ud.mirrortarballs = [mirrortarball] 81 ud.mirrortarballs = [mirrortarball]
82 82
83 hgdir = d.getVar("HGDIR") or (d.getVar("DL_DIR") + "/hg/") 83 hgdir = d.getVar("HGDIR") or (d.getVar("DL_DIR") + "/hg")
84 ud.pkgdir = os.path.join(hgdir, hgsrcname) 84 ud.pkgdir = os.path.join(hgdir, hgsrcname)
85 ud.moddir = os.path.join(ud.pkgdir, ud.module) 85 ud.moddir = os.path.join(ud.pkgdir, ud.module)
86 ud.localfile = ud.moddir 86 ud.localfile = ud.moddir
diff --git a/bitbake/lib/bb/fetch2/osc.py b/bitbake/lib/bb/fetch2/osc.py
index 2b4f7d9c13..6c60456b53 100644
--- a/bitbake/lib/bb/fetch2/osc.py
+++ b/bitbake/lib/bb/fetch2/osc.py
@@ -32,8 +32,9 @@ class Osc(FetchMethod):
32 ud.module = ud.parm["module"] 32 ud.module = ud.parm["module"]
33 33
34 # Create paths to osc checkouts 34 # Create paths to osc checkouts
35 oscdir = d.getVar("OSCDIR") or (d.getVar("DL_DIR") + "/osc")
35 relpath = self._strip_leading_slashes(ud.path) 36 relpath = self._strip_leading_slashes(ud.path)
36 ud.pkgdir = os.path.join(d.getVar('OSCDIR'), ud.host) 37 ud.pkgdir = os.path.join(oscdir, ud.host)
37 ud.moddir = os.path.join(ud.pkgdir, relpath, ud.module) 38 ud.moddir = os.path.join(ud.pkgdir, relpath, ud.module)
38 39
39 if 'rev' in ud.parm: 40 if 'rev' in ud.parm:
@@ -54,7 +55,7 @@ class Osc(FetchMethod):
54 command is "fetch", "update", "info" 55 command is "fetch", "update", "info"
55 """ 56 """
56 57
57 basecmd = d.expand('${FETCHCMD_osc}') 58 basecmd = d.getVar("FETCHCMD_osc") or "/usr/bin/env osc"
58 59
59 proto = ud.parm.get('protocol', 'ocs') 60 proto = ud.parm.get('protocol', 'ocs')
60 61
diff --git a/bitbake/lib/bb/fetch2/perforce.py b/bitbake/lib/bb/fetch2/perforce.py
index 3debad59f4..903a8e61ae 100644
--- a/bitbake/lib/bb/fetch2/perforce.py
+++ b/bitbake/lib/bb/fetch2/perforce.py
@@ -43,13 +43,9 @@ class Perforce(FetchMethod):
43 provided by the env, use it. If P4PORT is specified by the recipe, use 43 provided by the env, use it. If P4PORT is specified by the recipe, use
44 its values, which may override the settings in P4CONFIG. 44 its values, which may override the settings in P4CONFIG.
45 """ 45 """
46 ud.basecmd = d.getVar('FETCHCMD_p4') 46 ud.basecmd = d.getVar("FETCHCMD_p4") or "/usr/bin/env p4"
47 if not ud.basecmd:
48 ud.basecmd = "/usr/bin/env p4"
49 47
50 ud.dldir = d.getVar('P4DIR') 48 ud.dldir = d.getVar("P4DIR") or (d.getVar("DL_DIR") + "/p4")
51 if not ud.dldir:
52 ud.dldir = '%s/%s' % (d.getVar('DL_DIR'), 'p4')
53 49
54 path = ud.url.split('://')[1] 50 path = ud.url.split('://')[1]
55 path = path.split(';')[0] 51 path = path.split(';')[0]
diff --git a/bitbake/lib/bb/fetch2/repo.py b/bitbake/lib/bb/fetch2/repo.py
index c22d9b5578..8c7e81853a 100644
--- a/bitbake/lib/bb/fetch2/repo.py
+++ b/bitbake/lib/bb/fetch2/repo.py
@@ -45,6 +45,8 @@ class Repo(FetchMethod):
45 "master". 45 "master".
46 """ 46 """
47 47
48 ud.basecmd = d.getVar("FETCHCMD_repo") or "/usr/bin/env repo"
49
48 ud.proto = ud.parm.get('protocol', 'git') 50 ud.proto = ud.parm.get('protocol', 'git')
49 ud.branch = ud.parm.get('branch', 'master') 51 ud.branch = ud.parm.get('branch', 'master')
50 ud.manifest = ud.parm.get('manifest', 'default.xml') 52 ud.manifest = ud.parm.get('manifest', 'default.xml')
@@ -60,8 +62,8 @@ class Repo(FetchMethod):
60 logger.debug(1, "%s already exists (or was stashed). Skipping repo init / sync.", ud.localpath) 62 logger.debug(1, "%s already exists (or was stashed). Skipping repo init / sync.", ud.localpath)
61 return 63 return
62 64
65 repodir = d.getVar("REPODIR") or (d.getVar("DL_DIR") + "/repo")
63 gitsrcname = "%s%s" % (ud.host, ud.path.replace("/", ".")) 66 gitsrcname = "%s%s" % (ud.host, ud.path.replace("/", "."))
64 repodir = d.getVar("REPODIR") or os.path.join(d.getVar("DL_DIR"), "repo")
65 codir = os.path.join(repodir, gitsrcname, ud.manifest) 67 codir = os.path.join(repodir, gitsrcname, ud.manifest)
66 68
67 if ud.user: 69 if ud.user:
@@ -72,11 +74,11 @@ class Repo(FetchMethod):
72 repodir = os.path.join(codir, "repo") 74 repodir = os.path.join(codir, "repo")
73 bb.utils.mkdirhier(repodir) 75 bb.utils.mkdirhier(repodir)
74 if not os.path.exists(os.path.join(repodir, ".repo")): 76 if not os.path.exists(os.path.join(repodir, ".repo")):
75 bb.fetch2.check_network_access(d, "repo init -m %s -b %s -u %s://%s%s%s" % (ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), ud.url) 77 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)
76 runfetchcmd("repo init -m %s -b %s -u %s://%s%s%s" % (ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), d, workdir=repodir) 78 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)
77 79
78 bb.fetch2.check_network_access(d, "repo sync %s" % ud.url, ud.url) 80 bb.fetch2.check_network_access(d, "%s sync %s" % (ud.basecmd, ud.url), ud.url)
79 runfetchcmd("repo sync", d, workdir=repodir) 81 runfetchcmd("%s sync" % ud.basecmd, d, workdir=repodir)
80 82
81 scmdata = ud.parm.get("scmdata", "") 83 scmdata = ud.parm.get("scmdata", "")
82 if scmdata == "keep": 84 if scmdata == "keep":
diff --git a/bitbake/lib/bb/fetch2/svn.py b/bitbake/lib/bb/fetch2/svn.py
index 3f172eec9b..ed70bcf8fb 100644
--- a/bitbake/lib/bb/fetch2/svn.py
+++ b/bitbake/lib/bb/fetch2/svn.py
@@ -49,7 +49,7 @@ class Svn(FetchMethod):
49 if not "module" in ud.parm: 49 if not "module" in ud.parm:
50 raise MissingParameterError('module', ud.url) 50 raise MissingParameterError('module', ud.url)
51 51
52 ud.basecmd = d.getVar('FETCHCMD_svn') 52 ud.basecmd = d.getVar("FETCHCMD_svn") or "/usr/bin/env svn --non-interactive --trust-server-cert"
53 53
54 ud.module = ud.parm["module"] 54 ud.module = ud.parm["module"]
55 55
@@ -59,8 +59,9 @@ class Svn(FetchMethod):
59 ud.path_spec = ud.parm["path_spec"] 59 ud.path_spec = ud.parm["path_spec"]
60 60
61 # Create paths to svn checkouts 61 # Create paths to svn checkouts
62 svndir = d.getVar("SVNDIR") or (d.getVar("DL_DIR") + "/svn")
62 relpath = self._strip_leading_slashes(ud.path) 63 relpath = self._strip_leading_slashes(ud.path)
63 ud.pkgdir = os.path.join(d.expand('${SVNDIR}'), ud.host, relpath) 64 ud.pkgdir = os.path.join(svndir, ud.host, relpath)
64 ud.moddir = os.path.join(ud.pkgdir, ud.module) 65 ud.moddir = os.path.join(ud.pkgdir, ud.module)
65 66
66 ud.setup_revisions(d) 67 ud.setup_revisions(d)