Merged from trunk 4946:4959
authorFabian Groffen <grobian@gentoo.org>
Mon, 6 Nov 2006 20:44:34 +0000 (20:44 -0000)
committerFabian Groffen <grobian@gentoo.org>
Mon, 6 Nov 2006 20:44:34 +0000 (20:44 -0000)
Prevent the --newuse check in depgraph.create() that is intended for the
ebuild type from being done on binary packages (which can lead to a
KeyError).  The --newuse check for binaries is elsewhere (in
select_dep).

Ensure that sys-apps/portage is as close as possible to the beginning of
the merge list.  This is accomplished by merging it before any soft
deps that it may have.

Remove "update portage before proceeding" message that is no longer
relevant.

Remove old code the used to bump portage near the top of the merge list.
It's ineffective now that a complete depgraph is built.

Make sure the node is still in the graph so that a KeyError can't
happen.

For bug #154223, bridge new-style virtuals into old-style virtuals in
order to prevent old-style virtuals from making new-style virtuals
invisible.

Make config.add_new_virtuals() work properly even if self.virtuals has
previously been initialized.

For bug #154220, run /etc/portage/bin/post_sync at the end of
emerge-webrsync.

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

bin/emerge
bin/emerge-webrsync
pym/portage.py

index f83f0f51e7e750b7e21508297eabb4c01935615d..2125b3562b701f7d472ab49d9594ff7d06a798d4 100755 (executable)
@@ -722,10 +722,15 @@ class depgraph:
                        self.edebug = 1
                self.spinner = spinner
                self.pkgsettings = {}
-               self.pkgsettings[self.target_root] = portage.config(clone=settings)
-               if self.target_root != "/":
-                       self.pkgsettings["/"] = \
-                               portage.config(clone=trees["/"]["vartree"].settings)
+               for myroot in self.trees:
+                       self.pkgsettings[myroot] = portage.config(
+                               clone=trees[myroot]["vartree"].settings)
+                       mydbapis = []
+                       if "--usepkgonly" not in self.myopts:
+                               mydbapis.append(trees[myroot]["porttree"].dbapi)
+                       if "--usepkg" in self.myopts:
+                               mydbapis.append(trees[myroot]["bintree"].dbapi)
+                       self.pkgsettings[myroot].add_new_virtuals(mydbapis)
                self.useFlags = {}
                self.useFlags[self.target_root] = {}
                if self.target_root != "/":
@@ -842,6 +847,7 @@ class depgraph:
                            If the package has new iuse flags or different use flags then if
                            --newuse is specified, we need to merge the package. """
                        if merging==0 and "--newuse" in self.myopts and \
+                               mytype == "ebuild" and \
                                vardbapi.cpv_exists(mykey):
                                pkgsettings.setcpv(mykey, mydb=portdb)
                                forced_flags = set()
@@ -1502,18 +1508,37 @@ class depgraph:
                retlist=[]
                circular_blocks = False
                blocker_deps = None
+               asap_nodes = []
                if reversed:
                        get_nodes = mygraph.root_nodes
                else:
                        get_nodes = mygraph.leaf_nodes
+                       for cpv, node in self.pkg_node_map.iteritems():
+                               if "portage" == portage.catsplit(portage.dep_getkey(cpv))[-1]:
+                                       asap_nodes.append(node)
+                                       break
                ignore_priority_range = [None]
                ignore_priority_range.extend(
                        xrange(DepPriority.MIN, DepPriority.MEDIUM + 1))
                while not mygraph.empty():
-                       for ignore_priority in ignore_priority_range:
-                               nodes = get_nodes(ignore_priority=ignore_priority)
-                               if nodes:
-                                       break
+                       ignore_priority = None
+                       nodes = None
+                       if asap_nodes:
+                               """ASAP nodes are merged before their soft deps."""
+                               for node in asap_nodes:
+                                       if not mygraph.contains(node):
+                                               asap_nodes.remove(node)
+                                               continue
+                                       if not mygraph.child_nodes(node,
+                                               ignore_priority=DepPriority.SOFT):
+                                               nodes = [node]
+                                               asap_nodes.remove(node)
+                                               break
+                       if not nodes:
+                               for ignore_priority in ignore_priority_range:
+                                       nodes = get_nodes(ignore_priority=ignore_priority)
+                                       if nodes:
+                                               break
                        selected_nodes = None
                        if nodes:
                                if ignore_priority <= DepPriority.SOFT:
@@ -1619,9 +1644,7 @@ class depgraph:
                newlist = []
                for atom in mylist:
                        mykey = portage.dep_getkey(atom)
-                       if portage.catsplit(mykey)[-1] == "portage":
-                               newlist.insert(0, atom)
-                       else:
+                       if True:
                                newlist.append(atom)
                                """Make sure all installed slots are updated when possible.
                                Do this with --emptytree also, to ensure that all slots are
@@ -2121,12 +2144,7 @@ class depgraph:
                                        myversion = "%s-%s" % (mysplit[1], mysplit[2])
 
                                if myversion != portage.VERSION and "--quiet" not in self.myopts:
-                                       if "--emptytree" in self.myopts:
-                                               p.append(colorize("WARN", "***")+" Please update portage to the above version before proceeding.")
-                                               p.append("    Failure to do so may result in failed or improper merges.")
-                                               p.append("    A simple '"+green("emerge portage")+"' is sufficient.")
-                                               p.append("")
-                                       elif mylist.index(x) < len(mylist) - 1 and \
+                                       if mylist.index(x) < len(mylist) - 1 and \
                                                "livecvsportage" not in self.settings.features:
                                                p.append(colorize("WARN", "*** Portage will stop merging at this point and reload itself,"))
                                                p.append(colorize("WARN", "    then resume the merge."))
index bee4761f4265fe0c007e415da154021e5eee9ba8..8e9bb44c4c8c0916797d3099fc3a17b0fb4c5a00 100755 (executable)
@@ -7,7 +7,7 @@
 
 eval $("@PORTAGE_BASE@"/bin/portageq envvar -v FEATURES FETCHCOMMAND \
        GENTOO_MIRRORS PORTAGE_INST_UID PORTAGE_INST_GID PORTAGE_NICENESS \
-       PORTAGE_TMPDIR PORTDIR USERLAND)
+       PORTAGE_TMPDIR PORTDIR USERLAND EPREFIX)
 DISTDIR="${PORTAGE_TMPDIR}/emerge-webrsync"
 
 # If PORTAGE_NICENESS is overriden via the env then it will
@@ -79,6 +79,7 @@ sync_local() {
                echo "transferring metadata/cache"
                emerge --metadata
        fi
+       [ -x "${EPREFIX}"/etc/portage/bin/post_sync ] && "${EPREFIX}"/etc/portage/bin/post_sync
 }
 
 echo "Fetching most recent snapshot"
index b404aa41b529abbd2c378c33301bb56379c21552..9bc627b902ff70a289758ad315cba21779e3b5f3 100644 (file)
@@ -849,6 +849,7 @@ class config:
                self.virtuals = {}
                self.virts_p = {}
                self.dirVirtuals = None
+               self._new_virtuals = {}
                self.v_count  = 0
 
                # Virtuals obtained from the vartree
@@ -914,6 +915,7 @@ class config:
                        self.prevmaskdict = copy.deepcopy(clone.prevmaskdict)
                        self.pprovideddict = copy.deepcopy(clone.pprovideddict)
                        self.dirVirtuals = copy.deepcopy(clone.dirVirtuals)
+                       self._new_virtuals = copy.deepcopy(clone._new_virtuals)
                        self.treeVirtuals = copy.deepcopy(clone.treeVirtuals)
                        self.features = copy.deepcopy(clone.features)
 
@@ -1627,6 +1629,9 @@ class config:
                virts = flatten(portage_dep.use_reduce(portage_dep.paren_reduce(provides), uselist=myuse.split()))
 
                cp = dep_getkey(mycpv)
+               if cp.startswith("virtual/"):
+                       # Bridge new-style virtual into old-style.
+                       virts.append(cp)
                for virt in virts:
                        virt = dep_getkey(virt)
                        if not self.treeVirtuals.has_key(virt):
@@ -1865,7 +1870,21 @@ class config:
                                        ptVirtuals.setdefault(virt, [])
                                        ptVirtuals[virt].append(cp)
 
-               return stack_dictlist([ptVirtuals, self.treeVirtuals, self.dirVirtuals])
+               return stack_dictlist([ptVirtuals, self.treeVirtuals, self.dirVirtuals,
+                       self._new_virtuals])
+
+       def add_new_virtuals(self, mydbapis):
+               """Scan for new-style virtuals and bridge them into the old-style."""
+               new_virtuals = {}
+               for mydbapi in mydbapis:
+                       for cpv in mydbapi.cpv_all():
+                               if cpv.startswith("virtual/"):
+                                       cp = dep_getkey(cpv)
+                                       new_virtuals[cp] = [cp]
+               self._new_virtuals = new_virtuals
+               # Make sure dirVirtuals and treeVirtuals are initialized.
+               self.getvirtuals()
+               self.virtuals = self.__getvirtuals_compile()
 
        def __delitem__(self,mykey):
                self.modifying()
@@ -4747,6 +4766,9 @@ class vartree(packagetree):
                                        if not mys:
                                                mys = string.split(myprovide, "/")
                                        myprovides += [mys[0] + "/" + mys[1]]
+                       if mycpv.startswith("virtual/"):
+                               # Bridge new-style virtual into old-style.
+                               myprovides.append(dep_getkey(mycpv))
                        return myprovides
                except SystemExit, e:
                        raise
@@ -5327,6 +5349,8 @@ class portdbapi(dbapi):
                l.sort()
                return l
 
+       cpv_all = cp_all
+
        def p_list(self,mycp):
                d={}
                for oroot in self.porttrees: