diff options
author | bapt <bapt@FreeBSD.org> | 2013-09-24 06:09:21 +0800 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2013-09-24 06:09:21 +0800 |
commit | 08aceb950946fff246b5af3aba05673eff7e64c5 (patch) | |
tree | d300d89244b4139b4da41657875bca1240dc034d /Mk | |
parent | e1a5c5be62d4ad4de0ffd80d88adc6b8125a3ae5 (diff) | |
download | freebsd-ports-gnome-08aceb950946fff246b5af3aba05673eff7e64c5.tar.gz freebsd-ports-gnome-08aceb950946fff246b5af3aba05673eff7e64c5.tar.zst freebsd-ports-gnome-08aceb950946fff246b5af3aba05673eff7e64c5.zip |
New target make check-orphans to help discovering the files in staged not present in plist
Reviewed by: bdrewery
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/bsd.stage.mk | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Mk/bsd.stage.mk b/Mk/bsd.stage.mk index 7c81d76955a8..764cf617ea51 100644 --- a/Mk/bsd.stage.mk +++ b/Mk/bsd.stage.mk @@ -98,3 +98,56 @@ makeplist: stage -e "s,${DATADIR},%%DATADIR%%,g" \ -e "s,${PREFIX}/,,g" | ${GREP} -v "^@dirrmtry share/licenses" || ${TRUE} .endif + +.if !target(check-orphans) +check-orphans: stage + @while read line; do \ + cwd=${PREFIX} ; \ + case $$line in \ + @dirrm*) \ + set -- $$line ; \ + case $$2 in \ + /*) ${ECHO_CMD} "dir $$2" ;; \ + *) ${ECHO_CMD} "dir $$cwd/$$2" ;; \ + esac ; \ + ;; \ + @cwd) cwd=${PREFIX} ;; \ + @cwd*) set -- $$line ; \ + cwd=$$2 ;; \ + @*) ;; \ + /*) ${ECHO_CMD} $$line ;; \ + *) ${ECHO_CMD} $$cwd/$$line ;; \ + esac ; \ + done < ${TMPPLIST} > ${WRKDIR}/.expanded-plist + @{ ${ECHO_CMD} "#mtree"; ${CAT} ${MTREE_FILE}; } | ${TAR} tf - | \ + awk '{ sub(/^\.$$/, "", $$1); \ + if ($$1 == "") print "${PREFIX}"; else print "${PREFIX}/"$$1; }' \ + > ${WRKDIR}/.mtree + @a=${PREFIX}; \ + while :; do \ + a=$${a%/*} ; \ + [ -z "$${a}" ] && break ; \ + ${ECHO_CMD} $${a} >> ${WRKDIR}/.mtree ; \ + done + @${FIND} ${STAGEDIR} -type f -o -type l | ${SORT} | ${SED} -e "s,${STAGEDIR},,g" \ + | while read line; do \ + ${GREP} -qw "^$${line}$$" ${WRKDIR}/.expanded-plist || { \ + [ -n "$${line}" ] && ${ECHO_CMD} "$${line}" ; \ + } ; \ + done | ${SED} \ + -e "s,${DOCSDIR},%%PORTDOCS%%%%DOCSDIR%%,g" \ + -e "s,${EXAMPLESDIR},%%PORTEXAMPLES%%%%EXAMPLESDIR%%,g" \ + -e "s,${DATADIR},%%DATADIR%%,g" \ + -e "s,${PREFIX}/,,g" | ${GREP} -v "^share/licenses" || ${TRUE} + @${FIND} ${STAGEDIR} -type d | ${SED} -e "s,${STAGEDIR},,g" \ + | while read line; do \ + ${GREP} -qw "^$${line}$$" ${WRKDIR}/.mtree || \ + ${GREP} -qw "dir\ $${line}$$" ${WRKDIR}/.expanded-plist || { \ + [ -n "$${line}" ] && ${ECHO_CMD} "@dirrmtry $${line}"; \ + } ; \ + done | ${SORT} -r | ${SED} \ + -e "s,\(.*\)${DOCSDIR},%%PORTDOCS%%\1%%DOCSDIR%%,g" \ + -e "s,\(.*\)${EXAMPLESDIR},%%PORTEXAMPLES%%\1%%EXAMPLESDIR%%,g" \ + -e "s,${DATADIR},%%DATADIR%%,g" \ + -e "s,${PREFIX}/,,g" | ${GREP} -v "^@dirrmtry share/licenses" || ${TRUE} +.endif |