Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 147428

Summary: portage-2.1.1 LINGUAS problem
Product: Portage Development Reporter: Rafał Mużyło <galtgendo>
Component: Core - Ebuild SupportAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: truedfx
Priority: High Keywords: InVCS, REGRESSION
Version: 2.1   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 147007, 149110    
Attachments: don't export empty USE_EXPAND variables
unset empty USE_EXPAND variables
Don't export USE_EXPAND variables if they aren't already set and would be emptied

Description Rafał Mużyło 2006-09-13 02:15:33 UTC
Before, when LINGUAS was unset, all locales were installed.
Now, both emerge and ebuild set LINGUAS="" and no locales are installed.
(I'm talking about .gmo files in /usr/share/locales)
Comment 1 Zac Medico gentoo-dev 2006-09-13 11:33:43 UTC
Are you refering to a specific ebuild?  Please provide a test case.
Comment 2 Harald van Dijk (RETIRED) gentoo-dev 2006-09-13 11:54:51 UTC
This can be seen with any proper autotools+gettext-based ebuild, and a simple testcase is:

KEYWORDS=~x86
pkg_setup() { env | grep LINGUAS; die; }

If LINGUAS is unset, it will print nothing. If LINGUAS is exported as an empty variable, it will say so. The problem is that portage seems to assume that that's the same thing, so that it's safe to always export it. It's not, by design.
Comment 3 Zac Medico gentoo-dev 2006-09-13 12:30:31 UTC
Created attachment 96892 [details, diff]
don't export empty USE_EXPAND variables

This should correct the problem.  Please test.
Comment 4 Zac Medico gentoo-dev 2006-09-13 12:44:50 UTC
Created attachment 96894 [details, diff]
unset empty USE_EXPAND variables

This patch uses unset instead of export -n, so that the ebuild/eclass shell code won't see the empty variables either.
Comment 5 Harald van Dijk (RETIRED) gentoo-dev 2006-09-13 12:49:08 UTC
They do handle the unset LINGUAS case correctly, but unfortunately, those solutions won't work when the user exports LINGUAS="" (exactly to avoid installing .mo files): in that case, portage will unset it, and gettext builds will install everything.
Comment 6 Harald van Dijk (RETIRED) gentoo-dev 2006-09-13 13:01:29 UTC
A quick test suggests that

@@ -1609,7 +1641,8 @@
                        # like LINGUAS.
                        var_split = [ x for x in var_split if x in expand_flags ]
                        var_split.extend(expand_flags.difference(var_split))
-                       self[var] = " ".join(var_split)
+                       if self.has_key(var) or len(var_split):
+                               self[var] = " ".join(var_split)
 
                # Pre-Pend ARCH variable to USE settings so '-*' in env doesn't kill arch.
                if self.configdict["defaults"].has_key("ARCH"):

works, but I'm no portage guy, and I have no idea if this may break something else. :) (Line numbers are messed up, I know.)
Comment 7 Harald van Dijk (RETIRED) gentoo-dev 2006-09-13 13:07:51 UTC
Created attachment 96896 [details, diff]
Don't export USE_EXPAND variables if they aren't already set and would be emptied

In nice patch format...
Comment 8 Zac Medico gentoo-dev 2006-09-13 13:44:51 UTC
Thanks, it seems like that patch will cover all of the cases correctly.  It's in svn r4441.
Comment 9 Rafał Mużyło 2006-09-13 22:25:40 UTC
Well, "ebuild" meant "ebuild.sh", patch works for me.
Any chance for at least an early revision bump ?
Comment 10 Zac Medico gentoo-dev 2006-09-14 00:32:21 UTC
I'm planning to do a revbump in about a week.  We've got one other regression and I want to wait a little longer to see if anything else is discovered.
Comment 11 Zac Medico gentoo-dev 2006-09-15 20:31:28 UTC
This has been released in 2.1.2_pre1.
Comment 12 Zac Medico gentoo-dev 2006-09-22 14:43:14 UTC
*** Bug 148702 has been marked as a duplicate of this bug. ***
Comment 13 Zac Medico gentoo-dev 2006-09-25 20:33:21 UTC
This has also been released in 2.1.1-r1.