Merged from trunk 5265:5270
authorFabian Groffen <grobian@gentoo.org>
Mon, 11 Dec 2006 19:42:42 +0000 (19:42 -0000)
committerFabian Groffen <grobian@gentoo.org>
Mon, 11 Dec 2006 19:42:42 +0000 (19:42 -0000)
Ignore blockers when "--buildpkgonly" is enabled.

Ensure that the root of the vdb exists before attempting to lock it.
Thanks to Flameeyes for reporting.

When there are multiple packages occupying the same slot, only consider
the one with the highest COUNTER.  Thanks to leio for reporting.

For bug #157823, don't forget to split the USE.

svn path=/main/branches/prefix/; revision=5271

bin/emerge
pym/portage.py

index 6d744fe12e042df78322f5826aada0469327121c..af26bbb0150c865de5c1555a617394dcb4d8f3e4 100755 (executable)
@@ -716,15 +716,33 @@ class FakeVartree(portage.vartree):
                self.settings = real_vartree.settings
                self.dbapi = portage.fakedbapi(settings=real_vartree.settings)
                vdb_path = os.path.join(self.root, portage.VDB_PATH)
+               try:
+                       # At least the parent needs to exist for the lock file.
+                       portage_util.ensure_dirs(vdb_path)
+               except portage_exception.PortageException:
+                       pass
                vdb_lock = None
                try:
                        if os.access(vdb_path, os.W_OK):
                                vdb_lock = portage_locks.lockdir(vdb_path)
-                       mykeys = ["SLOT", "PROVIDE", "USE", "IUSE",
+                       mykeys = ["SLOT", "COUNTER", "PROVIDE", "USE", "IUSE",
                                "DEPEND", "RDEPEND", "PDEPEND"]
                        real_dbapi = real_vartree.dbapi
+                       slot_counters = {}
                        for cpv in real_dbapi.cpv_all():
                                metadata = dict(izip(mykeys, real_dbapi.aux_get(cpv, mykeys)))
+                               myslot = metadata["SLOT"]
+                               mycp = portage.dep_getkey(cpv)
+                               myslot_atom = "%s:%s" % (mycp, myslot)
+                               try:
+                                       mycounter = long(metadata["COUNTER"])
+                               except ValueError:
+                                       mycounter = 0
+                               other_counter = slot_counters.get(myslot_atom, None)
+                               if other_counter is not None:
+                                       if other_counter > mycounter:
+                                               continue
+                               slot_counters[myslot_atom] = mycounter
                                self.dbapi.cpv_inject(cpv, metadata=metadata)
                finally:
                        if vdb_lock:
@@ -1439,6 +1457,9 @@ class depgraph:
                correct merge order such that mutually blocking packages are never
                installed simultaneously."""
 
+               if "--buildpkgonly" in self.myopts:
+                       return True
+
                #if "deep" in self.myparams:
                if True:
                        # Pull in blockers from all installed packages that haven't already
@@ -1471,7 +1492,7 @@ class depgraph:
                                                                pkg, vardb, self.global_updates[myroot])
                                                        dep_vals = vardb.aux_get(pkg, dep_keys)
                                                        ptype = "installed"
-                                               myuse = vardb.aux_get(pkg, ["USE"])[0]
+                                               myuse = vardb.aux_get(pkg, ["USE"])[0].split()
                                                depstr = " ".join(dep_vals)
                                                # It is crucial to pass in final_db here in order to
                                                # optimize dep_check calls by eliminating atoms via
@@ -2757,6 +2778,11 @@ def unmerge(settings, myopts, vartree, unmerge_action, unmerge_files,
        xterm_titles = "notitles" not in settings.features
 
        vdb_path = os.path.join(settings["ROOT"], portage.VDB_PATH)
+       try:
+               # At least the parent needs to exist for the lock file.
+               portage_util.ensure_dirs(vdb_path)
+       except portage_exception.PortageException:
+               pass
        vdb_lock = None
        try:
                if os.access(vdb_path, os.W_OK):
index d7678ecc08ec6c6b1ae02e56f33a1b585147bf58..36c7e3f5397d49292dd3b34bea4b1778bfd8a451 100644 (file)
@@ -6208,6 +6208,8 @@ class dblink:
        def lockdb(self):
                if self._lock_vdb:
                        raise AssertionError("Lock already held.")
+               # At least the parent needs to exist for the lock file.
+               portage_util.ensure_dirs(self.dbroot)
                self._lock_vdb = portage_locks.lockdir(self.dbroot)
 
        def unlockdb(self):