bitbake/fetch2: Rewrite and improve exception handling, reusing core functions for common operations where possible

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2011-02-04 10:26:21 +00:00
parent f6eefb3ca3
commit d08397ba4d
11 changed files with 118 additions and 142 deletions

View File

@@ -59,7 +59,7 @@ class Git(Fetch):
branches = ud.parm.get("branch", "master").split(',')
if len(branches) != len(ud.names):
raise bb.fetch2.ParameterError("SRC_URI (%) name and branch number mismatch" % ud.url)
raise bb.fetch2.ParameterError("The number of name and branch parameters is not balanced", ud.url)
ud.branches = {}
for name in ud.names:
branch = branches[ud.names.index(name)]
@@ -194,7 +194,7 @@ class Git(Fetch):
cmd = "%s ls-remote %s://%s%s%s %s" % (basecmd, ud.proto, username, ud.host, ud.path, ud.branches[name])
output = runfetchcmd(cmd, d, True)
if not output:
raise bb.fetch2.FetchError("Fetch command %s gave empty output\n" % (cmd))
raise bb.fetch2.FetchError("The command %s gave empty output unexpectedly" % cmd, url)
return output.split()[0]
def _build_revision(self, url, ud, d, name):