Merged from trunk 4770:4783
authorFabian Groffen <grobian@gentoo.org>
Sat, 21 Oct 2006 15:16:01 +0000 (15:16 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sat, 21 Oct 2006 15:16:01 +0000 (15:16 -0000)
Allow an empty PROMPT_COMMAND for bug #152157.

For bug #152175, trigger greedy --update behavior when an atom matches a
slot that isn't installed yet.

Apply the fix for bug #152175 to system/world greedy behavior.

In greedy atom handlink, filter binary package for visiblity.

More filtering binary package for visiblity in greedy atom handling.

Add nodes to the fakedb in depgraph.create instead of
depgraph.select_deps.  It used to be in select_deps only for the case of
packages that depend on themselves for bootstrap, but that hack isn't
needed anymore because dep_check  returns all deps now.

Update the docs regarding delay of config.setinst calls for bootstrap
deps on old-style virtuals.

Remove redunant population of the fakedb in depgraph.validate_blockers,
since r4776 makes it unnecessary.

Add news about new-style virtuals being usable for bootstrap deps on
self.

Add package.use to the list of files supported in profiles.

Add news about package.use in profiles and default USE in ebuilds via
+flag in IUSE.

For bug #152157, don't send a redundant escape sequence with
${PROMPT_COMMAND}.

Also check keyword visibility via gvisible.

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

NEWS
bin/emerge
man/portage.5
pym/output.py

diff --git a/NEWS b/NEWS
index 07a3ba83c4f4ca3db1f65f22607288836d267633..fa295cd7efcfee551235e14a85cea870ee239249 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,7 +3,10 @@ News (mainly features/major bug fixes)
 portage-2.1.2
 ------------
 
-* Profiles support multiple inheritance.
+* Ebuilds support default USE flags via +flag in IUSE.
+* New-style virtuals are now usable for packages that depend on themselves for
+  bootstrap.
+* Profiles support multiple inheritance and package.use.
 * CONFIG_PROTECT and CONFIG_PROTECT_MASK both support files (not just
   directories).
 * Collision protection handles symlinks properly.
index fc0138082a479376a996124980adcb9eb91c6106..4efc819dec1351a9bb06992fd27bc2be39fe32fe 100755 (executable)
@@ -876,7 +876,11 @@ class depgraph:
                        self.pkg_node_map[mybigkey[2]] = jbigkey
                        self.digraph.addnode(jbigkey, myparent,
                                priority=priority)
-               
+
+               if addme:
+                       myslot = mydbapi.aux_get(mykey, ["SLOT"])[0]
+                       self.mydbapi[myroot].cpv_inject(mykey, myslot=myslot)
+
                """ This section determines whether we go deeper into dependencies or not.
                    We want to go deeper on a few occasions:
                    Installing package A, we need to make sure package A's deps are met.
@@ -963,6 +967,8 @@ class depgraph:
                bindb = self.trees[myroot]["bintree"].dbapi
                pkgsettings = self.pkgsettings[myroot]
                arg_atoms = []
+               def visible(mylist):
+                       return portdb.gvisible(portdb.visible(mylist))
                for x in myfiles:
                        ext = os.path.splitext(x)[1]
                        if ext==".tbz2":
@@ -1049,6 +1055,26 @@ class depgraph:
                                myslots = set()
                                for cpv in vardb.match(myatom):
                                        myslots.add(vardb.aux_get(cpv, ["SLOT"])[0])
+                               if myslots:
+                                       best_pkgs = []
+                                       if "--usepkg" in self.myopts:
+                                               mymatches = bindb.match(myatom)
+                                               if "--usepkgonly" not in self.myopts:
+                                                       mymatches = visible(mymatches)
+                                               best_pkg = portage.best(mymatches)
+                                               if best_pkg:
+                                                       best_slot = bindb.aux_get(best_pkg, ["SLOT"])[0]
+                                                       best_pkgs.append(("binary", best_pkg, best_slot))
+                                       if "--usepkgonly" not in self.myopts:
+                                               best_pkg = portage.best(portdb.match(myatom))
+                                               if best_pkg:
+                                                       best_slot = portdb.aux_get(best_pkg, ["SLOT"])[0]
+                                                       best_pkgs.append(("ebuild", best_pkg, best_slot))
+                                       if best_pkgs:
+                                               best_pkg = portage.best([x[1] for x in best_pkgs])
+                                               best_pkgs = [x for x in best_pkgs if x[1] == best_pkg]
+                                               best_slot = best_pkgs[0][2]
+                                               myslots.add(best_slot)
                                if len(myslots) > 1:
                                        for myslot in myslots:
                                                myslot_atom = "%s:%s" % \
@@ -1058,10 +1084,12 @@ class depgraph:
                                                        self.trees[self.target_root][
                                                        "porttree"].dbapi.match(myslot_atom):
                                                        available = True
-                                               elif "--usepkg" in self.myopts and \
-                                                       self.trees[self.target_root][
-                                                       "bintree"].dbapi.match(myslot_atom):
-                                                       available = True
+                                               elif "--usepkg" in self.myopts:
+                                                       mymatches = bindb.match(myslot_atom)
+                                                       if "--usepkgonly" not in self.myopts:
+                                                               mymatches = visible(mymatches)
+                                                       if mymatches:
+                                                               available = True
                                                if available:
                                                        greedy_atoms.append((myarg, myslot_atom))
                        arg_atoms = greedy_atoms
@@ -1169,26 +1197,14 @@ class depgraph:
                mymerge = mycheck[1]
 
                if myparent:
-                       # In order to get past circular dependencies (in
-                       # `emerge -e world`, for example), the parent must be allowed
-                       # to satisfy dependencies of it's children.
-
                        # The parent is added after it's own dep_check call so that it
                        # isn't allowed to satisfy a direct bootstrap dependency on itself
-                       # or an old-style virtual that it satisfies (unfortunately, this
-                       # only works for one level of deps, so it won't work for new-style
-                       # virtuals since they introduce an additional level of dependency
-                       # indirection).
+                       # via an old-style virtual.  This isn't a problem with new-style
+                       # virtuals, which are preferenced in dep_zapdeps by looking only at
+                       # the depstring, vdb, and available packages.
 
                        p_type, p_root, p_key, p_status = myparent.split()
                        if p_status == "merge":
-                               """ This fakedbapi data is used in dep_check calls to determine
-                               satisfied deps via dep_wordreduce"""
-                               myslot = self.trees[p_root][
-                                       self.pkg_tree_map[p_type]].dbapi.aux_get(
-                                               p_key, ["SLOT"])[0]
-                               self.mydbapi[p_root].cpv_inject(p_key, myslot=myslot)
-
                                # Update old-style virtuals if this package provides any.
                                # These are needed for dep_virtual calls inside dep_check.
                                self.pkgsettings[p_root].setinst(p_key,
@@ -1403,18 +1419,6 @@ class depgraph:
                correct merge order such that mutually blocking packages are never
                installed simultaneously."""
 
-               """ It's possible that some of the nodes haven't been added to the
-               fakedb yet, so make sure they're all accounted for."""
-               for node in self.digraph.all_nodes():
-                       node_split = node.split()
-                       mytype, myroot, mykey = node_split[0:3]
-                       if mytype in self.pkg_tree_map:
-                               if node_split[3] == "nomerge":
-                                       continue
-                               mydb = self.trees[myroot][self.pkg_tree_map[mytype]].dbapi
-                               myslot = mydb.aux_get(mykey, ["SLOT"])[0]
-                               self.mydbapi[myroot].cpv_inject(mykey, myslot=myslot)
-
                for blocker in self.blocker_parents.keys():
                        mytype, myroot, mydep = blocker.split()
                        vardb = self.trees[myroot]["vartree"].dbapi
@@ -1563,6 +1567,10 @@ class depgraph:
 
        def xcreate(self,mode="system"):
                vardb = self.trees[self.target_root]["vartree"].dbapi
+               portdb = self.trees[self.target_root]["porttree"].dbapi
+               bindb = self.trees[self.target_root]["bintree"].dbapi
+               def visible(mylist):
+                       return portdb.gvisible(portdb.visible(mylist))
                world_problems = False
                if mode=="system":
                        mylist = getlist(self.settings, "system")
@@ -1595,6 +1603,26 @@ class depgraph:
                                myslots = set()
                                for cpv in vardb.match(mykey):
                                        myslots.add(vardb.aux_get(cpv, ["SLOT"])[0])
+                               if myslots:
+                                       best_pkgs = []
+                                       if "--usepkg" in self.myopts:
+                                               mymatches = bindb.match(atom)
+                                               if "--usepkgonly" not in self.myopts:
+                                                       mymatches = visible(mymatches)
+                                               best_pkg = portage.best(mymatches)
+                                               if best_pkg:
+                                                       best_slot = bindb.aux_get(best_pkg, ["SLOT"])[0]
+                                                       best_pkgs.append(("binary", best_pkg, best_slot))
+                                       if "--usepkgonly" not in self.myopts:
+                                               best_pkg = portage.best(portdb.match(atom))
+                                               if best_pkg:
+                                                       best_slot = portdb.aux_get(best_pkg, ["SLOT"])[0]
+                                                       best_pkgs.append(("ebuild", best_pkg, best_slot))
+                                       if best_pkgs:
+                                               best_pkg = portage.best([x[1] for x in best_pkgs])
+                                               best_pkgs = [x for x in best_pkgs if x[1] == best_pkg]
+                                               best_slot = best_pkgs[0][2]
+                                               myslots.add(best_slot)
                                if len(myslots) > 1:
                                        for myslot in myslots:
                                                myslot_atom = "%s:%s" % (mykey, myslot)
@@ -1603,10 +1631,12 @@ class depgraph:
                                                        self.trees[self.target_root][
                                                        "porttree"].dbapi.match(myslot_atom):
                                                        available = True
-                                               elif "--usepkg" in self.myopts and \
-                                                       self.trees[self.target_root][
-                                                       "bintree"].dbapi.match(myslot_atom):
-                                                       available = True
+                                               elif "--usepkg" in self.myopts:
+                                                       mymatches = bindb.match(myslot_atom)
+                                                       if "--usepkgonly" not in self.myopts:
+                                                               mymatches = visible(mymatches)
+                                                       if mymatches:
+                                                               available = True
                                                if available:
                                                        newlist.append(myslot_atom)
                mylist = newlist
index 565daaa582964de4ad8fbaa6c2fa8afbe757e3f5..156bbdd0b73a8b255f20346b9608495c8a833cc6 100644 (file)
@@ -28,6 +28,7 @@ make.defaults
 packages
 packages.build
 package.provided
+package.use
 package.use.force
 package.use.mask
 parent
index 83a65927cac27901bf7d1c0e023affe4a7a7edc0..55082a5fcce4852e1ff82228f3eebb001731c1e8 100644 (file)
@@ -173,13 +173,15 @@ def nc_len(mystr):
        tmp = re.sub(esc_seq + "^m]+m", "", mystr);
        return len(tmp)
 
-def xtermTitle(mystr):
+def xtermTitle(mystr, raw=False):
        if havecolor and dotitles and os.environ.has_key("TERM") and sys.stderr.isatty():
                myt=os.environ["TERM"]
                legal_terms = ["xterm","Eterm","aterm","rxvt","screen","kterm","rxvt-unicode","gnome"]
                for term in legal_terms:
                        if myt.startswith(term):
-                               sys.stderr.write("\x1b]0;"+str(mystr)+"\x07")
+                               if not raw:
+                                       mystr = "\x1b]0;%s\x07" % mystr
+                               sys.stderr.write(mystr)
                                sys.stderr.flush()
                                break
 
@@ -189,16 +191,18 @@ def xtermTitleReset():
        global default_xterm_title
        if default_xterm_title is None:
                prompt_command = os.getenv('PROMPT_COMMAND')
-               if prompt_command is not None:
+               if prompt_command == "":
+                       default_xterm_title = ""
+               elif prompt_command is not None:
                        default_xterm_title = commands.getoutput(prompt_command)
                else:
                        pwd = os.getenv('PWD','')
                        home = os.getenv('HOME', '')
                        if home != '' and pwd.startswith(home):
                                pwd = '~' + pwd[len(home):]
-                       default_xterm_title = '%s@%s:%s' % (
+                       default_xterm_title = '\x1b]0;%s@%s:%s\x07' % (
                                os.getenv('LOGNAME', ''), os.getenv('HOSTNAME', '').split('.', 1)[0], pwd)
-       xtermTitle(default_xterm_title)
+       xtermTitle(default_xterm_title, raw=True)
 
 def notitles():
        "turn off title setting"