diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-04 10:26:21 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-07 09:06:36 +0000 |
commit | d08397ba4d1331993300eacbb2f78fcfef19c1cf (patch) | |
tree | 374d8aa46a69fbae08d2b3e8e7456a5c61005e4c /bitbake/lib/bb/fetch2/perforce.py | |
parent | f6eefb3ca3bb2a5ea0ec1364bdb0bc41ae58c815 (diff) | |
download | openembedded-core-d08397ba4d1331993300eacbb2f78fcfef19c1cf.tar.gz openembedded-core-d08397ba4d1331993300eacbb2f78fcfef19c1cf.tar.bz2 openembedded-core-d08397ba4d1331993300eacbb2f78fcfef19c1cf.zip |
bitbake/fetch2: Rewrite and improve exception handling, reusing core functions for common operations where possible
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/perforce.py')
-rw-r--r-- | bitbake/lib/bb/fetch2/perforce.py | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/bitbake/lib/bb/fetch2/perforce.py b/bitbake/lib/bb/fetch2/perforce.py index 5c128b3fde..e98440f59f 100644 --- a/bitbake/lib/bb/fetch2/perforce.py +++ b/bitbake/lib/bb/fetch2/perforce.py @@ -156,8 +156,7 @@ class Perforce(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(module) + raise FetchError("Fetch: unable to create temporary directory.. make sure 'mktemp' is in the PATH.", loc) if "label" in parm: depot = "%s@%s" % (depot, parm["label"]) @@ -171,8 +170,7 @@ class Perforce(Fetch): p4file = os.popen("%s%s files %s" % (p4cmd, p4opt, depot)) if not p4file: - logger.error("Fetch: unable to get the P4 files from %s", depot) - raise FetchError(module) + raise FetchError("Fetch: unable to get the P4 files from %s" % depot, loc) count = 0 @@ -189,15 +187,9 @@ class Perforce(Fetch): count = count + 1 if count == 0: - logger.error("Fetch: No files gathered from the P4 fetch") - raise FetchError(module) - - myret = os.system("tar -czf %s %s" % (ud.localpath, module)) - if myret != 0: - try: - os.unlink(ud.localpath) - except OSError: - pass - raise FetchError(module) + logger.error() + raise FetchError("Fetch: No files gathered from the P4 fetch", loc) + + runfetchcmd("tar -czf %s %s" % (ud.localpath, module), d, cleanup = [ud.localpath]) # cleanup bb.utils.prunedir(tmpfile) |