From: Joe O'Pecko Date: Wed, 29 May 2013 22:52:32 +0000 (-0700) Subject: Add optional architecture qualifier to apt-sources X-Git-Tag: 1.2.0~4^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=b3d67c8937644c1b40e29f68a35e1450f7e443bb;p=puppet-modules%2Fpuppetlabs-apt.git Add optional architecture qualifier to apt-sources --- diff --git a/manifests/source.pp b/manifests/source.pp index a859174..64461ee 100644 --- a/manifests/source.pp +++ b/manifests/source.pp @@ -12,7 +12,8 @@ define apt::source( $key_server = 'keyserver.ubuntu.com', $key_content = false, $key_source = false, - $pin = false + $pin = false, + $architecture = undef ) { include apt::params diff --git a/spec/defines/source_spec.rb b/spec/defines/source_spec.rb index 0f37f63..884194e 100644 --- a/spec/defines/source_spec.rb +++ b/spec/defines/source_spec.rb @@ -48,6 +48,9 @@ describe 'apt::source', :type => :define do }, { :release => 'custom', + }, + { + :architecture => 'amd64', } ].each do |param_set| describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do @@ -69,9 +72,13 @@ describe 'apt::source', :type => :define do let :content do content = "# #{title}" - content << "\ndeb #{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n" + if param_hash[:architecture] + arch = "[arch=#{param_hash[:architecture]}]" + end + content << "\ndeb #{arch} #{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n" + if param_hash[:include_src] - content << "deb-src #{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n" + content << "deb-src #{arch} #{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n" end content end diff --git a/templates/source.list.erb b/templates/source.list.erb index 65764b2..845b8ae 100644 --- a/templates/source.list.erb +++ b/templates/source.list.erb @@ -1,5 +1,5 @@ # <%= @name %> -deb <%= @location %> <%= @release_real %> <%= @repos %> +deb <% if @architecture %>[arch=<%= @architecture %>]<% end %> <%= @location %> <%= @release_real %> <%= @repos %> <%- if @include_src then -%> -deb-src <%= @location %> <%= @release_real %> <%= @repos %> +deb-src <% if @architecture %>[arch=<%= @architecture %>]<% end %> <%= @location %> <%= @release_real %> <%= @repos %> <%- end -%>