Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Apr 2014 23:28:27 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r351888 - head/Mk/Scripts
Message-ID:  <201404222328.s3MNSR96090531@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Tue Apr 22 23:28:27 2014
New Revision: 351888
URL: http://svnweb.freebsd.org/changeset/ports/351888
QAT: https://qat.redports.org/buildarchive/r351888/

Log:
  - 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

Modified:
  head/Mk/Scripts/check-stagedir.sh

Modified: head/Mk/Scripts/check-stagedir.sh
==============================================================================
--- head/Mk/Scripts/check-stagedir.sh	Tue Apr 22 23:00:01 2014	(r351887)
+++ head/Mk/Scripts/check-stagedir.sh	Tue Apr 22 23:28:27 2014	(r351888)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404222328.s3MNSR96090531>