emerge-delta-webrsync: rm empty file, bug #476416
authorZac Medico <zmedico@gentoo.org>
Wed, 10 Jul 2013 19:41:13 +0000 (12:41 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 10 Jul 2013 19:41:13 +0000 (12:41 -0700)
bin/emerge-webrsync
misc/emerge-delta-webrsync

index 0a943030d74b36b90cdd763daad467a890e64174..cd8653788878d38e072af67d87141933b0f7d912 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # Author: Karl Trygve Kalleberg <karltk@gentoo.org>
 # Rewritten from the old, Perl-based emerge-webrsync script
@@ -134,8 +134,13 @@ fetch_file() {
 
        __vecho "Fetching file ${FILE} ..."
        # already set DISTDIR=
-       eval "${FETCHCOMMAND}" ${opts}
-       [ -s "${DISTDIR}/${FILE}" ]
+       eval "${FETCHCOMMAND} ${opts}"
+       if [[ $? -eq 0 && -s ${DISTDIR}/${FILE} ]] ; then
+               return 0
+       else
+               rm -f "${DISTDIR}/${FILE}"
+               return 1
+       fi
 }
 
 check_file_digest() {
index 01d7f4a65344ea902699644512fb7b2f11b8ce4b..f7f82f81716278b2dcee38437dabf363526910b0 100755 (executable)
@@ -228,7 +228,12 @@ fetch_file() {
        __vecho "Fetching file ${FILE} ..."
        # already set DISTDIR=
        eval "${FETCHCOMMAND} ${opts}"
-       [ -s "${DISTDIR}/${FILE}" ]
+       if [[ $? -eq 0 && -s ${DISTDIR}/${FILE} ]] ; then
+               return 0
+       else
+               rm -f "${DISTDIR}/${FILE}"
+               return 1
+       fi
 }
 
 check_file_digest() {