Class: FPM::Package::P5P

Inherits:
FPM::Package show all
Defined in:
lib/fpm/package/p5p.rb

Instance Attribute Summary

Attributes inherited from FPM::Package

#attributes, #attrs, #category, #config_files, #conflicts, #dependencies, #description, #directories, #epoch, #iteration, #license, #maintainer, #name, #provides, #replaces, #scripts, #url, #vendor, #version

Instance Method Summary collapse

Methods inherited from FPM::Package

apply_options, #build_path, #cleanup, #cleanup_build, #cleanup_staging, #convert, #converted_from, default_attributes, #edit_file, #files, inherited, #initialize, #input, option, #script, #staging_path, #to_s, #type, type, types

Methods included from Util

#ar_cmd, #ar_cmd_deterministic?, #copied_entries, #copy_entry, #copy_metadata, #default_shell, #execmd, #expand_pessimistic_constraints, #logger, #mknod_w, #program_exists?, #program_in_path?, #safesystem, #safesystemout, #tar_cmd, #tar_cmd_supports_sort_names_and_set_mtime?

Constructor Details

This class inherits a constructor from FPM::Package

Instance Method Details

#architectureObject



38
39
40
41
42
43
44
45
46
47
# File 'lib/fpm/package/p5p.rb', line 38

def architecture
  case @architecture
  when nil, "native"
    @architecture = %x{uname -p}.chomp
  when "all"
    @architecture = 'i386 value=sparc'
  end

  return @architecture
end

#output(output_path) ⇒ Object

def architecture



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/fpm/package/p5p.rb', line 49

def output(output_path)
  
  # Fixup the category to an acceptable solaris category
  case @category
  when nil, "default"
    @category = 'Applications/System Utilities'
  end

  # Manifest Filename
  manifest_fn = build_path("#{name}.p5m")

  # Generate a package manifest.
  pkg_generate = safesystemout("pkgsend", "generate", "#{staging_path}")
  File.write(build_path("#{name}.p5m.1"), pkg_generate)

  # Add necessary metadata to the generated manifest.
   = template("p5p_metadata.erb").result(binding)
  File.write(build_path("#{name}.mog"), )

  # Combine template and filelist; allow user to edit before proceeding
  File.open(manifest_fn, "w") do |manifest|
    manifest.write 
    manifest.write pkg_generate
  end
  edit_file(manifest_fn) if attributes[:edit?]

  # Execute the transmogrification on the manifest
  pkg_mogrify = safesystemout("pkgmogrify", manifest_fn)
  File.write(build_path("#{name}.p5m.2"), pkg_mogrify)
  safesystem("cp", build_path("#{name}.p5m.2"), manifest_fn)

  # Evaluate dependencies.
  if !attributes[:no_auto_depends?]
   pkgdepend_gen = safesystemout("pkgdepend", "generate",  "-md", "#{staging_path}",  manifest_fn)
    File.write(build_path("#{name}.p5m.3"), pkgdepend_gen)

    # Allow user to review added dependencies
    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

  # Final format of manifest
  safesystem("pkgfmt", manifest_fn)

  # Final edit for lint check and packaging
  edit_file(manifest_fn) if attributes[:edit?]

  # Add any facets or actuators that are needed.
  # TODO(jcraig): add manpage actuator to enable install wo/ man pages

  # Verify the package.
  if attributes[:p5p_lint] then
    safesystem("pkglint", manifest_fn)
  end

  # Publish the package.
  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)

  # Test the package
  if attributes[:p5p_validate] then
    safesystem("pkg", "install",  "-nvg", build_path("#{name}.p5p"), name)
  end

  # Cleanup
  safesystem("mv", build_path("#{name}.p5p"), output_path)

end