From: Fabian Groffen Date: Sun, 4 Mar 2007 15:04:17 +0000 (-0000) Subject: Merged from trunk 6152:6169 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=3b53098c60933e7e706f9573e37a93c765a5b256;p=portage.git Merged from trunk 6152:6169 you can't insert into sys.path without importing sys... (WarnerBro) In the same vein as copyright, add Id and svn:keywords to it (WarnerBro) make sure uid is an int (WarnerBro) Pass waiting_msg into recursive lockfile() calls. Only prune duplicate consecutive nodes if they both have depth == 0. For bug #169187, make --depclean prune unneeded slots such that it is consistent with the world update algorithm. Add a note about --with-bdeps in the --depclean failure message. Fix the minimum index for pruning consecutive duplicate nodes. Remove the KVERS environment variable since it's code that creates it is broken anyway (only sets KVERS="." in the general case). Display blockers at the end of the list so that it will more often be easy for the user to see them in a terminal. Thanks to iapitus and hydrogen for the suggestion. svn path=/main/branches/prefix/; revision=6172 --- diff --git a/bin/emerge b/bin/emerge index 1a5a5fbc4..74262f11c 100755 --- a/bin/emerge +++ b/bin/emerge @@ -1,4 +1,7 @@ #!@PYTHON@ +# Copyright Gentoo Foundation 2006 +# Portage Emerge bits +# $Id$ try: from emerge import * diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py index 4307097b3..9f2434159 100644 --- a/pym/emerge/__init__.py +++ b/pym/emerge/__init__.py @@ -2256,6 +2256,7 @@ class depgraph: "--verbose" in self.myopts and 3 or 2) changelogs=[] p=[] + blockers = [] counters = PackageCounters() @@ -2385,8 +2386,9 @@ class depgraph: last_merge_depth = 0 for i in xrange(len(mylist)-1,-1,-1): graph_key, depth, ordered = mylist[i] - if not ordered and depth == 0 and i > 1 \ - and graph_key == mylist[i-1][0]: + if not ordered and depth == 0 and i > 0 \ + and graph_key == mylist[i-1][0] and \ + mylist[i-1][1] == 0: # An ordered node got a consecutive duplicate when the tree was # being filled in. del mylist[i] @@ -2425,17 +2427,18 @@ class depgraph: resolved = portage.key_expand( pkg_key, mydb=vardb, settings=pkgsettings) if "--columns" in self.myopts and "--quiet" in self.myopts: - print addl,red(resolved), + addl = addl + " " + red(resolved) else: - print "["+x[0]+" "+addl+"]",red(resolved), + addl = "[blocks " + addl + "] " + red(resolved) block_parents = self.blocker_parents[tuple(x)] block_parents = set([pnode[2] for pnode in block_parents]) block_parents = ", ".join(block_parents) if resolved!=x[2]: - print bad("(\"%s\" is blocking %s)") % \ + addl += bad(" (\"%s\" is blocking %s)") % \ (pkg_key, block_parents) else: - print bad("(is blocking %s)") % block_parents + addl += bad(" (is blocking %s)") % block_parents + blockers.append(addl) else: mydbapi = self.trees[myroot][self.pkg_tree_map[pkg_type]].dbapi binary_package = True @@ -2729,6 +2732,8 @@ class depgraph: for x in p: print x + for x in blockers: + print x if verbosity == 3: print @@ -4705,6 +4710,8 @@ def action_depclean(settings, trees, ldpath_mtimes, dep_check_trees[myroot]["porttree"] = dep_check_trees[myroot]["vartree"] syslist = getlist(settings, "system") worldlist = getlist(settings, "world") + system_world_dict = genericdict(worldlist) + system_world_dict.update(genericdict(syslist)) fakedb = portage.fakedbapi(settings=settings) myvarlist = vardb.cpv_all() @@ -4741,8 +4748,12 @@ def action_depclean(settings, trees, ldpath_mtimes, if not atom.startswith("!") and priority == hard: unresolveable.setdefault(atom, []).append(parent) continue - # Could put slot checking here to ensure that there aren't two - # packages with the same slot... + if portage.dep_getkey(atom) not in system_world_dict: + # Prune all but the best matching slot, since that's all that a + # deep world update would pull in. Don't prune if the cpv is in + # system or world though, since those sets trigger greedy update + # of all slots. + pkgs = [portage.best(pkgs)] for pkg in pkgs: if fakedb.cpv_exists(pkg): continue @@ -4799,9 +4810,10 @@ def action_depclean(settings, trees, ldpath_mtimes, print atom, "required by", " ".join(unresolveable[atom]) print print "Have you forgotten to run " + good("`emerge --update --newuse --deep world`") + " prior to" - print "depclean? It may also be necessary to manually uninstalled packages that no" - print "longer exist in the portage tree since it may not be possible to satisfy their" - print "dependencies." + print "depclean? It may be necessary to manually uninstall packages that no longer" + print "exist in the portage tree since it may not be possible to satisfy their" + print "dependencies. Also, be aware of the --with-bdeps option that is documented" + print "in " + good("`man emerge`") + "." print return diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 7b46f7cfd..de8d0be91 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -3000,10 +3000,6 @@ def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, m else: mysettings["KV"]="" - if (mydo!="depend") or not mysettings.has_key("KVERS"): - myso=os.uname()[2] - mysettings["KVERS"]=myso[1] - # Allow color.map to control colors associated with einfo, ewarn, etc... mycolors = [] for c in ("GOOD", "WARN", "BAD", "HILITE", "BRACKET"): diff --git a/pym/portage/locks.py b/pym/portage/locks.py index aad682574..1647d2058 100644 --- a/pym/portage/locks.py +++ b/pym/portage/locks.py @@ -54,7 +54,8 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, waiting_msg=None): os.chown(lockfilename,os.getuid(),portage_gid) except OSError, e: if e[0] == 2: # No such file or directory - return lockfile(mypath,wantnewlockfile,unlinkfile) + return lockfile(mypath, wantnewlockfile=wantnewlockfile, + unlinkfile=unlinkfile, waiting_msg=waiting_msg) else: writemsg("Cannot chown a lockfile. This could cause inconvenience later.\n"); os.umask(old_mask) @@ -111,7 +112,9 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, waiting_msg=None): # The file was deleted on us... Keep trying to make one... os.close(myfd) writemsg("lockfile recurse\n",1) - lockfilename,myfd,unlinkfile,locking_method = lockfile(mypath,wantnewlockfile,unlinkfile) + lockfilename, myfd, unlinkfile, locking_method = lockfile( + mypath, wantnewlockfile=wantnewlockfile, unlinkfile=unlinkfile, + waiting_msg=waiting_msg) writemsg(str((lockfilename,myfd,unlinkfile))+"\n",1) return (lockfilename,myfd,unlinkfile,locking_method) diff --git a/pym/portage/news.py b/pym/portage/news.py index 0f8c16da6..6cac55fee 100644 --- a/pym/portage/news.py +++ b/pym/portage/news.py @@ -58,7 +58,7 @@ class NewsManager(object): if os.path.exists(timestamp_file): # Make sure the timestamp has correct permissions. apply_permissions( filename=timestamp_file, - uid=self.config["PORTAGE_INST_UID"], gid=portage_gid, mode=664 ) + uid=int(self.config["PORTAGE_INST_UID"]), gid=portage_gid, mode=664 ) timestamp = os.stat(timestamp_file).st_mtime else: timestamp = 0 @@ -96,7 +96,7 @@ class NewsManager(object): open( path, "w" ) # Ensure correct perms on the unread file. apply_permissions( filename=path, - uid=self.config["PORTAGE_INST_UID"], gid=portage_gid, mode=664 ) + uid=int(self.config["PORTAGE_INST_UID"]), gid=portage_gid, mode=664 ) # Make sure we have the correct permissions when created unread_file = open( path, "a" )