diff options
author | bdrewery <bdrewery@FreeBSD.org> | 2014-04-23 07:28:27 +0800 |
---|---|---|
committer | bdrewery <bdrewery@FreeBSD.org> | 2014-04-23 07:28:27 +0800 |
commit | 7c2e85e1a05e9f51a883156dfc8d24084d5bcd4c (patch) | |
tree | 691885b8bdecef82bb2150a8d32ccb9b0d7c4256 /Mk | |
parent | 77ed9374a2ecbbba8b00a9b45e59dce2f4fa97ea (diff) | |
download | freebsd-ports-gnome-7c2e85e1a05e9f51a883156dfc8d24084d5bcd4c.tar.gz freebsd-ports-gnome-7c2e85e1a05e9f51a883156dfc8d24084d5bcd4c.tar.zst freebsd-ports-gnome-7c2e85e1a05e9f51a883156dfc8d24084d5bcd4c.zip |
- Fix handling of "@comment @cwd" so it does not reset real @cwd; only
change the cwd for commented lines (such as %%OPTION%%file). Reset it
back to the normal on the first non-commented line.
- Sort files after stripping out @comment
With hat: portmgr
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/Scripts/check-stagedir.sh | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/Mk/Scripts/check-stagedir.sh b/Mk/Scripts/check-stagedir.sh index f9b23aa1bb71..8ad3a11007f1 100644 --- a/Mk/Scripts/check-stagedir.sh +++ b/Mk/Scripts/check-stagedir.sh @@ -63,6 +63,8 @@ if [ $makeplist = 0 ] ; then echo "===> Checking for items in STAGEDIR missing from pkg-plist" cwd=${PREFIX} + cwd_save= + commented_cwd= while read line; do # Handle deactivated OPTIONS. Treat "@comment file" as being in # the plist so it does not show up as an orphan. PLIST_SUB uses @@ -75,6 +77,19 @@ if [ $makeplist = 0 ] ; then # but later prepend it again to create a list of # all files commented and uncommented. comment="@comment " + # Only consider comment @cwd for commented lines + if [ -n "${commented_cwd}" ]; then + [ -z "${cwd_save}" ] && cwd_save=${cwd} + cwd=${commented_cwd} + fi + else + # On first uncommented line, forget about commented + # @cwd + if [ -n "${cwd_save}" ]; then + cwd=${cwd_save} + cwd_save= + commented_cwd= + fi fi case $line in @@ -107,29 +122,44 @@ if [ $makeplist = 0 ] ; then # order matters here - we must check @cwd first because # otherwise the @cwd* would also match it first, shadowing the # @cwd) line. - @cwd|@cd) cwd=${PREFIX} ;; + @cwd|@cd) + # Don't actually reset cwd for commented @cwd + if [ -n "${comment}" ]; then + commented_cwd=${PREFIX} + else + cwd=${PREFIX} + fi + ;; @cwd*|@cd*) set -- $line - cwd=$2 + newcwd=$2 # Don't set cwd=/ as it causes // in plist and # won't match later. - [ "${cwd}" = "/" ] && cwd= + [ "${newcwd}" = "/" ] && newcwd= + # Don't actually reset cwd for commented @cwd + if [ -n "${comment}" ]; then + commented_cwd=${newcwd} + else + cwd=${newcwd} + fi + unset newcwd ;; @*) ;; /*) echo "${comment}${line}" ;; *) echo "${comment}${cwd}/${line}" ;; esac - done < ${TMPPLIST} 3>${WRKDIR}/.plist-dirs-unsorted | \ - sort >${WRKDIR}/.plist-files + done < ${TMPPLIST} 3>${WRKDIR}/.plist-dirs-unsorted \ + >${WRKDIR}/.plist-files-unsorted unset TMPPLIST # Create the -no-comments files and trim out @comment from the plists. # This is used for various tests later. sed -e '/^@comment/d' ${WRKDIR}/.plist-dirs-unsorted \ >${WRKDIR}/.plist-dirs-unsorted-no-comments sed -i '' -e 's/^@comment //' ${WRKDIR}/.plist-dirs-unsorted - sed -e '/^@comment/d' ${WRKDIR}/.plist-files \ + sed -e '/^@comment/d' ${WRKDIR}/.plist-files-unsorted | sort \ >${WRKDIR}/.plist-files-no-comments - sed -i '' -e 's/^@comment //' ${WRKDIR}/.plist-files + sed -e 's/^@comment //' ${WRKDIR}/.plist-files-unsorted | sort \ + >${WRKDIR}/.plist-files else # generate plist - pretend the plist had been empty : >${WRKDIR}/.plist-dirs-unsorted |