302c208fc5
Add common error function in hooks Error messages are printed in stderr Reviewed By: tcberner, #portmgr Differential Revision: https://reviews.freebsd.org/D38026
23 lines
703 B
Bash
Executable File
23 lines
703 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Check that ports are hooked into the build
|
|
#
|
|
|
|
common_functions="$(realpath "$(dirname "$0")")/common.sh"
|
|
if [ -r "${common_functions}" ]; then
|
|
. "${common_functions}"
|
|
fi
|
|
|
|
newish_makefiles=$(git diff --name-only --cached --diff-filter=ACR | grep -E '^[^/]+/[^/]+/Makefile$')
|
|
if [ $? -eq 0 ] ; then
|
|
for newish_makefile in ${newish_makefiles} ; do
|
|
category=$(echo "${newish_makefile}" | awk -F '/' '{print $1}')
|
|
port=$(echo "${newish_makefile}" | awk -F '/' '{print $2}')
|
|
grep -q -E "^[[:space:]]+SUBDIR[[:space:]]\+=[[:space:]]*${port}\$" ${category}/Makefile
|
|
if [ $? -ne 0 ] ; then
|
|
pre_commit_error "Missing 'SUBDIR += ${port}' in ${category}/Makefile"
|
|
exit 1
|
|
fi
|
|
done
|
|
fi
|