import freebsd scripts from misc/freebsd repository
[freebsd-maintainer-scripts/.git] / myportlint
1 #!/bin/sh
2
3 : ${PORTSDIR:="/usr/ports"}
4 : ${MAINTAINER:="${1:-${USER}}@FreeBSD.org"}
5
6 PORTLINT_FLAGS="-Abct${PORTLINT_FLAGS}"
7 SCRIPT=$0
8 SCRIPT=${SCRIPT##*/}
9
10 ports_by_maintainer() {
11         ports=`make -C ${PORTSDIR} search key=${MAINTAINER} display="path"|sed -n "s#Path:.*${PORTSDIR}\(.*\)#\1#p"`
12 }
13
14 cleanup() {
15         [ -f /tmp/${SCRIPT}.log ] && rm -f /tmp/${SCRIPT}.log
16 }
17
18 main() {
19         cleanup
20
21         ports_by_maintainer
22
23         for port in $ports
24         do
25                 cd "${PORTSDIR}/$port"
26                 echo "===> portlint output on port $port ==" >> /tmp/${SCRIPT}.log
27                 portlint ${PORTLINT_FLAGS} >> /tmp/${SCRIPT}.log
28                 echo -e "<=== portlint output ==\n" >> /tmp/${SCRIPT}.log
29                 cd -
30         done
31 }
32
33 main