Parent

Class/Module Index [+]

Quicksearch

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, 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.metadata[:name]}"
    @keep_artifacts = keep_artifacts
  else
    raise("Cannot build package. 'debuild' is not present on the system.")
  end
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, 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.metadata[: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

[Validate]

Generated with the Darkfish Rdoc Generator 2.