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:
parent
00da25a5ea
commit
adc6ca1f2c
3 changed files with 13 additions and 2 deletions
|
@ -25,14 +25,21 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
|
|
||||||
|
declare -a lint_package_functions
|
||||||
|
|
||||||
for lib in "$LIBRARY/lint_package/"*.sh; do
|
for lib in "$LIBRARY/lint_package/"*.sh; do
|
||||||
source "$lib"
|
source "$lib"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
readonly -a lint_package_functions
|
||||||
|
|
||||||
|
|
||||||
lint_package() {
|
lint_package() {
|
||||||
cd_safe "$pkgdir"
|
cd_safe "$pkgdir"
|
||||||
msg "$(gettext "Checking for packaging issue...")"
|
msg "$(gettext "Checking for packaging issue...")"
|
||||||
|
|
||||||
warn_missing_backup
|
for func in ${lint_package_functions[@]}; do
|
||||||
warn_build_references
|
$func
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
source "$LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
|
|
||||||
|
lint_package_functions+=('warn_build_references')
|
||||||
|
|
||||||
warn_build_references() {
|
warn_build_references() {
|
||||||
if find "${pkgdir}" -type f -print0 | xargs -0 grep -q -I "${srcdir}" ; then
|
if find "${pkgdir}" -type f -print0 | xargs -0 grep -q -I "${srcdir}" ; then
|
||||||
warning "$(gettext "Package contains reference to %s")" "\$srcdir"
|
warning "$(gettext "Package contains reference to %s")" "\$srcdir"
|
||||||
|
|
|
@ -26,6 +26,8 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
source "$LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
|
|
||||||
|
lint_package_functions+=('warn_missing_backup')
|
||||||
|
|
||||||
warn_missing_backup() {
|
warn_missing_backup() {
|
||||||
local file
|
local file
|
||||||
for file in "${backup[@]}"; do
|
for file in "${backup[@]}"; do
|
||||||
|
|
Loading…
Add table
Reference in a new issue