Merged from trunk 6152:6169
authorFabian Groffen <grobian@gentoo.org>
Sun, 4 Mar 2007 15:04:17 +0000 (15:04 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sun, 4 Mar 2007 15:04:17 +0000 (15:04 -0000)
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

bin/emerge
pym/emerge/__init__.py
pym/portage/__init__.py
pym/portage/locks.py
pym/portage/news.py

index 1a5a5fbc480b2ae2fd5286e373f1e13c6a6851c6..74262f11c92b618a31ad3c96beab99721acefb91 100755 (executable)
@@ -1,4 +1,7 @@
 #!@PYTHON@
+# Copyright Gentoo Foundation 2006
+# Portage Emerge bits
+# $Id$
 
 try:
        from emerge import *
index 4307097b3393d5d231e6fd03f03ba09dc9539376..9f2434159f177160d4d359e8a5a6223cf3e77df9 100644 (file)
@@ -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
 
index 7b46f7cfda3f165772b6812f2a273851ed51ae0b..de8d0be9178777ad3bfe2f33562e6ee586b0badf 100644 (file)
@@ -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"):
index aad68257413e70eb3dc8c6a72cc3ae367742780b..1647d20583fb54796482c3cef8f0de7bacee39d6 100644 (file)
@@ -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)
index 0f8c16da6c20dda2a1384660a99353057ea13d78..6cac55feec5e5739aee81e98a8e171cb53dcea03 100644 (file)
@@ -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" )