ports/112765: [patch] Speed improvements for package registration (about 30 times faster dependency computing)

Alexander Leidinger netchild at FreeBSD.org
Fri May 18 15:00:15 UTC 2007


>Number:         112765
>Category:       ports
>Synopsis:       [patch] Speed improvements for package registration (about 30 times faster dependency computing)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 18 15:00:14 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Alexander Leidinger
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
FreeBSD 
>Environment:


System: FreeBSD 7.0-CURRENT #249: Tue Apr 24 10:56:32 CEST 2007
    root at Magellan.Leidinger.net:/usr/src/sys/i386/compile/WORK



>Description:


Based upon a patch from Stephen (CCed) and a hint from rdivacky, I produced a patch which 
 - changes the package registration (package-depends) from pkgnames/dependencies in the ports collection to pkgnames/dependencies as installed on the current system (actual-package-depends)
 - speeds up the process from about 2min 30sec to about 5sec for gnome2 on my system

Depending on the config options used to install a system, the output of package-depends is different from actual-package-depends. This is intended and there should be no change for a stock run on the ports build cluster.


>How-To-Repeat:





>Fix:


--- bsd.port.mk.diff begins here ---
--- Mk/bsd.port.mk	Sat Apr  7 14:51:47 2007
+++ Mk/bsd.port.mk	Fri May 18 11:36:58 2007
@@ -692,8 +692,16 @@
 #				- Show all directories which are build-dependencies
 #				  for this port.
 # package-depends-list
-#				- Show all directories which are
-#				  package-dependencies for this port.
+#				- Show all directories which are package-dependencies
+#				  for this port. This is based upon the dependency
+#				  tree as recorded in the Makefiles of the ports
+#				  collection, not as recorded in the currently
+#				  installed ports.
+# actual-package-depends-list
+#				- Like package-depends-list but with the difference
+#				  that the dependencies of the currently installed
+#				  ports are used instead of the dependencies as
+#				  recorded in the ports collection.
 # run-depends-list
 #				- Show all directories which are run-dependencies
 #				  for this port.
@@ -2321,7 +2329,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
@@ -5145,16 +5153,45 @@
 				shift 3; \
 			done; \
 			checked="$$dir $$childdir $$checked"; \
-		else \\
+		else \
 			${ECHO_MSG} "${PKGNAME}: \"$$dir\" non-existent -- dependency list incomplete" >&2; \
 		fi; \
 	done
 
+ACTUAL-PACKAGE-DEPENDS?= \
+	if [ "${_LIB_RUN_DEPENDS}" != "  " ]; then \
+		origins=$$(for pkgname in ${PKG_DBDIR}/*; do \
+			if [ -e $$pkgname/+CONTENTS ]; then \
+				${ECHO_CMD} $${pkgname\#\#*/}; \
+				${SED} -n -e "s/@comment ORIGIN://p" $$pkgname/+CONTENTS; \
+			fi; \
+		done); \
+		for dir in ${_LIB_RUN_DEPENDS:C,[^:]*:([^:]*):?.*,\1,}; do \
+			tmp=$${dir%/*}; \
+			dir=$${tmp\#\#*/}/$${dir\#\#*/}; \
+			set -- $$origins; \
+			while [ $$\# != 0 ]; do \
+				if [ $$dir = $$2 ]; then \
+					${ECHO_CMD} $$1:$$dir; \
+					if [ -e ${PKG_DBDIR}/$$1/+CONTENTS ]; then \
+						packagelist="$$packagelist ${PKG_DBDIR}/$$1/+CONTENTS"; \
+					fi; \
+					break; \
+				fi; \
+				shift 2; \
+			done; \
+		done; \
+		[ -z "$$packagelist" ] || ${AWK} -F '( |:)' 'BEGIN { pkgname="broken_contents" } /@pkgdep / { pkgname=$$2 } /@comment DEPORIGIN:/ { printf "%s:%s\n", pkgname, $$3; pkgname="broken_contents" }' $$packagelist; \
+	fi
+
 # 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
 
 package-recursive: package
--- bsd.port.mk.diff ends here ---



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



More information about the freebsd-ports-bugs mailing list