Commit 66187b42 authored by Kevin Daudt's avatar Kevin Daudt

overlay: add script to run shellcheck on APKBUILD

A shim is used that will initialize the global variables that APKBUILD
files use and 'use' them afterwards to prevent shellcheck to complain
about those.
parent 7c4eae00
......@@ -9,3 +9,8 @@ Docker container with the necessary linting tools for verifying APKBUILD files
* **[shellcheck](https://www.shellcheck.net/)** - A generic shell script linter,
warning against common issues in shell scripts. Note that by default it's
too strict for APKBUILD files.
* **apkbuild-shellcheck** - A wrapper script to use shellcheck on APKBUILD
files. It uses a shim file that defines variabes normally defined by abuild
and 'uses' them so that shellcheck does not warn about them, while still
warning about other variables. It also disables some checks that are not
applicable for APKBUILDs.
#!/bin/sh
shellcheck -s ash \
-e SC2016 \
-e SC2086 \
-e SC2169 \
-e SC2155 \
-e SC2100 \
-e SC2209 \
-e SC2030 \
-e SC2031 \
-e SC1090 \
-xa /usr/share/abuild/APKBUILD_SHIM
#!/bin/sh
set -e
arch=
builddir=
checkdepends=
depends=
depends_dev=
install=
install_if=
ldpath=
license=
makedepends=
md5sums=
options=
pkgbasedir=
pkgdesc=
pkgdir=
pkgname=
pkgrel=
pkgver=
pkggroups=
pkgusers=
provides=
replaces=
sha256sums=
sha512sums=
sonameprefix=
source=
srcdir=
startdir=
subpackages=
subpkgdir=
subpkgname=
url=
# abuild.conf
CFLAGS=
CXXFLAGS=
CPPFLAGS=
LDFLAGS=
JOBS=
MAKEFLAGS=
. ./APKBUILD
: "$arch"
: "$builddir"
: "$checkdepends"
: "$depends"
: "$depends_dev"
: "$install"
: "$install_if"
: "$ldpath"
: "$license"
: "$makedepends"
: "$md5sums"
: "$options"
: "$pkgbasedir"
: "$pkgdesc"
: "$pkgdir"
: "$pkgname"
: "$pkgrel"
: "$pkgver"
: "$pkggroups"
: "$pkgusers"
: "$provides"
: "$replaces"
: "$sha256sums"
: "$sha512sums"
: "$sonameprefix"
: "$source"
: "$srcdir"
: "$startdir"
: "$subpackages"
: "$subpkgdir"
: "$subpkgname"
: "$url"
# abuild.conf
: "$CFLAGS"
: "$CXXFLAGS"
: "$CPPFLAGS"
: "$LDFLAGS"
: "$JOBS"
: "$MAKEFLAGS"
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