class MCollective::PluginPackager::DebpackagePackager - mcollective version 2.12.5

# class MCollective::PluginPackager::DebpackagePackager

### 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/debpackage_packager.rb
     6 def initialize(plugin, pluginpath = nil, signature = nil, verbose = false, keep_artifacts = nil, module_template = nil)
     7   if PluginPackager.command_available?('debuild')
     8     @plugin = plugin
     9     @verbose = verbose
    10     @libdir = pluginpath || '/usr/share/mcollective/plugins/mcollective/'
    11     @signature = signature
    12     @package_name = "#{@plugin.mcname}-#{@plugin.metadata[:name]}"
    13     @keep_artifacts = keep_artifacts
    14   else
    15     raise("Cannot build package. 'debuild' is not present on the system.")
    16   end
    17 end

### Public Instance Methods

create_packages() click to toggle source

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

       # File lib/mcollective/pluginpackager/debpackage_packager.rb
    30 def create_packages
    31   begin
    32     puts "Building packages for #{@package_name} plugin."
    33
    34     @tmpdir = Dir.mktmpdir('mcollective_packager')
    35     @build_dir = File.join(@tmpdir, "#{@package_name}_#{@plugin.metadata[:version]}")
    36     Dir.mkdir(@build_dir)
    37
    38     create_debian_dir
    39     @plugin.packagedata.each do |type, data|
    40       prepare_tmpdirs(data)
    41       create_install_file(type, data)
    42       create_pre_and_post_install(type)
    43     end
    44     create_debian_files
    45     create_tar
    46     run_build
    47     move_packages
    48
    49     puts "Completed building all packages for #{@package_name} plugin."
    50   ensure
    51     if @keep_artifacts
    52       puts 'Keeping build artifacts.'
    53       puts "Build artifacts saved - #{@tmpdir}"
    54     else
    55       puts 'Removing build artifacts.'
    56       cleanup_tmpdirs
    57     end
    58   end
    59 end