Merged from trunk -r13794:13803
authorFabian Groffen <grobian@gentoo.org>
Tue, 7 Jul 2009 15:10:15 +0000 (15:10 -0000)
committerFabian Groffen <grobian@gentoo.org>
Tue, 7 Jul 2009 15:10:15 +0000 (15:10 -0000)
   | 13798   | Bug #273631 - Add default src_install implementation for     |
   | zmedico | EAPI 3. Thanks to Markus Meier <maekke@gentoo.org> for this  |
   |         | patch (and people in #gentoo-portage for bash syntax         |
   |         | tweaks).                                                     |

   | 13799   | Bug #273622 - Add pkg_pretend support for the ebuild(1)      |
   | zmedico | command (emerge support not implemented yet). Thanks to      |
   |         | Markus Meier <maekke@gentoo.org> for this patch.             |

   | 13800   | Bug #273640 - Add --disable-dependency-tracking to econf     |
   | zmedico | arguments for EAPI 3. Thanks to Markus Meier                 |
   |         | <maekke@gentoo.org> for this patch.                          |

   | 13801   | Optimize dbapi._iter_match_use() so that it shares a single  |
   | zmedico | compiled regex for all implicit iuse checks. This avoids     |
   |         | lots of expensibe re.compile() calls. Thanks to Marat        |
   |         | Radchenko <slonopotamusorama@gmail.com> for the initial      |
   |         | patch.                                                       |

   | 13802   | Bug #276866 - --binpkg-respect-use < y | n > Tells emerge to |
   | zmedico | ignore binary packages if their use flags don't match the    |
   |         | current configuration. (default: ´n´) Thanks to Sebastian  |
   |         | Mingramm (few) <s.mingramm@gmx.de> for this patch (small     |
   |         | tweaks by me).                                               |

   | 13803   | Shorten the preserved libs message when in --quiet mode.     |
   | zmedico | Thanks to Sebastian Mingramm (few) <s.mingramm@gmx.de> for   |
   |         | this patch.                                                  |

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

bin/ebuild.sh
man/emerge.1
pym/_emerge/depgraph.py
pym/_emerge/help.py
pym/_emerge/main.py
pym/portage/__init__.py
pym/portage/dbapi/__init__.py
pym/portage/dbapi/porttree.py

index ff47591e5dd87d70f1fb93e0decccf233bc827a2..1e86a58e1bc26bfca4a3383ec1a7deb0cc428585 100755 (executable)
@@ -493,6 +493,11 @@ econf() {
                        done
                fi
 
+               # EAPI=3 adds --disable-dependency-tracking to econf
+               if ! hasq "$EAPI" 0 1 2 ; then
+                       set -- --disable-dependency-tracking "$@"
+               fi
+
                # if the profile defines a location to install libs to aside from default, pass it on.
                # if the ebuild passes in --libdir, they're responsible for the conf_libdir fun.
                local CONF_LIBDIR LIBDIR_VAR="LIBDIR_${ABI}"
@@ -599,6 +604,10 @@ _eapi0_src_compile() {
        _eapi2_src_compile
 }
 
+_eapi0_src_install() {
+       _eapi2_src_install
+}
+
 _eapi0_src_test() {
        if emake -j1 check -n &> /dev/null; then
                vecho ">>> Test phase [check]: ${CATEGORY}/${PF}"
@@ -622,6 +631,10 @@ _eapi1_src_compile() {
        _eapi2_src_compile
 }
 
+_eapi1_src_install() {
+       _eapi2_src_install
+}
+
 _eapi2_src_configure() {
        if [[ -x ${ECONF_SOURCE:-.}/configure ]] ; then
                econf
@@ -634,15 +647,33 @@ _eapi2_src_compile() {
        fi
 }
 
-src_install() {
+_eapi2_src_install() {
        if use prefix ; then
-               # this avoids misc errors in prefix because it doesn't exist
+               # this avoids misc errors in Prefix because it doesn't exist
                # by default
                mkdir -p "${ED}"
                return
        fi
 }
 
+_eapi3_src_install() {
+       if [[ -f Makefile || -f GNUmakefile || -f makefile ]] ; then
+               emake DESTDIR="${D}" install
+       fi
+
+       if [[ -z $DOCS ]] ; then
+               local d
+               for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \
+                               THANKS BUGS FAQ CREDITS CHANGELOG ; do
+                       [[ -s "${d}" ]] && dodoc "${d}"
+               done
+       elif [[ $(declare -p DOCS) == "declare -a "* ]] ; then
+               dodoc "${DOCS[@]}"
+       else
+               dodoc ${DOCS}
+       fi
+}
+
 ebuild_phase() {
        declare -F "$1" >/dev/null && qa_call $1
 }
@@ -655,6 +686,10 @@ ebuild_phase_with_hooks() {
        done
 }
 
+dyn_pretend() {
+       ebuild_phase_with_hooks pkg_pretend
+}
+
 dyn_setup() {
        ebuild_phase_with_hooks pkg_setup
 }
@@ -1073,6 +1108,7 @@ dyn_help() {
        echo "than one option is specified, each will be executed in order."
        echo
        echo "  help        : show this help screen"
+       echo "  pretend     : execute package specific pretend actions"
        echo "  setup       : execute package specific setup actions"
        echo "  fetch       : download source archive(s) and patches"
        echo "  digest      : create a manifest file for the package"
@@ -1340,6 +1376,10 @@ _ebuild_arg_to_phase() {
        local phase_func=""
 
        case "$arg" in
+               pretend)
+                       ! hasq $eapi 0 1 2 && \
+                               phase_func=pkg_pretend
+                       ;;
                setup)
                        phase_func=pkg_setup
                        ;;
@@ -1433,6 +1473,9 @@ _ebuild_phase_funcs() {
                        declare -F src_compile >/dev/null || \
                                src_compile() { _eapi2_src_compile "$@" ; }
 
+                       [[ $eapi == 2 ]] || declare -F src_install >/dev/null || \
+                               src_install() { _eapi3_src_install "$@" ; }
+
                        if hasq $phase_func $default_phases ; then
 
                                _eapi2_pkg_nofetch   () { _eapi0_pkg_nofetch          "$@" ; }
@@ -1793,11 +1836,16 @@ _source_ebuild() {
                                pkg_nofetch pkg_postinst pkg_postrm pkg_preinst pkg_prerm
                                pkg_setup src_test src_unpack"
                        ;;
-               *)
+               2)
                        valid_phases="src_compile pkg_config src_configure pkg_info
                                src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst
                                src_prepare pkg_prerm pkg_setup src_test src_unpack"
                        ;;
+               *)
+                       valid_phases="src_compile pkg_config src_configure pkg_info
+                               src_install pkg_nofetch pkg_postinst pkg_postrm pkg_preinst
+                               src_prepare pkg_prerm pkg_pretend pkg_setup src_test src_unpack"
+                       ;;
        esac
 
        DEFINED_PHASES=
@@ -1996,7 +2044,7 @@ ebuild_main() {
                fi
                export SANDBOX_ON="0"
                ;;
-       help|setup|preinst)
+       help|pretend|setup|preinst)
                #pkg_setup needs to be out of the sandbox for tmp file creation;
                #for example, awking and piping a file in /tmp requires a temp file to be created
                #in /etc.  If pkg_setup is in the sandbox, both our lilo and apache ebuilds break.
index 787e2e37f58e1facd5e50ff5a4b75364b5ae7bf9..852116d183e2b216e57d351d057fdae3e9ee748c 100644 (file)
@@ -249,6 +249,10 @@ it is interpreted as acceptance of the first choice.  Note that the input
 buffer is not cleared prior to the prompt, so an accidental press of the
 "Enter" key at any time prior to the prompt will be interpreted as a choice!\fR
 .TP
+.BR "\-\-binpkg\-respect\-use < y | n >"
+Tells emerge to ignore binary packages if their use flags
+don't match the current configuration. (default: \'n\')
+.TP
 .BR "\-\-buildpkg " (\fB\-b\fR)
 Tells emerge to build binary packages for all ebuilds processed in
 addition to actually merging the packages.  Useful for maintainers
index 47ddc4907963b5891f513b17ef975069b93aa3d2..a000e900a1fe7058e6fa7fde1d337a3ab23ecf0e 100644 (file)
@@ -574,7 +574,8 @@ class depgraph(object):
                orig_use, orig_iuse, cur_use, cur_iuse):
                """Return a set of flags that trigger reinstallation, or None if there
                are no such flags."""
-               if "--newuse" in self._frozen_config.myopts:
+               if "--newuse" in self._frozen_config.myopts or \
+                       "--binpkg-respect-use" in self._frozen_config.myopts:
                        flags = set(orig_iuse.symmetric_difference(
                                cur_iuse).difference(forced_flags))
                        flags.update(orig_iuse.intersection(orig_use).symmetric_difference(
@@ -2157,7 +2158,8 @@ class depgraph(object):
                                        # reject the built package if necessary.
                                        if built and not installed and \
                                                ("--newuse" in self._frozen_config.myopts or \
-                                               "--reinstall" in self._frozen_config.myopts):
+                                               "--reinstall" in self._frozen_config.myopts or \
+                                               "--binpkg-respect-use" in self._frozen_config.myopts):
                                                iuses = pkg.iuse.all
                                                old_use = pkg.use.enabled
                                                if myeb:
index 34a4bda290cd30babc18192a560d261ccea71d29..f78c2e0e0f1887f39987e1082d7088d845692585 100644 (file)
@@ -249,6 +249,13 @@ def help(myopts, havecolor=1):
                print "              to the prompt, so an accidental press of the \"Enter\" key at any"
                print "              time prior to the prompt will be interpreted as a choice!"
                print
+               print "        " + green("--binpkg-respect-use") + \
+                       " < " + turquoise("y") + " | " + turquoise("n") + " >"
+               desc = "Tells emerge to ignore binary packages if their use flags" + \
+                       " don't match the current configuration. (default: 'n')"
+               for line in wrap(desc, desc_width):
+                       print desc_indent + line
+               print
                print "       "+green("--buildpkg")+" ("+green("-b")+" short option)"
                desc = "Tells emerge to build binary packages for all ebuilds processed in" + \
                        " addition to actually merging the packages. Useful for maintainers" + \
index 19b9cf52476c9d9bc8e510bccd4ffe98c2ae9327..1a4ee877d564ab994ad45f17e1280d02e169ba47 100644 (file)
@@ -215,15 +215,21 @@ def chk_updated_info_files(root, infodirs, prev_mtimes, retval):
                                if icount > 0:
                                        out.einfo("Processed %d info files." % (icount,))
 
-def display_preserved_libs(vardbapi):
+def display_preserved_libs(vardbapi, myopts):
        MAX_DISPLAY = 3
 
        # Ensure the registry is consistent with existing files.
        vardbapi.plib_registry.pruneNonExisting()
 
        if vardbapi.plib_registry.hasEntries():
-               print
-               print colorize("WARN", "!!!") + " existing preserved libs:"
+               if "--quiet" in myopts:
+                       print
+                       print colorize("WARN", "!!!") + " existing preserved libs found"
+                       return
+               else:
+                       print
+                       print colorize("WARN", "!!!") + " existing preserved libs:"
+
                plibdata = vardbapi.plib_registry.getPreservedLibs()
                linkmap = vardbapi.linkmap
                consumer_map = {}
@@ -360,7 +366,7 @@ def post_emerge(root_config, myopts, mtimedb, retval):
 
        display_news_notification(root_config, myopts)
        if retval in (None, os.EX_OK) or (not "--pretend" in myopts):
-               display_preserved_libs(vardbapi)        
+               display_preserved_libs(vardbapi, myopts)        
 
        sys.exit(retval)
 
@@ -381,6 +387,7 @@ def insert_optional_args(args):
        jobs_opts = ("-j", "--jobs")
        default_arg_opts = {
                '--deselect'   : ('n',),
+               '--binpkg-respect-use'   : ('n', 'y',),
                '--root-deps'  : ('rdeps',),
        }
        arg_stack = args[:]
@@ -499,6 +506,14 @@ def parse_opts(tmpcmdline, silent=False):
                        "type":"choice",
                        "choices":["changed-use"]
                },
+
+               "--binpkg-respect-use": {
+                       "help"    : "discard binary packages if their use flags \
+                               don't match the current configuration",
+                       "type"    : "choice",
+                       "choices" : ("True", "y", "n")
+               },
+
                "--root": {
                 "help"   : "specify the target root filesystem for merging packages",
                 "action" : "store"
@@ -540,6 +555,11 @@ def parse_opts(tmpcmdline, silent=False):
        if myoptions.deselect == "True":
                myoptions.deselect = True
 
+       if myoptions.binpkg_respect_use in ("y", "True",):
+               myoptions.binpkg_respect_use = True
+       else:
+               myoptions.binpkg_respect_use = None
+
        if myoptions.root_deps == "True":
                myoptions.root_deps = True
 
index dc47cb13a86776016998d433453216c1b99b37bf..85c5312e0589e9959b53724cba1dfebac697e6be 100644 (file)
@@ -4942,6 +4942,9 @@ def spawnebuild(mydo, actionmap, mysettings, debug, alwaysdep=0,
        if mydo == "prepare" and eapi in ("0", "1"):
                return os.EX_OK
 
+       if mydo == "pretend" and eapi in ("0", "1", "2"):
+               return os.EX_OK
+
        kwargs = actionmap[mydo]["args"]
        mysettings["EBUILD_PHASE"] = mydo
        _doebuild_exit_status_unlink(
@@ -5907,7 +5910,7 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
 
        clean_phases = ("clean", "cleanrm")
        validcommands = ["help","clean","prerm","postrm","cleanrm","preinst","postinst",
-                       "config", "info", "setup", "depend",
+                       "config", "info", "setup", "depend", "pretend",
                        "fetch", "fetchall", "digest",
                        "unpack", "prepare", "configure", "compile", "test",
                        "install", "rpm", "qmerge", "merge",
@@ -6476,6 +6479,7 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
 
                # args are for the to spawn function
                actionmap = {
+"pretend":  {"cmd":ebuild_sh, "args":{"droppriv":0,        "free":1,         "sesandbox":0,         "fakeroot":0}},
 "setup":    {"cmd":ebuild_sh, "args":{"droppriv":0,        "free":1,         "sesandbox":0,         "fakeroot":0}},
 "unpack":   {"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":0,         "sesandbox":sesandbox, "fakeroot":0}},
 "prepare":  {"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":0,         "sesandbox":sesandbox, "fakeroot":0}},
index abd6cc870d2ebf2eabe5440f727c03542617ff4f..08b7a3b9bf645948135a2981333bb450a0dfd969 100644 (file)
@@ -23,7 +23,7 @@ class dbapi(object):
        _category_re = re.compile(r'^\w[-.+\w]*$')
        _pkg_dir_name_re = re.compile(r'^\w[-+\w]*$')
        _categories = None
-       _iuse_implicit = None
+       _iuse_implicit_re = None
        _use_mutable = False
        _known_keys = frozenset(x for x in auxdbkeys
                if not x.startswith("UNUSED_0"))
@@ -149,20 +149,20 @@ class dbapi(object):
                1) Check for required IUSE intersection (need implicit IUSE here).
                2) Check enabled/disabled flag states.
                """
-               if self._iuse_implicit is None:
-                       self._iuse_implicit = self.settings._get_implicit_iuse()
+               if self._iuse_implicit_re is None:
+                       self._iuse_implicit_re = re.compile("^(%s)$" % \
+                               "|".join(self.settings._get_implicit_iuse()))
+               iuse_implicit_re = self._iuse_implicit_re
                for cpv in cpv_iter:
                        try:
                                iuse, slot, use = self.aux_get(cpv, ["IUSE", "SLOT", "USE"])
                        except KeyError:
                                continue
                        use = use.split()
-                       iuse = self._iuse_implicit.union(
-                               re.escape(x.lstrip("+-")) for x in iuse.split())
-                       iuse_re = re.compile("^(%s)$" % "|".join(iuse))
+                       iuse = frozenset(x.lstrip('+-') for x in iuse.split())
                        missing_iuse = False
                        for x in atom.use.required:
-                               if iuse_re.match(x) is None:
+                               if x not in iuse and iuse_implicit_re.match(x) is None:
                                        missing_iuse = True
                                        break
                        if missing_iuse:
index 7c886ae259272d005c3186bb8384cbd3d2e91095..e29377f72304c139b3136081fd0d36038ee6dd9a 100644 (file)
@@ -133,7 +133,6 @@ class portdbapi(dbapi):
                else:
                        from portage import settings
                        self.mysettings = config(clone=settings)
-               self._iuse_implicit = self.mysettings._get_implicit_iuse()
                self._categories = self.mysettings.categories
                # This is strictly for use in aux_get() doebuild calls when metadata
                # is generated by the depend phase.  It's safest to use a clone for