From 9f59f1b33a4a8fd1a62d0b3f682d8592eefb4659 Mon Sep 17 00:00:00 2001 From: Daniele Sluijters Date: Fri, 28 Mar 2014 08:47:19 +0100 Subject: [PATCH] pin: Fix the template. In APT preferences files the only allowed comments are lines that start with `Explanation:`, commented lines that start with a # trigger a myriad of interesting bugs. This is considered a feature of APT. Because we're only ever writing a single file at a time with only a # comment at the top we were getting away with this but it shouldn't be there in the first place. --- spec/defines/pin_spec.rb | 18 +++++++++--------- templates/pin.pref.erb | 1 - 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/spec/defines/pin_spec.rb b/spec/defines/pin_spec.rb index 6438e8c..d79462c 100644 --- a/spec/defines/pin_spec.rb +++ b/spec/defines/pin_spec.rb @@ -15,14 +15,14 @@ describe 'apt::pin', :type => :define do [ { :params => {}, - :content => "# my_pin\nExplanation: : my_pin\nPackage: *\nPin: release a=my_pin\nPin-Priority: 0\n" + :content => "Explanation: : my_pin\nPackage: *\nPin: release a=my_pin\nPin-Priority: 0\n" }, { :params => { :packages => 'apache', :priority => '1' }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" + :content => "Explanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" }, { :params => { @@ -30,7 +30,7 @@ describe 'apt::pin', :type => :define do :packages => 'apache', :priority => '1' }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" + :content => "Explanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" }, { :params => { @@ -38,7 +38,7 @@ describe 'apt::pin', :type => :define do :packages => 'apache', :priority => '1' }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" + :content => "Explanation: : my_pin\nPackage: apache\nPin: release a=my_pin\nPin-Priority: 1\n" }, { :params => { @@ -46,7 +46,7 @@ describe 'apt::pin', :type => :define do :priority => '1', :release => 'my_newpin' }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=my_newpin\nPin-Priority: 1\n" + :content => "Explanation: : my_pin\nPackage: apache\nPin: release a=my_newpin\nPin-Priority: 1\n" }, { :params => { @@ -54,14 +54,14 @@ describe 'apt::pin', :type => :define do :priority => '1', :version => '2.2.16*' }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: version 2.2.16*\nPin-Priority: 1\n" + :content => "Explanation: : my_pin\nPackage: apache\nPin: version 2.2.16*\nPin-Priority: 1\n" }, { :params => { :priority => '1', :origin => 'ftp.de.debian.org' }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: *\nPin: origin ftp.de.debian.org\nPin-Priority: 1\n" + :content => "Explanation: : my_pin\nPackage: *\nPin: origin ftp.de.debian.org\nPin-Priority: 1\n" }, { :params => { @@ -74,13 +74,13 @@ describe 'apt::pin', :type => :define do :originator => 'Debian', :label => 'Debian' }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache\nPin: release a=stable, n=wheezy, v=3.0, c=main, o=Debian, l=Debian\nPin-Priority: 1\n" + :content => "Explanation: : my_pin\nPackage: apache\nPin: release a=stable, n=wheezy, v=3.0, c=main, o=Debian, l=Debian\nPin-Priority: 1\n" }, { :params => { :packages => ['apache', 'ntop'], }, - :content => "# my_pin\nExplanation: : my_pin\nPackage: apache ntop\nPin: release a=my_pin\nPin-Priority: 0\n" + :content => "Explanation: : my_pin\nPackage: apache ntop\nPin: release a=my_pin\nPin-Priority: 0\n" }, ].each do |param_set| describe "when #{param_set == {} ? "using default" : "specifying"} define parameters" do diff --git a/templates/pin.pref.erb b/templates/pin.pref.erb index a19e253..26b2516 100644 --- a/templates/pin.pref.erb +++ b/templates/pin.pref.erb @@ -15,7 +15,6 @@ elsif @origin.length > 0 @pin = "origin #{@origin}" end -%> -# <%= @name %> Explanation: <%= @explanation %> Package: <%= @packages_string %> Pin: <%= @pin %> -- 2.45.2