1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-11-16 22:35:09 -05:00

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

View File

@ -334,15 +334,7 @@ db_write_entry() {
return 0; return 0;
fi fi
else else
if (( DELTA )); then if (( DELTA || RMEXISTING )); 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
pkgentry=$(find_pkgentry "$pkgname") pkgentry=$(find_pkgentry "$pkgname")
if [[ -n $pkgentry ]]; then if [[ -n $pkgentry ]]; then
local oldfilename="$(sed -n '/^%FILENAME%$/ {n;p;q;}' "$pkgentry/desc")" local oldfilename="$(sed -n '/^%FILENAME%$/ {n;p;q;}' "$pkgentry/desc")"