Forgive me if there's a way to do this already. I can't seem to find an elegant way to do it.
I tried 2 approaches.
1. Setting the USE environment variable.
package { ssh:
name => "net-misc/openssh",
ensure => latest,
env => 'USE="ldap"'
}
2. Appending entries to /etc/portage/package.use before installing a package.
# got this from somewhere on the net, uses exec, the
# exec unless argument, grep and sed.
define append_if_no_such_line($file, $line) { ... }
append_if_no_such_line { tracportageuseflags:
file => "/etc/portage/package.use",
line => "www-apps/trac sqlite fastcgi vhosts"
}
package { trac:
ensure => latest,
require => Append_if_no_such_line[tracportageuseflags]
}
That works, but it's ugly and it will fail or write useless files when $packager != gentoo.