[pacman-dev] [PATCH 02/10] makepkg: Simplify SPLITPKG check

2018-05-31 Thread Jan Alexander Steffens (heftig)
This causes package_$pkgname() to be preferred over package() in the
non-split case, but the behavior if both functions exist was
undocumented anyway.
---
 scripts/makepkg.sh.in | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index e9080a70..748481e4 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1481,30 +1481,28 @@ fi
 # check we have the software required to process the PKGBUILD
 check_software || exit $E_MISSING_MAKEPKG_DEPS
 
-if (( ${#pkgname[@]} > 1 )); then
+if (( ${#pkgname[@]} > 1 )) || have_function package_${pkgname}; then
SPLITPKG=1
 fi
 
 # test for available PKGBUILD functions
 if have_function prepare; then
# "Hide" prepare() function if not going to be run
if [[ $RUN_PREPARE != "n" ]]; then
PREPAREFUNC=1
fi
 fi
 if have_function build; then
BUILDFUNC=1
 fi
 if have_function check; then
# "Hide" check() function if not going to be run
if [[ $RUN_CHECK = 'y' ]] || { ! check_buildenv "check" "n" && [[ 
$RUN_CHECK != "n" ]]; }; then
CHECKFUNC=1
fi
 fi
 if have_function package; then
PKGFUNC=1
-elif [[ $SPLITPKG -eq 0 ]] && have_function package_${pkgname}; then
-   SPLITPKG=1
 fi
 
 # check if gpg signature is to be created and if signing key is valid
-- 
2.17.0


Re: [pacman-dev] [PATCH 02/10] makepkg: Simplify SPLITPKG check

2018-05-31 Thread Eli Schwartz
On 05/31/2018 12:24 PM, Jan Alexander Steffens (heftig) wrote:
> This causes package_$pkgname() to be preferred over package() in the
> non-split case, but the behavior if both functions exist was
> undocumented anyway.

We don't document the behavior of arbitrary user-defined functions.
package_$pkgname() is only defined as having meaning in the context of
the PACKAGE SPLITTING section of the documentation.

IMHO this is us documenting that package() is the only correct function
unless ${#pkgname[@]} > 1.

I think it is far more intuitive to behave that way, and I'd actually be
willing to refuse to use package_$pkgname even if it is the only one...

-- 
Eli Schwartz
Bug Wrangler and Trusted User



signature.asc
Description: OpenPGP digital signature


Re: [pacman-dev] [PATCH 02/10] makepkg: Simplify SPLITPKG check

2018-06-04 Thread Allan McRae
On 01/06/18 07:01, Eli Schwartz wrote:
> On 05/31/2018 12:24 PM, Jan Alexander Steffens (heftig) wrote:
>> This causes package_$pkgname() to be preferred over package() in the
>> non-split case, but the behavior if both functions exist was
>> undocumented anyway.
> 
> We don't document the behavior of arbitrary user-defined functions.
> package_$pkgname() is only defined as having meaning in the context of
> the PACKAGE SPLITTING section of the documentation.
> 
> IMHO this is us documenting that package() is the only correct function
> unless ${#pkgname[@]} > 1.
> 
> I think it is far more intuitive to behave that way, and I'd actually be
> willing to refuse to use package_$pkgname even if it is the only one...
> 

We discussed on IRC to abort if both are present as undefined behavoiur.

Allan