aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2011-05-16 21:48:07 +0000
committerNicolas Vigier <boklm@mageia.org>2011-05-16 21:48:07 +0000
commit39362bee2228f6e1ebff990644a41229518e4c0c (patch)
tree62d2be22660a1e39e1a4d046828b26f6ce0f69e6
parented3190ffdf8b74b5ee2fce18f079784496469816 (diff)
downloadmgarepo-39362bee2228f6e1ebff990644a41229518e4c0c.tar
mgarepo-39362bee2228f6e1ebff990644a41229518e4c0c.tar.gz
mgarepo-39362bee2228f6e1ebff990644a41229518e4c0c.tar.bz2
mgarepo-39362bee2228f6e1ebff990644a41229518e4c0c.tar.xz
mgarepo-39362bee2228f6e1ebff990644a41229518e4c0c.zip
do not leave empty file when download failed (bug #374)
-rw-r--r--MgaRepo/rpmutil.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/MgaRepo/rpmutil.py b/MgaRepo/rpmutil.py
index fce2e1c..7f3ebd7 100644
--- a/MgaRepo/rpmutil.py
+++ b/MgaRepo/rpmutil.py
@@ -552,7 +552,12 @@ def sync(dryrun=False, commit=False, download=False):
except KeyError, e:
raise Error, "invalid variable %r in download-command "\
"configuration option" % e
- execcmd(cmd, show=True)
+ try:
+ status, output = execcmd(cmd, show=True)
+ except Error, e:
+ os.unlink(sourcepath)
+ raise Error, "Could not download file %s\n" % url
+
if os.path.isfile(sourcepath):
toadd.append(sourcepath)
else: