def output(output_path)
case @category
when nil, "default"
@category = 'Applications/System Utilities'
end
manifest_fn = build_path("#{name}.p5m")
pkg_generate = safesystemout("pkgsend", "generate", "#{staging_path}")
File.write(build_path("#{name}.p5m.1"), pkg_generate)
metadata_template = template("p5p_metadata.erb").result(binding)
File.write(build_path("#{name}.mog"), metadata_template)
File.open(manifest_fn, "w") do |manifest|
manifest.write metadata_template
manifest.write pkg_generate
end
edit_file(manifest_fn) if attributes[:edit?]
pkg_mogrify = safesystemout("pkgmogrify", manifest_fn)
File.write(build_path("#{name}.p5m.2"), pkg_mogrify)
safesystem("cp", build_path("#{name}.p5m.2"), manifest_fn)
if !attributes[:no_auto_depends?]
pkgdepend_gen = safesystemout("pkgdepend", "generate", "-md", "#{staging_path}", manifest_fn)
File.write(build_path("#{name}.p5m.3"), pkgdepend_gen)
edit_file(build_path("#{name}.p5m.3")) if attributes[:edit?]
safesystem("pkgdepend", "resolve", "-m", build_path("#{name}.p5m.3"))
safesystem("cp", build_path("#{name}.p5m.3.res"), manifest_fn)
end
safesystem("pkgfmt", manifest_fn)
edit_file(manifest_fn) if attributes[:edit?]
if attributes[:p5p_lint] then
safesystem("pkglint", manifest_fn)
end
repo_path = build_path("#{name}_repo")
safesystem("pkgrepo", "create", repo_path)
safesystem("pkgrepo", "set", "-s", repo_path, "publisher/prefix=#{attributes[:p5p_publisher]}")
safesystem("pkgsend", "-s", repo_path,
"publish", "-d", "#{staging_path}", "#{build_path}/#{name}.p5m")
safesystem("pkgrecv", "-s", repo_path, "-a",
"-d", build_path("#{name}.p5p"), name)
if attributes[:p5p_validate] then
safesystem("pkg", "install", "-nvg", build_path("#{name}.p5p"), name)
end
safesystem("mv", build_path("#{name}.p5p"), output_path)
end