Skip to content

Commit

Permalink
Merge branch '2.7.x' into 3.0.x
Browse files Browse the repository at this point in the history
* 2.7.x:
  (puppetlabs#7422) Support arrow syntax with metaparams
  rm packaging artifacts in rpm spec, debian rules
  Fix build targets for 2.7.x
  Preserve timestamps when installing files
  Replace dashes with dots for gem version

Conflicts:
	ext/build_defaults.yaml
	ext/debian/rules
	ext/redhat/puppet.spec.erb
	tasks/rake/gem.rake
  • Loading branch information
Jeff McCune committed Nov 5, 2012
2 parents 263d02d + 075b23e commit f93032b
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ext/build_defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
packaging_url: 'git://github.com/puppetlabs/packaging.git --branch=master'
packaging_repo: 'packaging'
default_cow: 'base-squeeze-i386.cow'
cows: 'base-lucid-i386.cow base-natty-i386.cow base-oneiric-i386.cow base-precise-i386.cow base-sid-i386.cow base-squeeze-i386.cow base-stable-i386.cow base-testing-i386.cow base-unstable-i386.cow base-wheezy-i386.cow'
cows: 'base-lucid-i386.cow base-natty-i386.cow base-oneiric-i386.cow base-precise-i386.cow base-quantal-i386.cow base-sid-i386.cow base-squeeze-i386.cow base-stable-i386.cow base-testing-i386.cow base-unstable-i386.cow base-wheezy-i386.cow'
pbuild_conf: '/etc/pbuilderrc'
packager: 'puppetlabs'
gpg_name: '[email protected]'
Expand Down
16 changes: 8 additions & 8 deletions install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def do_configs(configs, target, strip = 'conf/')
if $haveftools
File.install(cf, ocf, 0644, true)
else
FileUtils.install(cf, ocf, {:mode => 0644, :verbose => true})
FileUtils.install(cf, ocf, {:mode => 0644, :preserve => true, :verbose => true})
end
end

Expand All @@ -92,7 +92,7 @@ def do_configs(configs, target, strip = 'conf/')
if $haveftools
File.install(src_dll, dst_dll, 0644, true)
else
FileUtils.install(src_dll, dst_dll, {:mode => 0644, :verbose => true})
FileUtils.install(src_dll, dst_dll, {:mode => 0644, :preserve => true, :verbose => true})
end

require 'win32/registry'
Expand Down Expand Up @@ -128,7 +128,7 @@ def do_libs(libs, strip = 'lib/')
else
FileUtils.makedirs(op, {:mode => 0755, :verbose => true})
FileUtils.chmod(0755, op)
FileUtils.install(lf, olf, {:mode => 0644, :verbose => true})
FileUtils.install(lf, olf, {:mode => 0644, :preserve => true, :verbose => true})
end
end
end
Expand All @@ -144,7 +144,7 @@ def do_man(man, strip = 'man/')
else
FileUtils.makedirs(om, {:mode => 0755, :verbose => true})
FileUtils.chmod(0755, om)
FileUtils.install(mf, omf, {:mode => 0644, :verbose => true})
FileUtils.install(mf, omf, {:mode => 0644, :preserve => true, :verbose => true})
end
gzip = %x{which gzip}
gzip.chomp!
Expand Down Expand Up @@ -411,12 +411,12 @@ def install_binfile(from, op_file, target)
installed_wrapper = false

if File.exists?("#{from}.bat")
FileUtils.install("#{from}.bat", File.join(target, "#{op_file}.bat"), :mode => 0755, :verbose => true)
FileUtils.install("#{from}.bat", File.join(target, "#{op_file}.bat"), :mode => 0755, :preserve => true, :verbose => true)
installed_wrapper = true
end

if File.exists?("#{from}.cmd")
FileUtils.install("#{from}.cmd", File.join(target, "#{op_file}.cmd"), :mode => 0755, :verbose => true)
FileUtils.install("#{from}.cmd", File.join(target, "#{op_file}.cmd"), :mode => 0755, :preserve => true, :verbose => true)
installed_wrapper = true
end

Expand All @@ -430,13 +430,13 @@ def install_binfile(from, op_file, target)
"%RUBY_BIN%ruby.exe" -x "%RUBY_BIN%puppet" %*
EOS
File.open(tmp_file2.path, "w") { |cw| cw.puts cwv }
FileUtils.install(tmp_file2.path, File.join(target, "#{op_file}.bat"), :mode => 0755, :verbose => true)
FileUtils.install(tmp_file2.path, File.join(target, "#{op_file}.bat"), :mode => 0755, :preserve => true, :verbose => true)

tmp_file2.unlink
installed_wrapper = true
end
end
FileUtils.install(tmp_file.path, File.join(target, op_file), :mode => 0755, :verbose => true)
FileUtils.install(tmp_file.path, File.join(target, op_file), :mode => 0755, :preserve => true, :verbose => true)
tmp_file.unlink
end

Expand Down
4 changes: 3 additions & 1 deletion lib/puppet/parser/relationship.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def mk_relationship(source, target, catalog)
raise ArgumentError, "Could not find resource '#{target}' for relationship from '#{source}'"
end
Puppet.debug "Adding relationship from #{source} to #{target} with '#{param_name}'"
source_resource[param_name] ||= []
if source_resource[param_name].class != Array
source_resource[param_name] = [source_resource[param_name]].compact
end
source_resource[param_name] << target
end
end
24 changes: 24 additions & 0 deletions spec/unit/parser/relationship_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
before do
@source = Puppet::Resource.new(:mytype, "source")
@target = Puppet::Resource.new(:mytype, "target")
@extra_resource = Puppet::Resource.new(:mytype, "extra")
@extra_resource2 = Puppet::Resource.new(:mytype, "extra2")
@dep = Puppet::Parser::Relationship.new(@source, @target, :relationship)
end

Expand All @@ -15,6 +17,8 @@
@catalog = Puppet::Resource::Catalog.new
@catalog.add_resource(@source)
@catalog.add_resource(@target)
@catalog.add_resource(@extra_resource)
@catalog.add_resource(@extra_resource2)
end

it "should fail if the source resource cannot be found" do
Expand Down Expand Up @@ -44,10 +48,30 @@
it "should supplement rather than clobber existing relationship values" do
@source[:before] = "File[/bar]"
@dep.evaluate(@catalog)
# this test did not work before. It was appending the resources
# together as a string
(@source[:before].class == Array).should be_true
@source[:before].should be_include("Mytype[target]")
@source[:before].should be_include("File[/bar]")
end

it "should supplement rather than clobber existing resource relationships" do
@source[:before] = @extra_resource
@dep.evaluate(@catalog)
(@source[:before].class == Array).should be_true
@source[:before].should be_include("Mytype[target]")
@source[:before].should be_include(@extra_resource)
end

it "should supplement rather than clobber multiple existing resource relationships" do
@source[:before] = [@extra_resource, @extra_resource2]
@dep.evaluate(@catalog)
(@source[:before].class == Array).should be_true
@source[:before].should be_include("Mytype[target]")
@source[:before].should be_include(@extra_resource)
@source[:before].should be_include(@extra_resource2)
end

it "should use the collected retargets if the target is a Collector" do
orig_target = @target
@target = Puppet::Parser::Collector.new(stub("scope"), :file, "equery", "vquery", :virtual)
Expand Down
62 changes: 62 additions & 0 deletions tasks/rake/gem.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
require 'fileutils'
require 'puppet/version'

GEM_FILES = FileList[
'[A-Z]*',
'install.rb',
'bin/**/*',
'lib/**/*',
'conf/**/*',
'man/**/*',
'examples/**/*',
'ext/**/*',
'tasks/**/*',
'test/**/*',
'spec/**/*'
]

EXECUTABLES = FileList[
'bin/**/*',
'sbin/**/*'
]

SBIN = Dir.glob("sbin/*")
GEMVERSION = Puppet.version.gsub('-','.')

spec = Gem::Specification.new do |spec|
spec.platform = Gem::Platform::RUBY
spec.name = 'puppet'
spec.files = GEM_FILES.to_a
spec.executables = EXECUTABLES.gsub(/sbin\/|bin\//, '').to_a
spec.version = GEMVERSION
spec.add_dependency('facter', '~> 1.5')
spec.summary = 'Puppet, an automated configuration management tool'
spec.description = 'Puppet, an automated configuration management tool'
spec.author = 'Puppet Labs'
spec.email = '[email protected]'
spec.homepage = 'http://puppetlabs.com'
spec.rubyforge_project = 'puppet'
spec.has_rdoc = true
spec.rdoc_options <<
'--title' << 'Puppet - Configuration Management' <<
'--main' << 'README' <<
'--line-numbers'
end

desc "Prepare binaries for gem creation"
task :prepare_gem do
SBIN.each do |f|
FileUtils.copy(f,"bin")
end
end

desc "Create the gem"
task :create_gem => :prepare_gem do
Dir.mkdir("pkg") rescue nil
Gem::Builder.new(spec).build
FileUtils.move("puppet-#{GEMVERSION}.gem", "pkg")
SBIN.each do |f|
fn = f.gsub(/sbin\/(.*)/, '\1')
FileUtils.rm_r "bin/" + fn
end
end

0 comments on commit f93032b

Please sign in to comment.