Subject: pkg/9888: "make print-pkg-size" is broken on some package.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <taca@sky.yamashina.kyoto.jp>
List: netbsd-bugs
Date: 04/14/2000 20:26:15
>Number:         9888
>Category:       pkg
>Synopsis:       "make print-pkg-size" is broken on some package.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 14 20:27:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Takahiro Kambe
>Release:        NetBSD-current 2000/4/12
>Organization:
	
>Environment:
	
System: NetBSD land.sky.yamashina.kyoto.jp 1.4X NetBSD 1.4X (LAND) #13: Thu Apr 13 08:18:58 JST 2000 taca@land.sky.yamashina.kyoto.jp:/usr/src/sys/arch/i386/compile/LAND i386


>Description:
	"make print-pkg-size" is broken on some package which contains "@cwd"
	in the PLIST file.  Current print-pkg-size assume all files in PLIST
	is under /usr/pkg.
>How-To-Repeat:
	# cd /usr/pkgsrc/japanese/canna-lib
	# make package
>Fix:
	Instead of using sed(1), I changed using awk(1) to remember base
	directory.  Some sed(1) hacker could be done with sed(1).  :-)


--- mk/bsd.pkg.mk.orig	Fri Apr 14 14:47:12 2000
+++ mk/bsd.pkg.mk	Sat Apr 15 12:20:09 2000
@@ -2562,9 +2562,10 @@
 print-pkg-size:
 	${_PKG_SILENT}${_PKG_DEBUG}(					\
 	${SHCOMMENT} "This pkg's files" ;				\
-	${SED} -n							\
-		-e 's,^[^@],${PREFIX}/&,'				\
-		-e '/^\//p'						\
+	${AWK} 'BEGIN { base = "${PREFIX}" }				\
+		/^@cwd/ { base = $$2 "/" }				\
+		/^@ignore/ { next }					\
+		NF == 1 { print base $$1 }'				\
 		<${PLIST} ;						\
 	${SHCOMMENT} "Any depending pkgs' files" ;			\
 	if [ "${SIZEDEPENDS}" != "" ]; then 				\

>Release-Note:
>Audit-Trail:
>Unformatted: