public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r15729 - in main/branches/2.1.7: bin pym/portage
@ 2010-03-03  5:46 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2010-03-03  5:46 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2010-03-03 05:46:45 +0000 (Wed, 03 Mar 2010)
New Revision: 15729

Modified:
   main/branches/2.1.7/bin/fixpackages
   main/branches/2.1.7/pym/portage/_global_updates.py
Log:
Make _global_updates() silently return if ROOT != "/" and make fixpackages
bail out with an error message in this case which suggests to instead use
emaint --fix movebin and/or moveinst. This prevents useless/ugly global
updates messages that flood the terminal when ROOT != "/". (trunk r15728)

Modified: main/branches/2.1.7/bin/fixpackages
===================================================================
--- main/branches/2.1.7/bin/fixpackages	2010-03-03 05:45:47 UTC (rev 15728)
+++ main/branches/2.1.7/bin/fixpackages	2010-03-03 05:46:45 UTC (rev 15729)
@@ -15,11 +15,22 @@
 	import portage
 
 from portage import os
+from portage.output import EOutput
+from textwrap import wrap
 from portage._global_updates import _global_updates
 mysettings = portage.settings
 mytrees = portage.db
 mtimedb = portage.mtimedb
 
+if mysettings['ROOT'] != "/":
+	out = EOutput()
+	msg = "The fixpackages program is not intended for use with " + \
+		"ROOT != \"/\". Instead use `emaint --fix movebin` and/or " + \
+		"`emaint --fix moveinst."
+	for line in wrap(msg, 72):
+		out.eerror(line)
+	sys.exit(1)
+
 try:
 	os.nice(int(mysettings.get("PORTAGE_NICENESS", "0")))
 except (OSError, ValueError) as e:

Modified: main/branches/2.1.7/pym/portage/_global_updates.py
===================================================================
--- main/branches/2.1.7/pym/portage/_global_updates.py	2010-03-03 05:45:47 UTC (rev 15728)
+++ main/branches/2.1.7/pym/portage/_global_updates.py	2010-03-03 05:46:45 UTC (rev 15729)
@@ -18,6 +18,8 @@
 def _global_updates(trees, prev_mtimes):
 	"""
 	Perform new global updates if they exist in $PORTDIR/profiles/updates/.
+	This simply returns if ROOT != "/" (when len(trees) != 1). If ROOT != "/"
+	then the user should instead use emaint --fix movebin and/or moveinst.
 
 	@param trees: A dictionary containing portage trees.
 	@type trees: dict
@@ -30,8 +32,10 @@
 	"""
 	# only do this if we're root and not running repoman/ebuild digest
 
-	if secpass < 2 or "SANDBOX_ACTIVE" in os.environ:
-		return
+	if secpass < 2 or \
+		"SANDBOX_ACTIVE" in os.environ or \
+		len(trees) != 1:
+		return 0
 	root = "/"
 	mysettings = trees["/"]["vartree"].settings
 	updpath = os.path.join(mysettings["PORTDIR"], "profiles", "updates")
@@ -44,7 +48,7 @@
 	except DirectoryNotFound:
 		writemsg(_("--- 'profiles/updates' is empty or "
 			"not available. Empty portage tree?\n"), noiselevel=1)
-		return
+		return 0
 	myupd = None
 	if len(update_data) > 0:
 		do_upgrade_packagesmessage = 0




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

only message in thread, other threads:[~2010-03-03  5:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-03  5:46 [gentoo-commits] portage r15729 - in main/branches/2.1.7: bin pym/portage Zac Medico (zmedico)

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