repo-add: reorganize output messages for clarity

The use of warning once we had already started adding a package was
confusing as it broke the standard indent pattern. It was especially bad
if adding multiple packages as it wasn't clear what sub-messages applied
to which package being added. This should be an output change only from:

    ==> Adding package '/tmp/sync/netcfg-2.6.7-1-any.pkg.tar.xz'
      -> Computing checksums...
      -> Adding package signature...
    ==> WARNING: An entry for 'netcfg-2.6.7-1' already existed
      -> Removing existing entry 'netcfg-2.6.7-1'...
      -> Creating 'desc' db entry...
      -> Creating 'depends' db entry...

to:

    ==> Adding package '/tmp/sync/netcfg-2.6.7-1-any.pkg.tar.xz'
    ==> WARNING: An entry for 'netcfg-2.6.7-1' already existed
      -> Computing checksums...
      -> Adding package signature...
      -> Removing existing entry 'netcfg-2.6.7-1'...
      -> Creating 'desc' db entry...
      -> Creating 'depends' db entry...

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2011-08-15 08:05:59 -05:00
parent 11f4a7a48e
commit 11b9bc443d
1 changed files with 19 additions and 19 deletions

View File

@ -266,6 +266,24 @@ db_write_entry() {
esac
done< <(bsdtar -xOqf "$pkgfile" .PKGINFO)
# ensure $pkgname and $pkgver variables were found
if [[ -z $pkgname || -z $pkgver ]]; then
error "$(gettext "Invalid package file '%s'.")" "$pkgfile"
return 1
fi
if [[ -d $tmpdir/tree/$pkgname-$pkgver ]]; then
warning "$(gettext "An entry for '%s' already existed")" "$pkgname-$pkgver"
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
fi
csize=$(@SIZECMD@ "$pkgfile")
# compute checksums
@ -281,29 +299,11 @@ db_write_entry() {
pgpsig=$(openssl base64 -in "$pkgfile.sig" | tr -d '\n')
fi
# ensure $pkgname and $pkgver variables were found
if [[ -z $pkgname || -z $pkgver ]]; then
error "$(gettext "Invalid package file '%s'.")" "$pkgfile"
return 1
fi
pushd "$tmpdir/tree" >/dev/null
if [[ -d $pkgname-$pkgver ]]; then
warning "$(gettext "An entry for '%s' already existed")" "$pkgname-$pkgver"
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
fi
# remove an existing entry if it exists, ignore failures
db_remove_entry "$pkgname"
# create package directory
pushd "$tmpdir/tree" >/dev/null
mkdir "$pkgname-$pkgver"
pushd "$pkgname-$pkgver" >/dev/null