Only generate KV when setting up the environment for a real ebuild phase. This
should preven "Permission Denied: /usr/src/linux/.config" errors reported
by repoman users (repoman may trigger the error when it calls the fetch phase).

svn path=/main/trunk/; revision=13580
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index e185310..7eff357 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -5411,7 +5411,10 @@
 		mysettings["PORTAGE_BUILDDIR"], ".exit_status")
 
 	#set up KV variable -- DEP SPEEDUP :: Don't waste time. Keep var persistent.
-	if mydo != "depend" and "KV" not in mysettings:
+	if mydo != 'depend' and 'KV' not in mysettings and \
+		mydo in ('compile', 'config', 'configure', 'info',
+		'install', 'nofetch', 'postinst', 'postrm', 'preinst',
+		'prepare', 'prerm', 'setup', 'test', 'unpack'):
 		mykv,err1=ExtractKernelVersion(os.path.join(myroot, "usr/src/linux"))
 		if mykv:
 			# Regular source tree