summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2010-11-17 15:40:51 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2011-01-04 14:46:41 +0000
commit4df0d6adcaae5382009c356d750e7909a44284f6 (patch)
treed3b8b48e0ded47a63c4ea65b56add754cc750126 /bitbake/lib/bb/fetch
parentb7d667f25283cddf8ff4fc9e35425a884a9f527e (diff)
downloadpoky-4df0d6adcaae5382009c356d750e7909a44284f6.tar.gz
fetch: be more pythonic
no functional changes (Bitbake rev: e88834fb7c6821cc29c12d296f2edd51f6eb3746) Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.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__.py4
-rw-r--r--bitbake/lib/bb/fetch/bzr.py4
-rw-r--r--bitbake/lib/bb/fetch/cvs.py18
-rw-r--r--bitbake/lib/bb/fetch/hg.py9
-rw-r--r--bitbake/lib/bb/fetch/osc.py6
-rw-r--r--bitbake/lib/bb/fetch/perforce.py7
-rw-r--r--bitbake/lib/bb/fetch/repo.py23
-rw-r--r--bitbake/lib/bb/fetch/svk.py10
-rw-r--r--bitbake/lib/bb/fetch/svn.py4
9 files changed, 21 insertions, 64 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py
index 18775301a3..0562d72a23 100644
--- a/bitbake/lib/bb/fetch/__init__.py
+++ b/bitbake/lib/bb/fetch/__init__.py
@@ -733,9 +733,7 @@ class Fetch(object):
733 """ 733 """
734 Verify the md5sum we wanted with the one we got 734 Verify the md5sum we wanted with the one we got
735 """ 735 """
736 wanted_sum = None 736 wanted_sum = ud.parm.get('md5sum')
737 if 'md5sum' in ud.parm:
738 wanted_sum = ud.parm['md5sum']
739 if not wanted_sum: 737 if not wanted_sum:
740 return True 738 return True
741 739
diff --git a/bitbake/lib/bb/fetch/bzr.py b/bitbake/lib/bb/fetch/bzr.py
index 92fff741ac..7d377a15d9 100644
--- a/bitbake/lib/bb/fetch/bzr.py
+++ b/bitbake/lib/bb/fetch/bzr.py
@@ -61,9 +61,7 @@ class Bzr(Fetch):
61 61
62 basecmd = data.expand('${FETCHCMD_bzr}', d) 62 basecmd = data.expand('${FETCHCMD_bzr}', d)
63 63
64 proto = "http" 64 proto = ud.parm.get('proto', 'http')
65 if "proto" in ud.parm:
66 proto = ud.parm["proto"]
67 65
68 bzrroot = ud.host + ud.path 66 bzrroot = ud.host + ud.path
69 67
diff --git a/bitbake/lib/bb/fetch/cvs.py b/bitbake/lib/bb/fetch/cvs.py
index 42d71ba9fe..bd919e234e 100644
--- a/bitbake/lib/bb/fetch/cvs.py
+++ b/bitbake/lib/bb/fetch/cvs.py
@@ -47,9 +47,7 @@ class Cvs(Fetch):
47 raise MissingParameterError("cvs method needs a 'module' parameter") 47 raise MissingParameterError("cvs method needs a 'module' parameter")
48 ud.module = ud.parm["module"] 48 ud.module = ud.parm["module"]
49 49
50 ud.tag = "" 50 ud.tag = ud.parm.get('tag', "")
51 if 'tag' in ud.parm:
52 ud.tag = ud.parm['tag']
53 51
54 # Override the default date in certain cases 52 # Override the default date in certain cases
55 if 'date' in ud.parm: 53 if 'date' in ud.parm:
@@ -76,17 +74,9 @@ class Cvs(Fetch):
76 74
77 def go(self, loc, ud, d): 75 def go(self, loc, ud, d):
78 76
79 method = "pserver" 77 method = ud.parm.get('method', 'pserver')
80 if "method" in ud.parm: 78 localdir = ud.parm.get('localdir', ud.module)
81 method = ud.parm["method"] 79 cvs_port = ud.parm.get('port', '')
82
83 localdir = ud.module
84 if "localdir" in ud.parm:
85 localdir = ud.parm["localdir"]
86
87 cvs_port = ""
88 if "port" in ud.parm:
89 cvs_port = ud.parm["port"]
90 80
91 cvs_rsh = None 81 cvs_rsh = None
92 if method == "ext": 82 if method == "ext":
diff --git a/bitbake/lib/bb/fetch/hg.py b/bitbake/lib/bb/fetch/hg.py
index 0f8d9b8324..6bc261ae68 100644
--- a/bitbake/lib/bb/fetch/hg.py
+++ b/bitbake/lib/bb/fetch/hg.py
@@ -44,10 +44,7 @@ class Hg(Fetch):
44 return ud.type in ['hg'] 44 return ud.type in ['hg']
45 45
46 def forcefetch(self, url, ud, d): 46 def forcefetch(self, url, ud, d):
47 if 'rev' in ud.parm: 47 revTag = ud.parm.get('rev', 'tip')
48 revTag = ud.parm['rev']
49 else:
50 revTag = "tip"
51 return revTag == "tip" 48 return revTag == "tip"
52 49
53 def localpath(self, url, ud, d): 50 def localpath(self, url, ud, d):
@@ -84,9 +81,7 @@ class Hg(Fetch):
84 81
85 basecmd = data.expand('${FETCHCMD_hg}', d) 82 basecmd = data.expand('${FETCHCMD_hg}', d)
86 83
87 proto = "http" 84 proto = ud.parm.get('proto', 'http')
88 if "proto" in ud.parm:
89 proto = ud.parm["proto"]
90 85
91 host = ud.host 86 host = ud.host
92 if proto == "file": 87 if proto == "file":
diff --git a/bitbake/lib/bb/fetch/osc.py b/bitbake/lib/bb/fetch/osc.py
index a32d0b0a29..26820967a3 100644
--- a/bitbake/lib/bb/fetch/osc.py
+++ b/bitbake/lib/bb/fetch/osc.py
@@ -59,9 +59,7 @@ class Osc(Fetch):
59 59
60 basecmd = data.expand('${FETCHCMD_osc}', d) 60 basecmd = data.expand('${FETCHCMD_osc}', d)
61 61
62 proto = "ocs" 62 proto = ud.parm.get('proto', 'ocs')
63 if "proto" in ud.parm:
64 proto = ud.parm["proto"]
65 63
66 options = [] 64 options = []
67 65
@@ -124,7 +122,7 @@ class Osc(Fetch):
124 Generate a .oscrc to be used for this run. 122 Generate a .oscrc to be used for this run.
125 """ 123 """
126 124
127 config_path = "%s/oscrc" % data.expand('${OSCDIR}', d) 125 config_path = os.path.join(data.expand('${OSCDIR}', d), "oscrc")
128 if (os.path.exists(config_path)): 126 if (os.path.exists(config_path)):
129 os.remove(config_path) 127 os.remove(config_path)
130 128
diff --git a/bitbake/lib/bb/fetch/perforce.py b/bitbake/lib/bb/fetch/perforce.py
index bdd23deef5..222ed7eaaa 100644
--- a/bitbake/lib/bb/fetch/perforce.py
+++ b/bitbake/lib/bb/fetch/perforce.py
@@ -133,10 +133,7 @@ class Perforce(Fetch):
133 else: 133 else:
134 path = depot 134 path = depot
135 135
136 if "module" in parm: 136 module = parm.get('module', os.path.basename(path))
137 module = parm["module"]
138 else:
139 module = os.path.basename(path)
140 137
141 localdata = data.createCopy(d) 138 localdata = data.createCopy(d)
142 data.setVar('OVERRIDES', "p4:%s" % data.getVar('OVERRIDES', localdata), localdata) 139 data.setVar('OVERRIDES', "p4:%s" % data.getVar('OVERRIDES', localdata), localdata)
@@ -206,4 +203,4 @@ class Perforce(Fetch):
206 pass 203 pass
207 raise FetchError(module) 204 raise FetchError(module)
208 # cleanup 205 # cleanup
209 os.system('rm -rf %s' % tmpfile) 206 bb.utils.prunedir(tmpfile)
diff --git a/bitbake/lib/bb/fetch/repo.py b/bitbake/lib/bb/fetch/repo.py
index bafdb2a179..e5132a14fe 100644
--- a/bitbake/lib/bb/fetch/repo.py
+++ b/bitbake/lib/bb/fetch/repo.py
@@ -45,24 +45,11 @@ class Repo(Fetch):
45 "master". 45 "master".
46 """ 46 """
47 47
48 if "protocol" in ud.parm: 48 ud.proto = ud.parm.get('protocol', 'git')
49 ud.proto = ud.parm["protocol"] 49 ud.branch = ud.parm.get('branch', 'master')
50 else: 50 ud.manifest = ud.parm.get('manifest', 'default.xml')
51 ud.proto = "git" 51 if not ud.manifest.endswith('.xml'):
52 52 ud.manifest += '.xml'
53 if "branch" in ud.parm:
54 ud.branch = ud.parm["branch"]
55 else:
56 ud.branch = "master"
57
58 if "manifest" in ud.parm:
59 manifest = ud.parm["manifest"]
60 if manifest.endswith(".xml"):
61 ud.manifest = manifest
62 else:
63 ud.manifest = manifest + ".xml"
64 else:
65 ud.manifest = "default.xml"
66 53
67 ud.localfile = data.expand("repo_%s%s_%s_%s.tar.gz" % (ud.host, ud.path.replace("/", "."), ud.manifest, ud.branch), d) 54 ud.localfile = data.expand("repo_%s%s_%s_%s.tar.gz" % (ud.host, ud.path.replace("/", "."), ud.manifest, ud.branch), d)
68 55
diff --git a/bitbake/lib/bb/fetch/svk.py b/bitbake/lib/bb/fetch/svk.py
index 2754971eba..595a9da255 100644
--- a/bitbake/lib/bb/fetch/svk.py
+++ b/bitbake/lib/bb/fetch/svk.py
@@ -48,18 +48,14 @@ class Svk(Fetch):
48 else: 48 else:
49 ud.module = ud.parm["module"] 49 ud.module = ud.parm["module"]
50 50
51 ud.revision = "" 51 ud.revision = ud.parm.get('rev', "")
52 if 'rev' in ud.parm:
53 ud.revision = ud.parm['rev']
54 52
55 ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d) 53 ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d)
56 54
57 return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) 55 return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
58 56
59 def forcefetch(self, url, ud, d): 57 def forcefetch(self, url, ud, d):
60 if (ud.date == "now"): 58 return ud.date == "now"
61 return True
62 return False
63 59
64 def go(self, loc, ud, d): 60 def go(self, loc, ud, d):
65 """Fetch urls""" 61 """Fetch urls"""
@@ -105,4 +101,4 @@ class Svk(Fetch):
105 pass 101 pass
106 raise FetchError(ud.module) 102 raise FetchError(ud.module)
107 # cleanup 103 # cleanup
108 os.system('rm -rf %s' % tmpfile) 104 bb.utils.prunedir(tmpfile)
diff --git a/bitbake/lib/bb/fetch/svn.py b/bitbake/lib/bb/fetch/svn.py
index c46ace423d..dc35c9d121 100644
--- a/bitbake/lib/bb/fetch/svn.py
+++ b/bitbake/lib/bb/fetch/svn.py
@@ -91,9 +91,7 @@ class Svn(Fetch):
91 91
92 basecmd = data.expand('${FETCHCMD_svn}', d) 92 basecmd = data.expand('${FETCHCMD_svn}', d)
93 93
94 proto = "svn" 94 proto = ud.parm.get('proto', 'svn')
95 if "proto" in ud.parm:
96 proto = ud.parm["proto"]
97 95
98 svn_rsh = None 96 svn_rsh = None
99 if proto == "svn+ssh" and "rsh" in ud.parm: 97 if proto == "svn+ssh" and "rsh" in ud.parm: