fpm 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELIST +23 -1
- data/lib/fpm/command.rb +38 -5
- data/lib/fpm/package.rb +5 -2
- data/lib/fpm/package/cpan.rb +3 -3
- data/lib/fpm/package/deb.rb +54 -6
- data/lib/fpm/package/dir.rb +1 -1
- data/lib/fpm/package/gem.rb +1 -1
- data/lib/fpm/package/pyfpm/__init__.pyc +0 -0
- data/lib/fpm/package/pyfpm/get_metadata.pyc +0 -0
- data/lib/fpm/package/python.rb +1 -1
- data/lib/fpm/package/rpm.rb +68 -18
- data/lib/fpm/util.rb +32 -0
- data/lib/fpm/version.rb +1 -1
- data/templates/rpm.erb +4 -1
- data/templates/sh.erb +18 -7
- metadata +38 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1865c3f86f85b91177908b4ab565d14586795cb8
|
4
|
+
data.tar.gz: 0fbd72a7c8db1b4eb11104990182f248233e2252
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b988637a79243d70644a911e65143784129de29278a3581b31f777a433570fde9fbb125ae12f7ff15c81ba043917a67dac0c98a383e50ed49676457ff48d23c
|
7
|
+
data.tar.gz: 350fbd84054b7685815b527ff6cb51dcbd8ab8d4331f84f0deb0450f40ac6c12a7e06c8cf6df8caa2e8980512daf0439bbca5f3cd200ed04f1f368443effc088
|
data/CHANGELIST
CHANGED
@@ -1,4 +1,26 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0 (July 25, 2014)
|
2
|
+
- rpm: Add --rpm-verifyscript for adding a custom rpm verify script to
|
3
|
+
your package. (Remi Hakim)
|
4
|
+
- Allow the -p flag to target a directory for writing the output package
|
5
|
+
(#656, Jordan Sissel)
|
6
|
+
- Add --debug-workspace which skips any workspace cleanup to let users debug things
|
7
|
+
if they break. (#720, #734; Jordan Sissel)
|
8
|
+
- rpm: Add --rpm-attr for controlling attribute settings per file. This setting
|
9
|
+
will likely be removed in the future once rpmbuild is no longer needed.
|
10
|
+
(#719)
|
11
|
+
- deb: Add --deb-meta-file to add arbitrary files to the control dir (#599, Dan Brown)
|
12
|
+
- deb: Add --deb-interest and --deb-activate for adding package triggers (#595, Dan Brown)
|
13
|
+
- cpan: Fix small bug in handling empty metadata fields (#712, Mathias Lafeldt)
|
14
|
+
- rpm: Fix bug when specifying both --architecture and --rpm-os (#707, #716; Alan Ivey)
|
15
|
+
- gem: Fix bug where --gem-version-bins is given but package has no bins (#688, Jan Vansteenkiste)
|
16
|
+
- deb: Set permissions correct on the package's internals. Makes lintian happier. (Jan Vansteenkiste)
|
17
|
+
- rpm: rpmbuild's _tmppath now respects --workdir (#714, Jordan Sissel)
|
18
|
+
- gem/rpm: Add --rpm-verbatim-gem-dependencies to use old-style (fpm 0.4.x)
|
19
|
+
rpm gem dependencies (#724, Jordan Sissel)
|
20
|
+
- gem/rpm: Fix bug for gem pessimistic constraints when converting to rpm (Tom Duckering)
|
21
|
+
- python: Fix small bug with pip invocations (#727, Dane Knecht)
|
22
|
+
|
23
|
+
1.1.0 (April 23, 2014)
|
2
24
|
- New package type: zip, for converting to and from zip files (Jordan Sissel)
|
3
25
|
- New package type: sh, a self-extracting package installation shell archive. (#651, Chris Gerber)
|
4
26
|
- 'fpm --version' will now emit the version of fpm.
|
data/lib/fpm/command.rb
CHANGED
@@ -60,6 +60,9 @@ class FPM::Command < Clamp::Command
|
|
60
60
|
option ["-n", "--name"], "NAME", "The name to give to the package"
|
61
61
|
option "--verbose", :flag, "Enable verbose output"
|
62
62
|
option "--debug", :flag, "Enable debug output"
|
63
|
+
option "--debug-workspace", :flag, "Keep any file workspaces around for " \
|
64
|
+
"debugging. This will disable automatic cleanup of package staging and " \
|
65
|
+
"build paths. It will also print which directories are available."
|
63
66
|
option ["-v", "--version"], "VERSION", "The version to give to the package",
|
64
67
|
:default => 1.0
|
65
68
|
option "--iteration", "ITERATION",
|
@@ -191,8 +194,8 @@ class FPM::Command < Clamp::Command
|
|
191
194
|
end
|
192
195
|
|
193
196
|
option "--workdir", "WORKDIR",
|
194
|
-
"The directory you want fpm to do its work in, where 'work' is any file" \
|
195
|
-
"copying, downloading, etc. Roughly any scratch space fpm needs to build" \
|
197
|
+
"The directory you want fpm to do its work in, where 'work' is any file " \
|
198
|
+
"copying, downloading, etc. Roughly any scratch space fpm needs to build " \
|
196
199
|
"your package.", :default => Dir.tmpdir
|
197
200
|
|
198
201
|
parameter "[ARGS] ...",
|
@@ -346,6 +349,16 @@ class FPM::Command < Clamp::Command
|
|
346
349
|
input.replaces += replaces
|
347
350
|
input.config_files += config_files
|
348
351
|
input.directories += directories
|
352
|
+
|
353
|
+
h = {}
|
354
|
+
attrs.each do | e |
|
355
|
+
|
356
|
+
s = e.split(':', 2)
|
357
|
+
h[s.last] = s.first
|
358
|
+
end
|
359
|
+
|
360
|
+
input.attrs = h
|
361
|
+
|
349
362
|
|
350
363
|
script_errors = []
|
351
364
|
setscript = proc do |scriptname|
|
@@ -392,7 +405,15 @@ class FPM::Command < Clamp::Command
|
|
392
405
|
|
393
406
|
# Write the output somewhere, package can be nil if no --package is specified,
|
394
407
|
# and that's OK.
|
395
|
-
|
408
|
+
|
409
|
+
# If the package output (-p flag) is a directory, write to the default file name
|
410
|
+
# but inside that directory.
|
411
|
+
if ! package.nil? && File.directory?(package)
|
412
|
+
package_file = File.join(package, output.to_s)
|
413
|
+
else
|
414
|
+
package_file = output.to_s(package)
|
415
|
+
end
|
416
|
+
|
396
417
|
begin
|
397
418
|
output.output(package_file)
|
398
419
|
rescue FPM::Package::FileAlreadyExists => e
|
@@ -418,8 +439,20 @@ class FPM::Command < Clamp::Command
|
|
418
439
|
@logger.error("Process failed: #{e}")
|
419
440
|
return 1
|
420
441
|
ensure
|
421
|
-
|
422
|
-
|
442
|
+
if debug_workspace?
|
443
|
+
# only emit them if they have files
|
444
|
+
[input, output].each do |plugin|
|
445
|
+
next if plugin.nil?
|
446
|
+
[:staging_path, :build_path].each do |pathtype|
|
447
|
+
path = plugin.send(pathtype)
|
448
|
+
next unless Dir.open(path).to_a.size > 2
|
449
|
+
@logger.log("plugin directory", :plugin => plugin.type, :pathtype => pathtype, :path => path)
|
450
|
+
end
|
451
|
+
end
|
452
|
+
else
|
453
|
+
input.cleanup unless input.nil?
|
454
|
+
output.cleanup unless output.nil?
|
455
|
+
end
|
423
456
|
end # def execute
|
424
457
|
|
425
458
|
def run(*args)
|
data/lib/fpm/package.rb
CHANGED
@@ -111,6 +111,8 @@ class FPM::Package
|
|
111
111
|
# This is where you'd put rpm, deb, or other specific attributes.
|
112
112
|
attr_accessor :attributes
|
113
113
|
|
114
|
+
attr_accessor :attrs
|
115
|
+
|
114
116
|
private
|
115
117
|
|
116
118
|
def initialize
|
@@ -172,6 +174,7 @@ class FPM::Package
|
|
172
174
|
@scripts = {}
|
173
175
|
@config_files = []
|
174
176
|
@directories = []
|
177
|
+
@attrs = {}
|
175
178
|
|
176
179
|
staging_path
|
177
180
|
build_path
|
@@ -198,7 +201,7 @@ class FPM::Package
|
|
198
201
|
:@architecture, :@category, :@config_files, :@conflicts,
|
199
202
|
:@dependencies, :@description, :@epoch, :@iteration, :@license, :@maintainer,
|
200
203
|
:@name, :@provides, :@replaces, :@scripts, :@url, :@vendor, :@version,
|
201
|
-
:@directories, :@staging_path
|
204
|
+
:@directories, :@staging_path, :@attrs
|
202
205
|
]
|
203
206
|
ivars.each do |ivar|
|
204
207
|
#@logger.debug("Copying ivar", :ivar => ivar, :value => instance_variable_get(ivar),
|
@@ -519,5 +522,5 @@ class FPM::Package
|
|
519
522
|
|
520
523
|
# Package internal public api
|
521
524
|
public(:cleanup_staging, :cleanup_build, :staging_path, :converted_from,
|
522
|
-
:edit_file)
|
525
|
+
:edit_file, :build_path)
|
523
526
|
end # class FPM::Package
|
data/lib/fpm/package/cpan.rb
CHANGED
@@ -72,7 +72,7 @@ class FPM::Package::CPAN < FPM::Package
|
|
72
72
|
else; metadata["license"]
|
73
73
|
end
|
74
74
|
|
75
|
-
|
75
|
+
unless metadata["distribution"].nil?
|
76
76
|
@logger.info("Setting package name from 'distribution'",
|
77
77
|
:distribution => metadata["distribution"])
|
78
78
|
self.name = fix_name(metadata["distribution"])
|
@@ -83,7 +83,7 @@ class FPM::Package::CPAN < FPM::Package
|
|
83
83
|
end
|
84
84
|
|
85
85
|
# Not all things have 'author' listed.
|
86
|
-
self.vendor = metadata["author"].join(", ")
|
86
|
+
self.vendor = metadata["author"].join(", ") unless metadata["author"].nil?
|
87
87
|
self.url = metadata["resources"]["homepage"] rescue "unknown"
|
88
88
|
|
89
89
|
# TODO(sissel): figure out if this perl module compiles anything
|
@@ -102,7 +102,7 @@ class FPM::Package::CPAN < FPM::Package
|
|
102
102
|
safesystem(attributes[:cpan_cpanm_bin], *cpanm_flags)
|
103
103
|
|
104
104
|
if !attributes[:no_auto_depends?]
|
105
|
-
|
105
|
+
unless metadata["requires"].nil?
|
106
106
|
metadata["requires"].each do |dep_name, version|
|
107
107
|
# Special case for representing perl core as a version.
|
108
108
|
if dep_name == "perl"
|
data/lib/fpm/package/deb.rb
CHANGED
@@ -99,6 +99,24 @@ class FPM::Package::Deb < FPM::Package
|
|
99
99
|
next @suggests
|
100
100
|
end
|
101
101
|
|
102
|
+
option "--meta-file", "FILEPATH", "Add FILEPATH to DEBIAN directory" do |file|
|
103
|
+
@meta_files ||= []
|
104
|
+
@meta_files << File.expand_path(file)
|
105
|
+
next @meta_files
|
106
|
+
end
|
107
|
+
|
108
|
+
option "--interest", "EVENT", "Package is interested in EVENT trigger" do |event|
|
109
|
+
@interested_triggers ||= []
|
110
|
+
@interested_triggers << event
|
111
|
+
next @interested_triggers
|
112
|
+
end
|
113
|
+
|
114
|
+
option "--activate", "EVENT", "Package activates EVENT trigger" do |event|
|
115
|
+
@activated_triggers ||= []
|
116
|
+
@activated_triggers << event
|
117
|
+
next @activated_triggers
|
118
|
+
end
|
119
|
+
|
102
120
|
option "--field", "'FIELD: VALUE'", "Add custom field to the control file" do |fv|
|
103
121
|
@custom_fields ||= {}
|
104
122
|
field, value = fv.split(/: */, 2)
|
@@ -506,6 +524,8 @@ class FPM::Package::Deb < FPM::Package
|
|
506
524
|
write_scripts # write the maintainer scripts
|
507
525
|
write_conffiles # write the conffiles
|
508
526
|
write_debconf # write the debconf files
|
527
|
+
write_meta_files # write additional meta files
|
528
|
+
write_triggers # write trigger config to 'triggers' file
|
509
529
|
write_md5sums # write the md5sums file
|
510
530
|
|
511
531
|
# Make the control.tar.gz
|
@@ -553,6 +573,7 @@ class FPM::Package::Deb < FPM::Package
|
|
553
573
|
|
554
574
|
@logger.debug("Writing control file", :path => control)
|
555
575
|
File.write(control, control_data)
|
576
|
+
File.chmod(0644, control)
|
556
577
|
edit_file(control) if attributes[:edit?]
|
557
578
|
end
|
558
579
|
end # def write_control
|
@@ -594,13 +615,16 @@ class FPM::Package::Deb < FPM::Package
|
|
594
615
|
end
|
595
616
|
allconfigs.sort!.uniq!
|
596
617
|
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
618
|
+
with(control_path("conffiles")) do |conffiles|
|
619
|
+
File.open(conffiles, "w") do |out|
|
620
|
+
# 'config_files' comes from FPM::Package and is usually set with
|
621
|
+
# FPM::Command's --config-files flag
|
622
|
+
allconfigs.each do |cf|
|
623
|
+
# We need to put the leading / back. Stops lintian relative-conffile error.
|
624
|
+
out.puts("/" + cf)
|
625
|
+
end
|
603
626
|
end
|
627
|
+
File.chmod(0644, conffiles)
|
604
628
|
end
|
605
629
|
end # def write_conffiles
|
606
630
|
|
@@ -624,6 +648,30 @@ class FPM::Package::Deb < FPM::Package
|
|
624
648
|
end
|
625
649
|
end # def write_debconf
|
626
650
|
|
651
|
+
def write_meta_files
|
652
|
+
files = attributes[:deb_meta_files]
|
653
|
+
return unless files
|
654
|
+
files.each do |fn|
|
655
|
+
dest = control_path(File.basename(fn))
|
656
|
+
FileUtils.cp(fn, dest)
|
657
|
+
File.chmod(0644, dest)
|
658
|
+
end
|
659
|
+
end
|
660
|
+
|
661
|
+
def write_triggers
|
662
|
+
lines = [['interest', :deb_interest],
|
663
|
+
['activate', :deb_activate]].map { |label, attr|
|
664
|
+
(attributes[attr] || []).map { |e| "#{label} #{e}\n" }
|
665
|
+
}.flatten.join('')
|
666
|
+
|
667
|
+
if lines.size > 0
|
668
|
+
File.open(control_path("triggers"), 'a') do |f|
|
669
|
+
f.write "\n" if f.size > 0
|
670
|
+
f.write lines
|
671
|
+
end
|
672
|
+
end
|
673
|
+
end
|
674
|
+
|
627
675
|
def write_md5sums
|
628
676
|
md5_sums = {}
|
629
677
|
|
data/lib/fpm/package/dir.rb
CHANGED
@@ -71,7 +71,7 @@ class FPM::Package::Dir < FPM::Package
|
|
71
71
|
clone(source, destination)
|
72
72
|
rescue Errno::ENOENT => e
|
73
73
|
raise FPM::InvalidPackageConfiguration,
|
74
|
-
"Cannot package the path '#{source}', does it exist?"
|
74
|
+
"Cannot package the path '#{File.join(chdir, source)}', does it exist?"
|
75
75
|
end
|
76
76
|
end
|
77
77
|
rescue Errno::ENOENT => e
|
data/lib/fpm/package/gem.rb
CHANGED
@@ -207,7 +207,7 @@ class FPM::Package::Gem < FPM::Package
|
|
207
207
|
::Dir.rmdir(tmp)
|
208
208
|
tmp = File.dirname(tmp)
|
209
209
|
end
|
210
|
-
if attributes[:gem_version_bins?]
|
210
|
+
if attributes[:gem_version_bins?] and File.directory?(bin_path)
|
211
211
|
(::Dir.entries(bin_path) - ['.','..']).each do |bin|
|
212
212
|
FileUtils.mv("#{bin_path}/#{bin}", "#{bin_path}/#{bin}-#{self.version}")
|
213
213
|
end
|
Binary file
|
Binary file
|
data/lib/fpm/package/python.rb
CHANGED
@@ -127,7 +127,7 @@ class FPM::Package::Python < FPM::Package
|
|
127
127
|
"--build-directory", target, want_pkg)
|
128
128
|
else
|
129
129
|
@logger.debug("using pip", :pip => attributes[:python_pip])
|
130
|
-
safesystem(attributes[:python_pip], "install", "--no-install", "-i", attributes[:python_pypi], "-U", "--build", target, want_pkg)
|
130
|
+
safesystem(attributes[:python_pip], "install", "--no-deps", "--no-install", "-i", attributes[:python_pypi], "-U", "--build", target, want_pkg)
|
131
131
|
end
|
132
132
|
|
133
133
|
# easy_install will put stuff in @tmpdir/packagename/, so find that:
|
data/lib/fpm/package/rpm.rb
CHANGED
@@ -95,6 +95,10 @@ class FPM::Package::RPM < FPM::Package
|
|
95
95
|
option "--autoreq", :flag, "Enable RPM's AutoReq option"
|
96
96
|
option "--autoprov", :flag, "Enable RPM's AutoProv option"
|
97
97
|
|
98
|
+
option "--attr", "ATTRFILE",
|
99
|
+
"Set the attribute for a file (%attr).",
|
100
|
+
:multivalued => true, :attribute_name => :attrs
|
101
|
+
|
98
102
|
rpmbuild_filter_from_provides = []
|
99
103
|
option "--filter-from-provides", "REGEX",
|
100
104
|
"Set %filter_from_provides to the supplied REGEX." do |filter_from_provides|
|
@@ -113,6 +117,24 @@ class FPM::Package::RPM < FPM::Package
|
|
113
117
|
"version. Default is to be specific. This option allows the same " \
|
114
118
|
"version of a package but any iteration is permitted"
|
115
119
|
|
120
|
+
option "--verbatim-gem-dependencies", :flag,
|
121
|
+
"When converting from a gem, leave the old (fpm 0.4.x) style " \
|
122
|
+
"dependency names. This flag will use the old 'rubygem-foo' " \
|
123
|
+
"names in rpm requires instead of the redhat style " \
|
124
|
+
"rubygem(foo).", :default => false
|
125
|
+
|
126
|
+
option "--verifyscript", "FILE",
|
127
|
+
"a script to be run on verification" do |val|
|
128
|
+
File.expand_path(val) # Get the full path to the script
|
129
|
+
end # --verifyscript
|
130
|
+
option "--pretrans", "FILE",
|
131
|
+
"pretrans script" do |val|
|
132
|
+
File.expand_path(val) # Get the full path to the script
|
133
|
+
end # --pretrans
|
134
|
+
option "--posttrans", "FILE",
|
135
|
+
"posttrans script" do |val|
|
136
|
+
File.expand_path(val) # Get the full path to the script
|
137
|
+
end # --posttrans
|
116
138
|
private
|
117
139
|
|
118
140
|
# Fix path name
|
@@ -131,7 +153,17 @@ class FPM::Package::RPM < FPM::Package
|
|
131
153
|
def rpm_file_entry(file)
|
132
154
|
original_file = file
|
133
155
|
file = rpm_fix_name(file)
|
134
|
-
|
156
|
+
|
157
|
+
if !attributes[:rpm_use_file_permissions?]
|
158
|
+
|
159
|
+
if attrs[file].nil?
|
160
|
+
return file
|
161
|
+
else
|
162
|
+
return sprintf("%%attr(%s) %s\n", attrs[file], file)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
return sprintf("%%attr(%s) %s\n", attrs[file], file) unless attrs[file].nil?
|
135
167
|
|
136
168
|
# Stat the original filename in the relative staging path
|
137
169
|
::Dir.chdir(staging_path) do
|
@@ -174,17 +206,10 @@ class FPM::Package::RPM < FPM::Package
|
|
174
206
|
# See FPM::Package#converted_from
|
175
207
|
def converted_from(origin)
|
176
208
|
if origin == FPM::Package::Gem
|
177
|
-
# Gem dependency operator "~>" is not compatible with rpm. Translate any found.
|
178
209
|
fixed_deps = []
|
179
210
|
self.dependencies.collect do |dep|
|
180
|
-
|
181
|
-
|
182
|
-
# ~> x.y means: > x.y and < (x+1).0
|
183
|
-
fixed_deps << "#{name} >= #{version}"
|
184
|
-
fixed_deps << "#{name} < #{version.to_i + 1}.0.0"
|
185
|
-
else
|
186
|
-
fixed_deps << dep
|
187
|
-
end
|
211
|
+
# Gem dependency operator "~>" is not compatible with rpm. Translate any found.
|
212
|
+
fixed_deps = fixed_deps + expand_pessimistic_constraints(dep)
|
188
213
|
end
|
189
214
|
self.dependencies = fixed_deps
|
190
215
|
|
@@ -199,13 +224,15 @@ class FPM::Package::RPM < FPM::Package
|
|
199
224
|
provides
|
200
225
|
end
|
201
226
|
end
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
227
|
+
if !self.attributes[:rpm_verbatim_gem_dependencies?]
|
228
|
+
self.dependencies = self.dependencies.collect do |dependency|
|
229
|
+
# Tries to match rubygem_prefix [1], gem_name [2] and version [3] if present
|
230
|
+
# and return it in rubygem_prefix(gem_name) form
|
231
|
+
if name=/^(#{attributes[:gem_package_name_prefix]})-([^\s]+)\s*(.*)$/.match(dependency)
|
232
|
+
"#{name[1]}(#{name[2]})#{name[3] ? " #{name[3]}" : ""}"
|
233
|
+
else
|
234
|
+
dependency
|
235
|
+
end
|
209
236
|
end
|
210
237
|
end
|
211
238
|
end
|
@@ -238,6 +265,21 @@ class FPM::Package::RPM < FPM::Package
|
|
238
265
|
end.flatten
|
239
266
|
end
|
240
267
|
|
268
|
+
setscript = proc do |scriptname|
|
269
|
+
script_path = self.attributes[scriptname]
|
270
|
+
# Skip scripts not set
|
271
|
+
next if script_path.nil?
|
272
|
+
if !File.exists?(script_path)
|
273
|
+
@logger.error("No such file (for #{scriptname.to_s}): #{script_path.inspect}")
|
274
|
+
script_errors << script_path
|
275
|
+
end
|
276
|
+
# Load the script into memory.
|
277
|
+
scripts[scriptname] = File.read(script_path)
|
278
|
+
end
|
279
|
+
|
280
|
+
setscript.call(:rpm_verifyscript)
|
281
|
+
setscript.call(:rpm_posttrans)
|
282
|
+
setscript.call(:rpm_pretrans)
|
241
283
|
end # def converted
|
242
284
|
|
243
285
|
def input(path)
|
@@ -264,6 +306,9 @@ class FPM::Package::RPM < FPM::Package
|
|
264
306
|
self.scripts[:after_install] = tags[:postin]
|
265
307
|
self.scripts[:before_remove] = tags[:preun]
|
266
308
|
self.scripts[:after_remove] = tags[:postun]
|
309
|
+
self.scripts[:rpm_verifyscript] = tags[:verifyscript]
|
310
|
+
self.scripts[:rpm_posttrans] = tags[:posttrans]
|
311
|
+
self.scripts[:rpm_pretrans] = tags[:pretrans]
|
267
312
|
# TODO(sissel): prefix these scripts above with a shebang line if there isn't one?
|
268
313
|
# Also taking into account the value of tags[preinprog] etc, something like:
|
269
314
|
# #!#{tags[:preinprog]}
|
@@ -309,12 +354,16 @@ class FPM::Package::RPM < FPM::Package
|
|
309
354
|
args = ["rpmbuild", "-bb"]
|
310
355
|
|
311
356
|
if %x{uname -m}.chomp != self.architecture
|
312
|
-
|
357
|
+
rpm_target = self.architecture
|
313
358
|
end
|
314
359
|
|
315
360
|
# issue #309
|
316
361
|
if !attributes[:rpm_os].nil?
|
317
362
|
rpm_target = "#{architecture}-unknown-#{attributes[:rpm_os]}"
|
363
|
+
end
|
364
|
+
|
365
|
+
# issue #707
|
366
|
+
if !rpm_target.nil?
|
318
367
|
args += ["--target", rpm_target]
|
319
368
|
end
|
320
369
|
|
@@ -323,6 +372,7 @@ class FPM::Package::RPM < FPM::Package
|
|
323
372
|
"--define", "_topdir #{build_path}",
|
324
373
|
"--define", "_sourcedir #{build_path}",
|
325
374
|
"--define", "_rpmdir #{build_path}/RPMS",
|
375
|
+
"--define", "_tmppath #{attributes[:workdir]}"
|
326
376
|
]
|
327
377
|
|
328
378
|
args += ["--sign"] if attributes[:rpm_sign?]
|
data/lib/fpm/util.rb
CHANGED
@@ -191,4 +191,36 @@ module FPM::Util
|
|
191
191
|
# is already populated. even though this is anew round of copying.
|
192
192
|
return @copied_entries ||= {}
|
193
193
|
end # def copied_entries
|
194
|
+
|
195
|
+
def expand_pessimistic_constraints(constraint)
|
196
|
+
name, op, version = constraint.split(/\s+/)
|
197
|
+
|
198
|
+
if op == '~>'
|
199
|
+
|
200
|
+
new_lower_constraint = "#{name} >= #{version}"
|
201
|
+
|
202
|
+
version_components = version.split('.').collect { |v| v.to_i }
|
203
|
+
|
204
|
+
version_prefix = version_components[0..-3].join('.')
|
205
|
+
portion_to_work_with = version_components.last(2)
|
206
|
+
|
207
|
+
prefix = ''
|
208
|
+
unless version_prefix.empty?
|
209
|
+
prefix = version_prefix + '.'
|
210
|
+
end
|
211
|
+
|
212
|
+
one_to_increment = portion_to_work_with[0].to_i
|
213
|
+
incremented = one_to_increment + 1
|
214
|
+
|
215
|
+
new_version = ''+ incremented.to_s + '.0'
|
216
|
+
|
217
|
+
upper_version = prefix + new_version
|
218
|
+
|
219
|
+
new_upper_constraint = "#{name} < #{upper_version}"
|
220
|
+
|
221
|
+
return [new_lower_constraint,new_upper_constraint]
|
222
|
+
else
|
223
|
+
return [constraint]
|
224
|
+
end
|
225
|
+
end #def expand_pesimistic_constraints
|
194
226
|
end # module FPM::Util
|
data/lib/fpm/version.rb
CHANGED
data/templates/rpm.erb
CHANGED
@@ -108,13 +108,16 @@ Obsoletes: <%= repl %>
|
|
108
108
|
%clean
|
109
109
|
# noop
|
110
110
|
|
111
|
-
<%# This next section puts any %pre, %post, %preun, or %
|
111
|
+
<%# This next section puts any %pre, %post, %preun, %postun, %verifyscript, %pretrans or %posttrans scripts %>
|
112
112
|
<%
|
113
113
|
scriptmap = {
|
114
114
|
:before_install => "pre",
|
115
115
|
:after_install => "post",
|
116
116
|
:before_remove => "preun",
|
117
117
|
:after_remove => "postun",
|
118
|
+
:rpm_verifyscript => "verifyscript",
|
119
|
+
:rpm_posttrans => "posttrans",
|
120
|
+
:rpm_pretrans => "pretrans"
|
118
121
|
}
|
119
122
|
scriptmap.each do |name, rpmname|
|
120
123
|
-%>
|
data/templates/sh.erb
CHANGED
@@ -163,8 +163,10 @@ function run_post_install(){
|
|
163
163
|
if [ -r $AFTER_INSTALL ] ; then
|
164
164
|
chmod +x $AFTER_INSTALL
|
165
165
|
log "Running post install script"
|
166
|
-
|
167
|
-
|
166
|
+
output=$($AFTER_INSTALL 2>&1)
|
167
|
+
errorlevel=$?
|
168
|
+
log $output
|
169
|
+
return $errorlevel
|
168
170
|
fi
|
169
171
|
return 0
|
170
172
|
}
|
@@ -198,11 +200,20 @@ function revert_symlinks(){
|
|
198
200
|
function clean_out_old_releases(){
|
199
201
|
[ -n "$USE_FLAT_RELEASE_DIRECTORY" ] && return
|
200
202
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
203
|
+
if [ -n "$OLD_CURRENT_TARGET" ] ; then
|
204
|
+
# exclude old 'current' from deletions
|
205
|
+
while [ $(ls -tr "${RELEASES_DIR}" | grep -v ^$(basename "${OLD_CURRENT_TARGET}")$ | wc -l) -gt 2 ] ; do
|
206
|
+
OLDEST_RELEASE=$(ls -tr "${RELEASES_DIR}" | grep -v ^$(basename "${OLD_CURRENT_TARGET}")$ | head -1)
|
207
|
+
log "Deleting old release '${OLDEST_RELEASE}'"
|
208
|
+
rm -rf "${RELEASES_DIR}/${OLDEST_RELEASE}"
|
209
|
+
done
|
210
|
+
else
|
211
|
+
while [ $(ls -tr "${RELEASES_DIR}" | wc -l) -gt 2 ] ; do
|
212
|
+
OLDEST_RELEASE=$(ls -tr "${RELEASES_DIR}" | head -1)
|
213
|
+
log "Deleting old release '${OLDEST_RELEASE}'"
|
214
|
+
rm -rf "${RELEASES_DIR}/${OLDEST_RELEASE}"
|
215
|
+
done
|
216
|
+
fi
|
206
217
|
}
|
207
218
|
|
208
219
|
function print_usage(){
|
metadata
CHANGED
@@ -1,181 +1,167 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Sissel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.7.7
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.7.7
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: cabin
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.6.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.6.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: backports
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 2.6.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 2.6.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: arr-pm
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.0.9
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.0.9
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: clamp
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0.6'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.6'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: childprocess
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: ffi
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 3.0.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 3.0.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: insist
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: 0.0.5
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - ~>
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 0.0.5
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: minitest
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - '>='
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - '>='
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: pry
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
156
142
|
requirements:
|
157
|
-
- -
|
143
|
+
- - ">="
|
158
144
|
- !ruby/object:Gem::Version
|
159
145
|
version: '0'
|
160
146
|
type: :development
|
161
147
|
prerelease: false
|
162
148
|
version_requirements: !ruby/object:Gem::Requirement
|
163
149
|
requirements:
|
164
|
-
- -
|
150
|
+
- - ">="
|
165
151
|
- !ruby/object:Gem::Version
|
166
152
|
version: '0'
|
167
153
|
- !ruby/object:Gem::Dependency
|
168
154
|
name: stud
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|
170
156
|
requirements:
|
171
|
-
- -
|
157
|
+
- - ">="
|
172
158
|
- !ruby/object:Gem::Version
|
173
159
|
version: '0'
|
174
160
|
type: :development
|
175
161
|
prerelease: false
|
176
162
|
version_requirements: !ruby/object:Gem::Requirement
|
177
163
|
requirements:
|
178
|
-
- -
|
164
|
+
- - ">="
|
179
165
|
- !ruby/object:Gem::Version
|
180
166
|
version: '0'
|
181
167
|
description: Convert directories, rpms, python eggs, rubygems, and more to rpms, debs,
|
@@ -187,9 +173,15 @@ executables:
|
|
187
173
|
extensions: []
|
188
174
|
extra_rdoc_files: []
|
189
175
|
files:
|
176
|
+
- CHANGELIST
|
177
|
+
- CONTRIBUTORS
|
178
|
+
- LICENSE
|
179
|
+
- bin/fpm
|
180
|
+
- lib/fpm.rb
|
190
181
|
- lib/fpm/command.rb
|
191
182
|
- lib/fpm/errors.rb
|
192
183
|
- lib/fpm/namespace.rb
|
184
|
+
- lib/fpm/package.rb
|
193
185
|
- lib/fpm/package/cpan.rb
|
194
186
|
- lib/fpm/package/deb.rb
|
195
187
|
- lib/fpm/package/dir.rb
|
@@ -210,23 +202,17 @@ files:
|
|
210
202
|
- lib/fpm/package/solaris.rb
|
211
203
|
- lib/fpm/package/tar.rb
|
212
204
|
- lib/fpm/package/zip.rb
|
213
|
-
- lib/fpm/package.rb
|
214
205
|
- lib/fpm/util.rb
|
215
206
|
- lib/fpm/version.rb
|
216
|
-
- lib/fpm.rb
|
217
|
-
- bin/fpm
|
218
|
-
- templates/deb/ldconfig.sh.erb
|
219
207
|
- templates/deb.erb
|
208
|
+
- templates/deb/ldconfig.sh.erb
|
220
209
|
- templates/osxpkg.erb
|
221
|
-
- templates/puppet/package/remove.pp.erb
|
222
210
|
- templates/puppet/package.pp.erb
|
223
|
-
- templates/
|
211
|
+
- templates/puppet/package/remove.pp.erb
|
224
212
|
- templates/rpm.erb
|
213
|
+
- templates/rpm/filesystem_list
|
225
214
|
- templates/sh.erb
|
226
215
|
- templates/solaris.erb
|
227
|
-
- LICENSE
|
228
|
-
- CONTRIBUTORS
|
229
|
-
- CHANGELIST
|
230
216
|
homepage: https://github.com/jordansissel/fpm
|
231
217
|
licenses:
|
232
218
|
- MIT-like
|
@@ -238,17 +224,17 @@ require_paths:
|
|
238
224
|
- lib
|
239
225
|
required_ruby_version: !ruby/object:Gem::Requirement
|
240
226
|
requirements:
|
241
|
-
- -
|
227
|
+
- - ">="
|
242
228
|
- !ruby/object:Gem::Version
|
243
229
|
version: '0'
|
244
230
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
245
231
|
requirements:
|
246
|
-
- -
|
232
|
+
- - ">="
|
247
233
|
- !ruby/object:Gem::Version
|
248
234
|
version: '0'
|
249
235
|
requirements: []
|
250
236
|
rubyforge_project:
|
251
|
-
rubygems_version: 2.
|
237
|
+
rubygems_version: 2.2.2
|
252
238
|
signing_key:
|
253
239
|
specification_version: 4
|
254
240
|
summary: fpm - package building and mangling
|