class Omnibus::Packager::PKGSRC

Constants

PKGTOOLS_VERSION

Public Instance Methods

build_info() click to toggle source
# File lib/omnibus/packagers/pkgsrc.rb, line 31
def build_info
  staging_dir_path("build-info")
end
build_ver() click to toggle source
# File lib/omnibus/packagers/pkgsrc.rb, line 35
def build_ver
  staging_dir_path("build-ver")
end
comment_file() click to toggle source
# File lib/omnibus/packagers/pkgsrc.rb, line 39
def comment_file
  staging_dir_path("comment")
end
create_pkg() click to toggle source
# File lib/omnibus/packagers/pkgsrc.rb, line 47
def create_pkg
  postinst = "#{project.package_scripts_path}/postinst"
  postrm = "#{project.package_scripts_path}/postrm"

  shellout! "cd #{Config.package_dir} && pkg_create -i #{postinst} -k #{postrm} -p  #{project.install_dir} -b #{build_ver} -B #{build_info} -c #{comment_file} -d #{comment_file} -f #{pack_list} -I #{project.install_dir} -l -U #{package_name}"
end
opsys() click to toggle source
# File lib/omnibus/packagers/pkgsrc.rb, line 91
def opsys
  Ohai["kernel"]["name"]
end
os_version() click to toggle source
# File lib/omnibus/packagers/pkgsrc.rb, line 95
def os_version
  Ohai["kernel"]["release"]
end
pack_list() click to toggle source
# File lib/omnibus/packagers/pkgsrc.rb, line 43
def pack_list
  staging_dir_path("packlist")
end
package_name() click to toggle source
# File lib/omnibus/packagers/pkgsrc.rb, line 54
def package_name
  "#{project.package_name}-#{project.build_version}.tgz"
end
safe_architecture() click to toggle source
# File lib/omnibus/packagers/pkgsrc.rb, line 99
def safe_architecture
  if smartos?
    if Ohai["kernel"]["update"] == "86_64"
      "x86_64"
    else
      "i386"
    end
  else
    # FIXME: this undoubtedly will need filling out once we make this go for platforms that aren't SmartOS
    Ohai["kernel"]["machine"]
  end
end
write_buildinfo() click to toggle source
# File lib/omnibus/packagers/pkgsrc.rb, line 64
    def write_buildinfo
      buildinfo_content = <<~EOF
        MACHINE_ARCH=#{safe_architecture}
        OPSYS=#{opsys}
        OS_VERSION=#{os_version}
        PKGTOOLS_VERSION=#{PKGTOOLS_VERSION}
      EOF

      File.open(build_info, "w+") do |f|
        f.write(buildinfo_content)
      end
    end
write_buildver() click to toggle source
# File lib/omnibus/packagers/pkgsrc.rb, line 58
def write_buildver
  File.open build_ver, "w+" do |f|
    f.write"#{project.build_version}-#{project.build_iteration}"
  end
end
write_comment() click to toggle source
# File lib/omnibus/packagers/pkgsrc.rb, line 77
def write_comment
  File.open(comment_file, "w+") do |f|
    f.write(project.description)
  end
end
write_packlist() click to toggle source
# File lib/omnibus/packagers/pkgsrc.rb, line 83
def write_packlist
  File.open pack_list, "w+" do |f|
    f.write "@pkgdir #{project.install_dir}\n@cwd #{project.install_dir}/\n"
  end

  shellout! "cd #{project.install_dir} && find . -type l -or -type f | sort >> #{pack_list}"
end