repo-add: remove duplication finding old package details

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@archlinux.org>
This commit is contained in:
Allan McRae 2015-03-15 17:49:40 +10:00
parent 6aef45ee1a
commit 30c9dbcdeb
1 changed files with 1 additions and 9 deletions

View File

@ -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")"