fpm 0.4.41 → 0.4.42

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELIST CHANGED
@@ -1,3 +1,7 @@
1
+ 0.4.42 (July 23, 2013)
2
+ - dir: make source=destination mappings behave the same way 'rsync -a' does
3
+ with respect to source and destination paths.
4
+
1
5
  0.4.41 (July 17, 2013)
2
6
  - cpan: handle cases where modules don't specify a license
3
7
  - deb: support multiple init scripts (#487, patch by Kristian Glass)
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (This is an MIT-style license)
2
2
 
3
- Copyright (c) 2011 Jordan Sissel and contributors.
3
+ Copyright (c) 2011,2012,2013 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
@@ -365,14 +365,14 @@ class FPM::Package
365
365
  installdir = staging_path
366
366
  end
367
367
 
368
- Find.find(staging_path) do |path|
369
- match_path = path.sub("#{staging_path}/", '')
368
+ Find.find(installdir) do |path|
369
+ match_path = path.sub("#{installdir}/", '')
370
370
 
371
371
  attributes[:excludes].each do |wildcard|
372
- @logger.debug("Checking path against wildcard", :path => path, :wildcard => wildcard)
372
+ @logger.debug("Checking path against wildcard", :path => match_path, :wildcard => wildcard)
373
373
 
374
374
  if File.fnmatch(wildcard, match_path)
375
- @logger.info("Removing excluded path", :path => path, :matches => wildcard)
375
+ @logger.info("Removing excluded path", :path => match_path, :matches => wildcard)
376
376
  FileUtils.remove_entry_secure(path)
377
377
  Find.prune
378
378
  break
@@ -436,7 +436,7 @@ class FPM::Package
436
436
  def default_attributes(&block)
437
437
  return if @options.nil?
438
438
  @options.each do |flag, param, help, options, block|
439
- attr = flag.first.gsub(/^-+/, "").gsub(/-/, "_")
439
+ attr = flag.first.gsub(/^-+/, "").gsub(/-/, "_").gsub("[no_]", "")
440
440
  attr += "?" if param == :flag
441
441
  yield attr.to_sym, options[:default]
442
442
  end
@@ -218,7 +218,8 @@ class FPM::Package::CPAN < FPM::Package
218
218
  version = metadata["version"] if version.nil?
219
219
 
220
220
  tarball = "#{distribution}-#{version}.tar.gz"
221
- url = "http://www.cpan.org/CPAN/authors/id/#{author[0,1]}/#{author[0,2]}/#{author}/#{tarball}"
221
+ #url = "http://www.cpan.org/CPAN/authors/id/#{author[0,1]}/#{author[0,2]}/#{author}/#{tarball}"
222
+ url = "http://www.cpan.org/authors/id/#{author[0,1]}/#{author[0,2]}/#{author}/#{tarball}"
222
223
  @logger.debug("Fetching perl module", :url => url)
223
224
 
224
225
  begin
@@ -242,10 +243,10 @@ class FPM::Package::CPAN < FPM::Package
242
243
  metacpan_url = "http://api.metacpan.org/v0/module/" + package
243
244
  begin
244
245
  response = httpfetch(metacpan_url)
245
- rescue Net::HTTPServerException
246
+ rescue Net::HTTPServerException => e
246
247
  #@logger.error("metacpan query failed.", :error => response.status_line,
247
248
  #:module => package, :url => metacpan_url)
248
- @logger.error("metacpan query failed.", :error => response.message,
249
+ @logger.error("metacpan query failed.", :error => e.message,
249
250
  :module => package, :url => metacpan_url)
250
251
  raise FPM::InvalidPackageConfiguration, "metacpan query failed"
251
252
  end
@@ -39,15 +39,13 @@ class FPM::Package::Dir < FPM::Package
39
39
  chdir = attributes[:chdir] || "."
40
40
 
41
41
  # Support mapping source=dest
42
+ # This mapping should work the same way 'rsync -a' does
43
+ # Meaning 'rsync -a source dest'
44
+ # and 'source=dest' in fpm work the same as the above rsync
42
45
  if path =~ /.=./
43
46
  origin, destination = path.split("=", 2)
44
47
 
45
- # file -> directory
46
- # ./some/file=/usr/local should result in /usr/local/file
47
- # directory -> directory
48
- # ./some=/usr/local should result in /usr/local/...
49
- # if ./some/file, then /usr/local/file
50
- if File.directory?(origin)
48
+ if File.directory?(origin) && origin[-1,1] == "/"
51
49
  chdir = origin
52
50
  source = "."
53
51
  else
@@ -65,7 +63,6 @@ class FPM::Package::Dir < FPM::Package
65
63
  destination = File.join(staging_path, destination)
66
64
 
67
65
  @logger["method"] = "input"
68
- @logger.debug("Copying", :input => source, :output => destination)
69
66
  ::Dir.chdir(chdir) do
70
67
  clone(source, destination)
71
68
  end
@@ -107,11 +104,20 @@ class FPM::Package::Dir < FPM::Package
107
104
  # The above will copy, recursively, /tmp/hello/world into
108
105
  # /tmp/example/hello/world
109
106
  def clone(source, destination)
110
- # Copy all files from 'path' into staging_path
111
- #p :clone => { source => destination }
112
- Find.find(source) do |path|
113
- target = File.join(destination, path)
114
- copy(path, target)
107
+ @logger.debug("Cloning path", :source => source, :destination => destination)
108
+ # For single file copies, permit file destinations
109
+ if File.file?(source) && !File.directory?(destination)
110
+ if destination[-1,1] == "/"
111
+ copy(source, File.join(destination, source))
112
+ else
113
+ copy(source, destination)
114
+ end
115
+ else
116
+ # Copy all files from 'path' into staging_path
117
+ Find.find(source) do |path|
118
+ target = File.join(destination, path)
119
+ copy(path, target)
120
+ end
115
121
  end
116
122
  end # def clone
117
123
 
@@ -120,6 +126,7 @@ class FPM::Package::Dir < FPM::Package
120
126
  # Files will be hardlinked if possible, but copied otherwise.
121
127
  # Symlinks should be copied as symlinks.
122
128
  def copy(source, destination)
129
+ @logger.debug("Copying path", :source => source, :destination => destination)
123
130
  directory = File.dirname(destination)
124
131
  if !File.directory?(directory)
125
132
  FileUtils.mkdir_p(directory)
@@ -149,6 +156,9 @@ class FPM::Package::Dir < FPM::Package
149
156
  # Hardlink attempt failed, copy it instead
150
157
  @logger.debug("Copying", :source => source, :destination => destination)
151
158
  FileUtils.copy_entry(source, destination)
159
+ rescue Errno::EEXIST
160
+ sane_path = destination.gsub(staging_path, "")
161
+ @logger.error("Cannot copy file, the destination path is probably a directory and I attempted to write a file.", :path => sane_path, :staging => staging_path)
152
162
  end
153
163
  end
154
164
 
@@ -1,3 +1,3 @@
1
1
  module FPM
2
- VERSION = "0.4.41"
2
+ VERSION = "0.4.42"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.41
4
+ version: 0.4.42
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-17 00:00:00.000000000 Z
12
+ date: 2013-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -249,7 +249,8 @@ files:
249
249
  - CONTRIBUTORS
250
250
  - CHANGELIST
251
251
  homepage: https://github.com/jordansissel/fpm
252
- licenses: []
252
+ licenses:
253
+ - MIT-like
253
254
  post_install_message:
254
255
  rdoc_options: []
255
256
  require_paths: