Make --depclean treat DEPEND as soft deps instead of forcing the user to have all...
authorZac Medico <zmedico@gentoo.org>
Tue, 17 Oct 2006 02:27:03 +0000 (02:27 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 17 Oct 2006 02:27:03 +0000 (02:27 -0000)
svn path=/main/trunk/; revision=4732

bin/emerge

index 58dd2348e6ee3ffe994ae6c744df7dded4458ada..604b9760141503e00e0a1bc5dd6f4b9b40969ad1 100755 (executable)
@@ -3626,15 +3626,18 @@ def action_depclean(settings, trees, ldpath_mtimes,
        if "--quiet" not in myopts:
                print "\nCalculating dependencies  ",
 
-       remaining_atoms = [(atom, 'world') for atom in worldlist if vardb.match(atom)]
-       remaining_atoms += [(atom, 'system') for atom in syslist if vardb.match(atom)]
+       soft = 0
+       hard = 1
+       remaining_atoms = [(atom, 'world', hard) for atom in worldlist if vardb.match(atom)]
+       remaining_atoms += [(atom, 'system', hard) for atom in syslist if vardb.match(atom)]
        unresolveable = {}
+       aux_keys = ["DEPEND", "RDEPEND", "PDEPEND"]
 
        while remaining_atoms:
-               atom, parent = remaining_atoms.pop()
+               atom, parent, priority = remaining_atoms.pop()
                pkgs = vardb.match(atom)
                if not pkgs:
-                       if not atom.startswith("!"):
+                       if not atom.startswith("!") and priority == hard:
                                if atom in unresolveable:
                                        unresolveable[atom].append(parent)
                                else:
@@ -3648,22 +3651,23 @@ def action_depclean(settings, trees, ldpath_mtimes,
                        spinner.update()
                        fakedb.cpv_inject(pkg)
                        mydb = portdb.xmatch("match-visible", "="+pkg) and portdb or vardb
+                       myaux = dict(zip(aux_keys, mydb.aux_get(pkg, aux_keys)))
+                       mydeps = []
                        if myopts.get("--with-bdeps", "y") == "y":
-                               depstr = " ".join(mydb.aux_get(pkg,
-                                       ["DEPEND", "RDEPEND", "PDEPEND"]))
-                       else:
-                               depstr = " ".join(mydb.aux_get(pkg,
-                                       ["RDEPEND", "PDEPEND"]))
+                               mydeps.append((myaux["DEPEND"], soft))
+                       del myaux["DEPEND"]
+                       mydeps.append((" ".join(myaux.values()), hard))
                        usedef = vardb.aux_get(pkg, ["USE"])[0].split()
-                       success, atoms = portage.dep_check(depstr, emptydb, settings,
-                               myuse=usedef, trees=trees, myroot=settings["ROOT"])
-                       if not success:
-                               print "\n\n"
-                               print "Error occurred while processing",pkg
-                               print str(atoms)
-                               return
-                       for atom in atoms:
-                               remaining_atoms.append((atom, pkg))
+                       for depstr, priority in mydeps:
+                               success, atoms = portage.dep_check(depstr, emptydb, settings,
+                                       myuse=usedef, trees=trees, myroot=settings["ROOT"])
+                               if not success:
+                                       print "\n\n"
+                                       print "Error occurred while processing",pkg
+                                       print str(atoms)
+                                       return
+                               for atom in atoms:
+                                       remaining_atoms.append((atom, pkg, priority))
 
        if "--quiet" not in myopts:
                print "\b\b... done!\n"