Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for /etc/portage/package.env #67

Open
AdmiralNemo opened this issue Apr 13, 2013 · 6 comments
Open

Support for /etc/portage/package.env #67

AdmiralNemo opened this issue Apr 13, 2013 · 6 comments

Comments

@AdmiralNemo
Copy link

It's pretty common for packages to need specific environment variables at install time (i.e. to set MAKEOPTS, disable DistCC, or use safer CFLAGS). It would be great to see this module with the ability to modify /etc/portage/env files as well as /etc/portage/package.env like the other package.* directories.

@adrienthebo
Copy link

http://wiki.gentoo.org/wiki//etc/portage/env indicates that file format would be bash environment variables, correct? Could you provide an example of how you would expect to use a package_env resource?

@AdmiralNemo
Copy link
Author

Yes, files in /etc/portage/env are just bash environment variables. I typically only put one variable per file, but by no means is that a requirement, as the wiki shows in the first example. Files in /etc/portage/package.env/ then look exactly like those in /etc/portage/package.use, except instead of USE flags, they contain references to the files in /etc/portage/env.

I would thus expect there to be two definitions in Puppet manifests, one to define the file in /etc/portage/env and one to define the file in /etc/portage/package.env.

Here's an example of how I would envision it (given my current limited knowledge of the Puppet language and Ruby in general):

portage::env { 'makeopts-j1':
  ensure  => present,
  target  => 'single-build-thread',
  var     => 'MAKEOPTS',
  content => '-j1',
}

portage::env { 'no-distcc':
  ensure  => present,
  target  => 'no-distcc',
  var     => 'FEATURES',
  content => '-distcc',
}

package_env { 'dev-libs/boost':
  ensure => present
  target => 'boost',
  env   => ['no-distcc', 'single-build-thread'],
}

This would create the following files:

/etc/portage/env/single-build-thread:

# HEADER: This file was autogenerated at Tue Apr 15 15:44:25 -0500 2013
# HEADER: by puppet.  While it can still be managed manually, it
# HEADER: is definitely not recommended.
MAKEOPTS="-j1"

/etc/portage/env/no-distcc:

# HEADER: This file was autogenerated at Tue Apr 15 15:44:25 -0500 2013
# HEADER: by puppet.  While it can still be managed manually, it
# HEADER: is definitely not recommended.
FEATURES="-distcc"

/etc/portage/package.env/boost:

# HEADER: This file was autogenerated at Tue Apr 15 15:44:25 -0500 2013
# HEADER: by puppet.  While it can still be managed manually, it
# HEADER: is definitely not recommended.
dev-libs/boost no-distcc single-build-thread

I could probably implement this using the concat method like the current portage::makeconf implementation, but I got the feeling from issue #56 that that implementation would be going away.

@vikraman
Copy link

vikraman commented Oct 5, 2013

package_env is already implemented. For portage::env, just use a file resource?

@tampakrap
Copy link

what is the difference between putting FEATURES="distcc" in /etc/portage/env/no-distcc and /etc/portage/make.conf?

@vikraman
Copy link

vikraman commented Oct 5, 2013

I tried implementing what op suggested with concat but it doesn't work if we set multiple portage::env resources to have the same target. We could instead have a list of variables set in a single portage::env resource.

@tampakrap
Copy link

not another define please, native types and providers only. If you want to implement that, name it portage_env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants