Subject: Re: 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 22:49:15
On Tue, 10 Oct 2000, Hubert Feyrer wrote:
> On Tue, 10 Oct 2000, Frederick Bruckman wrote:
> > 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.
>
> FYI, I've backed out the last commit. It needs to get more thought, but I
> doubt to have time for that before 1.5.
Another data point: the offending verbosity _does_ _not_ occur with
1.5_ALPHA2. From running diff over the two pkg_install source trees,
it looks like pulling up the latest file.c to netbsd-1-4 would take
care of it, but I haven't tested that yet.
> For the other problem you came up with here, I'd suggest you let
> "pkg_info -e" evaluate the wildcards, instead of trying to do it
> manually (and be bound to fail). After that, you can still "sort
> -u" them.
>
> :C/-[0-9].*// is *definitely* a bad idea, as I had to learn last week.
Sounds like there could be a story there...
The following incorporates your suggestion, and also eliminates a
${GREP}.
Frederick
Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.583
diff -c -r1.583 bsd.pkg.mk
*** bsd.pkg.mk 2000/10/10 20:37:29 1.583
--- bsd.pkg.mk 2000/10/11 03:46:57
***************
*** 636,646 ****
TYPE?= type # Shell builtin
.endif # !SunOS
! PKG_ADD?= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_add
! PKG_ADMIN?= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_admin
! PKG_CREATE?= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_create
! PKG_DELETE?= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_delete
! PKG_INFO?= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_info
.if !defined(PKGTOOLS_VERSION)
.if !exists(${IDENT})
--- 636,646 ----
TYPE?= type # Shell builtin
.endif # !SunOS
! PKG_ADD?= PKG_PATH= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_add
! PKG_ADMIN?= PKG_PATH= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_admin
! PKG_CREATE?= PKG_PATH= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_create
! PKG_DELETE?= PKG_PATH= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_delete
! PKG_INFO?= PKG_PATH= PKG_DBDIR=${PKG_DBDIR} ${PKG_TOOLS_BIN}/pkg_info
.if !defined(PKGTOOLS_VERSION)
.if !exists(${IDENT})
***************
*** 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,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} "${DEPENDS:C/:.*//}" \
! | xargs -n 1 ${SETENV} ${PKG_INFO} -e \
! | sort -u \
! | xargs -n 1 ${SETENV} ${PKG_INFO} -qS \
! | ${AWK} 'BEGIN { print("0 "); } \
! /^[0-9].*/ { print($$1, " + "); } \
! END { print("p"); }'
###