apkbuild-lint 15.3 KB
Newer Older
Leo's avatar
Leo committed
1 2 3 4 5 6 7
#!/bin/sh
# alint APKBUILD - scan APKBUILD template for common mistakes
#
# Adapted from xlint from Void Linux's xtools to Alpine Linux
# https://github.com/leahneukirchen/xtools/
#
# Required packages (names are Alpine Linux pkgs):
8
# busybox - for grep, sed, tr, sort and other simple utiltiies
Leo's avatar
Leo committed
9 10 11

export LC_ALL=C

12 13 14 15 16
scan() {
	# shellcheck disable=2039
	# 2039: local operator is not posix but we can use it in ash/dash
	local rx="$1" msg="$2" tag="$3" severity="$4"
	grep -E -Hn -e "$rx" "$apkbuild" |
17
		sed "s~^\([^:]*:[^:]*:\)\(.*\)~$severity:[$tag]:\1$msg~"
18 19
}

Leo's avatar
Leo committed
20 21 22 23 24 25 26 27 28 29
variables=$(echo -n "#.*
_.*
startdir
srcdir
pkgdir
subpkgdir
builddir
arch
depends
depends_dev
30 31 32 33
depends_doc
depends_openrc
depends_libs
depends_static
Leo's avatar
Leo committed
34 35 36 37 38 39 40 41 42 43 44 45
checkdepends
giturl
install
.*.pre-install
.*.post-install
.*.pre-upgrade
.*.post-upgrade
.*.pre-deinstall
.*.post-deinstall
install_if
license
makedepends
46 47
makedepends_build
makedepends_host
Leo's avatar
Leo committed
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
md5sums
sha256sums
sha512sums
options
pkgdesc
pkggroups
pkgname
pkgrel
pkgusers
pkgver
provides
provider_priority
replaces
replaces_priority
source
subpackages
triggers
ldpath
66
linguas
Leo's avatar
Leo committed
67
sonameprefix
Leo's avatar
Leo committed
68
somask
69
url
70 71
langdir
patch_args
Leo's avatar
Leo committed
72 73 74
cpandepends
cpanmakedepends
cpancheckdepends
75
HOSTCC" | tr '\n' '|')
Leo's avatar
Leo committed
76

77 78 79 80 81 82 83 84 85
valid_options="
!archcheck
!check
checkroot
net
!strip
suid
!tracedeps
chmod-clean
86 87 88 89 90 91 92
!dbg
toolchain
!fhs
libtool
charset.alias
textrels
!spdx
93 94
ldpath-recursive
sover-namecheck
95
$(echo "$CUSTOM_VALID_OPTIONS" | tr ' ' '\n')
96 97
"

98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
valid_arches="
x86_64
!x86_64
x86
!x86
armel
!armel
armhf
!armhf
armv7
!armv7
s390x
!s390x
ppc
!ppc
ppc64
!ppc64
ppc64le
!ppc64le
all
noarch
mips
!mips
mipsel
!mipsel
mips64
!mips64
mips64el
!mips64el
aarch64
!aarch64
$(echo "$CUSTOM_VALID_ARCHES" | tr ' ' '\n')
"

132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
# This is a list of packages that need builddir= set because scripts/bootstrap.sh
# might want to build -bootstrap versionss
default_builddir_exception="
fortify-headers
linux-headers
musl
libc-dev
pkgconf
zlib
openssl
ca-certificates
libbsd
libtls-standalone
busybox
busybox-initscripts
binutils
make
apk-tools
file
gmp
mpfr4
mpc1
isl
cloog
gcc
openrc
alpine-conf
alpine-baselayout
alpine-keys
alpine-base
build-base
attr
libcap
patch
sudo
acl
fakeroot
tar
pax-utils
lzip
abuild
ncurses
libedit
openssh
libcap-ng
util-linux
libaio
lvm2
popt
xz
json-c
argon2
cryptsetup
kmod
lddtree
mkinitfs
community/go
libffi
community/ghc
linux-lts
linux-firmware
$(echo "$CUSTOM_BOOTSTRAP_PACKAGES" | tr ' ' '\n')
"

196 197
default_builddir_value() {
	[ "$SKIP_DEFAULT_BUILDDIR_VALUE" ] && return 0
Leo's avatar
Leo committed
198
	[ "$SKIP_AL1" ] && return 0
199 200

	# If the package is in our exceptions don't tell the user
201
	if printf "%s" "$default_builddir_exception" | grep -q -x -- "$pkgname"; then
202 203 204
		return 0
	fi

205
	if [ "$builddir" = "/$pkgname-$pkgver" ]; then
206
		scan '^builddir=' "builddir can be removed as it is the default value" 'AL1' 'MC'
207 208 209 210 211
	fi
}

unnecessary_return_1() {
	[ "$SKIP_UNNECESSARY_RETURN_1" ] && return 0
Leo's avatar
Leo committed
212 213
	[ "$SKIP_AL2" ] && return 0
	scan '\|\| return 1' "|| return 1 is not required as set -e is used" 'AL2' 'MC'
214 215 216 217
}

pkgname_quoted() {
	[ "$SKIP_PKGNAME_QUOTED" ] && return 0
Leo's avatar
Leo committed
218
	[ "$SKIP_AL3" ] && return 0
219
	scan "^pkgname=[\"'][^$]+[\"']" "pkgname must not be quoted" 'AL3' 'TP'
220 221 222 223
}

pkgver_quoted() {
	[ "$SKIP_PKGVER_QUOTED" ] && return 0
Leo's avatar
Leo committed
224
	[ "$SKIP_AL4" ] && return 0
225
	scan "^pkgver=[\"'][^$]+[\"']" "pkgver must not be quoted" 'AL4' 'TP'
226 227 228 229
}

empty_variable() {
	[ "$SKIP_EMPTY_VARIABLE" ] && return 0
Leo's avatar
Leo committed
230 231
	[ "$SKIP_AL5" ] && return 0
	scan '^[A-Za-z0-9_]*=(""|''|)$' "variable set to empty string: \2" 'AL5' 'MC'
232 233 234 235
}

custom_variable() {
	[ "$SKIP_CUSTOM_VARIABLE" ] && return 0
Leo's avatar
Leo committed
236
	[ "$SKIP_AL6" ] && return 0
237
	grep -E -oHn '^[\sA-Za-z0-9_-]*=' $apkbuild | \
238
		sed "s|:[ 	]*|:|g" | \
239 240
		grep -E -v ':('"$variables"')=' | \
		sed "s/^\([^:]*:[^:]*:\)\(.*\)/IC:[AL6]:\1prefix custom variable with _: \2/"
241 242 243 244
}

indent_tabs() {
	[ "$SKIP_INDENT_TABS" ] && return 0
Leo's avatar
Leo committed
245 246
	[ "$SKIP_AL7" ] && return 0
	scan '^  ' "indent with tabs" 'AL7' 'IC'
247 248 249 250
}

trailing_whitespace() {
	[ "$SKIP_TRAILING_WHITESPACE" ] && return 0
Leo's avatar
Leo committed
251
	[ "$SKIP_AL8" ] && return 0
252
	scan '[	 ]$' "trailing whitespace" 'AL8' 'IC'
253 254 255 256
}

backticks_usage() {
	[ "$SKIP_BACKTICKS_USAGE" ] && return 0
Leo's avatar
Leo committed
257 258
	[ "$SKIP_AL25" ] && return 0
	scan '[^\\]`' "use \$() instead of backticks" 'AL25' 'SP'
259 260 261 262
}

function_keyword() {
	[ "$SKIP_FUNCTION_KEYWORD" ] && return 0
Leo's avatar
Leo committed
263
	[ "$SKIP_AL9" ] && return 0
264
	scan '^	*function\b' 'do not use the function keyword' 'AL9' 'SC'
265 266 267 268
}

space_before_function_parenthesis() {
	[ "$SKIP_SPACE_BEFORE_FUNCTION_PARENTHESIS" ] && return 0
Leo's avatar
Leo committed
269
	[ "$SKIP_AL10" ] && return 0
270
	scan '^	*[^ ]*  *\(\)' 'do not use space before function parenthesis' 'AL10' 'TC'
271 272 273 274
}

space_after_function_parenthesis() {
	[ "$SKIP_SPACE_AFTER_FUNCTION_PARENTHESIS" ] && return 0
Leo's avatar
Leo committed
275
	[ "$SKIP_AL11" ] && return 0
276
	scan '^	*[^ ]*\(\)(|   *)\{' 'use one space after function parenthesis' 'AL11' 'TC'
277 278 279 280
}

newline_opening_brace() {
	[ "$SKIP_NEWLINE_OPENING_BRACE" ] && return 0
Leo's avatar
Leo committed
281
	[ "$SKIP_AL12" ] && return 0
282
	scan '^	*[^ ]*\(\)$' 'do not use a newline before function opening brace' 'AL12' 'TC'
283 284 285 286
}

superfluous_cd_builddir() {
	[ "$SKIP_SUPERFLUOUS_CD_BUILDDIR" ] && return 0
Leo's avatar
Leo committed
287
	[ "$SKIP_AL13" ] && return 0
288 289 290
	# shellcheck disable=2039
	# 2039: local operator is not posix but we can use it in ash/dash
	local cds='' cdscount='' prevcd='' phase="$1"
291 292 293 294 295 296 297

	# All ocurrences of the 'cd' command being used
	# 1. Print file with line numbers.
	# 2. Print the function from the opening declaration up to the closing bracked
	# 3. grep for all ocurrences of the 'cd' command (ignore obviously invalid ones
	#	like matching 'cd' until the end of the line)
	cds="$(cat -n "$apkbuild" \
298
		   | sed -n "/^\s\+[0-9].*	$phase() {/,/[0-9].*	}/p" \
299
		   | grep '\bcd ')"
300 301 302 303 304 305 306 307 308 309 310

	# Number of ocurrences of the 'cd' command being used
	# Used to tell if we are in a phase() with a single cd statement
	# in that case we can be free to warn the user that their cd statement
	# is superfluous if it is to "$builddir", this avoids problems of previous
	# 'cd' statements to other places giving false positives
	cdscount="$(printf "%s\\n" "$cds" | wc -l)"

	# if the previous line had a 'cd "$builddir"' statement
	prevcd=0

Leo's avatar
Leo committed
311 312 313
	# If it is the first cd of the program
	firstcd=1

314 315 316 317 318 319 320 321 322 323 324
	# Use newline as our IFS delimiter, so we can iterate over lines with
	# the for construct, since the while loop will create a subshell that
	# prevents the value of the prevcd variable from being propagated
	# to future runs
	OLDIFS="$IFS"
	IFS="
"
	for line in $(printf "%s\\n" "$cds"); do
		linenum="$(printf "%s\\n" "$line" | awk '{ print $1 }')"
		statement="$(printf "%s\\n" "$line" | awk '{ $1="" ; print $0 }')"
		[ -z "$statement" ] && continue
Leo's avatar
Leo committed
325 326
		if echo "$statement" | grep -E -q 'cd ["]?\$[{]?builddir["}]?+($| )' ; then
			if [ "$prevcd" -eq 1 ] || [ "$cdscount" -eq 1 ] || [ "$firstcd" -eq 1 ]; then
327
				printf "MP:[AL13]:%s:%s:cd \"\$builddir\" can be removed in phase '%s'\\n" \
Leo's avatar
Leo committed
328 329 330
					"$apkbuild" \
					"$linenum" \
					"$phase"
331 332 333 334 335
			fi
			prevcd=1
		else
			prevcd=0
		fi
Leo's avatar
Leo committed
336 337
		# Can be set to 0 in the first loop and the re-set it to 0 in any next loops
		firstcd=0
338
	done
339
	IFS="$OLDIFS"
340 341
}

342 343
pkgname_has_uppercase() {
	[ "$SKIP_PKGNAME_HAS_UPPERCASE" ] && return 0
Leo's avatar
Leo committed
344
	[ "$SKIP_AL14" ] && return 0
345
	scan '^pkgname=[a-z0-9\._\-]*[A-Z]' 'pkgname must not have uppercase characters' 'AL14' 'SC'
346 347 348 349
}

pkgver_has_pkgrel() {
	[ "$SKIP_PKGVER_HAS_PKGREL" ] && return 0
Leo's avatar
Leo committed
350
	[ "$SKIP_AL15" ] && return 0
351
	scan '^pkgver=.*(-r|_r[^c])' 'pkgver must not have -r or _r' 'AL15' 'SC'
352 353
}

Leo's avatar
Leo committed
354 355 356 357 358 359 360 361
_builddir_is_set() {
	[ "$SKIP__BUILDDIR_IS_SET" ] && return 0
	[ "$SKIP_AL26" ] && return 0
	if [ -z "$builddir" ] && [ -n "$_builddir" ]; then
		scan '^_builddir=' 'rename _builddir to builddir' 'AL26' 'SP'
	fi
}

Leo's avatar
Leo committed
362 363 364 365 366 367
literal_integer_is_quoted() {
	[ "$SKIP_LITERAL_INTEGER_IS_QUOTED" ] && return 0
	[ "$SKIP_AL28" ] && return 0
	scan '^[A-Za-z0-9_]*=('\''|")[0-9]+("|'\'')' 'literal integers must not be quoted' 'AL28' 'MC'
}

Kevin Daudt's avatar
Kevin Daudt committed
368 369 370
pkgname_used_in_source() {
    [ "$SKIP_PKGNAME_USED_IN_SOURCE" ] && return 0
    [ "$SKIP_AL29" ] && return 0
371 372 373 374 375 376 377 378
	for i in $distilled_source; do
		if printf "%s\\n" "$i" | grep -E -q '(.*?::)?[a-z]+://[^"]+\$\{?pkgname\}?'; then
			scan "$(printf "%s\\n" "$i" | sed 's|\$|\\$|g')" \
				 '$pkgname should not be used in the source url' \
				 'AL29' \
				 'MC'
		fi
	done
Kevin Daudt's avatar
Kevin Daudt committed
379 380
}

Leo's avatar
Leo committed
381 382 383
double_underscore_in_variable() {
	[ "$SKIP_DOUBLE_UNDERSCORE_IN_VARIABLE" ] && return 0
	[ "$SKIP_AL30" ] && return 0
384 385 386 387
	# Run this twice, once which will detect variables without the local keyword
	# which requires matching the = sign at the end. The second time will match
	# for variables declared with the local keyword which do not require the =
	# sign
388 389
	scan '(^|	)__[A-Za-z0-9_].*=' 'double underscore on variables are reserved' 'AL30' 'MC'
	scan '(^|	)local ([A-Za-z0-9_])?.*__[A-Za-z0-9_].*(=)?' 'double underscore on variables are reserved' 'AL30' 'MC'
390
}
Leo's avatar
Leo committed
391 392 393 394 395

variable_capitalized() {
	[ "$SKIP_VARIABLE_CAPITALIZED" ] && return 0
	[ "$SKIP_AL31" ] && return 0
	scan '^[a-z0-9_]*[A-Z].*=' 'variables must not have capital letters' 'AL31' 'MC'
396
	scan '(	)?local [a-z0-9_ ]*[A-Z].*(=)?' 'variables must not have capital letters' 'AL31' 'MC'
Leo's avatar
Leo committed
397 398
}

Leo's avatar
Leo committed
399 400 401
braced_variable() {
	[ "$SKIP_BRACED_VARIABLE" ] && return 0
	[ "$SKIP_AL32" ] && return 0
Leo's avatar
Leo committed
402 403
	# Match a Sigil ($) then a brace and any valid value until the end brace and then
	# match end-of-line or a character that can't be in the name of a variable
Leo's avatar
Leo committed
404
	grep -Eo -Hn -e '\$\{[A-Za-z0-9_]+\}($|["\./\(\)= -])' "$apkbuild" |
Leo's avatar
Leo committed
405
		sed "s/^\([^:]*:[^:]*:\)\(.*\)/MP:[AL32]:\1unnecessary usage of braces: \2/" |
406
		sed 's|[^}]$||g' # This strips the last match in the grep
Leo's avatar
Leo committed
407 408
}

Leo's avatar
Leo committed
409 410 411 412 413 414 415 416
cpan_variable() {
	[ "$SKIP_CPAN_VARIABLE" ] && return 0
	[ "$SKIP_AL35" ] && return 0
	scan '^cpandepends=' 'merge the contents of cpandepends into depends and remove it' 'AL35' 'MC'
	scan '^cpanmakedepends=' 'merge the contents of cpanmakedepends into makedepends and remove it' 'AL35' 'MC'
	scan '^cpancheckdepends=' 'merge the contents of cpancheckdepends into checkdepends and remove it' 'AL35' 'MC'
}

417 418 419
overwrite_xflags() {
	[ "$SKIP_OVERWRITE_XFLAGS" ] && return 0
	[ "$SKIP_AL36" ] && return 0
420 421 422 423 424
	# shellcheck disable=SC2016 disable=SC2086
	# We need to match either the start of the line or a whitespace
	# otherwise we can end up matching variables wrongly, like a variable
	# can be called 'LUA_CFLAGS' and we end up matching it because we only check
	# 'CFLAGS'
425 426
	#
	# The sed call is to strip any leading whitespace that is created
427
	grep -E -oHn "(^| |	)$1=\".*\"" $apkbuild |
428
		sed "s|:[ 	]*$1|:$1|g" |
429
		grep -vF "\$$1" |
Leo's avatar
Leo committed
430
		sed "s/^\([^:]*:[^:]*:\)\(.*\)/SP:[AL36]:\1$1 should not be overwritten, add \$$1 to it/"
431 432
}

433 434 435 436 437 438 439 440 441 442
invalid_option() {
	[ "$SKIP_INVALID_OPTION" ] && return 0
	[ "$SKIP_AL49" ] && return 0
	for i in $options; do
		if ! echo "$valid_options" | grep -q -x "$i"; then
			scan "options=.*$i" "invalid option '$i'" 'AL49' 'MC'
		fi
	done
}

Leo's avatar
Leo committed
443 444 445 446 447 448 449 450
missing_default_prepare() {
	[ "$SKIP_MISSING_DEFAULT_PREPARE" ] && return 0
	[ "$SKIP_AL54" ] && return 0

	# Check if we have prepare() defined
	# shellcheck disable=SC2086
	grep -q "^prepare() {" $apkbuild || return 0

451
	# shellcheck disable=SC2086
452 453 454
	# The '( | )' part of the sed call is not by mistake, the first component is a whitespace
	# the second component is a literal tab character, created by doing 'CTRL + V, <tab>'
	if ! sed -n '/^prepare() {/,/^}/p' $apkbuild | grep -q -E "^( |	)*default_prepare"; then
455
		scan "^prepare\(\) \{" "prepare() is missing call to 'default_prepare'" 'AL54' 'SC'
Leo's avatar
Leo committed
456 457 458
	fi
}

459 460
missing_patch_description() {
	[ "$SKIP_MISSING_PATCH_DESCRIPTION" ] && return 0
461
	[ "$SKIP_AL56" ] && return 0
462 463 464

	ret=0
	for i in $source; do
465
		case ${i#*::} in
466
			http://*|ftp://*|https://*) ;;
467 468 469 470
			*.patch)
				awk -vAPKBUILD="$apkbuild" '
				function desc_check() {
				  if (NR == 1) {
471
				    printf("MP:[AL56]:%s:Patch file %s is missing a description\n",
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492
				       APKBUILD,
				       FILENAME)
				    exit(1)
				  } else {
				    exit(0)
			          }
				}

				/^--- .*$/  { desc_check() }
				/^diff .*$/ { desc_check() }
				' "$(dirname "${apkbuild}")/$i"

				[ $? -ne 0 ] && ret=1

				;;
		esac
	done

	return $ret
}

493 494 495 496 497 498 499 500 501 502
build_type_not_none() {
	[ "$SKIP_BUILD_TYPE_NOT_NONE" ] && return 0
	[ "$SKIP_AL56" ] && return 0

	# Check inside the build function if we have a call to cmake
	if sed -n '/^build() {/,/^}/p' $apkbuild | grep -q -F cmake; then
		# Check if we have -DCMAKE_BUILD_TYPE= set
		_call="$(sed -n '/^build() {/,/^}/p' $apkbuild \
				| grep -E -o -- '.*-DCMAKE_BUILD_TYPE=[A-Za-z]*( |$)' \
				| sed 's| *$||g')"
503
		if [ "$(echo "$_call" | sed 's|.*-DCMAKE_BUILD_TYPE=||g' )" != None ]; then
504
			grep -Eo -Hn -e "$_call" "$apkbuild" |
Leo's avatar
Leo committed
505
				sed "s/^\([^:]*:[^:]*:\)\(.*\)/SP:[AL56]:\1CMAKE_BUILD_TYPE must be None: \2/" |
506 507 508 509 510
					sed -r 's|(: )[	]*|\1|g' # Strip all space and tabs caught by the grep
		fi
	fi
}

511 512 513 514 515 516 517 518 519 520
invalid_arch() {
	[ "$SKIP_INVALID_ARCH" ] && return 0
	[ "$SKIP_AL57" ] && return 0
	for i in $arch; do
		if ! echo "$valid_arches" | grep -q -x "$i"; then
			scan "arch=.*$i" "invalid arch '$i'" 'AL57' 'SC'
		fi
	done
}

521 522 523
remote_patch_from_live_source() {
	[ "$SKIP_REMOTE_PATCH_FROM_LIVE_SOURCE" ] && return 0
	[ "$SKIP_AL60" ] && return 0
524
	for i in $distilled_source; do
525
		if printf "%s\\n" "$i" | grep -q 'github.*/pull/[0-9]*.patch'; then
526
			scan "$(printf "%s\\n" "$i" | sed 's|\$|\\$|g')" "live source '$i'" 'AL60' 'IC'
527 528
		fi
		if printf "%s\\n" "$i" | grep -q 'gitlab.*/merge_requests/[0-9]*.patch'; then
529
			scan "$(printf "%s\\n" "$i" | sed 's|\$|\\$|g')" "live source '$i'" 'AL60' 'IC'
530 531 532 533
		fi
	done
}

534 535 536 537 538 539 540 541
# Remove variable and it's surrounding double-quotes
# this allows for iterating over all strings inside
# a variable, first written for source= which can have
# multiple values and we need to check each of them but
# we can't source the variable because we need to check
# for bad usage of $pkgname and other variables.
_distill() {
	local variable="$1" apkbuild="$2"
542 543 544 545
	# Check if we are dealing with an unquoted variable
	if ! grep -q -o "^$1=\"" "$apkbuild"; then
		grep -o "^$1=.*" "$apkbuild" | sed -e 's|$1=||'
	fi
546 547 548 549 550 551 552 553 554
	if grep -q -o "^$1=\".*\"" "$apkbuild"; then
		grep -o "^$1=\".*\"" "$apkbuild" \
			| sed -e "s|$1=\"||" -e 's|"||g'
	else
		sed -n -e "/$1=\"/,/\"/p" "$apkbuild" \
			| sed -e "s|$1=\"||" -e 's|"||g' -e 's|^\s*||'
	fi
}

Leo's avatar
Leo committed
555 556 557
ret=0
for apkbuild; do
	if [ -f "$apkbuild" ]; then
Leo's avatar
Leo committed
558 559

	# Source apkbuild, we need some nice values
560 561
	srcdir="" . "$apkbuild" || {
		echo "Failed to source APKBUILD in '$apkbuild'" ;
Leo's avatar
Leo committed
562
		exit 1;
563
	}
564 565 566 567
	# Distill the source by grabbing everything inside it, removing
	# source="" and remove all whitespace, it should end with a list:
	# source1
	# source2
568 569
	# source3d
	distilled_source="$(_distill "source" "$apkbuild")"
570

Leo's avatar
Leo committed
571
	default_builddir_value &
Leo's avatar
Leo committed
572
	_builddir_is_set &
Leo's avatar
Leo committed
573

574 575
	pkgname_quoted &
	pkgver_quoted &
Leo's avatar
Leo committed
576 577 578 579 580 581 582
	unnecessary_return_1 &
	empty_variable &
	custom_variable &
	indent_tabs &
	trailing_whitespace &
	backticks_usage &
	function_keyword &
583
	pkgname_has_uppercase &
584
	pkgver_has_pkgrel &
Leo's avatar
Leo committed
585 586 587
	space_before_function_parenthesis &
	space_after_function_parenthesis &
	newline_opening_brace &
Leo's avatar
Leo committed
588
	literal_integer_is_quoted &
Kevin Daudt's avatar
Kevin Daudt committed
589
	pkgname_used_in_source &
Leo's avatar
Leo committed
590
	double_underscore_in_variable &
Leo's avatar
Leo committed
591
	variable_capitalized &
Leo's avatar
Leo committed
592
	braced_variable &
Leo's avatar
Leo committed
593
	cpan_variable &
594 595 596 597 598
	overwrite_xflags "CFLAGS" &
	overwrite_xflags "GOFLAGS" &
	overwrite_xflags "CPPFLAGS" &
	overwrite_xflags "CXXFLAGS" &
	overwrite_xflags "FFLAGS" &
Leo's avatar
Leo committed
599
	overwrite_xflags "LDFLAGS" &
600
	overwrite_xflags "GOFLAGS" &
Leo's avatar
Leo committed
601
	missing_default_prepare &
602
	missing_patch_description &
603
	build_type_not_none &
604
	[ "$arch" ] && invalid_arch &
605
	[ "$options" ] && invalid_option &
606
	[ "$source" ] && remote_patch_from_live_source &
607

608
	for phase in prepare build check package; do
Leo's avatar
Leo committed
609
		superfluous_cd_builddir "$phase" &
Leo's avatar
Leo committed
610
	done
Leo's avatar
Leo committed
611
	wait
Leo's avatar
Leo committed
612 613
	else
	echo no such apkbuild "$apkbuild" 1>&2
Leo's avatar
Leo committed
614
	fi | sort -t: -V | grep . && ret=1
Leo's avatar
Leo committed
615 616
done
exit $ret