Class: Omnibus::Packager::PKGSRC
- Inherits:
-
Base
- Object
- Base
- Omnibus::Packager::PKGSRC
show all
- Defined in:
- lib/omnibus/packagers/pkgsrc.rb
Constant Summary
collapse
- PKGTOOLS_VERSION =
"20091115".freeze
Constants included
from Util
Util::SHELLOUT_OPTIONS
NullArgumentable::NULL
Instance Attribute Summary
Attributes inherited from Base
#project
Instance Method Summary
collapse
Methods inherited from Base
build, #exclusions, id, #id, #initialize, #install_dir, #package_path, #resource_path, #resources_path, #run!, setup, #skip_packager, #staging_dir, #staging_dir_path
Methods included from Util
#compiler_safe_path, #copy_file, #create_directory, #create_file, #create_link, included, #path_key, #remove_directory, #remove_file, #retry_block, #shellout, #shellout!, #windows_safe_path
Methods included from Templating
included, #render_template, #render_template_content
Methods included from Sugarable
extended, included, #node
included, #null?
Methods included from Logging
included
#measure
Methods included from Digestable
#digest, #digest_directory, included
Instance Method Details
#build_info ⇒ Object
31
32
33
|
# File 'lib/omnibus/packagers/pkgsrc.rb', line 31
def build_info
staging_dir_path("build-info")
end
|
#build_ver ⇒ Object
35
36
37
|
# File 'lib/omnibus/packagers/pkgsrc.rb', line 35
def build_ver
staging_dir_path("build-ver")
end
|
39
40
41
|
# File 'lib/omnibus/packagers/pkgsrc.rb', line 39
def
staging_dir_path("comment")
end
|
#create_pkg ⇒ Object
47
48
49
50
51
52
|
# 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 #{} -d #{} -f #{pack_list} -I #{project.install_dir} -l -U #{package_name}"
end
|
#opsys ⇒ Object
91
92
93
|
# File 'lib/omnibus/packagers/pkgsrc.rb', line 91
def opsys
Ohai["kernel"]["name"]
end
|
#os_version ⇒ Object
95
96
97
|
# File 'lib/omnibus/packagers/pkgsrc.rb', line 95
def os_version
Ohai["kernel"]["release"]
end
|
#pack_list ⇒ Object
43
44
45
|
# File 'lib/omnibus/packagers/pkgsrc.rb', line 43
def pack_list
staging_dir_path("packlist")
end
|
#package_name ⇒ Object
54
55
56
|
# File 'lib/omnibus/packagers/pkgsrc.rb', line 54
def package_name
"#{project.package_name}-#{project.build_version}.tgz"
end
|
#safe_architecture ⇒ Object
99
100
101
102
103
104
105
106
107
108
109
110
|
# 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
Ohai["kernel"]["machine"]
end
end
|
#write_buildinfo ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
|
# 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 ⇒ Object
58
59
60
61
62
|
# 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
|
77
78
79
80
81
|
# File 'lib/omnibus/packagers/pkgsrc.rb', line 77
def
File.open(, "w+") do |f|
f.write(project.description)
end
end
|
#write_packlist ⇒ Object
83
84
85
86
87
88
89
|
# 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
|