gentoo / puppet-portage

[ORIGIN] Puppet module providing various Gentoo portage features
GNU General Public License v2.0
49 stars 30 forks source link

Layman support breaks make.conf #156

Open aetherknight opened 7 years ago

aetherknight commented 7 years ago

I recently updated to the latest tag for puppet-portage (2.4.0) from 2.3.0, and I started running into a problem with how puppet-portage generates my make.conf file:

Notice: /Stage[main]/Portage/Concat[/etc/portage/make.conf]/File[/etc/portage/make.conf]/content:
--- /etc/portage/make.conf  2017-06-03 12:10:57.437000000 -0700
+++ /tmp/.private/root/puppet-file20170603-28523-1p5dszy    2017-06-03 12:11:40.672000000 -0700
@@ -26,4 +26,4 @@
 RUBY_TARGETS="ruby22"
 SUEXEC_DOCROOT="/srv/www"
 USE="-alsa -awt -cacert -cramfs -cron -cxx -deprecated -dso -firmware-loader -gdbm -gtk -hpn -http -iconv -introspection -kmod -modules -net -netifrc -nls -openmp -pci -rdoc -smartcard -sendmail -suid -system-crontab -tls-heartbeat -usb -webdab -webdav alpn audit caps gpg gpm mem-scramble mktemp pic sasl secure-delete threads vim-syntax"
-source /var/lib/layman/make.conf
+SOURCE /VAR/LIB/LAYMAN/MAKE.CONF=""

The line in question is added by ::portage::install:

  portage::makeconf { "source ${portage::layman_make_conf}":
    ensure => $layman_makeconf_ensure,
  }

Which calls ::portage::makeconf:

define portage::makeconf(
  $ensure = present,
  $content = undef,
) {
  include ::portage
# ...

Which uses the makeconf.conf.erb template with::concat::fragment` from the 1.x stdlib:

<% if @content == '' -%>
<%= @name %>
<% elsif @name == 'http_proxy' or @name == 'ftp_proxy' -%>
<%= @name.downcase %>="<%= [@content].flatten.join(' ') %>"
<% else -%>
<%= @name.upcase %>="<%= [@content].flatten.join(' ') %>"
<% end -%>

The problem was introduced by a change to ::portage::makeconf that changed $content from an empty string to undef in commit 45f367901483191a91e24b73c354c49cced019ab

diff --git a/manifests/makeconf.pp b/manifests/makeconf.pp
index ffe0ab8..bf34938 100644
--- a/manifests/makeconf.pp
+++ b/manifests/makeconf.pp
@@ -26,9 +26,9 @@

 define portage::makeconf(
   $ensure = present,
-  $content = '',
+  $content = undef,
 ) {
-  include portage
+  include ::portage

   if($ensure == 'present') {
     concat::fragment { $name:

The root cause is that undef != '', so the template is applying the last branch of the conditional instead of the first branch.

aetherknight commented 7 years ago

Fixed the link to the commit that introduced the change that broke my make.conf file.