Commit 54c07f41 authored by Leo's avatar Leo

add _builddir-is-set test

parent 5b76aaf1
CHANGES with 14:
- Add _builddir-is-set test
CHANGES with 13:
- Add tags for each violation in apkbuild-lint
......
......@@ -275,3 +275,10 @@ pkgver has *-r* followed by a number, that is reserved for the relaease of a pac
as defined by the *pkgrel* variable.
Severity: Serious, Certainty: Certain
## _builddir-is-set [AL26]
_builddir is set instead of builddir, which is an old variable from before builddir
existed as as concept understood by abuild
Severity: Serious, Certainty: Certain
......@@ -207,6 +207,14 @@ pkgver_has_pkgrel() {
scan '^pkgver=[A-Za-z0-9_\-\.]*(-r|_r(?!c))' 'pkgver must not have -r or _r' 'AL15' 'SC'
}
_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
}
ret=0
for apkbuild; do
if [ -f "$apkbuild" ]; then
......@@ -214,6 +222,7 @@ for apkbuild; do
# Source apkbuild, we need some nice values
srcdir="" . "$apkbuild"
default_builddir_value &
_builddir_is_set &
unnecessary_return_1 &
pkgname_quoted &
......
......@@ -448,4 +448,32 @@ is_travis() {
assert_match "${lines[0]}" "\[AL15\].*:pkgver must not have -r or _r"
}
@test '_builddir is set' {
cat <<-"EOF" >$apkbuild
pkgname=foo
_realname=Foo
pkgver=1.0.0
_builddir="$srcdir/$_realname-$pkgver"
EOF
run $cmd $apkbuild
[[ $status -eq 1 ]]
assert_match "${lines[0]}" "\[AL26\].*:rename _builddir to builddir"
}
@test '_builddir and builddir are set' {
cat <<-"EOF" >$apkbuild
pkgname=foo
_realname=Foo
pkgver=1.0.0
builddir="$srcdir/$_realname-$pkgver"
_builddir="$builddir/build"
EOF
run $cmd $apkbuild
[[ $status -eq 0 ]]
}
# vim: noexpandtab
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment