From f69d9b4475a0ca70b3e5a38ba012181d87ccc551 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sat, 9 Dec 2023 11:03:15 +1000 Subject: [PATCH] makepkg: only check software once Move the checks for software and gpg signing ability to after the fakeroot section so that it is only executed once. This also fixes gpg (lack of) interaction under fakeroot. Fixes #69 Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index fce01d0b..510c98d7 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1183,9 +1183,6 @@ if have_function pkgver; then PKGVERFUNC=1 fi -# check we have the software required to process the PKGBUILD -check_software || exit $E_MISSING_MAKEPKG_DEPS - if (( ${#pkgname[@]} > 1 )) || have_function package_${pkgname}; then SPLITPKG=1 fi @@ -1216,19 +1213,6 @@ if have_function package; then PKGFUNC=1 fi -# check if gpg signature is to be created and if signing key is valid -if { [[ -z $SIGNPKG ]] && check_buildenv "sign" "y"; } || [[ $SIGNPKG == 'y' ]]; then - SIGNPKG='y' - if ! gpg --list-secret-key ${GPGKEY:+"$GPGKEY"} &>/dev/null; then - if [[ ! -z $GPGKEY ]]; then - error "$(gettext "The key %s does not exist in your keyring.")" "${GPGKEY}" - else - error "$(gettext "There is no key in your keyring.")" - fi - exit $E_PRETTY_BAD_PRIVACY - fi -fi - if (( PACKAGELIST )); then print_all_package_names exit $E_OK @@ -1266,6 +1250,22 @@ if (( INFAKEROOT )); then exit $E_OK fi +# check we have the software required to process the PKGBUILD +check_software || exit $E_MISSING_MAKEPKG_DEPS + +# check if gpg signature is to be created and if signing key is valid +if { [[ -z $SIGNPKG ]] && check_buildenv "sign" "y"; } || [[ $SIGNPKG == 'y' ]]; then + SIGNPKG='y' + if ! gpg --list-secret-key ${GPGKEY:+"$GPGKEY"} &>/dev/null; then + if [[ ! -z $GPGKEY ]]; then + error "$(gettext "The key %s does not exist in your keyring.")" "${GPGKEY}" + else + error "$(gettext "There is no key in your keyring.")" + fi + exit $E_PRETTY_BAD_PRIVACY + fi +fi + msg "$(gettext "Making package: %s")" "$pkgbase $basever ($(date +%c))" # if we are creating a source-only package, go no further