fpm 1.3.3 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32e5de1dd66653d1c114a19665ffc0878615018c
4
- data.tar.gz: 159971a71bca1eb9118aca6145e1e52eaa046495
3
+ metadata.gz: c5242a72c4435675eabd2eb890ac8296bf77553b
4
+ data.tar.gz: 3aeda059fb3d5cfab49e0eaff6cb457c7a61e374
5
5
  SHA512:
6
- metadata.gz: e121f7c5fdd380c0e48255b5c8751c9aa1962be84611130995afc9f46e9122247ce0dd3faa8699cc5f3c68fe6a2c0b3a31934d9b32cd6eec9233e667d13376e5
7
- data.tar.gz: 0a118ebc654aba513eb091d5640865d8314103b9c44b20ea6070f6c6de7d92d8001fcf2b6fa6671855960c15f766c6ef3bc11449acc7692946b812003b41c92d
6
+ metadata.gz: 91d43f3e9ec89f218d08f2d05a0b2cf43c6e06ea2e617ce353bd4be58892167b7617f50f2bc1758a5946033ffc974d05bb9be01396759f79e8b532f5aa5efb93
7
+ data.tar.gz: 613babff93a8b1e0acf992ea46d4de82bfa0f175f20b1194f039049480f818a3d52cce267c282ec2721324a839de72da5a777c454a264f914e276b02c54ca4b4
data/CHANGELIST CHANGED
@@ -1,3 +1,35 @@
1
+ 1.4.0 (???)
2
+ - Solaris 11 IPS packages 'p5p' now supported `-t p5p`. (Jonathan Craig)
3
+ - Python Virtualenv is now supported `-t virtualenv` (#930, Simone
4
+ Margaritelli and Daniel Haskin)
5
+ - deb: Files in /etc are now by default marked as config files. (#877,
6
+ Vincent Bernat)
7
+ - `fpm --help` output now includes a list of supported package types (#896,
8
+ Daniel Haskin)
9
+ - cpan: --[no-]cpan-sandbox-non-core flag to make non-core module sandboxing
10
+ optional during packaging (#752, Matt Sharpe)
11
+ - rpm: Add --rpm-dist flag for specifically setting the target distribution
12
+ of an rpm. (Adam Lamar)
13
+ - rpm: Fix a crash if --before-upgrade or --after-upgrade were used. (#822,
14
+ Dave Anderson)
15
+ - deb: Ensure maintainer scripts have shebang lines (#836, Wesley Spikes)
16
+ - deb: Fix bug in maintainer scripts where sometimes we would write an empty
17
+ shell function. Empty functions aren't valid in shell. (Wesley Spikes)
18
+ - Fix symlink copying bug (#863, Pete Fritchman)
19
+ - python: Default to https for pypi queries (Timothy Sutton)
20
+ - New flag --exclude-file for providing a file containing line-delimited
21
+ exclusions (Jamie Lawrence)
22
+ - python: new flag --python-disable-dependency to disable specific python
23
+ dependencies (Ward Vandewege)
24
+ - python: ensure we avoid wheel packages for now until fpm better supports them.
25
+ (#885, Matt Callaway)
26
+ - deb: Add support for installation states "abort-remove" and "abort-install"
27
+ (#887, Daniel Haskin)
28
+ - If PATH isn't set, and we need it, tell the user (#886, Ranjib Dey)
29
+ - cpan: --[no-]cpan-test now works correctly (#853, Matt Schreiber)
30
+ - deb-to-rpm: some improved support for config file knowledge passing from
31
+ deb to rpm packages (Daniel Haskin)
32
+
1
33
  1.3.3 (December 11, 2014)
2
34
  - The fpm project now uses Contributor Covenant. You can read more about this on
3
35
  the website: http://contributor-covenant.org/
@@ -3,7 +3,7 @@ bug reports, code, or other to fpm:
3
3
 
4
4
  anthezium
5
5
  Curt Micol
6
- Jay Adkisson
6
+ Jeanine Adkisson
7
7
  Jordan Sissel
8
8
  Marc Fournier
9
9
  Michael Blume
data/lib/fpm.rb CHANGED
@@ -14,4 +14,5 @@ require "fpm/package/puppet"
14
14
  require "fpm/package/python"
15
15
  require "fpm/package/osxpkg"
16
16
  require "fpm/package/solaris"
17
+ require "fpm/package/p5p"
17
18
  require "fpm/package/pkgin"
@@ -24,7 +24,7 @@ class FPM::Command < Clamp::Command
24
24
  include FPM::Util
25
25
 
26
26
  def help(*args)
27
- return [
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
- # Lastly, include the default help output via Clamp.
40
- super
41
- ].join("\n")
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",
@@ -139,6 +143,11 @@ class FPM::Command < Clamp::Command
139
143
  excludes << val
140
144
  next excludes
141
145
  end # -x / --exclude
146
+
147
+ option "--exclude-file", "EXCLUDE_PATH",
148
+ "The path to a file containing a newline-sparated list of "\
149
+ "patterns to exclude from input."
150
+
142
151
  option "--description", "DESCRIPTION", "Add a description for this package." \
143
152
  " You can include '\n' sequences to indicate newline breaks.",
144
153
  :default => "no description" do |val|
@@ -191,7 +200,7 @@ class FPM::Command < Clamp::Command
191
200
  option "--after-upgrade", "FILE",
192
201
  "A script to be run after package upgrade. If not specified,\n" \
193
202
  "--before-install, --after-install, --before-remove, and \n" \
194
- "--after-remove wil behave in a backwards-compatible manner\n" \
203
+ "--after-remove will behave in a backwards-compatible manner\n" \
195
204
  "(they will not be upgrade-case aware).\n" \
196
205
  "Currently only supports deb and rpm packages." do |val|
197
206
  File.expand_path(val) # Get the full path to the script
@@ -199,7 +208,7 @@ class FPM::Command < Clamp::Command
199
208
  option "--before-upgrade", "FILE",
200
209
  "A script to be run before package upgrade. If not specified,\n" \
201
210
  "--before-install, --after-install, --before-remove, and \n" \
202
- "--after-remove wil behave in a backwards-compatible manner\n" \
211
+ "--after-remove will behave in a backwards-compatible manner\n" \
203
212
  "(they will not be upgrade-case aware).\n" \
204
213
  "Currently only supports deb and rpm packages." do |val|
205
214
  File.expand_path(val) # Get the full path to the script
@@ -215,7 +224,7 @@ class FPM::Command < Clamp::Command
215
224
  option "--template-value", "KEY=VALUE",
216
225
  "Make 'key' available in script templates, so <%= key %> given will be " \
217
226
  "the provided value. Implies --template-scripts",
218
- :multivalued => true do |kv|
227
+ :multivalued => true do |kv|
219
228
  @template_scripts = true
220
229
  next kv.split("=", 2)
221
230
  end
@@ -272,7 +281,7 @@ class FPM::Command < Clamp::Command
272
281
  # fpm would assume you meant to add '.' to the end of the commandline.
273
282
  # Let's hack that. https://github.com/jordansissel/fpm/issues/187
274
283
  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")
284
+ logger.info("No args, but -s dir and -C are given, assuming '.' as input")
276
285
  args << "."
277
286
  end
278
287
 
@@ -293,7 +302,7 @@ class FPM::Command < Clamp::Command
293
302
 
294
303
  input = input_class.new
295
304
 
296
- # Merge in package settings.
305
+ # Merge in package settings.
297
306
  # The 'settings' stuff comes in from #apply_options, which goes through
298
307
  # all the options defined in known packages and puts them into our command.
299
308
  # Flags in packages defined as "--foo-bar" become named "--<packagetype>-foo-bar"
@@ -310,10 +319,10 @@ class FPM::Command < Clamp::Command
310
319
  # clamp makes option attributes available as accessor methods
311
320
  # --foo-bar is available as 'foo_bar'. Put these in the package
312
321
  # attributes hash. (See FPM::Package#attributes)
313
- #
322
+ #
314
323
  # In the case of 'flag' options, the accessor is actually 'foo_bar?'
315
324
  # instead of just 'foo_bar'
316
-
325
+
317
326
  # If the instance variable @{attr} is defined, then
318
327
  # it means the flag was given on the command line.
319
328
  flag_given = instance_variable_defined?("@#{attr}")
@@ -328,8 +337,8 @@ class FPM::Command < Clamp::Command
328
337
  # For directories, this means paths. For things like gem and python, this
329
338
  # means package name or paths to the packages (rails, foo-1.0.gem, django,
330
339
  # bar/setup.py, etc)
331
- args.each do |arg|
332
- input.input(arg)
340
+ args.each do |arg|
341
+ input.input(arg)
333
342
  end
334
343
 
335
344
  # If --inputs was specified, read it as a file.
@@ -340,12 +349,28 @@ class FPM::Command < Clamp::Command
340
349
  end
341
350
 
342
351
  # Read each line as a path
343
- File.new(inputs, "r").each_line do |line|
352
+ File.new(inputs, "r").each_line do |line|
344
353
  # Handle each line as if it were an argument
345
354
  input.input(line.strip)
346
355
  end
347
356
  end
348
357
 
358
+ # If --exclude-file was specified, read it as a file and append to
359
+ # the exclude pattern list.
360
+ if !exclude_file.nil?
361
+ if !File.exists?(exclude_file)
362
+ logger.fatal("File given for --exclude-file does not exist (#{exclude_file})")
363
+ return 1
364
+ end
365
+
366
+ # Read each line as a path
367
+ File.new(exclude-file, "r").each_line do |line|
368
+ # Handle each line as if it were an argument
369
+ # 'excludes' is defined above near the -x option.
370
+ excludes << line.strip
371
+ end
372
+ end
373
+
349
374
  # Override package settings if they are not the default flag values
350
375
  # the below proc essentially does:
351
376
  #
@@ -389,7 +414,7 @@ class FPM::Command < Clamp::Command
389
414
 
390
415
  input.attrs = h
391
416
 
392
-
417
+
393
418
  script_errors = []
394
419
  setscript = proc do |scriptname|
395
420
  # 'self.send(scriptname) == self.before_install == --before-install
@@ -435,9 +460,9 @@ class FPM::Command < Clamp::Command
435
460
  end
436
461
  end
437
462
 
438
- # Write the output somewhere, package can be nil if no --package is specified,
463
+ # Write the output somewhere, package can be nil if no --package is specified,
439
464
  # and that's OK.
440
-
465
+
441
466
  # If the package output (-p flag) is a directory, write to the default file name
442
467
  # but inside that directory.
443
468
  if ! package.nil? && File.directory?(package)
@@ -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,7 +151,7 @@ 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|
@@ -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 unless logger.level == :debug
274
- cleanup_build unless logger.level == :debug
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
@@ -390,7 +390,7 @@ class FPM::Package
390
390
 
391
391
  class << self
392
392
  # This method is invoked when subclass occurs.
393
- #
393
+ #
394
394
  # Lets us track all known FPM::Package subclasses
395
395
  def inherited(klass)
396
396
  @subclasses ||= {}
@@ -441,7 +441,7 @@ class FPM::Package
441
441
 
442
442
  def default_attributes(&block)
443
443
  return if @options.nil?
444
- @options.each do |flag, param, help, options, block|
444
+ @options.each do |flag, param, help, options, _block|
445
445
  attr = flag.first.gsub(/^-+/, "").gsub(/-/, "_").gsub("[no_]", "")
446
446
  attr += "?" if param == :flag
447
447
  yield attr.to_sym, options[:default]
@@ -509,7 +509,7 @@ class FPM::Package
509
509
  def provides=(value)
510
510
  if !value.is_a?(Array)
511
511
  @provides = [value]
512
- else
512
+ else
513
513
  @provides = value
514
514
  end
515
515
  end
@@ -27,6 +27,9 @@ class FPM::Package::CPAN < FPM::Package
27
27
  option "--perl-lib-path", "PERL_LIB_PATH",
28
28
  "Path of target Perl Libraries"
29
29
 
30
+ option "--sandbox-non-core", :flag,
31
+ "Sandbox all non-core modules, even if they're already installed", :default => true
32
+
30
33
  private
31
34
  def input(package)
32
35
  #if RUBY_VERSION =~ /^1\.8/
@@ -49,18 +52,18 @@ class FPM::Package::CPAN < FPM::Package
49
52
  end
50
53
 
51
54
  # Read package metadata (name, version, etc)
52
- if File.exists?(File.join(moduledir, "META.json"))
55
+ if File.exist?(File.join(moduledir, "META.json"))
53
56
  metadata = JSON.parse(File.read(File.join(moduledir, ("META.json"))))
54
- elsif File.exists?(File.join(moduledir, ("META.yml")))
57
+ elsif File.exist?(File.join(moduledir, ("META.yml")))
55
58
  require "yaml"
56
59
  metadata = YAML.load_file(File.join(moduledir, ("META.yml")))
57
- elsif File.exists?(File.join(moduledir, "MYMETA.json"))
60
+ elsif File.exist?(File.join(moduledir, "MYMETA.json"))
58
61
  metadata = JSON.parse(File.read(File.join(moduledir, ("MYMETA.json"))))
59
- elsif File.exists?(File.join(moduledir, ("MYMETA.yml")))
62
+ elsif File.exist?(File.join(moduledir, ("MYMETA.yml")))
60
63
  require "yaml"
61
64
  metadata = YAML.load_file(File.join(moduledir, ("MYMETA.yml")))
62
65
  else
63
- raise FPM::InvalidPackageConfiguration,
66
+ raise FPM::InvalidPackageConfiguration,
64
67
  "Could not find package metadata. Checked for META.json and META.yml"
65
68
  end
66
69
  self.version = metadata["version"]
@@ -100,14 +103,23 @@ class FPM::Package::CPAN < FPM::Package
100
103
  # We'll install to a temporary directory.
101
104
  logger.info("Installing any build or configure dependencies")
102
105
 
103
- cpanm_flags = ["-L", build_path("cpan"), moduledir]
104
- cpanm_flags += ["-n"] if attributes[:cpan_test?]
106
+ if attributes[:cpan_sandbox_non_core?]
107
+ cpanm_flags = ["-L", build_path("cpan"), moduledir]
108
+ else
109
+ cpanm_flags = ["-l", build_path("cpan"), moduledir]
110
+ end
111
+
112
+ # This flag causes cpanm to ONLY download dependencies, skipping the target
113
+ # module itself. This is fine, because the target module has already been
114
+ # downloaded, and there's no need to download twice, test twice, etc.
115
+ cpanm_flags += ["--installdeps"]
116
+ cpanm_flags += ["-n"] if !attributes[:cpan_test?]
105
117
  cpanm_flags += ["--mirror", "#{attributes[:cpan_mirror]}"] if !attributes[:cpan_mirror].nil?
106
118
  cpanm_flags += ["--mirror-only"] if attributes[:cpan_mirror_only?] && !attributes[:cpan_mirror].nil?
107
119
 
108
120
  safesystem(attributes[:cpan_cpanm_bin], *cpanm_flags)
109
121
 
110
- if !attributes[:no_auto_depends?]
122
+ if !attributes[:no_auto_depends?]
111
123
  unless metadata["requires"].nil?
112
124
  metadata["requires"].each do |dep_name, version|
113
125
  # Special case for representing perl core as a version.
@@ -116,7 +128,7 @@ class FPM::Package::CPAN < FPM::Package
116
128
  next
117
129
  end
118
130
  dep = search(dep_name)
119
-
131
+
120
132
  if dep.include?("distribution")
121
133
  name = fix_name(dep["distribution"])
122
134
  else
@@ -156,7 +168,7 @@ class FPM::Package::CPAN < FPM::Package
156
168
 
157
169
  # Try Makefile.PL, Build.PL
158
170
  #
159
- if File.exists?("Build.PL")
171
+ if File.exist?("Build.PL")
160
172
  # Module::Build is in use here; different actions required.
161
173
  safesystem(attributes[:cpan_perl_bin],
162
174
  "-Mlocal::lib=#{build_path("cpan")}",
@@ -180,7 +192,7 @@ class FPM::Package::CPAN < FPM::Package
180
192
  # Empty install_base to avoid local::lib being used.
181
193
  "--install_base", "")
182
194
  end
183
- elsif File.exists?("Makefile.PL")
195
+ elsif File.exist?("Makefile.PL")
184
196
  if attributes[:cpan_perl_lib_path]
185
197
  perl_lib_path = attributes[:cpan_perl_lib_path]
186
198
  safesystem(attributes[:cpan_perl_bin],
@@ -206,7 +218,7 @@ class FPM::Package::CPAN < FPM::Package
206
218
 
207
219
 
208
220
  else
209
- raise FPM::InvalidPackageConfiguration,
221
+ raise FPM::InvalidPackageConfiguration,
210
222
  "I don't know how to build #{name}. No Makefile.PL nor " \
211
223
  "Build.PL found"
212
224
  end
@@ -231,10 +243,10 @@ class FPM::Package::CPAN < FPM::Package
231
243
  # Find any shared objects in the staging directory to set architecture as
232
244
  # native if found; otherwise keep the 'all' default.
233
245
  Find.find(staging_path) do |path|
234
- if path =~ /\.so$/
246
+ if path =~ /\.so$/
235
247
  logger.info("Found shared library, setting architecture=native",
236
248
  :path => path)
237
- self.architecture = "native"
249
+ self.architecture = "native"
238
250
  end
239
251
  end
240
252
  end
@@ -280,7 +292,7 @@ class FPM::Package::CPAN < FPM::Package
280
292
  release_metadata = JSON.parse(data)
281
293
  archive = release_metadata["archive"]
282
294
 
283
- # should probably be basepathed from the url
295
+ # should probably be basepathed from the url
284
296
  tarball = File.basename(archive)
285
297
 
286
298
  url_base = "http://www.cpan.org/"
@@ -289,7 +301,7 @@ class FPM::Package::CPAN < FPM::Package
289
301
  #url = "http://www.cpan.org/CPAN/authors/id/#{author[0,1]}/#{author[0,2]}/#{author}/#{tarball}"
290
302
  url = "#{url_base}/authors/id/#{author[0,1]}/#{author[0,2]}/#{author}/#{archive}"
291
303
  logger.debug("Fetching perl module", :url => url)
292
-
304
+
293
305
  begin
294
306
  response = httpfetch(url)
295
307
  rescue Net::HTTPServerException => e
@@ -336,7 +348,7 @@ class FPM::Package::CPAN < FPM::Package
336
348
  def httpfetch(url)
337
349
  uri = URI.parse(url)
338
350
  if ENV['http_proxy']
339
- proxy = URI.parse(ENV['http_proxy'])
351
+ proxy = URI.parse(ENV['http_proxy'])
340
352
  http = Net::HTTP.Proxy(proxy.host,proxy.port,proxy.user,proxy.password).new(uri.host, uri.port)
341
353
  else
342
354
  http = Net::HTTP.new(uri.host, uri.port)