Add a --backtrack=COUNT option to control how many times backtracking is
authorZac Medico <zmedico@gentoo.org>
Sat, 31 Oct 2009 23:35:48 +0000 (23:35 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 31 Oct 2009 23:35:48 +0000 (23:35 -0000)
allowed, and reduce the default from 30 to 5. (trunk r14763)

svn path=/main/branches/2.1.7/; revision=14766

man/emerge.1
pym/_emerge/depgraph.py
pym/_emerge/help.py
pym/_emerge/main.py

index 81bcf1bbf0a68ab1d4fd8edbd7938d36399104a0..bb3234d17e0ba9233f9a28d00c6bd38d1cd62417 100644 (file)
@@ -269,6 +269,11 @@ acceptance of the first choice. This option is
 intended to be set in the \fBmake.conf\fR(5)
 \fBEMERGE_DEFAULT_OPTS\fR variable.
 .TP
+.BR \-\-backtrack=COUNT
+Specifies an integer number of times to backtrack if
+dependency calculation fails due to a conflict or an
+unsatisfied dependency (default: \'5\').
+.TP
 .BR "\-\-binpkg\-respect\-use < y | n >"
 Tells emerge to ignore binary packages if their use flags
 don't match the current configuration. (default: \'n\')
index 6d9a30daf3f2e202b5a7fef04c9e77b327354e61..2b2c0c62fac5a164eff0c0f91960cd70cd4b7a9d 100644 (file)
@@ -5329,7 +5329,7 @@ def backtrack_depgraph(settings, trees, myopts, myparams,
 def _backtrack_depgraph(settings, trees, myopts, myparams, 
        myaction, myfiles, spinner):
 
-       backtrack_max = 30
+       backtrack_max = myopts.get('backtrack', 5)
        runtime_pkg_mask = None
        allow_backtracking = True
        backtracked = 0
index 54caa22c4d0ede2610fa93c2d0323c8b27f3b594..aae3bab2242bb2fe16b8e6b4e1547cd3e26c0494 100644 (file)
@@ -276,6 +276,13 @@ def help(myopts, havecolor=1):
                for line in wrap(desc, desc_width):
                        print(desc_indent + line)
                print()
+               print("       " + green("--backtrack") + " " + turquoise("COUNT"))
+               desc = "Specifies an integer number of times to backtrack if " + \
+                       "dependency calculation fails due to a conflict or an " + \
+                       "unsatisfied dependency (default: '5')."
+               for line in wrap(desc, desc_width):
+                       print(desc_indent + line)
+               print()
                print("        " + green("--binpkg-respect-use") + \
                        " < " + turquoise("y") + " | " + turquoise("n") + " >")
                desc = "Tells emerge to ignore binary packages if their use flags" + \
index 37875cbd20d24d36573a249edf0844e2dbfbeaa8..0ed2604a772b3812503e7af8455bd2ca7988b9b6 100644 (file)
@@ -432,6 +432,15 @@ def parse_opts(tmpcmdline, silent=False):
                        "help":"temporarily override ACCEPT_PROPERTIES",
                        "action":"store"
                },
+
+               "--backtrack": {
+
+                       "help"   : "Specifies how many times to backtrack if dependency " + \
+                               "calculation fails ",
+
+                       "action" : "store"
+               },
+
                "--config-root": {
                        "help":"specify the location for portage configuration files",
                        "action":"store"
@@ -653,6 +662,21 @@ def parse_opts(tmpcmdline, silent=False):
        if myoptions.selective == "True":
                myoptions.selective = True
 
+       if myoptions.backtrack is not None:
+
+               try:
+                       backtrack = int(myoptions.backtrack)
+               except (OverflowError, ValueError):
+                       backtrack = -1
+
+               if backtrack < 0:
+                       backtrack = None
+                       if not silent:
+                               writemsg("!!! Invalid --backtrack parameter: '%s'\n" % \
+                                       (myoptions.backtrack,), noiselevel=-1)
+
+               myoptions.backtrack = backtrack
+
        if myoptions.deep is not None:
                deep = None
                if myoptions.deep == "True":