[pacman-dev] [PATCH] Fix use of relative paths for packages in repo-add
Dan McGee
dpmcgee at gmail.com
Thu Mar 24 18:16:09 EDT 2011
On Thu, Mar 24, 2011 at 5:05 PM, Ray Kohler <ataraxia937 at gmail.com> wrote:
> Move checksum and pgpsig calcluation before changing into the
> tmpdir, otherwise we can't find the files if a relative path
> was used.
Thanks! I made a few small touchups to the local var declaration to
ensure sha256sum and pgpsig made it into there as well.
> Signed-off-by: Ray Kohler <ataraxia937 at gmail.com>
> ---
> scripts/repo-add.sh.in | 26 ++++++++++++++------------
> 1 files changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
> index 59e98cf..4e7e00b 100644
> --- a/scripts/repo-add.sh.in
> +++ b/scripts/repo-add.sh.in
> @@ -265,6 +265,18 @@ db_write_entry()
>
> 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
> if [[ -z $pkgname || -z $pkgver ]]; then
> error "$(gettext "Invalid package file '%s'.")" "$pkgfile"
> @@ -284,13 +296,6 @@ db_write_entry()
> 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
> db_remove_entry "$pkgname"
>
> @@ -316,11 +321,8 @@ db_write_entry()
> echo -e "%MD5SUM%\n$md5sum\n" >>desc
> echo -e "%SHA256SUM%\n$sha256sum\n" >>desc
>
> - # add base64'd PGP signature
> - if [[ -f $startdir/$pkgfile.sig ]]; then
> - pgpsig=$(openssl base64 -in "$startdir/$pkgfile.sig" | tr -d '\n')
> - echo -e "%PGPSIG%\n$pgpsig\n" >>desc
> - fi
> + # add PGP sig
> + [[ -n $pgpsig ]] && echo -e "%PGPSIG%\n$pgpsig\n" >>desc
>
> [[ -n $url ]] && echo -e "%URL%\n$url\n" >>desc
> write_list_entry "LICENSE" "$_licenses" "desc"
> --
> 1.7.4.1
>
>
>
More information about the pacman-dev
mailing list