fpm 0.2.35 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fpm.rb +1 -0
- data/lib/fpm/builder.rb +36 -10
- data/lib/fpm/package.rb +35 -19
- data/lib/fpm/source.rb +5 -1
- data/lib/fpm/source/rpm.rb +9 -10
- data/lib/fpm/target/deb.rb +10 -2
- data/lib/fpm/target/puppet.rb +122 -0
- data/lib/fpm/target/rpm.rb +2 -3
- data/templates/deb.erb +16 -10
- data/templates/puppet/package.pp.erb +34 -0
- data/templates/puppet/package/remove.pp.erb +13 -0
- data/templates/rpm.erb +24 -25
- data/templates/solaris.erb +2 -2
- metadata +30 -29
- data/lib/fpm/source/pyfpm/__init__.pyc +0 -0
- data/lib/fpm/source/pyfpm/get_metadata.pyc +0 -0
data/lib/fpm.rb
CHANGED
data/lib/fpm/builder.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
require
|
1
|
+
require "fileutils"
|
2
|
+
require "pathname"
|
3
|
+
|
2
4
|
class FPM::Builder
|
3
5
|
# where is the package's root?
|
4
6
|
def root
|
@@ -27,6 +29,9 @@ class FPM::Builder
|
|
27
29
|
attr_reader :source
|
28
30
|
|
29
31
|
def initialize(settings, paths=[])
|
32
|
+
@logger = Logger.new(STDERR)
|
33
|
+
@logger.level = $DEBUG ? Logger::DEBUG : Logger::WARN
|
34
|
+
|
30
35
|
@working_dir = Dir.pwd
|
31
36
|
root = settings.chdir || '.'
|
32
37
|
paths = ['.'] if paths.empty?
|
@@ -84,6 +89,21 @@ class FPM::Builder
|
|
84
89
|
::Dir.chdir root do
|
85
90
|
@source.make_tarball!(tar_path, builddir)
|
86
91
|
|
92
|
+
# Hack to unpack before generating the spec, etc.
|
93
|
+
# Need to formalize this feature.
|
94
|
+
# Perhaps something like @package.prepare
|
95
|
+
if @package.respond_to?(:unpack_data_to)
|
96
|
+
data_tarball = File.join(builddir, "data.tar.gz")
|
97
|
+
Dir.chdir(builddir) do
|
98
|
+
FileUtils.mkdir_p(@package.unpack_data_to)
|
99
|
+
system("gzip -d #{data_tarball}")
|
100
|
+
Dir.chdir(@package.unpack_data_to) do
|
101
|
+
@source.root = Dir.pwd
|
102
|
+
system("tar -xf #{data_tarball.gsub(/\.gz$/, "")}")
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
87
107
|
generate_md5sums if @package.needs_md5sums
|
88
108
|
generate_specfile
|
89
109
|
edit_specfile if @edit
|
@@ -118,23 +138,29 @@ class FPM::Builder
|
|
118
138
|
# TODO: [Jay] make this better.
|
119
139
|
private
|
120
140
|
def package_class_for(type)
|
121
|
-
|
122
|
-
if !
|
141
|
+
realtype = FPM::Target.constants.find { |c| c.downcase.to_s == type }
|
142
|
+
if !realtype
|
143
|
+
valid_types = FPM::Target.constants.collect { |c| c.downcase }
|
144
|
+
@logger.fatal("No such package target type #{type.inspect}; " \
|
145
|
+
"Valid types: #{valid_types.join(", ")}")
|
123
146
|
raise ArgumentError, "unknown package type #{type.inspect}"
|
124
147
|
end
|
125
148
|
|
126
|
-
return FPM::Target.const_get(
|
149
|
+
return FPM::Target.const_get(realtype)
|
127
150
|
end
|
128
151
|
|
129
152
|
# TODO: [Jay] make this better.
|
130
153
|
private
|
131
154
|
def source_class_for(type)
|
132
|
-
|
133
|
-
if !
|
155
|
+
realtype = FPM::Source::constants.find { |c| c.downcase.to_s == type }
|
156
|
+
if !realtype
|
157
|
+
valid_types = FPM::Source.constants.collect { |c| c.downcase }
|
158
|
+
@logger.fatal("No such package source type #{type.inspect}; " \
|
159
|
+
"Valid types: #{valid_types.join(", ")}")
|
134
160
|
raise ArgumentError, "unknown package type #{type.inspect}"
|
135
161
|
end
|
136
162
|
|
137
|
-
return FPM::Source.const_get(
|
163
|
+
return FPM::Source.const_get(realtype)
|
138
164
|
end
|
139
165
|
|
140
166
|
private
|
@@ -145,13 +171,13 @@ class FPM::Builder
|
|
145
171
|
|
146
172
|
private
|
147
173
|
def generate_specfile
|
148
|
-
|
149
|
-
f.puts @package.render_spec
|
150
|
-
end
|
174
|
+
@package.generate_specfile(builddir)
|
151
175
|
end
|
152
176
|
|
153
177
|
private
|
154
178
|
def edit_specfile
|
179
|
+
# TODO(sissel): support editing multiple files for targets like
|
180
|
+
# puppet which generate multiple manifests.
|
155
181
|
editor = ENV['FPM_EDITOR'] || ENV['EDITOR'] || 'vi'
|
156
182
|
system("#{editor} '#{package.specfile(builddir)}'")
|
157
183
|
unless File.size? package.specfile(builddir)
|
data/lib/fpm/package.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "fpm/namespace"
|
2
2
|
require "socket" # for Socket.gethostname
|
3
3
|
require "logger"
|
4
|
+
require "find" # for Find.find (directory walking)
|
4
5
|
|
5
6
|
class FPM::Package
|
6
7
|
# The name of this package
|
@@ -61,6 +62,7 @@ class FPM::Package
|
|
61
62
|
def initialize(source)
|
62
63
|
@source = source
|
63
64
|
@logger = Logger.new(STDERR)
|
65
|
+
@logger.level = $DEBUG ? Logger::DEBUG : Logger::WARN
|
64
66
|
|
65
67
|
@name = source[:name] # || fail
|
66
68
|
|
@@ -106,40 +108,41 @@ class FPM::Package
|
|
106
108
|
@scripts = source[:scripts]
|
107
109
|
end # def initialize
|
108
110
|
|
109
|
-
def generate_specfile(builddir, paths)
|
110
|
-
spec = template.result(binding)
|
111
|
-
File.open(specfile(builddir), "w") { |f| f.puts spec }
|
112
|
-
end # def generate_specfile
|
113
|
-
|
114
111
|
# nobody needs md5sums by default.
|
115
112
|
def needs_md5sums
|
116
113
|
false
|
117
114
|
end # def needs_md5sums
|
118
115
|
|
119
|
-
#def generate_md5sums(builddir, paths)
|
120
|
-
#md5sums = self.checksum(paths)
|
121
|
-
#File.open("#{builddir}/md5sums", "w") { |f| f.puts md5sums }
|
122
|
-
#md5sums
|
123
|
-
#end # def generate_md5sums
|
124
|
-
|
125
116
|
# TODO [Jay]: make this better...?
|
126
117
|
def type
|
127
118
|
self.class.name.split(':').last.downcase
|
128
119
|
end # def type
|
129
120
|
|
130
|
-
def template
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
ERB.new(tpl, nil, "<>")
|
136
|
-
end
|
121
|
+
def template(path=nil)
|
122
|
+
path ||= "#{type}.erb"
|
123
|
+
@logger.info("Reading template: #{path}")
|
124
|
+
tpl = File.read("#{FPM::DIRS[:templates]}/#{path}")
|
125
|
+
return ERB.new(tpl, nil, "-")
|
137
126
|
end # def template
|
138
127
|
|
139
128
|
def render_spec
|
129
|
+
# find all files in paths given.
|
130
|
+
paths = []
|
131
|
+
@source.paths.each do |path|
|
132
|
+
Find.find(path) { |p| paths << p }
|
133
|
+
end
|
134
|
+
#@logger.info(:paths => paths.sort)
|
140
135
|
template.result(binding)
|
141
136
|
end # def render_spec
|
142
137
|
|
138
|
+
# Default specfile generator just makes one specfile, whatever that is for
|
139
|
+
# this package.
|
140
|
+
def generate_specfile(builddir)
|
141
|
+
File.open(specfile(builddir), "w") do |f|
|
142
|
+
f.puts render_spec
|
143
|
+
end
|
144
|
+
end # def generate_specfile
|
145
|
+
|
143
146
|
def default_output
|
144
147
|
if iteration
|
145
148
|
"#{name}-#{version}-#{iteration}.#{architecture}.#{type}"
|
@@ -147,4 +150,17 @@ class FPM::Package
|
|
147
150
|
"#{name}-#{version}.#{architecture}.#{type}"
|
148
151
|
end
|
149
152
|
end # def default_output
|
150
|
-
|
153
|
+
|
154
|
+
def fixpath(path)
|
155
|
+
if path.first != "/"
|
156
|
+
path = File.join(@source.root, path)
|
157
|
+
end
|
158
|
+
return path if File.symlink?(path)
|
159
|
+
@logger.info(:fixpath => path)
|
160
|
+
realpath = Pathname.new(path).realpath.to_s
|
161
|
+
re = Regexp.new("^#{Regexp.escape(@source.root)}")
|
162
|
+
realpath.gsub!(re, "")
|
163
|
+
@logger.info(:fixpath_result => realpath)
|
164
|
+
return realpath
|
165
|
+
end # def fixpath
|
166
|
+
end # class FPM::Package
|
data/lib/fpm/source.rb
CHANGED
@@ -23,8 +23,12 @@ class FPM::Source
|
|
23
23
|
end
|
24
24
|
|
25
25
|
attr_reader :paths
|
26
|
-
|
26
|
+
attr_accessor :root
|
27
|
+
|
27
28
|
def initialize(paths, root, params={})
|
29
|
+
@logger = Logger.new(STDERR)
|
30
|
+
@logger.level = $DEBUG ? Logger::DEBUG : Logger::WARN
|
31
|
+
|
28
32
|
@paths = paths
|
29
33
|
@root = root
|
30
34
|
|
data/lib/fpm/source/rpm.rb
CHANGED
@@ -2,18 +2,17 @@ require "fpm/source"
|
|
2
2
|
|
3
3
|
class FPM::Source::RPM < FPM::Source
|
4
4
|
def get_metadata
|
5
|
-
|
5
|
+
@rpm = @paths.first
|
6
|
+
self[:name] = %x{rpm -q --qf '%{name}' -p #{@rpm}}.chomp
|
6
7
|
|
7
|
-
self[:version] = %x{rpm -q --qf '%{version}' -p #{@
|
8
|
-
self[:iteration] = %x{rpm -q --qf '%{release}' -p #{@
|
9
|
-
self[:summary] = %x{rpm -q --qf '%{summary}' -p #{@
|
10
|
-
#self[:description] = %x{rpm -q --qf '%{description}' -p #{@
|
11
|
-
self[:dependencies] = %x{rpm -qRp #{@
|
8
|
+
self[:version] = %x{rpm -q --qf '%{version}' -p #{@rpm}}.chomp
|
9
|
+
self[:iteration] = %x{rpm -q --qf '%{release}' -p #{@rpm}}.chomp
|
10
|
+
self[:summary] = %x{rpm -q --qf '%{summary}' -p #{@rpm}}.chomp
|
11
|
+
#self[:description] = %x{rpm -q --qf '%{description}' -p #{@rpm}}
|
12
|
+
self[:dependencies] = %x{rpm -qRp #{@rpm}}.split("\n")\
|
12
13
|
.collect { |line| line.strip }
|
13
14
|
|
14
|
-
@
|
15
|
-
@paths = %x{rpm -qlp #{@paths.first}}.split("\n")
|
16
|
-
|
15
|
+
@paths = %x{rpm -qlp #{@rpm}}.split("\n")
|
17
16
|
end
|
18
17
|
|
19
18
|
def make_tarball!(tar_path, builddir)
|
@@ -21,7 +20,7 @@ class FPM::Source::RPM < FPM::Source
|
|
21
20
|
::Dir.mkdir(tmpdir)
|
22
21
|
system("rpm2cpio #{@rpm} | (cd #{tmpdir}; cpio -i --make-directories)")
|
23
22
|
tar(tar_path, ".", tmpdir)
|
24
|
-
|
23
|
+
@paths = ["."]
|
25
24
|
# TODO(sissel): Make a helper method.
|
26
25
|
system(*["gzip", "-f", tar_path])
|
27
26
|
end
|
data/lib/fpm/target/deb.rb
CHANGED
@@ -14,7 +14,7 @@ class FPM::Target::Deb < FPM::Package
|
|
14
14
|
# to ask the system about.
|
15
15
|
arch = %x{dpkg --print-architecture}.chomp
|
16
16
|
if $?.exitstatus != 0
|
17
|
-
arch = %x{uname -m}
|
17
|
+
arch = %x{uname -m}.chomp
|
18
18
|
@logger.warn("Can't find 'dpkg' tool (need it to get default " \
|
19
19
|
"architecture!). Please specificy --architecture " \
|
20
20
|
"specifically. (Defaulting now to #{arch})")
|
@@ -104,6 +104,14 @@ class FPM::Target::Deb < FPM::Package
|
|
104
104
|
dep = "#{da[0]} (#{da[1]} #{da[2]})"
|
105
105
|
end
|
106
106
|
|
107
|
+
name_re = /^[^ \(]+/
|
108
|
+
name = dep[name_re]
|
109
|
+
if name =~ /[A-Z]/
|
110
|
+
@logger.warn("Downcasing dependnecy '#{name}' because deb packages " \
|
111
|
+
" don't work so good with uppercase names")
|
112
|
+
dep.gsub!(name_re) { |n| n.downcase }
|
113
|
+
end
|
114
|
+
|
107
115
|
# Convert gem ~> X.Y.Z to '>= X.Y.Z' and << X.Y+1.0
|
108
116
|
if dep =~ /\(~>/
|
109
117
|
name, version = dep.gsub(/[()~>]/, "").split(/ +/)[0..1]
|
@@ -116,5 +124,5 @@ class FPM::Target::Deb < FPM::Package
|
|
116
124
|
return dep
|
117
125
|
end
|
118
126
|
end # def fix_dependency
|
119
|
-
end # class FPM::Deb
|
127
|
+
end # class FPM::Target::Deb
|
120
128
|
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require "erb"
|
2
|
+
require "fpm/namespace"
|
3
|
+
require "fpm/package"
|
4
|
+
require "fpm/errors"
|
5
|
+
require "etc"
|
6
|
+
require "ftools"
|
7
|
+
|
8
|
+
# TODO(sissel): Add dependency checking support.
|
9
|
+
# IIRC this has to be done as a 'checkinstall' step.
|
10
|
+
class FPM::Target::Puppet < FPM::Package
|
11
|
+
def architecture
|
12
|
+
case @architecture
|
13
|
+
when nil, "native"
|
14
|
+
@architecture = %x{uname -m}.chomp
|
15
|
+
end
|
16
|
+
return @architecture
|
17
|
+
end # def architecture
|
18
|
+
|
19
|
+
# Default specfile generator just makes one specfile, whatever that is for
|
20
|
+
# this package.
|
21
|
+
def generate_specfile(builddir)
|
22
|
+
paths = []
|
23
|
+
@logger.info("PWD: #{File.join(builddir, unpack_data_to)}")
|
24
|
+
fileroot = File.join(builddir, unpack_data_to)
|
25
|
+
Dir.chdir(fileroot) do
|
26
|
+
Find.find(".") do |p|
|
27
|
+
next if p == "."
|
28
|
+
paths << p
|
29
|
+
end
|
30
|
+
end
|
31
|
+
@logger.info(paths[-1])
|
32
|
+
manifests = %w{package.pp package/remove.pp}
|
33
|
+
|
34
|
+
::Dir.mkdir(File.join(builddir, "manifests"))
|
35
|
+
manifests.each do |manifest|
|
36
|
+
dir = File.join(builddir, "manifests", File.dirname(manifest))
|
37
|
+
@logger.info("manifests targeting: #{dir}")
|
38
|
+
::Dir.mkdir(dir) if !File.directory?(dir)
|
39
|
+
|
40
|
+
File.open(File.join(builddir, "manifests", manifest), "w") do |f|
|
41
|
+
@logger.info("manifest: #{f.path}")
|
42
|
+
template = template(File.join("puppet", "#{manifest}.erb"))
|
43
|
+
::Dir.chdir(fileroot) do
|
44
|
+
f.puts template.result(binding)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end # def generate_specfile
|
49
|
+
|
50
|
+
def unpack_data_to
|
51
|
+
"files"
|
52
|
+
end
|
53
|
+
|
54
|
+
def build!(params)
|
55
|
+
# TODO(sissel): Support these somehow, perhaps with execs and files.
|
56
|
+
self.scripts.each do |name, path|
|
57
|
+
case name
|
58
|
+
when "pre-install"
|
59
|
+
when "post-install"
|
60
|
+
when "pre-uninstall"
|
61
|
+
when "post-uninstall"
|
62
|
+
end # case name
|
63
|
+
end # self.scripts.each
|
64
|
+
|
65
|
+
if File.exists?(params[:output])
|
66
|
+
# TODO(sissel): Allow folks to choose output?
|
67
|
+
@logger.error("Puppet module directory '#{params[:output]}' already " \
|
68
|
+
"exists. Delete it or choose another output (-p flag)")
|
69
|
+
end
|
70
|
+
|
71
|
+
::Dir.mkdir(params[:output])
|
72
|
+
builddir = ::Dir.pwd
|
73
|
+
|
74
|
+
# Copy 'files' from builddir to :output/files
|
75
|
+
Find.find("files", "manifests") do |path|
|
76
|
+
@logger.info("Copying path: #{path}")
|
77
|
+
if File.directory?(path)
|
78
|
+
::Dir.mkdir(File.join(params[:output], path))
|
79
|
+
else
|
80
|
+
File.copy(path, File.join(params[:output], path))
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end # def build!
|
84
|
+
|
85
|
+
# The directory we create should just be the name of the package as the
|
86
|
+
# module name
|
87
|
+
def default_output
|
88
|
+
name
|
89
|
+
end # def default_output
|
90
|
+
|
91
|
+
# This method is used by the puppet manifest template
|
92
|
+
def puppetsort(hash)
|
93
|
+
# TODO(sissel): Implement sorting that follows the puppet style guide
|
94
|
+
# Such as, 'ensure' goes first, etc.
|
95
|
+
return hash.to_a
|
96
|
+
end # def puppetsort
|
97
|
+
|
98
|
+
# Helper for user lookup
|
99
|
+
def uid2user(uid)
|
100
|
+
begin
|
101
|
+
pwent = Etc.getpwuid(uid)
|
102
|
+
return pwent.name
|
103
|
+
rescue ArgumentError => e
|
104
|
+
# Invalid user id? No user? Return the uid.
|
105
|
+
@logger.warn("Failed to find username for uid #{uid}")
|
106
|
+
return uid.to_s
|
107
|
+
end
|
108
|
+
end # def uid2user
|
109
|
+
|
110
|
+
# Helper for group lookup
|
111
|
+
def gid2group(gid)
|
112
|
+
begin
|
113
|
+
grent = Etc.getgrgid(gid)
|
114
|
+
return grent.name
|
115
|
+
rescue ArgumentError => e
|
116
|
+
# Invalid user id? No user? Return the uid.
|
117
|
+
@logger.warn("Failed to find group for gid #{gid}")
|
118
|
+
return gid.to_s
|
119
|
+
end
|
120
|
+
end # def uid2user
|
121
|
+
end # class FPM::Target::Puppet
|
122
|
+
|
data/lib/fpm/target/rpm.rb
CHANGED
data/templates/deb.erb
CHANGED
@@ -2,20 +2,26 @@ Package: <%= name %>
|
|
2
2
|
Version: <%= "#{epoch}:" if epoch %><%= version %><%= iteration && '-'+iteration.to_s %>
|
3
3
|
Architecture: <%= architecture %>
|
4
4
|
Maintainer: <%= maintainer or "<unknown>" %>
|
5
|
-
<% if !dependencies.empty?
|
6
|
-
<% properdeps = dependencies.collect { |d| fix_dependency(d) }.flatten
|
5
|
+
<% if !dependencies.empty? -%>
|
6
|
+
<% properdeps = dependencies.collect { |d| fix_dependency(d) }.flatten -%>
|
7
7
|
Depends: <%= properdeps.flatten.join(", ") %>
|
8
|
-
<% end
|
9
|
-
<% if !provides.empty?
|
10
|
-
Provides: <%= provides.join(", ")
|
11
|
-
<% end
|
12
|
-
<% if !replaces.empty?
|
13
|
-
<% properrepl = replaces.collect { |d| fix_dependency(d) }.flatten
|
8
|
+
<% end -%>
|
9
|
+
<% if !provides.empty? -%>
|
10
|
+
Provides: <%= provides.join(", ") -%>
|
11
|
+
<% end -%>
|
12
|
+
<% if !replaces.empty? -%>
|
13
|
+
<% properrepl = replaces.collect { |d| fix_dependency(d) }.flatten -%>
|
14
14
|
Replaces: <%= properrepl.flatten.join(", ") %>
|
15
|
-
<% end
|
15
|
+
<% end -%>
|
16
16
|
Standards-Version: 3.9.1
|
17
17
|
Section: <%= category or "unknown" %>
|
18
18
|
Priority: extra
|
19
19
|
Homepage: <%= url or "http://nourlgiven.example.com/" %>
|
20
|
-
Description: <%=
|
20
|
+
Description: <%= name %> (FPM-generated package)
|
21
|
+
<% max_len = 74 -%>
|
22
|
+
<% if description -%>
|
23
|
+
<%= description.gsub(/^$/, ".").gsub(/(.{1,#{max_len}})( +|$)\n?|(.{#{max_len}})/," \\1\\3\n") %>
|
24
|
+
<% else -%>
|
25
|
+
<%= "no description given" %>
|
26
|
+
<% end -%>
|
21
27
|
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# TODO(sissel): implement 'anti' class for this package.
|
2
|
+
class <%= name %>::package {
|
3
|
+
$version = "<%= version %>"
|
4
|
+
$iteration = "<%= iteration %>"
|
5
|
+
|
6
|
+
file {
|
7
|
+
<% paths.each do |path|
|
8
|
+
stat = File.lstat(path)
|
9
|
+
params = {}
|
10
|
+
if stat.directory?
|
11
|
+
params[:ensure] = "directory"
|
12
|
+
elsif stat.symlink?
|
13
|
+
params[:ensure] = "link"
|
14
|
+
params[:target] = File.readlink(path)
|
15
|
+
stat = File.stat(path)
|
16
|
+
else
|
17
|
+
params[:ensure] = "file"
|
18
|
+
params[:source] = "puppet:///modules/#{name}/#{path}"
|
19
|
+
end
|
20
|
+
|
21
|
+
if params[:ensure] != "link"
|
22
|
+
params[:owner] = uid2user(stat.uid)
|
23
|
+
params[:group] = gid2group(stat.gid)
|
24
|
+
params[:mode] = sprintf("%04o", stat.mode & 0777)
|
25
|
+
end
|
26
|
+
|
27
|
+
settings = puppetsort(params).collect { |k,v| "#{k} => \"#{v}\"" }.join(",\n ")
|
28
|
+
-%>
|
29
|
+
# <%= stat.inspect %>
|
30
|
+
"<%= fixpath(path) %>":
|
31
|
+
<%= settings %>;
|
32
|
+
<% end # paths.each -%>
|
33
|
+
}
|
34
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class <%= name %>::package::remove {
|
2
|
+
$version = "<%= version %>"
|
3
|
+
$iteration = "<%= iteration %>"
|
4
|
+
|
5
|
+
fail("DO NOT USE THIS. IT IS NOT WELL DEFINED YET.")
|
6
|
+
|
7
|
+
file {
|
8
|
+
<% paths.each do |path| -%>
|
9
|
+
"<%= fixpath(path) %>":
|
10
|
+
ensure => absent;
|
11
|
+
<% end # paths.each -%>
|
12
|
+
}
|
13
|
+
}
|
data/templates/rpm.erb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
Name: <%= name %>
|
2
2
|
Version: <%= version %>
|
3
|
-
<% if epoch
|
3
|
+
<% if epoch -%>
|
4
4
|
Epoch: <%= epoch %>
|
5
|
-
<% end
|
5
|
+
<% end -%>
|
6
6
|
Release: <%= iteration or 1 %>
|
7
|
-
<%# use the first line of the description as the summary
|
7
|
+
<%# use the first line of the description as the summary -%>
|
8
8
|
Summary: <%= description.split("\n").first %>
|
9
9
|
BuildArch: <%= architecture %>
|
10
10
|
AutoReqProv: no
|
@@ -13,13 +13,13 @@ Group: <%= category %>
|
|
13
13
|
<%#
|
14
14
|
TODO: [Jay] rpms require a license
|
15
15
|
let's detect it intelligently
|
16
|
-
|
16
|
+
-%>
|
17
17
|
License: <%= license %>
|
18
18
|
URL: <%= url or "http://nourlgiven.example.com/" %>
|
19
19
|
Source0: %{_sourcedir}/data.tar.gz
|
20
20
|
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
21
21
|
|
22
|
-
<% if !dependencies.empty?
|
22
|
+
<% if !dependencies.empty? -%>
|
23
23
|
<%
|
24
24
|
properdeps = dependencies.collect do |d|
|
25
25
|
# Convert gem ~> X.Y.Z to '>= X.Y.Z' and < X.Y+1.0
|
@@ -40,18 +40,17 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
|
40
40
|
d
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
44
|
-
<% end
|
45
|
-
<% provides.each do |prov|
|
43
|
+
-%>Requires: <%= properdeps.join(", ") %>
|
44
|
+
<% end -%>
|
45
|
+
<% provides.each do |prov| -%>
|
46
46
|
Provides: <%= prov %>
|
47
|
-
<% end
|
48
|
-
|
49
|
-
|
47
|
+
<% end -%>
|
48
|
+
<% replaces.each do |repl| -%>
|
49
|
+
<%# The closes equivalent in RPM to "replaces" is "Obsoletes" -%>
|
50
50
|
Obsoletes: <%= repl %>
|
51
|
-
<% end
|
52
|
-
|
51
|
+
<% end -%>
|
53
52
|
<%# rpm rejects descriptions with blank lines (even between content), so hack
|
54
|
-
around it by replacing blank lines with ' .'
|
53
|
+
around it by replacing blank lines with ' .' -%>
|
55
54
|
%description
|
56
55
|
<%= description.gsub(/^\s*$/, " .") %>
|
57
56
|
|
@@ -62,7 +61,7 @@ Obsoletes: <%= repl %>
|
|
62
61
|
# some rpm implementations delete the build dir and then recreate it by
|
63
62
|
# default, for some reason. Whatever, let's work around it.
|
64
63
|
cd $RPM_BUILD_ROOT
|
65
|
-
tar -
|
64
|
+
tar -zxf %SOURCE0
|
66
65
|
|
67
66
|
%install
|
68
67
|
#noop
|
@@ -70,30 +69,30 @@ tar -zvxf %SOURCE0
|
|
70
69
|
%clean
|
71
70
|
rm -rf $RPM_BUILD_ROOT
|
72
71
|
|
73
|
-
<% if scripts["pre-install"]
|
72
|
+
<% if scripts["pre-install"] -%>
|
74
73
|
%pre
|
75
74
|
<%= File.read(scripts["pre-install"]) %>
|
76
|
-
<% end %>
|
77
75
|
|
78
|
-
<%
|
76
|
+
<% end -%>
|
77
|
+
<% if scripts["post-install"] -%>
|
79
78
|
%post
|
80
79
|
<%= File.read(scripts["post-install"]) %>
|
81
|
-
<% end %>
|
82
80
|
|
83
|
-
<%
|
81
|
+
<% end -%>
|
82
|
+
<% if scripts["pre-uninstall"] -%>
|
84
83
|
%preun
|
85
84
|
<%= File.read(scripts["pre-uninstall"]) %>
|
86
|
-
<% end %>
|
87
85
|
|
88
|
-
<%
|
86
|
+
<% end -%>
|
87
|
+
<% if scripts["post-uninstall"] -%>
|
89
88
|
%postun
|
90
89
|
<%= File.read(scripts["post-uninstall"]) %>
|
91
|
-
<% end %>
|
92
90
|
|
91
|
+
<% end -%>
|
93
92
|
%files
|
94
93
|
%defattr(-,root,root,-)
|
95
|
-
<%# Trim leading '.' from paths if they are './blah...'
|
96
|
-
<%# Also ensure paths start with '/'
|
94
|
+
<%# Trim leading '.' from paths if they are './blah...' -%>
|
95
|
+
<%# Also ensure paths start with '/' -%>
|
97
96
|
<%= @source.paths.collect { |p| p.gsub(/^\.\//, "/").gsub(/^[^\/]/, "/\\0") }.join("\n") %>
|
98
97
|
|
99
98
|
%changelog
|
data/templates/solaris.erb
CHANGED
@@ -7,9 +7,9 @@ NAME=<%= name %>
|
|
7
7
|
ARCH=<%= architecture %>
|
8
8
|
VERSION=<%= version %><%= iteration && "-" + iteration.to_s %>
|
9
9
|
CATEGORY=application
|
10
|
-
<%# pkginfo(4) says DESC is max 256 characters
|
10
|
+
<%# pkginfo(4) says DESC is max 256 characters -%>
|
11
11
|
DESC=<%= description.split("\n").first[0..255] or "no description given" %>
|
12
12
|
VENDOR=<%= maintainer %>
|
13
|
-
<%# Take maintainer of "Foo <bar@baz.com>" and use "bar@baz.com"
|
13
|
+
<%# Take maintainer of "Foo <bar@baz.com>" and use "bar@baz.com" -%>
|
14
14
|
EMAIL=<%= maintainer[/<.+>/].gsub(/[<>]/, "") %>
|
15
15
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 3
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jordan Sissel
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-20 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: "0"
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
|
-
description:
|
35
|
+
description: Convert directories, rpms, python eggs, rubygems, and more to rpms, debs, solaris packages and more. Win at package management without wasting pointless hours debugging bad rpm specs!
|
36
36
|
email: jls@semicomplete.com
|
37
37
|
executables:
|
38
38
|
- fpm
|
@@ -42,38 +42,39 @@ extensions: []
|
|
42
42
|
extra_rdoc_files: []
|
43
43
|
|
44
44
|
files:
|
45
|
-
- lib/rpm/tag.rb
|
46
|
-
- lib/rpm/namespace.rb
|
47
|
-
- lib/rpm/lead.rb
|
48
|
-
- lib/rpm/header.rb
|
49
|
-
- lib/rpm/rpmfile.rb
|
50
45
|
- lib/fpm/builder.rb
|
51
|
-
- lib/fpm/
|
46
|
+
- lib/fpm/target/puppet.rb
|
47
|
+
- lib/fpm/target/solaris.rb
|
48
|
+
- lib/fpm/target/rpm.rb
|
49
|
+
- lib/fpm/target/deb.rb
|
50
|
+
- lib/fpm/rubyfixes.rb
|
52
51
|
- lib/fpm/flags.rb
|
53
|
-
- lib/fpm/
|
52
|
+
- lib/fpm/errors.rb
|
54
53
|
- lib/fpm/source.rb
|
55
|
-
- lib/fpm/
|
56
|
-
- lib/fpm/
|
54
|
+
- lib/fpm/namespace.rb
|
55
|
+
- lib/fpm/package.rb
|
56
|
+
- lib/fpm/program.rb
|
57
|
+
- lib/fpm/source/gem.rb
|
57
58
|
- lib/fpm/source/npm.rb
|
58
|
-
- lib/fpm/source/
|
59
|
+
- lib/fpm/source/python.rb
|
59
60
|
- lib/fpm/source/rpm.rb
|
60
|
-
- lib/fpm/source/
|
61
|
-
- lib/fpm/source/pyfpm/get_metadata.pyc
|
62
|
-
- lib/fpm/source/pyfpm/get_metadata.py
|
63
|
-
- lib/fpm/source/pyfpm/__init__.py
|
61
|
+
- lib/fpm/source/dir.rb
|
64
62
|
- lib/fpm/source/tar.rb
|
65
|
-
- lib/fpm/source/
|
66
|
-
- lib/fpm/
|
67
|
-
- lib/
|
68
|
-
- lib/
|
69
|
-
- lib/
|
70
|
-
- lib/
|
63
|
+
- lib/fpm/source/pyfpm/__init__.py
|
64
|
+
- lib/fpm/source/pyfpm/get_metadata.py
|
65
|
+
- lib/rpm/tag.rb
|
66
|
+
- lib/rpm/rpmfile.rb
|
67
|
+
- lib/rpm/lead.rb
|
68
|
+
- lib/rpm/namespace.rb
|
69
|
+
- lib/rpm/header.rb
|
71
70
|
- lib/fpm.rb
|
72
71
|
- bin/fpm
|
73
72
|
- bin/fpm-npm
|
74
|
-
- templates/
|
75
|
-
- templates/
|
73
|
+
- templates/puppet/package.pp.erb
|
74
|
+
- templates/puppet/package/remove.pp.erb
|
76
75
|
- templates/deb.erb
|
76
|
+
- templates/rpm.erb
|
77
|
+
- templates/solaris.erb
|
77
78
|
- LICENSE
|
78
79
|
- CONTRIBUTORS
|
79
80
|
- CHANGELIST
|
@@ -108,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
109
|
requirements: []
|
109
110
|
|
110
111
|
rubyforge_project:
|
111
|
-
rubygems_version: 1.
|
112
|
+
rubygems_version: 1.6.2
|
112
113
|
signing_key:
|
113
114
|
specification_version: 3
|
114
115
|
summary: fpm - package building and mangling
|
Binary file
|
Binary file
|