[pacman-dev] [PATCH] repo-remove: remove deltas file is it becomes empty

Florian Pritz bluewind at xinu.at
Fri Apr 6 12:18:45 EDT 2012


Signed-off-by: Florian Pritz <bluewind at xinu.at>
---
 scripts/repo-add.sh.in |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index 043a0b8..147da69 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -176,6 +176,11 @@ db_remove_delta() {
 	if grep -q "$filename" $deltas; then
 		sed -i.backup "/$filename/d" $deltas && rm -f $deltas.backup
 		msg2 "$(gettext "Removing existing entry '%s'...")" "$filename"
+		# empty deltas file contains only "%DELTAS%"
+		if [[ $(wc -l "$deltas" | cut -d\  -f1) = 1 ]]; then
+			msg2 "$(gettext "Removing empty deltas file ...")"
+			rm $deltas
+		fi
 		return 0
 	fi
 
-- 
1.7.9.6


More information about the pacman-dev mailing list