diff options
author | Nicolas Vigier <boklm@mageia.org> | 2011-05-16 21:48:07 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2011-05-16 21:48:07 +0000 |
commit | 39362bee2228f6e1ebff990644a41229518e4c0c (patch) | |
tree | 62d2be22660a1e39e1a4d046828b26f6ce0f69e6 /MgaRepo/rpmutil.py | |
parent | ed3190ffdf8b74b5ee2fce18f079784496469816 (diff) | |
download | mgarepo-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)
Diffstat (limited to 'MgaRepo/rpmutil.py')
-rw-r--r-- | MgaRepo/rpmutil.py | 7 |
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: |