diff options
-rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/bzr.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/cvs.py | 18 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/hg.py | 9 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/osc.py | 6 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/perforce.py | 7 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/repo.py | 23 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/svk.py | 10 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/svn.py | 4 |
9 files changed, 21 insertions, 64 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index 18775301a..0562d72a2 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py @@ -733,9 +733,7 @@ class Fetch(object): """ Verify the md5sum we wanted with the one we got """ - wanted_sum = None - if 'md5sum' in ud.parm: - wanted_sum = ud.parm['md5sum'] + wanted_sum = ud.parm.get('md5sum') if not wanted_sum: return True diff --git a/bitbake/lib/bb/fetch/bzr.py b/bitbake/lib/bb/fetch/bzr.py index 92fff741a..7d377a15d 100644 --- a/bitbake/lib/bb/fetch/bzr.py +++ b/bitbake/lib/bb/fetch/bzr.py @@ -61,9 +61,7 @@ class Bzr(Fetch): basecmd = data.expand('${FETCHCMD_bzr}', d) - proto = "http" - if "proto" in ud.parm: - proto = ud.parm["proto"] + proto = ud.parm.get('proto', 'http') bzrroot = ud.host + ud.path diff --git a/bitbake/lib/bb/fetch/cvs.py b/bitbake/lib/bb/fetch/cvs.py index 42d71ba9f..bd919e234 100644 --- a/bitbake/lib/bb/fetch/cvs.py +++ b/bitbake/lib/bb/fetch/cvs.py @@ -47,9 +47,7 @@ class Cvs(Fetch): raise MissingParameterError("cvs method needs a 'module' parameter") ud.module = ud.parm["module"] - ud.tag = "" - if 'tag' in ud.parm: - ud.tag = ud.parm['tag'] + ud.tag = ud.parm.get('tag', "") # Override the default date in certain cases if 'date' in ud.parm: @@ -76,17 +74,9 @@ class Cvs(Fetch): def go(self, loc, ud, d): - method = "pserver" - if "method" in ud.parm: - method = ud.parm["method"] - - localdir = ud.module - if "localdir" in ud.parm: - localdir = ud.parm["localdir"] - - cvs_port = "" - if "port" in ud.parm: - cvs_port = ud.parm["port"] + method = ud.parm.get('method', 'pserver') + localdir = ud.parm.get('localdir', ud.module) + cvs_port = ud.parm.get('port', '') cvs_rsh = None if method == "ext": diff --git a/bitbake/lib/bb/fetch/hg.py b/bitbake/lib/bb/fetch/hg.py index 0f8d9b832..6bc261ae6 100644 --- a/bitbake/lib/bb/fetch/hg.py +++ b/bitbake/lib/bb/fetch/hg.py @@ -44,10 +44,7 @@ class Hg(Fetch): return ud.type in ['hg'] def forcefetch(self, url, ud, d): - if 'rev' in ud.parm: - revTag = ud.parm['rev'] - else: - revTag = "tip" + revTag = ud.parm.get('rev', 'tip') return revTag == "tip" def localpath(self, url, ud, d): @@ -84,9 +81,7 @@ class Hg(Fetch): basecmd = data.expand('${FETCHCMD_hg}', d) - proto = "http" - if "proto" in ud.parm: - proto = ud.parm["proto"] + proto = ud.parm.get('proto', 'http') host = ud.host if proto == "file": diff --git a/bitbake/lib/bb/fetch/osc.py b/bitbake/lib/bb/fetch/osc.py index a32d0b0a2..26820967a 100644 --- a/bitbake/lib/bb/fetch/osc.py +++ b/bitbake/lib/bb/fetch/osc.py @@ -59,9 +59,7 @@ class Osc(Fetch): basecmd = data.expand('${FETCHCMD_osc}', d) - proto = "ocs" - if "proto" in ud.parm: - proto = ud.parm["proto"] + proto = ud.parm.get('proto', 'ocs') options = [] @@ -124,7 +122,7 @@ class Osc(Fetch): Generate a .oscrc to be used for this run. """ - config_path = "%s/oscrc" % data.expand('${OSCDIR}', d) + config_path = os.path.join(data.expand('${OSCDIR}', d), "oscrc") if (os.path.exists(config_path)): os.remove(config_path) diff --git a/bitbake/lib/bb/fetch/perforce.py b/bitbake/lib/bb/fetch/perforce.py index bdd23deef..222ed7eaa 100644 --- a/bitbake/lib/bb/fetch/perforce.py +++ b/bitbake/lib/bb/fetch/perforce.py @@ -133,10 +133,7 @@ class Perforce(Fetch): else: path = depot - if "module" in parm: - module = parm["module"] - else: - module = os.path.basename(path) + module = parm.get('module', os.path.basename(path)) localdata = data.createCopy(d) data.setVar('OVERRIDES', "p4:%s" % data.getVar('OVERRIDES', localdata), localdata) @@ -206,4 +203,4 @@ class Perforce(Fetch): pass raise FetchError(module) # cleanup - os.system('rm -rf %s' % tmpfile) + bb.utils.prunedir(tmpfile) diff --git a/bitbake/lib/bb/fetch/repo.py b/bitbake/lib/bb/fetch/repo.py index bafdb2a17..e5132a14f 100644 --- a/bitbake/lib/bb/fetch/repo.py +++ b/bitbake/lib/bb/fetch/repo.py @@ -45,24 +45,11 @@ class Repo(Fetch): "master". """ - if "protocol" in ud.parm: - ud.proto = ud.parm["protocol"] - else: - ud.proto = "git" - - if "branch" in ud.parm: - ud.branch = ud.parm["branch"] - else: - ud.branch = "master" - - if "manifest" in ud.parm: - manifest = ud.parm["manifest"] - if manifest.endswith(".xml"): - ud.manifest = manifest - else: - ud.manifest = manifest + ".xml" - else: - ud.manifest = "default.xml" + ud.proto = ud.parm.get('protocol', 'git') + ud.branch = ud.parm.get('branch', 'master') + ud.manifest = ud.parm.get('manifest', 'default.xml') + if not ud.manifest.endswith('.xml'): + ud.manifest += '.xml' ud.localfile = data.expand("repo_%s%s_%s_%s.tar.gz" % (ud.host, ud.path.replace("/", "."), ud.manifest, ud.branch), d) diff --git a/bitbake/lib/bb/fetch/svk.py b/bitbake/lib/bb/fetch/svk.py index 2754971eb..595a9da25 100644 --- a/bitbake/lib/bb/fetch/svk.py +++ b/bitbake/lib/bb/fetch/svk.py @@ -48,18 +48,14 @@ class Svk(Fetch): else: ud.module = ud.parm["module"] - ud.revision = "" - if 'rev' in ud.parm: - ud.revision = ud.parm['rev'] + ud.revision = ud.parm.get('rev', "") ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d) return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) def forcefetch(self, url, ud, d): - if (ud.date == "now"): - return True - return False + return ud.date == "now" def go(self, loc, ud, d): """Fetch urls""" @@ -105,4 +101,4 @@ class Svk(Fetch): pass raise FetchError(ud.module) # cleanup - os.system('rm -rf %s' % tmpfile) + bb.utils.prunedir(tmpfile) diff --git a/bitbake/lib/bb/fetch/svn.py b/bitbake/lib/bb/fetch/svn.py index c46ace423..dc35c9d12 100644 --- a/bitbake/lib/bb/fetch/svn.py +++ b/bitbake/lib/bb/fetch/svn.py @@ -91,9 +91,7 @@ class Svn(Fetch): basecmd = data.expand('${FETCHCMD_svn}', d) - proto = "svn" - if "proto" in ud.parm: - proto = ud.parm["proto"] + proto = ud.parm.get('proto', 'svn') svn_rsh = None if proto == "svn+ssh" and "rsh" in ud.parm: |