public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoolkit r697 - in trunk/gentoolkit: . bin
@ 2009-10-30 14:02 Christian Ruppert (idl0r)
  0 siblings, 0 replies; only message in thread
From: Christian Ruppert (idl0r) @ 2009-10-30 14:02 UTC (permalink / raw
  To: gentoo-commits

Author: idl0r
Date: 2009-10-30 14:02:08 +0000 (Fri, 30 Oct 2009)
New Revision: 697

Modified:
   trunk/gentoolkit/ChangeLog
   trunk/gentoolkit/bin/revdep-rebuild
Log:
Speedup portageq queries. Include FuzzyRay's patch to respect EMERGE_DEFAULT_OPTS.


Modified: trunk/gentoolkit/ChangeLog
===================================================================
--- trunk/gentoolkit/ChangeLog	2009-10-28 20:48:11 UTC (rev 696)
+++ trunk/gentoolkit/ChangeLog	2009-10-30 14:02:08 UTC (rev 697)
@@ -1,3 +1,7 @@
+2009-10-30: Christian Ruppert <idl0r@gentoo.org>
+	* revdep-rebuild: Speedup portageq queries. Include FuzzyRay's patch to
+		respect EMERGE_DEFAULT_OPTS.
+
 2009-10-27: Christian Ruppert <idl0r@gentoo.org>
 	* revdep-rebuild: Use realpath in get_file_owner to be able to get the
 		package containing e.g. /lib/libreadline.so.6 on amd64, fixes bug 280341.

Modified: trunk/gentoolkit/bin/revdep-rebuild
===================================================================
--- trunk/gentoolkit/bin/revdep-rebuild	2009-10-28 20:48:11 UTC (rev 696)
+++ trunk/gentoolkit/bin/revdep-rebuild	2009-10-30 14:02:08 UTC (rev 697)
@@ -89,6 +89,7 @@
 
 main() {
 	# preliminary setup
+	portage_settings
 	get_opts "$@"
 	setup_portage
 	setup_search_paths_and_masks
@@ -280,7 +281,6 @@
 setup_color() {
 	# This should still work if NOCOLOR is set by the -C flag or in the user's
 	# environment.
-	export NOCOLOR=$(portageq envvar NOCOLOR)
 	[[ $NOCOLOR = yes || $NOCOLOR = true ]] && export RC_NOCOLOR=yes # HACK! (grr)
 	. /etc/init.d/functions.sh
 }
@@ -971,12 +971,38 @@
 		done < "$OWNERS_FILE" | gawk '!s[$0]++' # (omit dupes)
 	fi
 }
+
+# Get multiple portage variables at once to speedup revdep-rebuild.
+portage_settings() {
+	local results=()
+
+	local query_vars=(
+		ROOT
+		PORTAGE_NICENESS
+		EMERGE_DEFAULT_OPTS
+		NOCOLOR
+		SEARCH_DIRS
+		SEARCH_DIRS_MASK
+		LD_LIBRARY_MASK
+	)
+
+	# one value per line
+	IFS=$'\n'
+	results=( $(unset SEARCH_DIRS; unset SEARCH_DIRS_MASK; unset LD_LIBRARY_MASK; portageq envvar ${query_vars[*]}) )
+	IFS=$OIFS
+
+	PORTAGE_ROOT=${results[0]}
+	PORTAGE_NICENESS=${results[1]}
+	EMERGE_DEFAULT_OPTS=${results[2]}
+	export NOCOLOR=${results[3]}
+	SEARCH_DIRS+=" "${results[4]}
+	SEARCH_DIRS_MASK+=" "${results[5]}
+	LD_LIBRARY_MASK+=" "${results[6]}
+}
+
 ##
 # Setup portage and the search paths
 setup_portage() {
-	local PORTAGE_NICENESS=$(portageq envvar PORTAGE_NICENESS)
-	PORTAGE_ROOT=$(portageq envvar ROOT)
-
 	# Obey PORTAGE_NICENESS
 	if [[ $PORTAGE_NICENESS ]]; then
 		renice $PORTAGE_NICENESS $$ > /dev/null
@@ -1001,9 +1027,9 @@
 	# Read the incremental variables from environment and portage
 	# Until such time as portage supports these variables as incrementals
 	# The value will be what is in /etc/make.conf
-	SEARCH_DIRS+=" "$(unset SEARCH_DIRS; portageq envvar SEARCH_DIRS)
-	SEARCH_DIRS_MASK+=" "$(unset SEARCH_DIRS_MASK; portageq envvar SEARCH_DIRS_MASK)
-	LD_LIBRARY_MASK+=" "$(unset LD_LIBRARY_MASK; portageq envvar LD_LIBRARY_MASK)
+#	SEARCH_DIRS+=" "$(unset SEARCH_DIRS; portageq envvar SEARCH_DIRS)
+#	SEARCH_DIRS_MASK+=" "$(unset SEARCH_DIRS_MASK; portageq envvar SEARCH_DIRS_MASK)
+#	LD_LIBRARY_MASK+=" "$(unset LD_LIBRARY_MASK; portageq envvar LD_LIBRARY_MASK)
 
 	# Add the defaults
 	if [[ -d /etc/revdep-rebuild ]]; then
@@ -1056,7 +1082,7 @@
 	trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
 
 	einfo 'All prepared. Starting rebuild'
-	echo "emerge --oneshot ${EMERGE_OPTIONS[@]} $REBUILD_LIST"
+	echo "emerge --oneshot ${EMERGE_OPTIONS[@]} ${EMERGE_DEFAULT_OPTS} $REBUILD_LIST"
 
 	is_real_merge && countdown 10
 
@@ -1065,7 +1091,7 @@
 
 	# Run in background to correctly handle Ctrl-C
 	{
-		EMERGE_DEFAULT_OPTS="--oneshot ${EMERGE_OPTIONS[@]}" emerge $REBUILD_LIST <&6
+		emerge --oneshot ${EMERGE_OPTIONS[@]} ${EMERGE_DEFAULT_OPTS} $REBUILD_LIST <&6
 		echo $? > "$STATUS_FILE"
 	} &
 	wait




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-10-30 14:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-30 14:02 [gentoo-commits] gentoolkit r697 - in trunk/gentoolkit: . bin Christian Ruppert (idl0r)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox