Ensure correct IUSE in vdb for bug #386829.
authorZac Medico <zmedico@gentoo.org>
Tue, 11 Oct 2011 20:57:49 +0000 (13:57 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 11 Oct 2011 20:57:49 +0000 (13:57 -0700)
pym/portage/package/ebuild/doebuild.py

index b2f8c7744301859d16f8bbe84b29c51140bfb506..156da1acabd68cd603014ade00495ea68c06c9af 100644 (file)
@@ -1542,15 +1542,24 @@ def _post_src_install_chost_fix(settings):
        """
        It's possible that the ebuild has changed the
        CHOST variable, so revert it to the initial
-       setting.
+       setting. Also, revert IUSE in case it's corrupted
+       due to local environment settings like in bug #386829.
        """
-       if settings.get('CATEGORY') == 'virtual':
-               return
 
-       chost = settings.get('CHOST')
-       if chost:
-               write_atomic(os.path.join(settings['PORTAGE_BUILDDIR'],
-                       'build-info', 'CHOST'), chost + '\n')
+       build_info_dir = os.path.join(settings['PORTAGE_BUILDDIR'], 'build-info')
+
+       for k in ('IUSE',):
+               v = settings.get(k)
+               if v is not None:
+                       write_atomic(os.path.join(build_info_dir, k), v + '\n')
+
+       # The following variables are irrelevant for virtual packages.
+       if settings.get('CATEGORY') != 'virtual':
+
+               for k in ('CHOST',):
+                       v = settings.get(k)
+                       if v is not None:
+                               write_atomic(os.path.join(build_info_dir, k), v + '\n')
 
 _vdb_use_conditional_keys = ('DEPEND', 'LICENSE', 'PDEPEND',
        'PROPERTIES', 'PROVIDE', 'RDEPEND', 'RESTRICT',)