Module: PEBuild::Util::PEPackaging

Included in:
Provisioner::PEAgent
Defined in:
lib/pe_build/util/pe_packaging.rb

Overview

Utilities related to PE Packages

This module provides general-purpose utility functions for working with PE packages.

Since:

  • 0.13.0

Class Method Summary collapse

Class Method Details

.platform_tag(facts) ⇒ String

Determine package tag from Facts

The platform_tag is a os-version-archtecture value that is used in many PE package filenames and repostiory names.

Parameters:

  • facts (Hash)

    A hash of facts which includes architecture and os values.

Returns:

  • (String)

    A string representing the platform tag.

Since:

  • 0.13.0



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/pe_build/util/pe_packaging.rb', line 20

def platform_tag(facts)
  case facts['os']['family'].downcase
  when 'redhat'
    # TODO: Fedora might be in here.
    os      = 'el'
    version = facts['os']['release']['major']
    arch    = facts['architecture']
  when 'windows'
    os      = 'windows'
    # Windows packages don't discriminate based on version.
    version = nil
    arch    = (facts['architecture'] == 'x64' ? 'x86_64' : 'i386')
  when 'debian'
    case os = facts['os']['name'].downcase
    when 'debian'
      version = facts['os']['release']['major']
    when 'ubuntu'
      version = facts['os']['release']['full']
    end
    # TODO: Add "unknown debian" error.
    arch = (facts['architecture'] == 'x86_64' ? 'amd64' : 'i386')
  when 'solaris'
    os      = 'solaris'
    version = facts['os']['release']['major']
    arch    = (facts['architecture'].match(/^i\d+/) ? 'i386' : 'sparc')
  when 'suse'
    os      = 'sles'
    version = facts['os']['release']['major']
    arch    = facts['architecture']
  end
  # TODO: Add "unknown os" error.

  [os, version, arch].compact.join('-').downcase
end