libmakepkg: make package checking functions extendable

To add a new package check, drop a file in libmakepkg/lint and add the
function to the "lint_functions" array.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2015-02-01 22:32:51 +10:00
parent 00da25a5ea
commit adc6ca1f2c
3 changed files with 13 additions and 2 deletions

View File

@ -25,14 +25,21 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
source "$LIBRARY/util/message.sh"
declare -a lint_package_functions
for lib in "$LIBRARY/lint_package/"*.sh; do
source "$lib"
done
readonly -a lint_package_functions
lint_package() {
cd_safe "$pkgdir"
msg "$(gettext "Checking for packaging issue...")"
warn_missing_backup
warn_build_references
for func in ${lint_package_functions[@]}; do
$func
done
}

View File

@ -26,6 +26,8 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
source "$LIBRARY/util/message.sh"
lint_package_functions+=('warn_build_references')
warn_build_references() {
if find "${pkgdir}" -type f -print0 | xargs -0 grep -q -I "${srcdir}" ; then
warning "$(gettext "Package contains reference to %s")" "\$srcdir"

View File

@ -26,6 +26,8 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
source "$LIBRARY/util/message.sh"
lint_package_functions+=('warn_missing_backup')
warn_missing_backup() {
local file
for file in "${backup[@]}"; do