summaryrefslogtreecommitdiffstats
path: root/bitbake/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-07 09:06:36 +0000
commitd08397ba4d1331993300eacbb2f78fcfef19c1cf (patch)
tree374d8aa46a69fbae08d2b3e8e7456a5c61005e4c /bitbake/lib/bb/fetch2/cvs.py
parentf6eefb3ca3bb2a5ea0ec1364bdb0bc41ae58c815 (diff)
downloadast2050-yocto-poky-d08397ba4d1331993300eacbb2f78fcfef19c1cf.zip
ast2050-yocto-poky-d08397ba4d1331993300eacbb2f78fcfef19c1cf.tar.gz
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/cvs.py')
-rw-r--r--bitbake/lib/bb/fetch2/cvs.py30
1 files changed, 12 insertions, 18 deletions
diff --git a/bitbake/lib/bb/fetch2/cvs.py b/bitbake/lib/bb/fetch2/cvs.py
index 907812d..d792328 100644
--- a/bitbake/lib/bb/fetch2/cvs.py
+++ b/bitbake/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])
+
OpenPOWER on IntegriCloud