Class: MCollective::PluginPackager::DebpackagePackager
- Inherits:
-
Object
- Object
- MCollective::PluginPackager::DebpackagePackager
- Defined in:
- lib/mcollective/pluginpackager/debpackage_packager.rb
Instance Method Summary collapse
-
#create_packages ⇒ Object
Build process : - create buildroot - craete buildroot/debian - create the relative directories with package contents - create install files for each of the plugins that are going to be built - create debian build files - create tarball - create pre and post install files - run the build script - move packages to cwd - clean up.
-
#initialize(plugin, pluginpath = nil, signature = nil, verbose = false, keep_artifacts = nil, module_template = nil) ⇒ DebpackagePackager
constructor
A new instance of DebpackagePackager.
Constructor Details
#initialize(plugin, pluginpath = nil, signature = nil, verbose = false, keep_artifacts = nil, module_template = nil) ⇒ DebpackagePackager
Returns a new instance of DebpackagePackager.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/mcollective/pluginpackager/debpackage_packager.rb', line 6 def initialize(plugin, pluginpath = nil, signature = nil, verbose = false, keep_artifacts = nil, module_template = nil) if PluginPackager.command_available?('debuild') @plugin = plugin @verbose = verbose @libdir = pluginpath || '/usr/share/mcollective/plugins/mcollective/' @signature = signature @package_name = "#{@plugin.mcname}-#{@plugin.[:name]}" @keep_artifacts = keep_artifacts else raise("Cannot build package. 'debuild' is not present on the system.") end end |
Instance Method Details
#create_packages ⇒ Object
Build process :
-
create buildroot
-
craete buildroot/debian
-
create the relative directories with package contents
-
create install files for each of the plugins that are going to be built
-
create debian build files
-
create tarball
-
create pre and post install files
-
run the build script
-
move packages to cwd
-
clean up
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/mcollective/pluginpackager/debpackage_packager.rb', line 30 def create_packages begin puts "Building packages for #{@package_name} plugin." @tmpdir = Dir.mktmpdir('mcollective_packager') @build_dir = File.join(@tmpdir, "#{@package_name}_#{@plugin.[:version]}") Dir.mkdir(@build_dir) create_debian_dir @plugin.packagedata.each do |type, data| prepare_tmpdirs(data) create_install_file(type, data) create_pre_and_post_install(type) end create_debian_files create_tar run_build move_packages puts "Completed building all packages for #{@package_name} plugin." ensure if @keep_artifacts puts 'Keeping build artifacts.' puts "Build artifacts saved - #{@tmpdir}" else puts 'Removing build artifacts.' cleanup_tmpdirs end end end |