summaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch2/cvs.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-04 10:26:21 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-10 23:37:00 +0000
commitd0ffe023c4a642c8d1c188ec499870e7a7113d7d (patch)
tree5d22edd49e9e733643c73959bbbebee55d3df089 /lib/bb/fetch2/cvs.py
parente448fa0432d12cc54f0b540fe2cacff37135c9ed (diff)
downloadbitbake-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/cvs.py')
-rw-r--r--lib/bb/fetch2/cvs.py30
1 files changed, 12 insertions, 18 deletions
diff --git a/lib/bb/fetch2/cvs.py b/lib/bb/fetch2/cvs.py
index 907812d71..d792328c2 100644
--- a/lib/bb/fetch2/cvs.py
+++ b/lib/bb/fetch2/cvs.py
@@ -44,7 +44,7 @@ class Cvs(Fetch):
def urldata_init(self, ud, d):
if not "module" in ud.parm:
- raise MissingParameterError("cvs method needs a 'module' parameter")
+ raise MissingParameterError("module", ud.url)
ud.module = ud.parm["module"]
ud.tag = ud.parm.get('tag', "")
@@ -132,7 +132,7 @@ class Cvs(Fetch):
bb.fetch2.check_network_access(d, cvsupdatecmd)
# update sources there
os.chdir(moddir)
- myret = os.system(cvsupdatecmd)
+ cmd = cvsupdatecmd
else:
logger.info("Fetch " + loc)
# check out sources there
@@ -140,14 +140,12 @@ class Cvs(Fetch):
os.chdir(pkgdir)
logger.debug(1, "Running %s", cvscmd)
bb.fetch2.check_network_access(d, cvscmd)
- myret = os.system(cvscmd)
+ cmd = cvscmd
- if myret != 0 or not os.access(moddir, os.R_OK):
- try:
- os.rmdir(moddir)
- except OSError:
- pass
- raise FetchError(ud.module)
+ runfetchcmd(cmd, d, cleanup = [moddir])
+
+ if not os.access(moddir, os.R_OK):
+ raise FetchError("Directory %s was not readable despite sucessful fetch?!" % moddir, ud.url)
scmdata = ud.parm.get("scmdata", "")
if scmdata == "keep":
@@ -158,15 +156,11 @@ class Cvs(Fetch):
# tar them up to a defined filename
if 'fullpath' in ud.parm:
os.chdir(pkgdir)
- myret = os.system("tar %s -czf %s %s" % (tar_flags, ud.localpath, localdir))
+ cmd = "tar %s -czf %s %s" % (tar_flags, ud.localpath, localdir)
else:
os.chdir(moddir)
os.chdir('..')
- myret = os.system("tar %s -czf %s %s" % (tar_flags, ud.localpath, os.path.basename(moddir)))
-
- if myret != 0:
- try:
- os.unlink(ud.localpath)
- except OSError:
- pass
- raise FetchError(ud.module)
+ cmd = "tar %s -czf %s %s" % (tar_flags, ud.localpath, os.path.basename(moddir))
+
+ runfetchcmd(cmd, d, cleanup = [ud.localpath])
+