Subject: A proposed fix for print-pkg-size-depends-help
To: Hubert Feyrer <hubert.feyrer@informatik.fh-regensburg.de>
From: Frederick Bruckman <fb@enteract.com>
List: tech-pkg
Date: 10/10/2000 15:14:02
Besides fixing the problem of feeding garbage to "dc", the following
patch 1) eliminates a ".for" loop -- make ".for" loops are evil, and
2) doesn't count dependencies twice, for big packages which depend on
the same package twice with a different wildcard, say both png>=1.0.3
and png-1.0.8.

I haven't actually tested this, much. Please review.

Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.582
diff -c -r1.582 bsd.pkg.mk
*** bsd.pkg.mk	2000/10/08 13:59:10	1.582
--- bsd.pkg.mk	2000/10/10 20:13:12
***************
*** 2900,2912 ****
  # need this in a make look to prevent the shell clobbering the depends
  # also includes size of depends of depends (XXX)
  print-pkg-size-depends-help:
! 	@${ECHO} "0"
! .for dep in ${DEPENDS}
! 	@pkg="${dep:C/:.*//}";						\
! 	size=`${PKG_INFO} -qS "$$pkg"`;					\
! 	${TEST} -z "$$size" || ${ECHO} "$$size +"
! .endfor
! 	@${ECHO} "p"
  
  
  ###
--- 2900,2913 ----
  # need this in a make look to prevent the shell clobbering the depends
  # also includes size of depends of depends (XXX)
  print-pkg-size-depends-help:
! 	@${ECHO} "${DEPENDS:C/:.*//:C/>=.*//:C/-[0-9].*//}"		\
! 	| xargs -n 1 ${ECHO}						\
! 	| sort -u							\
! 	| xargs -n 1 ${SETENV} ${PKG_INFO} -qS				\
! 	| ${GREP} "[0-9].*"						\
! 	| ${AWK} 'BEGIN { print("0 "); }				\
! 		  { print($$1, " + "); }				\
! 		  END { print("p"); }'
  
  
  ###