Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 108314 - GLEP 47: Creating 'safe' environment variables
Summary: GLEP 47: Creating 'safe' environment variables
Status: RESOLVED WONTFIX
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Portage team
URL: http://www.gentoo.org/proj/en/glep/gl...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-06 13:50 UTC by Diego Elio Pettenò (RETIRED)
Modified: 2008-03-02 15:36 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Elio Pettenò (RETIRED) gentoo-dev 2005-10-06 13:50:48 UTC
Sorry if I don't submit a completely wrote-for-bug text, but I really think  
the gentoo-alt post plus vapier stuff explain quite good the idea :)  
  
To: gentoo-alt@g.o  
  
Now this is my idea: let CHOST/CBUILD expand to vars (and then to useflags):  
  
*-*-linux-* -> KERNEL="linux"  
*-*-*-gnu -> ELIBC="glibc" USERLAND="GNU"  
*-*-kfreebsd-gnu -> KERNEL="FreeBSD" ELIBC="glibc" USERLAND="GNU"  
*-*-freebsd* ->KERNEL="FreeBSD" ELIBC="FreeBSD" USERLAND="BSD"  
*-*-darwin* -> KERNEL="Darwin" ELIBC="Darwin" USERLAND="Darwin"  
*-*-netbsd* -> KERNEL="NetBSD" ELIBC="NetBSD" USERLAND="BSD"  
*-*-solaris* -> KERNEL="Solaris" ELIBC="Solaris" USERLAND="Solaris"(?)  
  
Now this could probably be simple to implement. From here we can expand the   
variables to get the right use-expanded vars as we do now.  
  
But that's not enough, as this is valid to set features and dependency we are   
compiling FOR.  
If we crosscompile from FreeBSD to Linux, we would get userland_GNU, and that   
would make a package that uses bsdish make command to depend on pmake and   
also to run "pmake" instead of "make"... what to do?  
  
CBUILD comes to help, as it will represent the system you're building ON. This   
could add BUSERLAND BELIBC BKERNEL variables and use expands (B for Build   
like BDEPEND), also if probably BUSERLAND is the only one that would be used.  
  
The expansion will occur on portage itself, without having to deal with   
changes from env to those variables.  
  
--  
  
Vapier then came out with this:  
 
$ cat env-map 
*-linux-* KERNEL=linux 
*-gnu USERLAND=GNU ELIBC=glibc 
x86_64-* ARCH=amd64 
  
$ cat readmap 
#!/bin/bash 
  
CBUILD=${CBUILD:-${CHOST=${CHOST:-$1}}} 
[[ -z ${CHOST} ]] && echo need chost 
  
unset KERNEL ELIBC USERLAND ARCH 
  
while read LINE ; do 
        set -- ${LINE} 
        targ=$1 
        shift 
        [[ ${CBUILD} == ${targ} ]] && eval $@ 
done < env-map 
  
echo ARCH=${ARCH} KERNEL=${KERNEL} ELIBC=${ELIBC} USERLAND=${USERLAND} 
  
$ ./readmap x86_64-pc-linux-gnu 
ARCH=amd64 KERNEL=linux ELIBC=glibc USERLAND=GNU 
 
-- 
 
and with the idea of putting that in the profiles/ subdirectory (possibly 
incremental with overlays, thanks :) ). 
 
What would that seem?
Comment 1 Jason Stubbs (RETIRED) gentoo-dev 2005-10-07 03:03:30 UTC
Profile bashrc's don't affect the python side of portage at all, at the moment.
Hence, it couldn't be used immediately. I definitely like this much more than
GLEP22 though. ;)

Speaking of which, how would this work with ebuild keywording? 
Comment 2 Robert Millan 2006-02-05 01:14:35 UTC
Just a little side-note, GNU/kFreeBSD carries version info in the triplet, e.g. x86_64-pc-kfreebsd5.4-gnu

So instead of *-*-kfreebsd-gnu, you need *-*-kfreebsd*-gnu.
Comment 3 Robert Millan 2006-02-05 22:07:38 UTC
Btw, why do you need this "readmap" thing.  Can't these variables in /etc/make.conf just be made mandatory?

It doesn't even need to be mandatory for all platforms, if you assume that non-existance of the vars implies *-*-linux-gnu.
Comment 4 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-02-06 07:27:44 UTC
The point of all this is to make sure that they are not tricked by users breaking systems in untoldable ways.

I think this is just waiting for the new GLEP to be presented, discussed and, hopefully, accepted.
Comment 5 Marius Mauch (RETIRED) gentoo-dev 2007-01-11 05:08:24 UTC
What's the status on this?
Mind that if this is supposed to affect $USE (via USE_EXPAND) you can't use a bash solution (as mentioned in comment #1) and I don't see this restriction changing anytime soon.
Comment 6 Marius Mauch (RETIRED) gentoo-dev 2007-06-07 14:46:36 UTC
Anyone still going for this?
Comment 7 Marius Mauch (RETIRED) gentoo-dev 2008-03-02 15:36:15 UTC
closing due to apparent lack of interest