In order to properly preserve --jobs and --load-average settings for --resume
authorZac Medico <zmedico@gentoo.org>
Thu, 7 Aug 2008 14:00:24 +0000 (14:00 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 7 Aug 2008 14:00:24 +0000 (14:00 -0000)
operations, store resume options in the mtimedb as a dict instead of a list.
The dict type is supported in >=portage-2.1.3_rc8 (2.1.4.4 is current stable)
so people switching between stable/unstable will be fine.

svn path=/main/trunk/; revision=11343

pym/_emerge/__init__.py

index a0c7c73785b6cf2853128251d55d588cab953b71..b72f964a4e7ed3f4f64d1b9b3585e3986c288fd8 100644 (file)
@@ -12450,6 +12450,10 @@ def action_build(settings, trees, mtimedb,
                for opt in ("--skipfirst", "--ask", "--tree"):
                        resume_opts.pop(opt, None)
                myopts.update(resume_opts)
+
+               if "--debug" in myopts:
+                       writemsg_level("myopts %s\n" % (myopts,))
+
                # Adjust config according to options of the command being resumed.
                for myroot in trees:
                        mysettings =  trees[myroot]["vartree"].settings
@@ -12779,9 +12783,10 @@ def action_build(settings, trees, mtimedb,
                                del mtimedb["resume"]
                                mtimedb.commit()
                        mtimedb["resume"]={}
-                       # XXX: Stored as a list for backward compatibility.
-                       mtimedb["resume"]["myopts"] = \
-                               [k for k in myopts if myopts[k] is True]
+                       # Stored as a dict starting with portage-2.2_rc7, and supported
+                       # by >=portage-2.1.3_rc8. Versions <portage-2.1.3_rc8 only support
+                       # a list type for options.
+                       mtimedb["resume"]["myopts"] = myopts.copy()
 
                        # Convert Atom instances to plain str since the mtimedb loader
                        # sets unpickler.find_global = None which causes unpickler.load()