class MCollective::PluginPackager::RpmpackagePackager
Public Class Methods
new(plugin, pluginpath = nil, signature = nil, verbose = false, keep_artifacts = nil, module_template = nil)
click to toggle source
# File lib/mcollective/pluginpackager/rpmpackage_packager.rb 6 def initialize(plugin, pluginpath = nil, signature = nil, verbose = false, keep_artifacts = nil, module_template = nil) 7 if @buildtool = select_command 8 @plugin = plugin 9 @package_name = "#{@plugin.mcname}-#{@plugin.metadata[:name]}" 10 @package_name_and_version = "#{@package_name}-#{@plugin.metadata[:version]}" 11 @verbose = verbose 12 @libdir = pluginpath || '/usr/libexec/mcollective/mcollective/' 13 @signature = signature 14 @rpmdir = rpmdir 15 @srpmdir = srpmdir 16 @keep_artifacts = keep_artifacts 17 else 18 raise("Cannot build package. 'rpmbuild' or 'rpmbuild-md5' is not present on the system") 19 end 20 end
Public Instance Methods
create_packages()
click to toggle source
Build Process :
-
create temporary buildroot
-
create the spec file
-
create the tarball
-
run the build script
-
move pacakges to cwd
-
clean up
# File lib/mcollective/pluginpackager/rpmpackage_packager.rb 48 def create_packages 49 begin 50 puts "Building packages for #{@package_name} plugin." 51 52 @tmpdir = Dir.mktmpdir('mcollective_packager') 53 prepare_tmpdirs 54 55 make_spec_file 56 run_build 57 move_packages 58 59 puts "Completed building all packages for #{@package_name} plugin." 60 ensure 61 if @keep_artifacts 62 puts 'Keeping build artifacts' 63 puts "Build artifacts saved - #{@tmpdir}" 64 else 65 cleanup_tmpdirs 66 end 67 end 68 end
rpmdir()
click to toggle source
# File lib/mcollective/pluginpackager/rpmpackage_packager.rb 33 def rpmdir 34 `rpm --eval '%_rpmdir'`.chomp 35 end
select_command()
click to toggle source
Determine the build tool present on the system
# File lib/mcollective/pluginpackager/rpmpackage_packager.rb 23 def select_command 24 if PluginPackager.command_available?('rpmbuild-md5') 25 return 'rpmbuild-md5' 26 elsif PluginPackager.command_available?('rpmbuild') 27 return 'rpmbuild' 28 else 29 return nil 30 end 31 end
srpmdir()
click to toggle source
# File lib/mcollective/pluginpackager/rpmpackage_packager.rb 37 def srpmdir 38 `rpm --eval '%_srcrpmdir'`.chomp 39 end