Merged from trunk -r15340:15350
authorFabian Groffen <grobian@gentoo.org>
Fri, 19 Feb 2010 10:12:27 +0000 (10:12 -0000)
committerFabian Groffen <grobian@gentoo.org>
Fri, 19 Feb 2010 10:12:27 +0000 (10:12 -0000)
   | 15341   | Fix dblink._eerror argument where list is required instead   |
   | zmedico | of string.                                                   |

   | 15342   | Remove unnecessary newline in dblink._eerror message.        |
   | zmedico |                                                              |

   | 15343   | Logg errors that occur during binpkg extraction.             |
   | zmedico |                                                              |

   | 15344   | Use os.environ instead of the config.environ(). This solves  |
   | zmedico | binpkg extraction issues with catalyst stage1 due to PATH    |
   |         | being unset and bzip2/tar binaries not being found by bash.  |

   | 15345   | When creating a config instance for ROOT=/ with a clean env, |
   | zmedico | copy PATH and TERM variables, since they may be useful.      |

   | 15346   | Bug #304793 - Update --newuse docs to indicate that this     |
   | zmedico | option also implies --selective.                             |

   | 15347   | Bug #262647 - Explicitly exclude SRC_URI and other           |
   | zmedico | potentially long metadata variables from config.environ()    |
   |         | exports, to avoid potential E2BIG errors from execve calls.  |

   | 15348   | Evaluate USE conditionals when writing vdb entries after     |
   | zmedico | src_install.                                                 |

   | 15349   | After src_install, save fewer variables when writing the vdb |
   | zmedico | entry for a virtual package.                                 |

   | 15350   | Don't save SRC_URI as a vdb entry since it's pretty useless  |
   | zmedico | and it's available in environment.bz2 anyway.                |

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

bin/ebuild.sh
man/emerge.1
pym/_emerge/Binpkg.py
pym/_emerge/BinpkgExtractorAsync.py
pym/_emerge/help.py
pym/portage/__init__.py
pym/portage/dbapi/vartree.py

index f61d322d3c6a3591dc77a4085a3583f3dde7b65d..3d6f2ef289c4ff6513fb0f196c022b774cd1a7e2 100755 (executable)
@@ -1089,17 +1089,22 @@ dyn_install() {
        set -f
        local f x
        IFS=$' \t\n\r'
-       for f in ASFLAGS CATEGORY CBUILD CC CFLAGS CHOST CTARGET CXX \
-               CXXFLAGS DEFINED_PHASES DEPEND EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \
-               FEATURES INHERITED IUSE LDFLAGS LIBCFLAGS LIBCXXFLAGS \
-               LICENSE PDEPEND PF PKGUSE PROPERTIES PROVIDE RDEPEND RESTRICT SLOT \
-               KEYWORDS HOMEPAGE SRC_URI DESCRIPTION; do
+       for f in CATEGORY DEFINED_PHASES FEATURES INHERITED IUSE  \
+               PF PKGUSE SLOT KEYWORDS HOMEPAGE DESCRIPTION ; do
                x=$(echo -n ${!f})
                [[ -n $x ]] && echo "$x" > $f
        done
-       echo "${EPREFIX}"   > EPREFIX
+       if [[ $CATEGORY != virtual ]] ; then
+               for f in ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX \
+                       CXXFLAGS EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \
+                       LDFLAGS LIBCFLAGS LIBCXXFLAGS ; do
+                       x=$(echo -n ${!f})
+                       [[ -n $x ]] && echo "$x" > $f
+               done
+       fi
        echo "${USE}"       > USE
        echo "${EAPI:-0}"   > EAPI
+       echo "${EPREFIX}"   > EPREFIX
        set +f
 
        # local variables can leak into the saved environment.
index 7532797ac01f87936bc04b7890b272b981f65a95..bf9cdaa966973f6ab0701b31f3949e860ba144ac 100644 (file)
@@ -403,8 +403,10 @@ analogous options that should be configured via \fBMAKEOPTS\fR in
 \fBmake.conf\fR(5).
 .TP
 .BR "\-\-newuse " (\fB\-N\fR)
-Tells emerge to include installed packages where USE flags have changed since 
-compilation.  USE flag changes include:
+Tells emerge to include installed packages where USE
+flags have changed since compilation. This option
+also implies the \fB\-\-selective\fR option.
+USE flag changes include:
 
 A USE flag was added to a package.
 A USE flag was removed from a package.
index c0d0b88c56c08130bb0ef74182acd69baf9125a5..ae61b7918598943c19c5745a2d91090a7f873500 100644 (file)
@@ -22,6 +22,7 @@ if os.environ.__contains__("PORTAGE_PYTHONPATH"):
 else:
        sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "pym"))
 import portage
+import logging
 from portage.output import colorize
 from portage.const import EPREFIX
 
@@ -303,15 +304,17 @@ class Binpkg(CompositeTask):
 
                extractor = BinpkgExtractorAsync(background=self.background,
                        image_dir=pkgloc,
-                       pkg=self.pkg, pkg_path=self._pkg_path, scheduler=self.scheduler)
+                       pkg=self.pkg, pkg_path=self._pkg_path,
+                       logfile=self.settings.get("PORTAGE_LOG_FILE"),
+                       scheduler=self.scheduler)
                self._writemsg_level(">>> Extracting %s\n" % self.pkg.cpv)
                self._start_task(extractor, self._extractor_exit)
 
        def _extractor_exit(self, extractor):
                if self._final_exit(extractor) != os.EX_OK:
                        self._unlock_builddir()
-                       writemsg("!!! Error Extracting '%s'\n" % self._pkg_path,
-                               noiselevel=-1)
+                       self._writemsg_level("!!! Error Extracting '%s'\n" % \
+                               self._pkg_path, noiselevel=-1, level=logging.ERROR)
                        self.wait()
                        return
 
index e22fcf65d3b999c9ab8452156d6f789ef7e854f9..45af54136be44b610273b59c3bb89314f3782ba1 100644 (file)
@@ -11,6 +11,7 @@ if os.environ.__contains__("PORTAGE_PYTHONPATH"):
 else:
        sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "pym"))
 import portage
+
 class BinpkgExtractorAsync(SpawnProcess):
 
        __slots__ = ("image_dir", "pkg", "pkg_path")
@@ -19,10 +20,15 @@ class BinpkgExtractorAsync(SpawnProcess):
 
        def _start(self):
                self.args = [self._shell_binary, "-c",
-                       "bzip2 -dqc -- %s | tar -xp -C %s -f -" % \
+                       ("bzip2 -dqc -- %s | tar -xp -C %s -f - ; " + \
+                       "p=(${PIPESTATUS[@]}) ; " + \
+                       "if [ ${p[0]} != 0 ] ; then " + \
+                       "echo bzip2 failed with status ${p[0]} ; exit ${p[0]} ; fi ; " + \
+                       "if [ ${p[1]} != 0 ] ; then " + \
+                       "echo tar failed with status ${p[1]} ; exit ${p[1]} ; fi ; " + \
+                       "exit 0 ;") % \
                        (portage._shell_quote(self.pkg_path),
                        portage._shell_quote(self.image_dir))]
 
-               self.env = self.pkg.root_config.settings.environ()
+               self.env = os.environ.copy()
                SpawnProcess._start(self)
-
index 82f0666c8a11ab222da555c9398c8d4e163b5d7b..88b818cfb371e88bc3167110ab53be264b8bdb29 100644 (file)
@@ -442,8 +442,11 @@ def help(myopts, havecolor=1):
                        print(desc_indent + line)
                print()
                print("       "+green("--newuse")+" ("+green("-N")+" short option)")
-               print("              Tells emerge to include installed packages where USE flags have ")
-               print("              changed since installation.")
+               desc = "Tells emerge to include installed packages where USE " + \
+                       "flags have changed since compilation. This option " + \
+                       "also implies the --selective option."
+               for line in wrap(desc, desc_width):
+                       print(desc_indent + line)
                print()
                print("       "+green("--noconfmem"))
                print("              Portage keeps track of files that have been placed into")
index 9a55f90e265ca92f1700c6016d857cedfca67a09..6f5ec6424f0a4bd9717839e99b616ceed49986a8 100644 (file)
@@ -1382,12 +1382,10 @@ class config(object):
        virtuals ...etc you look in here.
        """
 
-       # Don't include anything that could be extremely long here (like SRC_URI)
-       # since that could cause execve() calls to fail with E2BIG errors. For
-       # example, see bug #262647.
-       _setcpv_aux_keys = ('SLOT', 'RESTRICT', 'LICENSE',
-               'KEYWORDS',  'INHERITED', 'IUSE', 'PROVIDE', 'EAPI',
-               'PROPERTIES', 'DEFINED_PHASES', 'repository')
+       _setcpv_aux_keys = ('DEFINED_PHASES', 'DEPEND', 'EAPI',
+               'INHERITED', 'IUSE', 'KEYWORDS', 'LICENSE', 'PDEPEND',
+               'PROPERTIES', 'PROVIDE', 'RDEPEND', 'SLOT',
+               'repository', 'RESTRICT', 'LICENSE',)
 
        _env_blacklist = [
                "A", "AA", "CATEGORY", "DEPEND", "DESCRIPTION", "EAPI",
@@ -1486,6 +1484,13 @@ class config(object):
        # they don't needlessly propagate down into the ebuild environment.
        _environ_filter = []
 
+       # Exclude anything that could be extremely long here (like SRC_URI)
+       # since that could cause execve() calls to fail with E2BIG errors. For
+       # example, see bug #262647.
+       _environ_filter += [
+               'DEPEND', 'RDEPEND', 'PDEPEND', 'SRC_URI',
+       ]
+
        # misc variables inherited from the calling environment
        _environ_filter += [
                "INFOPATH", "MANPATH", "USER",
@@ -5883,6 +5888,9 @@ def _post_src_install_chost_fix(settings):
                write_atomic(os.path.join(settings['PORTAGE_BUILDDIR'],
                        'build-info', 'CHOST'), chost + '\n')
 
+_vdb_use_conditional_keys = ('DEPEND', 'LICENSE', 'PDEPEND',
+       'PROPERTIES', 'PROVIDE', 'RDEPEND', 'RESTRICT',)
+
 def _post_src_install_uid_fix(mysettings, out=None):
        """
        Files in $D with user and group bits that match the "portage"
@@ -5985,8 +5993,29 @@ def _post_src_install_uid_fix(mysettings, out=None):
                for l in _merge_unicode_error(unicode_errors):
                        eerror(l, phase='install', key=mysettings.mycpv, out=out)
 
-       open(_unicode_encode(os.path.join(mysettings['PORTAGE_BUILDDIR'],
-               'build-info', 'SIZE')), 'w').write(str(size) + '\n')
+       build_info_dir = os.path.join(mysettings['PORTAGE_BUILDDIR'],
+               'build-info')
+
+       codecs.open(_unicode_encode(os.path.join(build_info_dir,
+               'SIZE'), encoding=_encodings['fs'], errors='strict'),
+               'w', encoding=_encodings['repo.content'],
+               errors='strict').write(str(size) + '\n')
+
+       use = frozenset(mysettings['PORTAGE_USE'].split())
+       for k in _vdb_use_conditional_keys:
+               v = mysettings.configdict['pkg'].get(k)
+               if v is None:
+                       continue
+               v = dep.paren_reduce(v)
+               v = dep.use_reduce(v, uselist=use)
+               v = dep.paren_normalize(v)
+               v = dep.paren_enclose(v)
+               if not v:
+                       continue
+               codecs.open(_unicode_encode(os.path.join(build_info_dir,
+                       k), encoding=_encodings['fs'], errors='strict'),
+                       mode='w', encoding=_encodings['repo.content'],
+                       errors='strict').write(v + '\n')
 
        if bsd_chflags:
                # Restore all of the flags saved above.
@@ -9252,8 +9281,13 @@ def create_trees(config_root=None, target_root=None, trees=None):
 
                # When ROOT != "/" we only want overrides from the calling
                # environment to apply to the config that's associated
-               # with ROOT != "/", so pass an empty dict for the env parameter.
-               settings = config(config_root=None, target_root="/", env={})
+               # with ROOT != "/", so pass a nearly empty dict for the env parameter.
+               clean_env = {}
+               for k in ('PATH', 'TERM'):
+                       v = settings.get(k)
+                       if v is not None:
+                               clean_env[k] = v
+               settings = config(config_root=None, target_root="/", env=clean_env)
                settings.lock()
                myroots.append((settings["ROOT"], settings))
 
index 89df6e73f69d5e43f2b5e35cdd17910ed5a16055..25f92d402386f740d42f236a9367d9bb56147a68 100644 (file)
@@ -3455,7 +3455,8 @@ class dblink(object):
                                        # like hell and continue to hopefully finish all our
                                        # administrative and pkg_postinst stuff.
                                        self._eerror("postrm", 
-                                               "Could not chmod or unlink '%s': %s\n" % (file_name, ose))
+                                               ["Could not chmod or unlink '%s': %s" % \
+                                               (file_name, ose)])
                                finally:
                                        if bsd_chflags and pflags != 0:
                                                # Restore the parent flags we saved before unlinking