Class: Vanagon::Platform::RPM::EOS

Inherits:
Vanagon::Platform::RPM show all
Defined in:
lib/vanagon/platform/rpm/eos.rb

Constant Summary

Constants inherited from Vanagon::Platform

PLATFORM_REGEX

Instance Attribute Summary

Attributes inherited from Vanagon::Platform

#architecture, #aws_ami, #aws_instance_type, #aws_key, #aws_key_name, #aws_region, #aws_shutdown_behavior, #aws_subnet_id, #aws_user_data, #aws_vpc_id, #build_dependencies, #build_hosts, #cflags, #codename, #copy, #cross_compiled, #defaultdir, #docker_image, #find, #install, #ldflags, #make, #name, #num_cores, #os_name, #os_version, #output_dir, #package_type, #patch, #platform_triple, #provisioning, #rpmbuild, #servicedir, #servicetype, #settings, #sort, #ssh_port, #tar, #target_user, #vmpooler_template

Instance Method Summary collapse

Methods inherited from Vanagon::Platform::RPM

#add_repository, #generate_packaging_artifacts, #initialize, #rpm_defines

Methods inherited from Vanagon::Platform

#[], #add_group, #add_user, #initialize, #is_aix?, #is_cisco_wrlinux?, #is_cross_compiled?, #is_cross_compiled_linux?, #is_deb?, #is_el?, #is_eos?, #is_fedora?, #is_huaweios?, #is_linux?, #is_osx?, #is_rpm?, #is_sles?, #is_solaris?, #is_unix?, #is_windows?, load_platform

Methods included from HashableAttributes

#to_hash, #to_json

Constructor Details

This class inherits a constructor from Vanagon::Platform::RPM

Instance Method Details

#generate_package(project) ⇒ Array

The specific bits used to generate an EOS package for a given project

for the given project from an rpm or a swix

Parameters:

Returns:

  • (Array)

    list of commands required to build the EOS package



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/vanagon/platform/rpm/eos.rb', line 10

def generate_package(project)
  # If nothing is passed in as platform type, default to building a swix package
  if project.platform.package_type.nil? || project.platform.package_type.empty?
    return generate_swix_package(project)
  else
    case project.platform.package_type
    when "rpm"
      return super(project)
    when "swix"
      return generate_swix_package(project)
    else
      fail "I don't know how to build package type '#{project.platform.package_type}' for EOS. Teach me?"
    end
  end
end

#generate_swix_package(project) ⇒ Array

The specific bits used to generate an SWIX package for a given project

for the given project from an rpm

Parameters:

Returns:

  • (Array)

    list of commands required to build the SWIX package



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/vanagon/platform/rpm/eos.rb', line 51

def generate_swix_package(project)
  target_dir = project.repo ? output_dir(project.repo) : output_dir
  commands = ["bash -c 'mkdir -p $(tempdir)/rpmbuild/{SOURCES,SPECS,BUILD,RPMS,SRPMS}'",
  "cp #{project.name}-#{project.version}.tar.gz $(tempdir)/rpmbuild/SOURCES",
  "cp file-list-for-rpm $(tempdir)/rpmbuild/SOURCES",
  "cp #{project.name}.spec $(tempdir)/rpmbuild/SPECS",
  "PATH=/opt/freeware/bin:$$PATH #{@rpmbuild} -bb --target #{@architecture} #{rpm_defines} $(tempdir)/rpmbuild/SPECS/#{project.name}.spec",
  "mkdir -p output/#{target_dir}",
  "cp $(tempdir)/rpmbuild/*RPMS/**/*.rpm ./output/#{target_dir}"]


  pkgname_swix = swix_package_name(project)
  pkgname_rpm = pkgname_swix.sub(/swix$/, 'rpm')
  commands += ["echo 'format: 1' > ./output/#{target_dir}/manifest.txt",
  "echo \"primaryRpm: #{pkgname_rpm}\" >> ./output/#{target_dir}/manifest.txt",
  "echo #{pkgname_rpm}-sha1: `sha1sum ./output/#{target_dir}/#{pkgname_rpm}`",
  "cd ./output/#{target_dir}/ && zip #{pkgname_swix} manifest.txt #{pkgname_rpm}",
  "rm ./output/#{target_dir}/manifest.txt ./output/#{target_dir}/#{pkgname_rpm}"]

  commands
end

#package_name(project) ⇒ String

Method to derive the package name for the project

Parameters:

Returns:

  • (String)

    name of the EOS package for this project



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/vanagon/platform/rpm/eos.rb', line 30

def package_name(project)
  # If nothing is passed in as platform type, default to building a swix package
  if project.platform.package_type.nil? || project.platform.package_type.empty?
    return swix_package_name(project)
  else
    case project.platform.package_type
    when "rpm"
      return super(project)
    when "swix"
      return swix_package_name(project)
    else
      fail "I don't know how to name package type '#{project.platform.package_type}' for EOS. Teach me?"
    end
  end
end

#swix_package_name(project) ⇒ String

Method to derive the package name for the project

Parameters:

Returns:

  • (String)

    name of the SWIX package for this project



77
78
79
# File 'lib/vanagon/platform/rpm/eos.rb', line 77

def swix_package_name(project)
  "#{project.name}-#{project.version}-#{project.release}.#{os_name}#{os_version}.#{project.noarch ? 'noarch' : @architecture}.swix"
end