"""
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
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
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:
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":
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):
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":
basecmd = data.expand('${FETCHCMD_osc}', d)
- proto = "ocs"
- if "proto" in ud.parm:
- proto = ud.parm["proto"]
+ proto = ud.parm.get('proto', 'ocs')
options = []
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)
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)
pass
raise FetchError(module)
# cleanup
- os.system('rm -rf %s' % tmpfile)
+ bb.utils.prunedir(tmpfile)
"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)
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"""
pass
raise FetchError(ud.module)
# cleanup
- os.system('rm -rf %s' % tmpfile)
+ bb.utils.prunedir(tmpfile)
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: