Merged from trunk -r13244:13253
authorFabian Groffen <grobian@gentoo.org>
Thu, 2 Apr 2009 12:58:32 +0000 (12:58 -0000)
committerFabian Groffen <grobian@gentoo.org>
Thu, 2 Apr 2009 12:58:32 +0000 (12:58 -0000)
   | 13245   | Add support for --rdeps-only and --root-deps options which   |
   | zmedico | are useful in combination with $ROOT. Thanks to Ned Ludd     |
   |         | <solar@g.o> for the initial patch.                           |

   | 13246   | Add a --root option that sets $ROOT (complements the         |
   | zmedico | --config-root option).                                       |

   | 13247   | Document --root and --config-root.                           |
   | zmedico |                                                              |

   | 13248   | Inside depgraph.validate_blockers(), prevent false positives |
   | zmedico | in PROVIDE virtual blocker matches that can occur for        |
   |         | packages for packages that don't actual have the appropriate |
   |         | value in PROVIDE (triggered by profile 'virtuals' settings). |
   |         | Thanks to Ned Ludd <solar@g.o> for reporting.                |

   | 13249   | Fix bug in old-style virtuals code from previous commit.     |
   | zmedico |                                                              |

   | 13250   | Update dep_getusedeps() docstring. Thanks to Douglass        |
   | zmedico | Anderson <dja@gendja.com>.                                   |

   | 13251   | Implement _use_dep.__repr__(). Thanks to Douglass Anderson   |
   | zmedico | for the suggestion.                                          |

   | 13252   | Bug #264291 - Fix inappropriate build dir creation for       |
   | zmedico | emerge --fetchonly.                                          |

   | 13253   | Fix --newuse code to compare installed package USE to the    |
   | zmedico | USE that a binary package was built with (instead of         |
   |         | config["PORTAGE_USE"]).                                      |

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

man/emerge.1
pym/_emerge/__init__.py
pym/_emerge/help.py
pym/portage/__init__.py
pym/portage/dep.py

index b838f624d9ea8af80f5f9a1d9f7778cc3d282058..4af77071690493b35f8fc6d7a016e22677789617 100644 (file)
@@ -414,12 +414,29 @@ b blocked by another package (automatically resolved conflict)
 Results may vary, but the general outcome is a reduced or condensed
 output from portage's displays.
 .TP
+.BR "\-\-rdeps\-only"
+Discard all build\-time dependencies. This option is commonly used together
+with \fBROOT\fR and it should not be enabled under normal circumstances. For
+currently supported \fBEAPI\fR values, the dependencies specified in the
+\fBDEPEND\fR variable are discarded. However, behavior may change for new
+\fBEAPI\fRs when related extensions are added in the future.
+.TP
 .BR "\-\-reinstall changed\-use"
 Tells emerge to include installed packages where USE flags have
 changed since installation.  Unlike \fB\-\-newuse\fR, this option does
 not trigger reinstallation when flags that the user has not
 enabled are added or removed.
 .TP
+.BR \-\-root=DIR
+Set the \fBROOT\fR environment variable.
+.TP
+.BR "\-\-root\-deps"
+Install build\-time dependencies to \fBROOT\fR instead of /. This option
+should not be enabled under normal circumstances. For currently supported
+\fBEAPI\fR values, the dependencies specified in the \fBDEPEND\fR variable
+are used. However, behavior may change for new
+\fBEAPI\fRs when related extensions are added in the future.
+.TP
 .BR "\-\-skipfirst"
 This option is only valid when used with \fB\-\-resume\fR.  It removes the 
 first package in the resume list. Dependencies are recalculated for
@@ -474,7 +491,8 @@ command line.
 .TP
 \fBROOT\fR = \fI[path]\fR
 Use \fBROOT\fR to specify the target root filesystem to be used for
-merging packages or ebuilds.  This variable can be set in \fBmake.conf\fR(5).
+merging packages or ebuilds. This variable can be set via the \fB\-\-root\fR
+option or in \fBmake.conf\fR(5) (the command line overrides other settings).
 .br
 Defaults to /.
 .TP
index 975ea3d032b39827dc5d29df90b32d85fafba5b1..f2fb37ead6c886bcb86250afba8143ef0eaf8838 100644 (file)
@@ -222,6 +222,7 @@ options=[
 "--nospinner",    "--oneshot",
 "--onlydeps",     "--pretend",
 "--quiet",        "--resume",
+"--rdeps-only",   "--root-deps",
 "--searchdesc",   "--selective",
 "--skipfirst",
 "--tree",
@@ -1814,8 +1815,6 @@ class EbuildFetchonly(SlotObject):
                portdb = root_config.trees["porttree"].dbapi
                ebuild_path = portdb.findname(pkg.cpv)
                debug = settings.get("PORTAGE_DEBUG") == "1"
-               portage.prepare_build_dirs(self.pkg.root, self.settings, 0)
-
                retval = portage.doebuild(ebuild_path, "fetch",
                        self.settings["ROOT"], self.settings, debug=debug,
                        listonly=self.pretend, fetchonly=1, fetchall=self.fetch_all,
@@ -5302,8 +5301,16 @@ class depgraph(object):
                if removal_action and self.myopts.get("--with-bdeps", "y") == "n":
                        edepend["DEPEND"] = ""
 
+               bdeps_root = "/"
+               if self.target_root != "/":
+                       if "--root-deps" in self.myopts:
+                                       bdeps_root = myroot
+                       if "--rdeps-only" in self.myopts:
+                                       bdeps_root = "/"
+                                       edepend["DEPEND"] = ""
+
                deps = (
-                       ("/", edepend["DEPEND"],
+                       (bdeps_root, edepend["DEPEND"],
                                self._priority(buildtime=(not bdeps_optional),
                                optional=bdeps_optional)),
                        (myroot, edepend["RDEPEND"], self._priority(runtime=True)),
@@ -6427,7 +6434,7 @@ class depgraph(object):
                                                old_use = vardb.aux_get(cpv, ["USE"])[0].split()
                                                old_iuse = set(filter_iuse_defaults(
                                                        vardb.aux_get(cpv, ["IUSE"])[0].split()))
-                                               cur_use = pkgsettings["PORTAGE_USE"].split()
+                                               cur_use = pkg.use.enabled
                                                cur_iuse = pkg.iuse.all
                                                reinstall_for_flags = \
                                                        self._reinstall_for_flags(
@@ -6775,6 +6782,11 @@ class depgraph(object):
                                not self._have_new_virt(blocker.root, blocker.cp):
                                provider_virtual = True
 
+                       # Use this to check PROVIDE for each matched package
+                       # when necessary.
+                       atom_set = InternalPackageSet(
+                               initial_atoms=[blocker.atom])
+
                        if provider_virtual:
                                atoms = []
                                for provider_entry in virtuals[blocker.cp]:
@@ -6785,13 +6797,17 @@ class depgraph(object):
                        else:
                                atoms = [blocker.atom]
 
-                       blocked_initial = []
+                       blocked_initial = set()
                        for atom in atoms:
-                               blocked_initial.extend(initial_db.match_pkgs(atom))
+                               for pkg in initial_db.match_pkgs(atom):
+                                       if atom_set.findAtomForPackage(pkg):
+                                               blocked_initial.add(pkg)
 
-                       blocked_final = []
+                       blocked_final = set()
                        for atom in atoms:
-                               blocked_final.extend(final_db.match_pkgs(atom))
+                               for pkg in final_db.match_pkgs(atom):
+                                       if atom_set.findAtomForPackage(pkg):
+                                               blocked_final.add(pkg)
 
                        if not blocked_initial and not blocked_final:
                                parent_pkgs = self._blocker_parents.parent_nodes(blocker)
@@ -14876,7 +14892,11 @@ def parse_opts(tmpcmdline, silent=False):
                        "help":"specify conditions to trigger package reinstallation",
                        "type":"choice",
                        "choices":["changed-use"]
-               }
+               },
+               "--root": {
+                "help"   : "specify the target root filesystem for merging packages",
+                "action" : "store"
+               },
        }
 
        from optparse import OptionParser
@@ -15401,6 +15421,8 @@ def emerge_main():
                os.environ["PORTAGE_DEBUG"] = "1"
        if "--config-root" in myopts:
                os.environ["PORTAGE_CONFIGROOT"] = myopts["--config-root"]
+       if "--root" in myopts:
+               os.environ["ROOT"] = myopts["--root"]
 
        # Portage needs to ensure a sane umask for the files it creates.
        os.umask(022)
index 2c5f04bbfab45879fea163a10e12a433abe5e5e9..15aa88a027fa4ed780d2071383234fe4edb3540d 100644 (file)
@@ -269,6 +269,12 @@ def help(myaction,myopts,havecolor=1):
                for line in wrap(desc, desc_width):
                        print desc_indent + line
                print
+               print "       "+green("--config-root=DIR")
+               desc = "Set the PORTAGE_CONFIGROOT environment variable " + \
+                       "which is documented in the emerge(1) man page."
+               for line in wrap(desc, desc_width):
+                       print desc_indent + line
+               print
                print "       "+green("--debug")+" ("+green("-d")+" short option)"
                print "              Tell emerge to run the ebuild command in --debug mode. In this"
                print "              mode, the bash build environment will run with the -x option,"
@@ -404,12 +410,36 @@ def help(myaction,myopts,havecolor=1):
                print "              Effects vary, but the general outcome is a reduced or condensed"
                print "              output from portage's displays."
                print
+               print "       "+green("--rdeps-only")
+               desc = "Discard all build-time dependencies. This option is commonly used together " + \
+                       "with ROOT and it should not be enabled under normal circumstances. For " + \
+                       "currently supported EAPI values, the dependencies specified in the " + \
+                       "DEPEND variable are discarded. However, behavior may change for new " + \
+                       "EAPIs when related extensions are added in the future."
+               for line in wrap(desc, desc_width):
+                       print desc_indent + line
+               print
                print "       "+green("--reinstall ") + turquoise("changed-use")
                print "              Tells emerge to include installed packages where USE flags have"
                print "              changed since installation.  Unlike --newuse, this option does"
                print "              not trigger reinstallation when flags that the user has not"
                print "              enabled are added or removed."
                print
+               print "       "+green("--root=DIR")
+               desc = "Set the ROOT environment variable " + \
+                       "which is documented in the emerge(1) man page."
+               for line in wrap(desc, desc_width):
+                       print desc_indent + line
+               print
+               print "       "+green("--root-deps")
+               desc = "Install build-time dependencies to ROOT instead of /. This option " + \
+                       "should not be enabled under normal circumstances. For currently supported " + \
+                       "EAPI values, the dependencies specified in the DEPEND variable " + \
+                       "are used. However, behavior may change for new " + \
+                       "EAPIs when related extensions are added in the future."
+               for line in wrap(desc, desc_width):
+                       print desc_indent + line
+               print
                print "       "+green("--skipfirst")
                desc = "This option is only valid when " + \
                        "used with --resume.  It removes the " + \
index 64ca4b860470d9329a4d0e7b8a6e4fdc007fabf8..fee4c04bc46c47f9381f587b0e6e6ea21abb212c 100644 (file)
@@ -5878,6 +5878,7 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                                logfile=None, returnpid=returnpid)
                        return retval
 
+               restrict = set(mysettings.get('PORTAGE_RESTRICT', '').split())
                # get possible slot information from the deps file
                if mydo == "depend":
                        writemsg("!!! DEBUG: dbkey: %s\n" % str(dbkey), 2)
@@ -5986,8 +5987,13 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                                mysettings["PF"], myroot, mysettings, vartree=vartree)
 
                # Build directory creation isn't required for any of these.
+               # In the fetch phase, the directory is needed only for RESTRICT=fetch
+               # in order to satisfy the sane $PWD requirement (from bug #239560)
+               # when pkg_nofetch is spawned.
                have_build_dirs = False
-               if not parallel_fetchonly and mydo not in ("digest", "help", "manifest"):
+               if not parallel_fetchonly and \
+                       mydo not in ('digest', 'help', 'manifest') and \
+                       not (mydo == 'fetch' and 'fetch' not in restrict):
                        mystatus = prepare_build_dirs(myroot, mysettings, cleanup)
                        if mystatus:
                                return mystatus
index 0bff1104ccffd46aca84d684bc6e645b55fd32ba..86625871511cae5dddd3ad622e9a726c540101cc 100644 (file)
@@ -417,6 +417,9 @@ class _use_dep(object):
                        return ""
                return "[%s]" % (",".join(self.tokens),)
 
+       def __repr__(self):
+               return "portage.dep._use_dep(%s)" % repr(self.tokens)
+
        def evaluate_conditionals(self, use):
                """
                Create a new instance with conditionals evaluated.
@@ -740,8 +743,8 @@ def dep_getusedeps( depend ):
        Pull a listing of USE Dependencies out of a dep atom.
        
        Example usage:
-               >>> dep_getusedeps('app-misc/test:3[foo][-bar]')
-               ['foo','-bar']
+               >>> dep_getusedeps('app-misc/test:3[foo,-bar]')
+               ('foo', '-bar')
        
        @param depend: The depstring to process
        @type depend: String