cure-fpm 1.3.3b → 1.6.0b
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELIST +73 -0
- data/CONTRIBUTORS +1 -1
- data/LICENSE +1 -1
- data/lib/fpm.rb +2 -0
- data/lib/fpm/command.rb +100 -50
- data/lib/fpm/package.rb +42 -28
- data/lib/fpm/package/apk.rb +510 -0
- data/lib/fpm/package/cpan.rb +50 -25
- data/lib/fpm/package/deb.rb +211 -47
- data/lib/fpm/package/dir.rb +29 -28
- data/lib/fpm/package/empty.rb +6 -0
- data/lib/fpm/package/freebsd.rb +144 -0
- data/lib/fpm/package/gem.rb +5 -5
- data/lib/fpm/package/npm.rb +2 -2
- data/lib/fpm/package/osxpkg.rb +8 -7
- data/lib/fpm/package/p5p.rb +124 -0
- data/lib/fpm/package/pacman.rb +399 -0
- data/lib/fpm/package/pleaserun.rb +63 -0
- data/lib/fpm/package/pyfpm/get_metadata.py +9 -1
- data/lib/fpm/package/python.rb +19 -7
- data/lib/fpm/package/rpm.rb +58 -18
- data/lib/fpm/package/sh.rb +1 -7
- data/lib/fpm/package/solaris.rb +1 -1
- data/lib/fpm/package/tar.rb +14 -2
- data/lib/fpm/package/virtualenv.rb +145 -0
- data/lib/fpm/package/zip.rb +1 -1
- data/lib/fpm/rake_task.rb +60 -0
- data/lib/fpm/util.rb +176 -48
- data/lib/fpm/util/tar_writer.rb +80 -0
- data/lib/fpm/version.rb +1 -1
- data/templates/deb/postinst_upgrade.sh.erb +33 -2
- data/templates/deb/postrm_upgrade.sh.erb +10 -1
- data/templates/deb/preinst_upgrade.sh.erb +11 -2
- data/templates/deb/prerm_upgrade.sh.erb +14 -2
- data/templates/p5p_metadata.erb +12 -0
- data/templates/pacman.erb +47 -0
- data/templates/pacman/INSTALL.erb +41 -0
- data/templates/pleaserun/generate-cleanup.sh +17 -0
- data/templates/pleaserun/install-path.sh +17 -0
- data/templates/pleaserun/install.sh +117 -0
- data/templates/pleaserun/scripts/after-install.sh +4 -0
- data/templates/pleaserun/scripts/before-remove.sh +12 -0
- data/templates/rpm.erb +38 -6
- data/templates/sh.erb +38 -3
- metadata +81 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 793e76e8e1b3a125e0100ab92d7ffc0c755edbed
|
4
|
+
data.tar.gz: 669e6e34742b95d5bae4f2084aaa72fff8298286
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2db1b84e6d8148beebe2def93bb948bd7d67eabc34ba4d417a06d5bf3aef28ff13cb8d152bf2bcd2472df98d4a44f856b04f13e635ddfd218a360b60b7e0bfd
|
7
|
+
data.tar.gz: b67535eda96144747b07df6e0a714f1dbe0cbb64f0cc6126d637897620bcd3b1f3f8dba7ad9bbb6c84917486b60c0774d21fbfb42e6869c1ff02c679d0b1958f
|
data/CHANGELIST
CHANGED
@@ -1,3 +1,76 @@
|
|
1
|
+
1.6.0 (May 25, 2016)
|
2
|
+
- New source: pleaserun. This lets you create packages that will install a
|
3
|
+
system service. An after-install script is used in the package to determine
|
4
|
+
which service platform to target (systemd, upstart, etc). (#1119, #1112)
|
5
|
+
- New target: Alpine Linux "apk" packages. (#1054, George Lester)
|
6
|
+
- deb: don't append `.conf` to an upstart file if the file name already ends
|
7
|
+
in `.conf`. (#1115, josegonzalez)
|
8
|
+
- freebsd: fix bug where --package flag was ignored. (#1093, Paweł Tomulik)
|
9
|
+
- Improvements to the fpm rake tasks (#1101, Evan Gilman)
|
10
|
+
|
11
|
+
1.5.0 (April 12, 2016)
|
12
|
+
- Arch package support is now available via -s pacman and -t pacman.
|
13
|
+
(#916; wonderful community effort making this happen!)
|
14
|
+
- FreeBSD packages can now be built `-t freebsd`
|
15
|
+
(#1073; huge community effort making this happen!)
|
16
|
+
- You can now set fpm flags and arguments with the FPMOPTS environment
|
17
|
+
variable (#977, mildred)
|
18
|
+
- Using --exclude-file no longer causes a crash. Yay! (#982, wyaeld)
|
19
|
+
- A new rake task is available for folks who want to invoke fpm from rake
|
20
|
+
(#756, pstengel)
|
21
|
+
- On FreeBSD, when tarring, gtar is now used. (#1008, liv3d)
|
22
|
+
- virtualenv: Add --virtualenv-pypi-extra-url flag to specify additional PyPI
|
23
|
+
locations to use when searching for packages (#1012, Paul Krohn)
|
24
|
+
- deb: Init scripts, etc/default, and upstart files are automatically added
|
25
|
+
as config files in a debian package. Disable this behavior with
|
26
|
+
---deb-auto-config-files
|
27
|
+
- deb: Small changes to make lintian complain less about our resulting debs.
|
28
|
+
- deb: New flag --deb-systemd lets you specify a systemd service file to include
|
29
|
+
in your package. (#952, Jens Peter Schroer)
|
30
|
+
- cpan: Add --[no-]cpan-cpanm-force flag to pass --force to cpanm.
|
31
|
+
- rpm: File names with both spaces and symbols should now be packageable.
|
32
|
+
(#946, iwonbigbro)
|
33
|
+
- cpan: Now queries MetaCPAN for package info if we can't find any in the
|
34
|
+
cpan archive we just downloaded. (#849, BaxterStockman)
|
35
|
+
- rpm: You can now specify custom rpm tags at the command line. Be careful,
|
36
|
+
as no validation is done on this before sending to rpmbuild. (#687, vStone)
|
37
|
+
- cpan: Install if the package name given is a local file (#986, mdom)
|
38
|
+
- sh: Metadata now available as env vars for post-install scripts (#1006, Ed Healy)
|
39
|
+
- rpm: No more warning if you don't set an epoch. (#1053, Joseph Frazier)
|
40
|
+
|
41
|
+
|
42
|
+
1.4.0 (July 26, 2015)
|
43
|
+
- Solaris 11 IPS packages 'p5p' now supported `-t p5p`. (Jonathan Craig)
|
44
|
+
- Python Virtualenv is now supported `-t virtualenv` (#930, Simone
|
45
|
+
Margaritelli and Daniel Haskin)
|
46
|
+
- deb: Files in /etc are now by default marked as config files. (#877,
|
47
|
+
Vincent Bernat)
|
48
|
+
- `fpm --help` output now includes a list of supported package types (#896,
|
49
|
+
Daniel Haskin)
|
50
|
+
- cpan: --[no-]cpan-sandbox-non-core flag to make non-core module sandboxing
|
51
|
+
optional during packaging (#752, Matt Sharpe)
|
52
|
+
- rpm: Add --rpm-dist flag for specifically setting the target distribution
|
53
|
+
of an rpm. (Adam Lamar)
|
54
|
+
- rpm: Fix a crash if --before-upgrade or --after-upgrade were used. (#822,
|
55
|
+
Dave Anderson)
|
56
|
+
- deb: Ensure maintainer scripts have shebang lines (#836, Wesley Spikes)
|
57
|
+
- deb: Fix bug in maintainer scripts where sometimes we would write an empty
|
58
|
+
shell function. Empty functions aren't valid in shell. (Wesley Spikes)
|
59
|
+
- Fix symlink copying bug (#863, Pete Fritchman)
|
60
|
+
- python: Default to https for pypi queries (Timothy Sutton)
|
61
|
+
- New flag --exclude-file for providing a file containing line-delimited
|
62
|
+
exclusions (Jamie Lawrence)
|
63
|
+
- python: new flag --python-disable-dependency to disable specific python
|
64
|
+
dependencies (Ward Vandewege)
|
65
|
+
- python: ensure we avoid wheel packages for now until fpm better supports them.
|
66
|
+
(#885, Matt Callaway)
|
67
|
+
- deb: Add support for installation states "abort-remove" and "abort-install"
|
68
|
+
(#887, Daniel Haskin)
|
69
|
+
- If PATH isn't set, and we need it, tell the user (#886, Ranjib Dey)
|
70
|
+
- cpan: --[no-]cpan-test now works correctly (#853, Matt Schreiber)
|
71
|
+
- deb-to-rpm: some improved support for config file knowledge passing from
|
72
|
+
deb to rpm packages (Daniel Haskin)
|
73
|
+
|
1
74
|
1.3.3 (December 11, 2014)
|
2
75
|
- The fpm project now uses Contributor Covenant. You can read more about this on
|
3
76
|
the website: http://contributor-covenant.org/
|
data/CONTRIBUTORS
CHANGED
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
(This is an MIT-style license)
|
2
2
|
|
3
|
-
Copyright (c) 2011
|
3
|
+
Copyright (c) 2011-2016 Jordan Sissel and contributors.
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/lib/fpm.rb
CHANGED
data/lib/fpm/command.rb
CHANGED
@@ -24,7 +24,7 @@ class FPM::Command < Clamp::Command
|
|
24
24
|
include FPM::Util
|
25
25
|
|
26
26
|
def help(*args)
|
27
|
-
|
27
|
+
lines = [
|
28
28
|
"Intro:",
|
29
29
|
"",
|
30
30
|
" This is fpm version #{FPM::VERSION}",
|
@@ -35,10 +35,14 @@ class FPM::Command < Clamp::Command
|
|
35
35
|
" You can find support on irc (#fpm on freenode irc) or via email with",
|
36
36
|
" fpm-users@googlegroups.com",
|
37
37
|
"",
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
"Loaded package types:",
|
39
|
+
]
|
40
|
+
FPM::Package.types.each do |name, _|
|
41
|
+
lines.push(" - #{name}")
|
42
|
+
end
|
43
|
+
lines.push("")
|
44
|
+
lines.push(super)
|
45
|
+
return lines.join("\n")
|
42
46
|
end # def help
|
43
47
|
|
44
48
|
option "-t", "OUTPUT_TYPE",
|
@@ -52,8 +56,8 @@ class FPM::Command < Clamp::Command
|
|
52
56
|
:attribute_name => :chdir
|
53
57
|
option "--prefix", "PREFIX",
|
54
58
|
"A path to prefix files with when building the target package. This may " \
|
55
|
-
"be necessary for all input packages. For example, the 'gem' type
|
56
|
-
"prefix with your gem directory automatically."
|
59
|
+
"not be necessary for all input packages. For example, the 'gem' type " \
|
60
|
+
"will prefix with your gem directory automatically."
|
57
61
|
option ["-p", "--package"], "OUTPUT", "The package file path to output."
|
58
62
|
option ["-f", "--force"], :flag, "Force output even if it will overwrite an " \
|
59
63
|
"existing file", :default => false
|
@@ -103,12 +107,12 @@ class FPM::Command < Clamp::Command
|
|
103
107
|
"specified multiple times.", :multivalued => true,
|
104
108
|
:attribute_name => :provides
|
105
109
|
option "--conflicts", "CONFLICTS",
|
106
|
-
"Other packages/versions this package conflicts with. This flag can " \
|
110
|
+
"Other packages/versions this package conflicts with. This flag can be " \
|
107
111
|
"specified multiple times.", :multivalued => true,
|
108
112
|
:attribute_name => :conflicts
|
109
113
|
option "--replaces", "REPLACES",
|
110
|
-
"Other packages/versions this package replaces.
|
111
|
-
"specified multiple times.", :multivalued => true,
|
114
|
+
"Other packages/versions this package replaces. Equivalent of rpm's 'Obsoletes'. " \
|
115
|
+
"This flag can be specified multiple times.", :multivalued => true,
|
112
116
|
:attribute_name => :replaces
|
113
117
|
|
114
118
|
option "--config-files", "CONFIG_FILES",
|
@@ -118,7 +122,9 @@ class FPM::Command < Clamp::Command
|
|
118
122
|
"directory all files inside it will be recursively marked as config files.",
|
119
123
|
:multivalued => true, :attribute_name => :config_files
|
120
124
|
option "--directories", "DIRECTORIES", "Recursively mark a directory as being owned " \
|
121
|
-
"by the package
|
125
|
+
"by the package. Use this flag multiple times if you have multiple directories " \
|
126
|
+
"and they are not under the same parent directory ", :multivalued => true,
|
127
|
+
:attribute_name => :directories
|
122
128
|
option ["-a", "--architecture"], "ARCHITECTURE",
|
123
129
|
"The architecture name. Usually matches 'uname -m'. For automatic values," \
|
124
130
|
" you can use '-a all' or '-a native'. These two strings will be " \
|
@@ -139,12 +145,14 @@ class FPM::Command < Clamp::Command
|
|
139
145
|
excludes << val
|
140
146
|
next excludes
|
141
147
|
end # -x / --exclude
|
148
|
+
|
149
|
+
option "--exclude-file", "EXCLUDE_PATH",
|
150
|
+
"The path to a file containing a newline-sparated list of "\
|
151
|
+
"patterns to exclude from input."
|
152
|
+
|
142
153
|
option "--description", "DESCRIPTION", "Add a description for this package." \
|
143
|
-
" You can include '
|
144
|
-
:default => "no description"
|
145
|
-
# Replace literal "\n" sequences with a newline character.
|
146
|
-
val.gsub("\\n", "\n")
|
147
|
-
end
|
154
|
+
" You can include '\\n' sequences to indicate newline breaks.",
|
155
|
+
:default => "no description"
|
148
156
|
option "--url", "URI", "Add a url for this package.",
|
149
157
|
:default => "http://example.com/no-uri-given"
|
150
158
|
option "--inputs", "INPUTS_PATH",
|
@@ -191,17 +199,17 @@ class FPM::Command < Clamp::Command
|
|
191
199
|
option "--after-upgrade", "FILE",
|
192
200
|
"A script to be run after package upgrade. If not specified,\n" \
|
193
201
|
"--before-install, --after-install, --before-remove, and \n" \
|
194
|
-
"--after-remove
|
202
|
+
"--after-remove will behave in a backwards-compatible manner\n" \
|
195
203
|
"(they will not be upgrade-case aware).\n" \
|
196
|
-
"Currently only supports deb and
|
204
|
+
"Currently only supports deb, rpm and pacman packages." do |val|
|
197
205
|
File.expand_path(val) # Get the full path to the script
|
198
206
|
end # --after-upgrade
|
199
207
|
option "--before-upgrade", "FILE",
|
200
208
|
"A script to be run before package upgrade. If not specified,\n" \
|
201
209
|
"--before-install, --after-install, --before-remove, and \n" \
|
202
|
-
"--after-remove
|
210
|
+
"--after-remove will behave in a backwards-compatible manner\n" \
|
203
211
|
"(they will not be upgrade-case aware).\n" \
|
204
|
-
"Currently only supports deb and
|
212
|
+
"Currently only supports deb, rpm and pacman packages." do |val|
|
205
213
|
File.expand_path(val) # Get the full path to the script
|
206
214
|
end # --before-upgrade
|
207
215
|
|
@@ -215,7 +223,7 @@ class FPM::Command < Clamp::Command
|
|
215
223
|
option "--template-value", "KEY=VALUE",
|
216
224
|
"Make 'key' available in script templates, so <%= key %> given will be " \
|
217
225
|
"the provided value. Implies --template-scripts",
|
218
|
-
:multivalued => true do |kv|
|
226
|
+
:multivalued => true do |kv|
|
219
227
|
@template_scripts = true
|
220
228
|
next kv.split("=", 2)
|
221
229
|
end
|
@@ -272,7 +280,7 @@ class FPM::Command < Clamp::Command
|
|
272
280
|
# fpm would assume you meant to add '.' to the end of the commandline.
|
273
281
|
# Let's hack that. https://github.com/jordansissel/fpm/issues/187
|
274
282
|
if input_type == "dir" and args.empty? and !chdir.nil?
|
275
|
-
logger.info("No args, but -s dir and -C are given, assuming '.' as input")
|
283
|
+
logger.info("No args, but -s dir and -C are given, assuming '.' as input")
|
276
284
|
args << "."
|
277
285
|
end
|
278
286
|
|
@@ -293,7 +301,7 @@ class FPM::Command < Clamp::Command
|
|
293
301
|
|
294
302
|
input = input_class.new
|
295
303
|
|
296
|
-
# Merge in package settings.
|
304
|
+
# Merge in package settings.
|
297
305
|
# The 'settings' stuff comes in from #apply_options, which goes through
|
298
306
|
# all the options defined in known packages and puts them into our command.
|
299
307
|
# Flags in packages defined as "--foo-bar" become named "--<packagetype>-foo-bar"
|
@@ -305,15 +313,15 @@ class FPM::Command < Clamp::Command
|
|
305
313
|
#
|
306
314
|
# Things like '--foo-bar' will be available as pkg.attributes[:foo_bar]
|
307
315
|
self.class.declared_options.each do |option|
|
308
|
-
|
316
|
+
option.attribute_name.tap do |attr|
|
309
317
|
next if attr == "help"
|
310
318
|
# clamp makes option attributes available as accessor methods
|
311
319
|
# --foo-bar is available as 'foo_bar'. Put these in the package
|
312
320
|
# attributes hash. (See FPM::Package#attributes)
|
313
|
-
#
|
321
|
+
#
|
314
322
|
# In the case of 'flag' options, the accessor is actually 'foo_bar?'
|
315
323
|
# instead of just 'foo_bar'
|
316
|
-
|
324
|
+
|
317
325
|
# If the instance variable @{attr} is defined, then
|
318
326
|
# it means the flag was given on the command line.
|
319
327
|
flag_given = instance_variable_defined?("@#{attr}")
|
@@ -324,12 +332,18 @@ class FPM::Command < Clamp::Command
|
|
324
332
|
end
|
325
333
|
end
|
326
334
|
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
input.
|
335
|
+
if input_type == "pleaserun"
|
336
|
+
# Special case for pleaserun that all parameters are considered the 'command'
|
337
|
+
# to run through pleaserun.
|
338
|
+
input.input(args)
|
339
|
+
else
|
340
|
+
# Each remaining command line parameter is used as an 'input' argument.
|
341
|
+
# For directories, this means paths. For things like gem and python, this
|
342
|
+
# means package name or paths to the packages (rails, foo-1.0.gem, django,
|
343
|
+
# bar/setup.py, etc)
|
344
|
+
args.each do |arg|
|
345
|
+
input.input(arg)
|
346
|
+
end
|
333
347
|
end
|
334
348
|
|
335
349
|
# If --inputs was specified, read it as a file.
|
@@ -340,12 +354,30 @@ class FPM::Command < Clamp::Command
|
|
340
354
|
end
|
341
355
|
|
342
356
|
# Read each line as a path
|
343
|
-
File.new(inputs, "r").each_line do |line|
|
357
|
+
File.new(inputs, "r").each_line do |line|
|
344
358
|
# Handle each line as if it were an argument
|
345
359
|
input.input(line.strip)
|
346
360
|
end
|
347
361
|
end
|
348
362
|
|
363
|
+
# If --exclude-file was specified, read it as a file and append to
|
364
|
+
# the exclude pattern list.
|
365
|
+
if !exclude_file.nil?
|
366
|
+
if !File.exists?(exclude_file)
|
367
|
+
logger.fatal("File given for --exclude-file does not exist (#{exclude_file})")
|
368
|
+
return 1
|
369
|
+
end
|
370
|
+
|
371
|
+
# Ensure hash is initialized
|
372
|
+
input.attributes[:excludes] ||= []
|
373
|
+
|
374
|
+
# Read each line as a path
|
375
|
+
File.new(exclude_file, "r").each_line do |line|
|
376
|
+
# Handle each line as if it were an argument
|
377
|
+
input.attributes[:excludes] << line.strip
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
349
381
|
# Override package settings if they are not the default flag values
|
350
382
|
# the below proc essentially does:
|
351
383
|
#
|
@@ -371,7 +403,6 @@ class FPM::Command < Clamp::Command
|
|
371
403
|
set.call(input, :url)
|
372
404
|
set.call(input, :vendor)
|
373
405
|
set.call(input, :version)
|
374
|
-
set.call(input, :architecture)
|
375
406
|
|
376
407
|
input.conflicts += conflicts
|
377
408
|
input.dependencies += dependencies
|
@@ -389,7 +420,6 @@ class FPM::Command < Clamp::Command
|
|
389
420
|
|
390
421
|
input.attrs = h
|
391
422
|
|
392
|
-
|
393
423
|
script_errors = []
|
394
424
|
setscript = proc do |scriptname|
|
395
425
|
# 'self.send(scriptname) == self.before_install == --before-install
|
@@ -435,9 +465,9 @@ class FPM::Command < Clamp::Command
|
|
435
465
|
end
|
436
466
|
end
|
437
467
|
|
438
|
-
# Write the output somewhere, package can be nil if no --package is specified,
|
468
|
+
# Write the output somewhere, package can be nil if no --package is specified,
|
439
469
|
# and that's OK.
|
440
|
-
|
470
|
+
|
441
471
|
# If the package output (-p flag) is a directory, write to the default file name
|
442
472
|
# but inside that directory.
|
443
473
|
if ! package.nil? && File.directory?(package)
|
@@ -484,7 +514,7 @@ class FPM::Command < Clamp::Command
|
|
484
514
|
end
|
485
515
|
end # def execute
|
486
516
|
|
487
|
-
def run(*
|
517
|
+
def run(*run_args)
|
488
518
|
logger.subscribe(STDOUT)
|
489
519
|
|
490
520
|
# fpm initialization files, note the order of the following array is
|
@@ -493,21 +523,41 @@ class FPM::Command < Clamp::Command
|
|
493
523
|
rc_files = [ ".fpm" ]
|
494
524
|
rc_files << File.join(ENV["HOME"], ".fpm") if ENV["HOME"]
|
495
525
|
|
526
|
+
rc_args = []
|
527
|
+
|
528
|
+
if ENV["FPMOPTS"]
|
529
|
+
logger.warn("Loading flags from FPMOPTS environment variable")
|
530
|
+
rc_args.push(*Shellwords.shellsplit(ENV["FPMOPTS"]))
|
531
|
+
end
|
532
|
+
|
496
533
|
rc_files.each do |rc_file|
|
497
534
|
if File.readable? rc_file
|
498
535
|
logger.warn("Loading flags from rc file #{rc_file}")
|
499
|
-
File.
|
500
|
-
# reverse becasue 'unshift' pushes onto the left side of the array.
|
501
|
-
Shellwords.shellsplit(line).reverse.each do |arg|
|
502
|
-
# Put '.fpm'-file flags *before* the command line flags
|
503
|
-
# so that we the CLI can override the .fpm flags
|
504
|
-
ARGV.unshift(arg)
|
505
|
-
end
|
506
|
-
end
|
536
|
+
rc_args.push(*Shellwords.shellsplit(File.read(rc_file)))
|
507
537
|
end
|
508
538
|
end
|
509
539
|
|
510
|
-
|
540
|
+
flags = []
|
541
|
+
args = []
|
542
|
+
while rc_args.size > 0 do
|
543
|
+
arg = rc_args.shift
|
544
|
+
opt = self.class.find_option(arg)
|
545
|
+
if opt and not opt.flag?
|
546
|
+
flags.push(arg)
|
547
|
+
flags.push(rc_args.shift)
|
548
|
+
elsif opt or arg[0] == "-"
|
549
|
+
flags.push(arg)
|
550
|
+
else
|
551
|
+
args.push(arg)
|
552
|
+
end
|
553
|
+
end
|
554
|
+
|
555
|
+
logger.warn("Additional options: #{flags.join " "}") if flags.size > 0
|
556
|
+
logger.warn("Additional arguments: #{args.join " "}") if args.size > 0
|
557
|
+
|
558
|
+
ARGV.unshift(*flags)
|
559
|
+
ARGV.push(*args)
|
560
|
+
super(*run_args)
|
511
561
|
rescue FPM::Package::InvalidArgument => e
|
512
562
|
logger.error("Invalid package argument: #{e}")
|
513
563
|
return 1
|
@@ -542,21 +592,21 @@ class FPM::Command < Clamp::Command
|
|
542
592
|
|
543
593
|
# Verify the types requested are valid
|
544
594
|
types = FPM::Package.types.keys.sort
|
545
|
-
|
595
|
+
@command.input_type.tap do |val|
|
546
596
|
next if val.nil?
|
547
597
|
mandatory(FPM::Package.types.include?(val),
|
548
598
|
"Invalid input package -s flag) type #{val.inspect}. " \
|
549
599
|
"Expected one of: #{types.join(", ")}")
|
550
600
|
end
|
551
601
|
|
552
|
-
|
602
|
+
@command.output_type.tap do |val|
|
553
603
|
next if val.nil?
|
554
604
|
mandatory(FPM::Package.types.include?(val),
|
555
605
|
"Invalid output package (-t flag) type #{val.inspect}. " \
|
556
606
|
"Expected one of: #{types.join(", ")}")
|
557
607
|
end
|
558
608
|
|
559
|
-
|
609
|
+
@command.dependencies.tap do |dependencies|
|
560
610
|
# Verify dependencies don't include commas (#257)
|
561
611
|
dependencies.each do |dep|
|
562
612
|
next unless dep.include?(",")
|
data/lib/fpm/package.rb
CHANGED
@@ -17,7 +17,7 @@ class FPM::Package
|
|
17
17
|
|
18
18
|
# This class is raised if there's something wrong with a setting in the package.
|
19
19
|
class InvalidArgument < StandardError; end
|
20
|
-
|
20
|
+
|
21
21
|
# This class is raised when a file already exists when trying to write.
|
22
22
|
class FileAlreadyExists < StandardError
|
23
23
|
# Get a human-readable error message
|
@@ -116,7 +116,7 @@ class FPM::Package
|
|
116
116
|
private
|
117
117
|
|
118
118
|
def initialize
|
119
|
-
# Attributes for this specific package
|
119
|
+
# Attributes for this specific package
|
120
120
|
@attributes = {}
|
121
121
|
|
122
122
|
# Reference
|
@@ -151,11 +151,11 @@ class FPM::Package
|
|
151
151
|
@category = "default"
|
152
152
|
@license = "unknown"
|
153
153
|
@vendor = "none"
|
154
|
-
|
154
|
+
|
155
155
|
# Iterate over all the options and set defaults
|
156
156
|
if self.class.respond_to?(:declared_options)
|
157
157
|
self.class.declared_options.each do |option|
|
158
|
-
|
158
|
+
option.attribute_name.tap do |attr|
|
159
159
|
# clamp makes option attributes available as accessor methods
|
160
160
|
# do --foo-bar is available as 'foo_bar'
|
161
161
|
# make these available as package attributes.
|
@@ -216,7 +216,7 @@ class FPM::Package
|
|
216
216
|
return pkg
|
217
217
|
end # def convert
|
218
218
|
|
219
|
-
# This method is invoked on a package when it has been
|
219
|
+
# This method is invoked on a package when it has been converted to a new
|
220
220
|
# package format. The purpose of this method is to do any extra conversion
|
221
221
|
# steps, like translating dependency conditions, etc.
|
222
222
|
def converted_from(origin)
|
@@ -227,7 +227,7 @@ class FPM::Package
|
|
227
227
|
# Add a new source to this package.
|
228
228
|
# The exact behavior depends on the kind of package being managed.
|
229
229
|
#
|
230
|
-
# For instance:
|
230
|
+
# For instance:
|
231
231
|
#
|
232
232
|
# * for FPM::Package::Dir, << expects a path to a directory or files.
|
233
233
|
# * for FPM::Package::RPM, << expects a path to an rpm.
|
@@ -270,21 +270,21 @@ class FPM::Package
|
|
270
270
|
|
271
271
|
# Clean up any temporary storage used by this class.
|
272
272
|
def cleanup
|
273
|
-
cleanup_staging
|
274
|
-
cleanup_build
|
273
|
+
cleanup_staging
|
274
|
+
cleanup_build
|
275
275
|
end # def cleanup
|
276
276
|
|
277
277
|
def cleanup_staging
|
278
278
|
if File.directory?(staging_path)
|
279
279
|
logger.debug("Cleaning up staging path", :path => staging_path)
|
280
|
-
FileUtils.rm_r(staging_path)
|
280
|
+
FileUtils.rm_r(staging_path)
|
281
281
|
end
|
282
282
|
end # def cleanup_staging
|
283
283
|
|
284
284
|
def cleanup_build
|
285
285
|
if File.directory?(build_path)
|
286
286
|
logger.debug("Cleaning up build path", :path => build_path)
|
287
|
-
FileUtils.rm_r(build_path)
|
287
|
+
FileUtils.rm_r(build_path)
|
288
288
|
end
|
289
289
|
end # def cleanup_build
|
290
290
|
|
@@ -292,7 +292,7 @@ class FPM::Package
|
|
292
292
|
#
|
293
293
|
# The paths will all be relative to staging_path and will not include that
|
294
294
|
# path.
|
295
|
-
#
|
295
|
+
#
|
296
296
|
# This method will emit 'leaf' paths. Files, symlinks, and other file-like
|
297
297
|
# things are emitted. Intermediate directories are ignored, but
|
298
298
|
# empty directories are emitted.
|
@@ -317,7 +317,7 @@ class FPM::Package
|
|
317
317
|
.select { |path| is_leaf.call(path) } \
|
318
318
|
.collect { |path| path[staging_path.length + 1.. -1] }
|
319
319
|
end # def files
|
320
|
-
|
320
|
+
|
321
321
|
def template_dir
|
322
322
|
File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "templates"))
|
323
323
|
end
|
@@ -331,17 +331,31 @@ class FPM::Package
|
|
331
331
|
return erb
|
332
332
|
end # def template
|
333
333
|
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
334
|
+
#######################################
|
335
|
+
# The following methods are provided to
|
336
|
+
# easily override particular substitut-
|
337
|
+
# ions performed by to_s for subclasses
|
338
|
+
#######################################
|
339
|
+
def to_s_arch; architecture.to_s; end
|
340
|
+
def to_s_name; name.to_s; end
|
341
|
+
def to_s_fullversion; iteration ? "#{version}-#{iteration}" : "#{version}"; end
|
342
|
+
def to_s_version; version.to_s; end
|
343
|
+
def to_s_iteration; iteration.to_s; end
|
344
|
+
def to_s_epoch; epoch.to_s; end
|
345
|
+
def to_s_type; type.to_s; end
|
346
|
+
def to_s_extension; type.to_s; end
|
347
|
+
#######################################
|
348
|
+
|
349
|
+
def to_s(fmt=nil)
|
350
|
+
fmt = "NAME.EXTENSION" if fmt.nil?
|
351
|
+
return fmt.gsub("ARCH", to_s_arch) \
|
352
|
+
.gsub("NAME", to_s_name) \
|
353
|
+
.gsub("FULLVERSION", to_s_fullversion) \
|
354
|
+
.gsub("VERSION", to_s_version) \
|
355
|
+
.gsub("ITERATION", to_s_iteration) \
|
356
|
+
.gsub("EPOCH", to_s_epoch) \
|
357
|
+
.gsub("TYPE", to_s_type) \
|
358
|
+
.gsub("EXTENSION", to_s_extension)
|
345
359
|
end # def to_s
|
346
360
|
|
347
361
|
def edit_file(path)
|
@@ -351,7 +365,7 @@ class FPM::Package
|
|
351
365
|
system("#{editor} #{Shellwords.escape(path)}")
|
352
366
|
if !$?.success?
|
353
367
|
raise ProcessFailed.new("'#{editor}' failed (exit code " \
|
354
|
-
"#{$?.exitstatus}) Full command was: "\
|
368
|
+
"#{$?.exitstatus}) Full command was: " \
|
355
369
|
"#{command}");
|
356
370
|
end
|
357
371
|
|
@@ -379,7 +393,7 @@ class FPM::Package
|
|
379
393
|
|
380
394
|
if File.fnmatch(wildcard, match_path)
|
381
395
|
logger.info("Removing excluded path", :path => match_path, :matches => wildcard)
|
382
|
-
FileUtils.
|
396
|
+
FileUtils.rm_r(path)
|
383
397
|
Find.prune
|
384
398
|
break
|
385
399
|
end
|
@@ -390,7 +404,7 @@ class FPM::Package
|
|
390
404
|
|
391
405
|
class << self
|
392
406
|
# This method is invoked when subclass occurs.
|
393
|
-
#
|
407
|
+
#
|
394
408
|
# Lets us track all known FPM::Package subclasses
|
395
409
|
def inherited(klass)
|
396
410
|
@subclasses ||= {}
|
@@ -441,7 +455,7 @@ class FPM::Package
|
|
441
455
|
|
442
456
|
def default_attributes(&block)
|
443
457
|
return if @options.nil?
|
444
|
-
@options.each do |flag, param, help, options,
|
458
|
+
@options.each do |flag, param, help, options, _block|
|
445
459
|
attr = flag.first.gsub(/^-+/, "").gsub(/-/, "_").gsub("[no_]", "")
|
446
460
|
attr += "?" if param == :flag
|
447
461
|
yield attr.to_sym, options[:default]
|
@@ -509,7 +523,7 @@ class FPM::Package
|
|
509
523
|
def provides=(value)
|
510
524
|
if !value.is_a?(Array)
|
511
525
|
@provides = [value]
|
512
|
-
else
|
526
|
+
else
|
513
527
|
@provides = value
|
514
528
|
end
|
515
529
|
end
|