[aur-general] review of getax2019 PKGBUILD

Eli Schwartz eschwartz at archlinux.org
Sun Feb 23 14:59:44 UTC 2020


On 2/23/20 7:17 AM, Yoan Blanc via aur-general wrote:
> Hi folks,
> 
> I've built my first PKGBUILD based on Brunio Renié's vaudtax,
> https://aur.archlinux.org/packages/vaudtax/
> 
> https://gitlab.com/greut/getax
> 
> Do you think I could propose it as is to aur-request? Do you see anything
> that could be improved?

Added to what others have pointed out...

	for v in $(seq 1 2); do
		varname=_update_1_0$v
		for f in ${!varname}; do

You could just use:

for f in _update_1_0{1,2}

Your file https://gitlab.com/greut/getax/-/blob/master/getax contains
bash-specific &>, but a /bin/sh shebang. You can easily use /bin/sh
compatible syntax:

type java &> /dev/null

becomes

type java > /dev/null 2>&1

...

but you should not be using "type" at all, just use command -v >/dev/null

You also don't need to check if [ "$?" -ne "0" ] ; then

Instead, just check

if ! command -v java >/dev/null; then

later you use:

which zenity

The "which" program is not guaranteed to be installed, stick to one
builtin method (command -v is preferred, type has reliable results if
you stick to #!/bin/bash).

(Of course this is mostly moot if your package depends on java-runtime
anyway.)

cd $(dirname $(dirname $(realpath $0)))

Each $() should be quoted, just like a variable, to avoid unexpected
whitespace in paths. Since you're not hardcoding the same directory you
installed to, but building it using dirname/realpath, you should not be
assuming *anything* about the path.

pkgver=2019
_pkgver=1.02

This is confusing and the latter should maybe be "_minor_version" or
something that makes it clear why they are so different.


-- 
Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1601 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/aur-general/attachments/20200223/9cf6fc57/attachment.sig>


More information about the aur-general mailing list