Time to abandon recursive pulling of dependencies?

Stephen Montgomery-Smith stephen at math.missouri.edu
Mon May 14 14:39:18 UTC 2007


[LoN]Kamikaze wrote:
> Stephen Montgomery-Smith wrote:
>> Basically I think we are stuck on making "make package-depends" go any
>> faster.
>>
>> However I do think that the modifications I made to pkg_create go a very
>> significant way to solving the problem of registration taking so very long.
>>
>> Stephen
>>
> 
> You are right about invoking make being the problem. However, I was able to
> increase the performance of package-depends by 20 to 30 percent, by avoiding
> recursive make calls and moving the recursion into the stack of the shell
> invocation.
> 
> With my changes there's less than 10% overhead over the sum of make calls. I.e.
>  for 56 seconds of make calls (x11/xorg on my system) there are only 4 more
> seconds of processing, instead of 15 to 20 seconds.
> 
> The original make package-depends does some things I don't understand. Once
> I've figured them out I will post my little patch here.
> 
> 


Someone pointed out that what I was proposing in +DEPENDENCIES is 
already to be found in +CONTENTS.  So here is a proof of concept patch 
to /usr/ports/Mk/bsd.port.mk (proof of concept because no error 
checking, and things like that).

For me it makes registration about 3 times faster.


-------------- next part --------------
--- bsd.port.mk-orig	Mon May 14 09:28:42 2007
+++ bsd.port.mk	Mon May 14 09:33:39 2007
@@ -2387,7 +2387,7 @@
 DISABLE_CONFLICTS=	YES
 .endif
 .if !defined(PKG_ARGS)
-PKG_ARGS=		-v -c -${COMMENT:Q} -d ${DESCR} -f ${TMPPLIST} -p ${PREFIX} -P "`cd ${.CURDIR} && ${MAKE} package-depends | ${GREP} -v -E ${PKG_IGNORE_DEPENDS} | ${SORT} -u`" ${EXTRA_PKG_ARGS} $${_LATE_PKG_ARGS}
+PKG_ARGS=		-v -c -${COMMENT:Q} -d ${DESCR} -f ${TMPPLIST} -p ${PREFIX} -P "`cd ${.CURDIR} && ${MAKE} actual-package-depends | ${GREP} -v -E ${PKG_IGNORE_DEPENDS} | ${SORT} -u`" ${EXTRA_PKG_ARGS} $${_LATE_PKG_ARGS}
 .if !defined(NO_MTREE)
 PKG_ARGS+=		-m ${MTREE_FILE}
 .endif
@@ -5216,10 +5216,26 @@
 		fi; \
 	done
 
+ACTUAL-PACKAGE-DEPENDS?= \
+	pkgs=`(for dir in ${_LIB_RUN_DEPENDS:C,[^:]*:([^:]*):?.*,\1,}; do \
+		dir=$$(${REALPATH} $$dir); \
+		if [ -d $$dir ]; then \
+			pkgname=$$(cd $$dir; ${MAKE} -V PKGNAME); \
+			${ECHO_CMD} $$pkgname; \
+			${GREP} @pkgdep /var/db/pkg/$$pkgname/+CONTENTS | ${SED} "s/@pkgdep //"; \
+		fi; \
+	done) | sort -u`; \
+	for pkgname in $$pkgs; do \
+		${ECHO_CMD} $$pkgname`${GREP} "@comment ORIGIN:" /var/db/pkg/$$pkgname/+CONTENTS | ${SED} "s/@comment ORIGIN//"`; \
+	done
+
 # Print out package names.
 
 package-depends:
 	@${PACKAGE-DEPENDS-LIST} | ${AWK} '{print $$1":"$$3}'
+
+actual-package-depends:
+	@${ACTUAL-PACKAGE-DEPENDS}
 
 # Build packages for port and dependencies
 


More information about the freebsd-ports mailing list