mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-23 00:08:50 -05:00
Fix use of relative paths for packages in repo-add
Move checksum and pgpsig calcluation before changing into the tmpdir, otherwise we can't find the files if a relative path was used. Signed-off-by: Ray Kohler <ataraxia937@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
a8b22e16ef
commit
cfa2eebdaf
@ -234,8 +234,9 @@ db_write_entry()
|
|||||||
{
|
{
|
||||||
# blank out all variables
|
# blank out all variables
|
||||||
local pkgfile="$1"
|
local pkgfile="$1"
|
||||||
local pkgname pkgver pkgdesc csize size md5sum url arch builddate packager \
|
local pkgname pkgver pkgdesc csize size url arch builddate packager \
|
||||||
_groups _licenses _replaces _depends _conflicts _provides _optdepends
|
_groups _licenses _replaces _depends _conflicts _provides _optdepends \
|
||||||
|
md5sum sha256sum pgpsig
|
||||||
|
|
||||||
local OLDIFS="$IFS"
|
local OLDIFS="$IFS"
|
||||||
# IFS (field separator) is only the newline character
|
# IFS (field separator) is only the newline character
|
||||||
@ -265,6 +266,18 @@ db_write_entry()
|
|||||||
|
|
||||||
csize=$(@SIZECMD@ "$pkgfile")
|
csize=$(@SIZECMD@ "$pkgfile")
|
||||||
|
|
||||||
|
# compute checksums
|
||||||
|
msg2 "$(gettext "Computing checksums...")"
|
||||||
|
md5sum="$(openssl dgst -md5 "$pkgfile")"
|
||||||
|
md5sum="${md5sum##* }"
|
||||||
|
sha256sum="$(openssl dgst -sha256 "$pkgfile")"
|
||||||
|
sha256sum="${sha256sum##* }"
|
||||||
|
|
||||||
|
# compute base64'd PGP signature
|
||||||
|
if [[ -f "$pkgfile.sig" ]]; then
|
||||||
|
pgpsig=$(openssl base64 -in "$pkgfile.sig" | tr -d '\n')
|
||||||
|
fi
|
||||||
|
|
||||||
# ensure $pkgname and $pkgver variables were found
|
# ensure $pkgname and $pkgver variables were found
|
||||||
if [[ -z $pkgname || -z $pkgver ]]; then
|
if [[ -z $pkgname || -z $pkgver ]]; then
|
||||||
error "$(gettext "Invalid package file '%s'.")" "$pkgfile"
|
error "$(gettext "Invalid package file '%s'.")" "$pkgfile"
|
||||||
@ -284,13 +297,6 @@ db_write_entry()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# compute checksums
|
|
||||||
msg2 "$(gettext "Computing checksums...")"
|
|
||||||
md5sum="$(openssl dgst -md5 "$pkgfile")"
|
|
||||||
md5sum="${md5sum##* }"
|
|
||||||
sha256sum="$(openssl dgst -sha256 "$pkgfile")"
|
|
||||||
sha256sum="${sha256sum##* }"
|
|
||||||
|
|
||||||
# remove an existing entry if it exists, ignore failures
|
# remove an existing entry if it exists, ignore failures
|
||||||
db_remove_entry "$pkgname"
|
db_remove_entry "$pkgname"
|
||||||
|
|
||||||
@ -316,11 +322,8 @@ db_write_entry()
|
|||||||
echo -e "%MD5SUM%\n$md5sum\n" >>desc
|
echo -e "%MD5SUM%\n$md5sum\n" >>desc
|
||||||
echo -e "%SHA256SUM%\n$sha256sum\n" >>desc
|
echo -e "%SHA256SUM%\n$sha256sum\n" >>desc
|
||||||
|
|
||||||
# add base64'd PGP signature
|
# add PGP sig
|
||||||
if [[ -f $startdir/$pkgfile.sig ]]; then
|
[[ -n $pgpsig ]] && echo -e "%PGPSIG%\n$pgpsig\n" >>desc
|
||||||
pgpsig=$(openssl base64 -in "$startdir/$pkgfile.sig" | tr -d '\n')
|
|
||||||
echo -e "%PGPSIG%\n$pgpsig\n" >>desc
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ -n $url ]] && echo -e "%URL%\n$url\n" >>desc
|
[[ -n $url ]] && echo -e "%URL%\n$url\n" >>desc
|
||||||
write_list_entry "LICENSE" "$_licenses" "desc"
|
write_list_entry "LICENSE" "$_licenses" "desc"
|
||||||
|
Loading…
Reference in New Issue
Block a user