[pacman-dev] [PATCH 5/7] repo-add: remove duplication finding old package details

Allan McRae allan at archlinux.org
Sun Mar 15 10:49:05 UTC 2015


The information needed to create a delta entry and remove the old package from
the filesystem are the same.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 scripts/repo-add.sh.in | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index c16295b..7512136 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -334,15 +334,7 @@ db_write_entry() {
 			return 0;
 		fi
 	else
-		if (( DELTA )); then
-			pkgentry=$(find_pkgentry "$pkgname")
-			if [[ -n $pkgentry ]]; then
-				local oldfilename=$(grep -A1 FILENAME "$pkgentry/desc" | tail -n1)
-				local oldfile="$(dirname "$1")/$oldfilename"
-			fi
-		fi
-		if (( RMEXISTING )); then
-			# gather information needed to remove old file
+		if (( DELTA || RMEXISTING )); then
 			pkgentry=$(find_pkgentry "$pkgname")
 			if [[ -n $pkgentry ]]; then
 				local oldfilename="$(sed -n '/^%FILENAME%$/ {n;p;q;}' "$pkgentry/desc")"
-- 
2.3.3


More information about the pacman-dev mailing list