Evaluate USE conditionals when writing vdb entries after src_install.
authorZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:13:56 +0000 (20:13 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:13:56 +0000 (20:13 -0000)
(trunk r15348)

svn path=/main/branches/2.1.7/; revision=15575

bin/ebuild.sh
pym/portage/__init__.py

index 2d51914672e689168328e07d27f1237f7bf019e0..8a5076d1aa6d86392940de98603cbc19220e5b2f 100755 (executable)
@@ -1088,10 +1088,9 @@ dyn_install() {
        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 \
+               CXXFLAGS DEFINED_PHASES 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
+               PF PKGUSE SLOT KEYWORDS HOMEPAGE DESCRIPTION ; do
                x=$(echo -n ${!f})
                [[ -n $x ]] && echo "$x" > $f
        done
index 9fc0963f1618b0449bcd2b41245868ba2f8c162c..5e52dac5c32fb3224f62aefb5aa791662436d988 100644 (file)
@@ -1365,9 +1365,10 @@ class config(object):
        virtuals ...etc you look in here.
        """
 
-       _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', 'SRC_URI',
+               'repository', 'RESTRICT', 'LICENSE',)
 
        _env_blacklist = [
                "A", "AA", "CATEGORY", "DEPEND", "DESCRIPTION", "EAPI",
@@ -5869,6 +5870,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', 'SRC_URI')
+
 def _post_src_install_uid_fix(mysettings, out=None):
        """
        Files in $D with user and group bits that match the "portage"
@@ -5971,8 +5975,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.