diff options
author | 2011-02-04 10:26:21 +0000 | |
---|---|---|
committer | 2011-02-10 23:37:00 +0000 | |
commit | d0ffe023c4a642c8d1c188ec499870e7a7113d7d (patch) | |
tree | 5d22edd49e9e733643c73959bbbebee55d3df089 /lib/bb/fetch2/svk.py | |
parent | e448fa0432d12cc54f0b540fe2cacff37135c9ed (diff) | |
download | bitbake-d0ffe023c4a642c8d1c188ec499870e7a7113d7d.tar.gz |
bitbake/fetch2: Rewrite and improve exception handling, reusing core functions for common operations where possible
(From Poky rev: d08397ba4d1331993300eacbb2f78fcfef19c1cf)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/fetch2/svk.py')
-rw-r--r-- | lib/bb/fetch2/svk.py | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/lib/bb/fetch2/svk.py b/lib/bb/fetch2/svk.py index 95206f52f..8220bf3dc 100644 --- a/lib/bb/fetch2/svk.py +++ b/lib/bb/fetch2/svk.py @@ -45,7 +45,7 @@ class Svk(Fetch): def urldata_init(self, ud, d): if not "module" in ud.parm: - raise MissingParameterError("svk method needs a 'module' parameter") + raise MissingParameterError('module', ud.url) else: ud.module = ud.parm["module"] @@ -75,29 +75,18 @@ class Svk(Fetch): tmppipe = os.popen(data.getVar('MKTEMPDIRCMD', localdata, 1) or "false") tmpfile = tmppipe.readline().strip() if not tmpfile: - logger.error("Fetch: unable to create temporary directory.. make sure 'mktemp' is in the PATH.") - raise FetchError(ud.module) + logger.error() + raise FetchError("Fetch: unable to create temporary directory.. make sure 'mktemp' is in the PATH.", loc) # check out sources there os.chdir(tmpfile) logger.info("Fetch " + loc) logger.debug(1, "Running %s", svkcmd) - myret = os.system(svkcmd) - if myret != 0: - try: - os.rmdir(tmpfile) - except OSError: - pass - raise FetchError(ud.module) + runfetchcmd(svkcmd, d, cleanup = [tmpfile]) os.chdir(os.path.join(tmpfile, os.path.dirname(ud.module))) # tar them up to a defined filename - myret = os.system("tar -czf %s %s" % (ud.localpath, os.path.basename(ud.module))) - if myret != 0: - try: - os.unlink(ud.localpath) - except OSError: - pass - raise FetchError(ud.module) + runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.basename(ud.module)), d, cleanup = [ud.localpath]) + # cleanup bb.utils.prunedir(tmpfile) |