summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-03-24 16:56:12 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2010-07-02 15:41:32 +0100
commit7acc132cac873e60005516272473a55a8160b9c4 (patch)
tree2e4122862ffd856803160b6089fcb979d3efd630 /bitbake/lib/bb/fetch
parentbbf83fd988ca3cf9dae7d2b542a11a7c942b1702 (diff)
downloadpoky-7acc132cac873e60005516272473a55a8160b9c4.tar.gz
Formatting cleanups
(Bitbake rev: 2caf134b43a44dad30af4fbe33033b3c58deee57) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/fetch')
-rw-r--r--bitbake/lib/bb/fetch/__init__.py32
-rw-r--r--bitbake/lib/bb/fetch/bzr.py7
-rw-r--r--bitbake/lib/bb/fetch/cvs.py2
-rw-r--r--bitbake/lib/bb/fetch/git.py11
-rw-r--r--bitbake/lib/bb/fetch/hg.py7
-rw-r--r--bitbake/lib/bb/fetch/local.py6
-rw-r--r--bitbake/lib/bb/fetch/osc.py10
-rw-r--r--bitbake/lib/bb/fetch/perforce.py8
-rw-r--r--bitbake/lib/bb/fetch/svn.py2
9 files changed, 40 insertions, 45 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py
index b1b5eda35b..09c83b0264 100644
--- a/bitbake/lib/bb/fetch/__init__.py
+++ b/bitbake/lib/bb/fetch/__init__.py
@@ -85,7 +85,7 @@ def decodeurl(url):
85 p = {} 85 p = {}
86 if parm: 86 if parm:
87 for s in parm.split(';'): 87 for s in parm.split(';'):
88 s1,s2 = s.split('=') 88 s1, s2 = s.split('=')
89 p[s1] = s2 89 p[s1] = s2
90 90
91 return (type, host, path, user, pswd, p) 91 return (type, host, path, user, pswd, p)
@@ -121,7 +121,7 @@ def uri_replace(uri, uri_find, uri_replace, d):
121 uri_decoded = list(decodeurl(uri)) 121 uri_decoded = list(decodeurl(uri))
122 uri_find_decoded = list(decodeurl(uri_find)) 122 uri_find_decoded = list(decodeurl(uri_find))
123 uri_replace_decoded = list(decodeurl(uri_replace)) 123 uri_replace_decoded = list(decodeurl(uri_replace))
124 result_decoded = ['','','','','',{}] 124 result_decoded = ['', '', '', '', '', {}]
125 for i in uri_find_decoded: 125 for i in uri_find_decoded:
126 loc = uri_find_decoded.index(i) 126 loc = uri_find_decoded.index(i)
127 result_decoded[loc] = uri_decoded[loc] 127 result_decoded[loc] = uri_decoded[loc]
@@ -214,7 +214,7 @@ def init(urls, d, setup = True):
214 if setup: 214 if setup:
215 for url in urldata: 215 for url in urldata:
216 if not urldata[url].setup: 216 if not urldata[url].setup:
217 urldata[url].setup_localpath(d) 217 urldata[url].setup_localpath(d)
218 218
219 urldata_cache[fn] = urldata 219 urldata_cache[fn] = urldata
220 return urldata 220 return urldata
@@ -243,7 +243,7 @@ def go(d, urls = None):
243 continue 243 continue
244 lf = bb.utils.lockfile(ud.lockfile) 244 lf = bb.utils.lockfile(ud.lockfile)
245 if not m.forcefetch(u, ud, d) and os.path.exists(ud.md5): 245 if not m.forcefetch(u, ud, d) and os.path.exists(ud.md5):
246 # If someone else fetched this before we got the lock, 246 # If someone else fetched this before we got the lock,
247 # notice and don't try again 247 # notice and don't try again
248 try: 248 try:
249 os.utime(ud.md5, None) 249 os.utime(ud.md5, None)
@@ -309,7 +309,7 @@ def localpaths(d):
309 urldata = init([], d, True) 309 urldata = init([], d, True)
310 310
311 for u in urldata: 311 for u in urldata:
312 ud = urldata[u] 312 ud = urldata[u]
313 local.append(ud.localpath) 313 local.append(ud.localpath)
314 314
315 return local 315 return local
@@ -321,15 +321,15 @@ def get_srcrev(d):
321 Return the version string for the current package 321 Return the version string for the current package
322 (usually to be used as PV) 322 (usually to be used as PV)
323 Most packages usually only have one SCM so we just pass on the call. 323 Most packages usually only have one SCM so we just pass on the call.
324 In the multi SCM case, we build a value based on SRCREV_FORMAT which must 324 In the multi SCM case, we build a value based on SRCREV_FORMAT which must
325 have been set. 325 have been set.
326 """ 326 """
327 327
328 # 328 #
329 # Ugly code alert. localpath in the fetchers will try to evaluate SRCREV which 329 # Ugly code alert. localpath in the fetchers will try to evaluate SRCREV which
330 # could translate into a call to here. If it does, we need to catch this 330 # could translate into a call to here. If it does, we need to catch this
331 # and provide some way so it knows get_srcrev is active instead of being 331 # and provide some way so it knows get_srcrev is active instead of being
332 # some number etc. hence the srcrev_internal_call tracking and the magic 332 # some number etc. hence the srcrev_internal_call tracking and the magic
333 # "SRCREVINACTION" return value. 333 # "SRCREVINACTION" return value.
334 # 334 #
335 # Neater solutions welcome! 335 # Neater solutions welcome!
@@ -339,7 +339,7 @@ def get_srcrev(d):
339 339
340 scms = [] 340 scms = []
341 341
342 # Only call setup_localpath on URIs which suppports_srcrev() 342 # Only call setup_localpath on URIs which suppports_srcrev()
343 urldata = init(bb.data.getVar('SRC_URI', d, 1).split(), d, False) 343 urldata = init(bb.data.getVar('SRC_URI', d, 1).split(), d, False)
344 for u in urldata: 344 for u in urldata:
345 ud = urldata[u] 345 ud = urldata[u]
@@ -352,7 +352,7 @@ def get_srcrev(d):
352 bb.msg.error(bb.msg.domain.Fetcher, "SRCREV was used yet no valid SCM was found in SRC_URI") 352 bb.msg.error(bb.msg.domain.Fetcher, "SRCREV was used yet no valid SCM was found in SRC_URI")
353 raise ParameterError 353 raise ParameterError
354 354
355 bb.data.setVar('__BB_DONT_CACHE','1', d) 355 bb.data.setVar('__BB_DONT_CACHE', '1', d)
356 356
357 if len(scms) == 1: 357 if len(scms) == 1:
358 return urldata[scms[0]].method.sortable_revision(scms[0], urldata[scms[0]], d) 358 return urldata[scms[0]].method.sortable_revision(scms[0], urldata[scms[0]], d)
@@ -375,7 +375,7 @@ def get_srcrev(d):
375 375
376def localpath(url, d, cache = True): 376def localpath(url, d, cache = True):
377 """ 377 """
378 Called from the parser with cache=False since the cache isn't ready 378 Called from the parser with cache=False since the cache isn't ready
379 at this point. Also called from classed in OE e.g. patch.bbclass 379 at this point. Also called from classed in OE e.g. patch.bbclass
380 """ 380 """
381 ud = init([url], d) 381 ud = init([url], d)
@@ -538,7 +538,7 @@ class Fetch(object):
538 def localpath(self, url, urldata, d): 538 def localpath(self, url, urldata, d):
539 """ 539 """
540 Return the local filename of a given url assuming a successful fetch. 540 Return the local filename of a given url assuming a successful fetch.
541 Can also setup variables in urldata for use in go (saving code duplication 541 Can also setup variables in urldata for use in go (saving code duplication
542 and duplicate code execution) 542 and duplicate code execution)
543 """ 543 """
544 return url 544 return url
@@ -599,8 +599,8 @@ class Fetch(object):
599 """ 599 """
600 Return: 600 Return:
601 a) a source revision if specified 601 a) a source revision if specified
602 b) True if auto srcrev is in action 602 b) True if auto srcrev is in action
603 c) False otherwise 603 c) False otherwise
604 """ 604 """
605 605
606 if 'rev' in ud.parm: 606 if 'rev' in ud.parm:
@@ -632,7 +632,7 @@ class Fetch(object):
632 b) None otherwise 632 b) None otherwise
633 """ 633 """
634 634
635 localcount= None 635 localcount = None
636 if 'name' in ud.parm: 636 if 'name' in ud.parm:
637 pn = data.getVar("PN", d, 1) 637 pn = data.getVar("PN", d, 1)
638 localcount = data.getVar("LOCALCOUNT_" + ud.parm['name'], d, 1) 638 localcount = data.getVar("LOCALCOUNT_" + ud.parm['name'], d, 1)
@@ -685,7 +685,7 @@ class Fetch(object):
685 685
686 def sortable_revision(self, url, ud, d): 686 def sortable_revision(self, url, ud, d):
687 """ 687 """
688 688
689 """ 689 """
690 if hasattr(self, "_sortable_revision"): 690 if hasattr(self, "_sortable_revision"):
691 return self._sortable_revision(url, ud, d) 691 return self._sortable_revision(url, ud, d)
diff --git a/bitbake/lib/bb/fetch/bzr.py b/bitbake/lib/bb/fetch/bzr.py
index c6e33c3343..813d7d8c80 100644
--- a/bitbake/lib/bb/fetch/bzr.py
+++ b/bitbake/lib/bb/fetch/bzr.py
@@ -46,15 +46,15 @@ class Bzr(Fetch):
46 46
47 revision = Fetch.srcrev_internal_helper(ud, d) 47 revision = Fetch.srcrev_internal_helper(ud, d)
48 if revision is True: 48 if revision is True:
49 ud.revision = self.latest_revision(url, ud, d) 49 ud.revision = self.latest_revision(url, ud, d)
50 elif revision: 50 elif revision:
51 ud.revision = revision 51 ud.revision = revision
52 52
53 if not ud.revision: 53 if not ud.revision:
54 ud.revision = self.latest_revision(url, ud, d) 54 ud.revision = self.latest_revision(url, ud, d)
55 55
56 ud.localfile = data.expand('bzr_%s_%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.revision), d) 56 ud.localfile = data.expand('bzr_%s_%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.revision), d)
57 57
58 return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) 58 return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
59 59
60 def _buildbzrcommand(self, ud, d, command): 60 def _buildbzrcommand(self, ud, d, command):
@@ -145,4 +145,3 @@ class Bzr(Fetch):
145 145
146 def _build_revision(self, url, ud, d): 146 def _build_revision(self, url, ud, d):
147 return ud.revision 147 return ud.revision
148
diff --git a/bitbake/lib/bb/fetch/cvs.py b/bitbake/lib/bb/fetch/cvs.py
index 443f521317..c0d43618f9 100644
--- a/bitbake/lib/bb/fetch/cvs.py
+++ b/bitbake/lib/bb/fetch/cvs.py
@@ -157,7 +157,7 @@ class Cvs(Fetch):
157 try: 157 try:
158 os.rmdir(moddir) 158 os.rmdir(moddir)
159 except OSError: 159 except OSError:
160 pass 160 pass
161 raise FetchError(ud.module) 161 raise FetchError(ud.module)
162 162
163 # tar them up to a defined filename 163 # tar them up to a defined filename
diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py
index 41ebc5b998..5332686252 100644
--- a/bitbake/lib/bb/fetch/git.py
+++ b/bitbake/lib/bb/fetch/git.py
@@ -57,12 +57,12 @@ class Git(Fetch):
57 57
58 tag = Fetch.srcrev_internal_helper(ud, d) 58 tag = Fetch.srcrev_internal_helper(ud, d)
59 if tag is True: 59 if tag is True:
60 ud.tag = self.latest_revision(url, ud, d) 60 ud.tag = self.latest_revision(url, ud, d)
61 elif tag: 61 elif tag:
62 ud.tag = tag 62 ud.tag = tag
63 63
64 if not ud.tag or ud.tag == "master": 64 if not ud.tag or ud.tag == "master":
65 ud.tag = self.latest_revision(url, ud, d) 65 ud.tag = self.latest_revision(url, ud, d)
66 66
67 subdir = ud.parm.get("subpath", "") 67 subdir = ud.parm.get("subpath", "")
68 if subdir != "": 68 if subdir != "":
@@ -114,7 +114,7 @@ class Git(Fetch):
114 114
115 os.chdir(ud.clonedir) 115 os.chdir(ud.clonedir)
116 mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) 116 mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True)
117 if mirror_tarballs != "0" or 'fullclone' in ud.parm: 117 if mirror_tarballs != "0" or 'fullclone' in ud.parm:
118 bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git repository") 118 bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git repository")
119 runfetchcmd("tar -czf %s %s" % (repofile, os.path.join(".", ".git", "*") ), d) 119 runfetchcmd("tar -czf %s %s" % (repofile, os.path.join(".", ".git", "*") ), d)
120 120
@@ -188,7 +188,7 @@ class Git(Fetch):
188 188
189 def _sortable_buildindex_disabled(self, url, ud, d, rev): 189 def _sortable_buildindex_disabled(self, url, ud, d, rev):
190 """ 190 """
191 Return a suitable buildindex for the revision specified. This is done by counting revisions 191 Return a suitable buildindex for the revision specified. This is done by counting revisions
192 using "git rev-list" which may or may not work in different circumstances. 192 using "git rev-list" which may or may not work in different circumstances.
193 """ 193 """
194 194
@@ -213,5 +213,4 @@ class Git(Fetch):
213 213
214 buildindex = "%s" % output.split()[0] 214 buildindex = "%s" % output.split()[0]
215 bb.msg.debug(1, bb.msg.domain.Fetcher, "GIT repository for %s in %s is returning %s revisions in rev-list before %s" % (url, ud.clonedir, buildindex, rev)) 215 bb.msg.debug(1, bb.msg.domain.Fetcher, "GIT repository for %s in %s is returning %s revisions in rev-list before %s" % (url, ud.clonedir, buildindex, rev))
216 return buildindex 216 return buildindex
217
diff --git a/bitbake/lib/bb/fetch/hg.py b/bitbake/lib/bb/fetch/hg.py
index d0756382f8..efb3b5c76d 100644
--- a/bitbake/lib/bb/fetch/hg.py
+++ b/bitbake/lib/bb/fetch/hg.py
@@ -134,9 +134,9 @@ class Hg(Fetch):
134 os.chdir(ud.pkgdir) 134 os.chdir(ud.pkgdir)
135 bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % fetchcmd) 135 bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % fetchcmd)
136 runfetchcmd(fetchcmd, d) 136 runfetchcmd(fetchcmd, d)
137 137
138 # Even when we clone (fetch), we still need to update as hg's clone 138 # Even when we clone (fetch), we still need to update as hg's clone
139 # won't checkout the specified revision if its on a branch 139 # won't checkout the specified revision if its on a branch
140 updatecmd = self._buildhgcommand(ud, d, "update") 140 updatecmd = self._buildhgcommand(ud, d, "update")
141 bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % updatecmd) 141 bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % updatecmd)
142 runfetchcmd(updatecmd, d) 142 runfetchcmd(updatecmd, d)
@@ -170,4 +170,3 @@ class Hg(Fetch):
170 Return a unique key for the url 170 Return a unique key for the url
171 """ 171 """
172 return "hg:" + ud.moddir 172 return "hg:" + ud.moddir
173
diff --git a/bitbake/lib/bb/fetch/local.py b/bitbake/lib/bb/fetch/local.py
index f9bdf589cb..a2abc8639c 100644
--- a/bitbake/lib/bb/fetch/local.py
+++ b/bitbake/lib/bb/fetch/local.py
@@ -65,8 +65,8 @@ class Local(Fetch):
65 Check the status of the url 65 Check the status of the url
66 """ 66 """
67 if urldata.localpath.find("*") != -1: 67 if urldata.localpath.find("*") != -1:
68 bb.msg.note(1, bb.msg.domain.Fetcher, "URL %s looks like a glob and was therefore not checked." % url) 68 bb.msg.note(1, bb.msg.domain.Fetcher, "URL %s looks like a glob and was therefore not checked." % url)
69 return True 69 return True
70 if os.path.exists(urldata.localpath): 70 if os.path.exists(urldata.localpath):
71 return True 71 return True
72 return False 72 return False
diff --git a/bitbake/lib/bb/fetch/osc.py b/bitbake/lib/bb/fetch/osc.py
index 548dd9d074..ed773939b0 100644
--- a/bitbake/lib/bb/fetch/osc.py
+++ b/bitbake/lib/bb/fetch/osc.py
@@ -16,7 +16,7 @@ from bb.fetch import MissingParameterError
16from bb.fetch import runfetchcmd 16from bb.fetch import runfetchcmd
17 17
18class Osc(Fetch): 18class Osc(Fetch):
19 """Class to fetch a module or modules from Opensuse build server 19 """Class to fetch a module or modules from Opensuse build server
20 repositories.""" 20 repositories."""
21 21
22 def supports(self, url, ud, d): 22 def supports(self, url, ud, d):
@@ -64,7 +64,7 @@ class Osc(Fetch):
64 proto = "ocs" 64 proto = "ocs"
65 if "proto" in ud.parm: 65 if "proto" in ud.parm:
66 proto = ud.parm["proto"] 66 proto = ud.parm["proto"]
67 67
68 options = [] 68 options = []
69 69
70 config = "-c %s" % self.generate_config(ud, d) 70 config = "-c %s" % self.generate_config(ud, d)
@@ -108,7 +108,7 @@ class Osc(Fetch):
108 os.chdir(ud.pkgdir) 108 os.chdir(ud.pkgdir)
109 bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % oscfetchcmd) 109 bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % oscfetchcmd)
110 runfetchcmd(oscfetchcmd, d) 110 runfetchcmd(oscfetchcmd, d)
111 111
112 os.chdir(os.path.join(ud.pkgdir + ud.path)) 112 os.chdir(os.path.join(ud.pkgdir + ud.path))
113 # tar them up to a defined filename 113 # tar them up to a defined filename
114 try: 114 try:
@@ -131,7 +131,7 @@ class Osc(Fetch):
131 131
132 config_path = "%s/oscrc" % data.expand('${OSCDIR}', d) 132 config_path = "%s/oscrc" % data.expand('${OSCDIR}', d)
133 if (os.path.exists(config_path)): 133 if (os.path.exists(config_path)):
134 os.remove(config_path) 134 os.remove(config_path)
135 135
136 f = open(config_path, 'w') 136 f = open(config_path, 'w')
137 f.write("[general]\n") 137 f.write("[general]\n")
@@ -146,5 +146,5 @@ class Osc(Fetch):
146 f.write("user = %s\n" % ud.parm["user"]) 146 f.write("user = %s\n" % ud.parm["user"])
147 f.write("pass = %s\n" % ud.parm["pswd"]) 147 f.write("pass = %s\n" % ud.parm["pswd"])
148 f.close() 148 f.close()
149 149
150 return config_path 150 return config_path
diff --git a/bitbake/lib/bb/fetch/perforce.py b/bitbake/lib/bb/fetch/perforce.py
index 8bc3205c2a..67de6f59fa 100644
--- a/bitbake/lib/bb/fetch/perforce.py
+++ b/bitbake/lib/bb/fetch/perforce.py
@@ -95,7 +95,7 @@ class Perforce(Fetch):
95 return cset.split(' ')[1] 95 return cset.split(' ')[1]
96 getcset = staticmethod(getcset) 96 getcset = staticmethod(getcset)
97 97
98 def localpath(self, url, ud, d): 98 def localpath(self, url, ud, d):
99 99
100 (host,path,user,pswd,parm) = Perforce.doparse(url,d) 100 (host,path,user,pswd,parm) = Perforce.doparse(url,d)
101 101
@@ -180,7 +180,7 @@ class Perforce(Fetch):
180 180
181 count = 0 181 count = 0
182 182
183 for file in p4file: 183 for file in p4file:
184 list = file.split() 184 list = file.split()
185 185
186 if list[2] == "delete": 186 if list[2] == "delete":
@@ -191,7 +191,7 @@ class Perforce(Fetch):
191 191
192 os.system("%s%s print -o %s/%s %s" % (p4cmd, p4opt, module,dest[:where],list[0])) 192 os.system("%s%s print -o %s/%s %s" % (p4cmd, p4opt, module,dest[:where],list[0]))
193 count = count + 1 193 count = count + 1
194 194
195 if count == 0: 195 if count == 0:
196 bb.msg.error(bb.msg.domain.Fetcher, "Fetch: No files gathered from the P4 fetch") 196 bb.msg.error(bb.msg.domain.Fetcher, "Fetch: No files gathered from the P4 fetch")
197 raise FetchError(module) 197 raise FetchError(module)
@@ -205,5 +205,3 @@ class Perforce(Fetch):
205 raise FetchError(module) 205 raise FetchError(module)
206 # cleanup 206 # cleanup
207 os.system('rm -rf %s' % tmpfile) 207 os.system('rm -rf %s' % tmpfile)
208
209
diff --git a/bitbake/lib/bb/fetch/svn.py b/bitbake/lib/bb/fetch/svn.py
index ba9f6ab109..375e8df055 100644
--- a/bitbake/lib/bb/fetch/svn.py
+++ b/bitbake/lib/bb/fetch/svn.py
@@ -78,7 +78,7 @@ class Svn(Fetch):
78 ud.revision = rev 78 ud.revision = rev
79 ud.date = "" 79 ud.date = ""
80 else: 80 else:
81 ud.revision = "" 81 ud.revision = ""
82 82
83 ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d) 83 ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d)
84 84