Allow the --depclean library consumer check to be disabled by
authorZac Medico <zmedico@gentoo.org>
Mon, 26 Jul 2010 09:26:58 +0000 (02:26 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 26 Jul 2010 09:26:58 +0000 (02:26 -0700)
--depclean-lib-check=n.

pym/_emerge/actions.py
pym/_emerge/main.py

index a379af8c4b5ec72bc77dfb5c68a314827e29c5d9..07b3a663050bde338b44793271e60050aedabb7f 100644 (file)
@@ -871,9 +871,9 @@ def calc_depclean(settings, trees, ldpath_mtimes,
                return pkgs_to_remove
 
        cleanlist = create_cleanlist()
+       clean_set = set(cleanlist)
 
-       if len(cleanlist):
-               clean_set = set(cleanlist)
+       if cleanlist and myopts.get('--depclean-lib-check') != 'n':
 
                # Check if any of these package are the sole providers of libraries
                # with consumers that have not been selected for removal. If so, these
@@ -1058,6 +1058,7 @@ def calc_depclean(settings, trees, ldpath_mtimes,
                                return 0, [], False, required_pkgs_total
                        clean_set = set(cleanlist)
 
+       if True:
                # Use a topological sort to create an unmerge order such that
                # each package is unmerged before it's dependencies. This is
                # necessary to avoid breaking things that may need to run
index 4e621d21eb0be5d4e7896f0f36b32fb808625f1d..b553e15e34b19fac69afab87c8fe9e1c07fa6287 100644 (file)
@@ -390,6 +390,7 @@ def insert_optional_args(args):
        default_arg_opts = {
                '--complete-graph' : ('n',),
                '--deep'       : valid_integers,
+               '--depclean-lib-check'   : ('n',),
                '--deselect'   : ('n',),
                '--binpkg-respect-use'   : ('n', 'y',),
                '--fail-clean'           : ('n',),
@@ -554,6 +555,12 @@ def parse_opts(tmpcmdline, silent=False):
                        "action" : "store"
                },
 
+               "--depclean-lib-check": {
+                       "help"    : "check for consumers of libraries before removing them",
+                       "type"    : "choice",
+                       "choices" : ("True", "n")
+               },
+
                "--deselect": {
                        "help"    : "remove atoms/sets from the world file",
                        "type"    : "choice",
@@ -738,6 +745,9 @@ def parse_opts(tmpcmdline, silent=False):
        else:
                myoptions.complete_graph = None
 
+       if myoptions.depclean_lib_check in ("True",):
+               myoptions.depclean_lib_check = True
+
        if myoptions.exclude:
                exclude = []
                bad_atoms = []