summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/hg.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/hg.py
parentf6eefb3ca3bb2a5ea0ec1364bdb0bc41ae58c815 (diff)
downloadpoky-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/hg.py')
-rw-r--r--bitbake/lib/bb/fetch2/hg.py14
1 files changed, 3 insertions, 11 deletions
diff --git a/bitbake/lib/bb/fetch2/hg.py b/bitbake/lib/bb/fetch2/hg.py
index 6929d971f5..ffede8cf5a 100644
--- a/bitbake/lib/bb/fetch2/hg.py
+++ b/bitbake/lib/bb/fetch2/hg.py
@@ -48,7 +48,7 @@ class Hg(Fetch):
48 init hg specific variable within url data 48 init hg specific variable within url data
49 """ 49 """
50 if not "module" in ud.parm: 50 if not "module" in ud.parm:
51 raise MissingParameterError("hg method needs a 'module' parameter") 51 raise MissingParameterError('module', ud.url)
52 52
53 ud.module = ud.parm["module"] 53 ud.module = ud.parm["module"]
54 54
@@ -105,7 +105,7 @@ class Hg(Fetch):
105 elif command is "update": 105 elif command is "update":
106 cmd = "%s update -C %s" % (basecmd, " ".join(options)) 106 cmd = "%s update -C %s" % (basecmd, " ".join(options))
107 else: 107 else:
108 raise FetchError("Invalid hg command %s" % command) 108 raise FetchError("Invalid hg command %s" % command, ud.url)
109 109
110 return cmd 110 return cmd
111 111
@@ -147,15 +147,7 @@ class Hg(Fetch):
147 tar_flags = "--exclude '.hg' --exclude '.hgrags'" 147 tar_flags = "--exclude '.hg' --exclude '.hgrags'"
148 148
149 os.chdir(ud.pkgdir) 149 os.chdir(ud.pkgdir)
150 try: 150 runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, ud.module), d, cleanup = [ud.localpath])
151 runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, ud.module), d)
152 except:
153 t, v, tb = sys.exc_info()
154 try:
155 os.unlink(ud.localpath)
156 except OSError:
157 pass
158 raise t, v, tb
159 151
160 def supports_srcrev(self): 152 def supports_srcrev(self):
161 return True 153 return True