fpm 0.4.20 → 0.4.21

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELIST CHANGED
@@ -1,3 +1,11 @@
1
+ 0.4.21 (November 8, 2012)
2
+ - gem: remove restriction on expected gem names (#287)
3
+ - add --directory flag; lets you mark a directory as being owned by a
4
+ package. (#260, #245, patch by ajf8)
5
+ - deb: don't include a version in the Provides field (#280)
6
+ - gem: if the version is '1.1' make it imply '1.1.0' (#269, patch by
7
+ Radim Marek)
8
+
1
9
  0.4.20 (October 5, 2012)
2
10
  - python: only specify --install-{scripts,lib,data} flags to setup.py if
3
11
  they were given on the command line to fpm. Fixes #273.
@@ -89,6 +89,12 @@ class FPM::Command < Clamp::Command
89
89
  @config_files ||= []
90
90
  @config_files << val
91
91
  end # --config-files
92
+ option "--directories", "DIRECTORIES",
93
+ "Mark a directory as being owned by the package" \
94
+ do |val|
95
+ @directories ||= []
96
+ @directories << val
97
+ end # directories
92
98
  option ["-a", "--architecture"], "ARCHITECTURE",
93
99
  "The architecture name. Usually matches 'uname -m'. For automatic values," \
94
100
  " you can use '-a all' or '-a native'. These two strings will be " \
@@ -204,6 +210,7 @@ class FPM::Command < Clamp::Command
204
210
  @provides = []
205
211
  @dependencies = []
206
212
  @config_files = []
213
+ @directories = []
207
214
  @excludes = []
208
215
  end # def initialize
209
216
 
@@ -332,6 +339,7 @@ class FPM::Command < Clamp::Command
332
339
  input.provides += provides
333
340
  input.replaces += replaces
334
341
  input.config_files += config_files
342
+ input.directories += directories
335
343
 
336
344
  setscript = proc do |scriptname|
337
345
  # 'self.send(scriptname) == self.before_install == --before-install
@@ -390,6 +398,9 @@ class FPM::Command < Clamp::Command
390
398
  rescue FPM::InvalidPackageConfiguration => e
391
399
  @logger.error("Invalid package configuration: #{e}")
392
400
  return 1
401
+ rescue FPM::Package::InvalidArgument => e
402
+ @logger.error("Invalid package argument: #{e}")
403
+ return 1
393
404
  ensure
394
405
  input.cleanup unless input.nil?
395
406
  output.cleanup unless output.nil?
@@ -104,6 +104,8 @@ class FPM::Package
104
104
  # Array of configuration files
105
105
  attr_accessor :config_files
106
106
 
107
+ attr_accessor :directories
108
+
107
109
  # Any other attributes specific to this package.
108
110
  # This is where you'd put rpm, deb, or other specific attributes.
109
111
  attr_accessor :attributes
@@ -168,6 +170,7 @@ class FPM::Package
168
170
  @dependencies = []
169
171
  @scripts = {}
170
172
  @config_files = []
173
+ @directories = []
171
174
 
172
175
  staging_path
173
176
  build_path
@@ -194,7 +197,7 @@ class FPM::Package
194
197
  :@architecture, :@attributes, :@category, :@config_files, :@conflicts,
195
198
  :@dependencies, :@description, :@epoch, :@iteration, :@license, :@maintainer,
196
199
  :@name, :@provides, :@replaces, :@scripts, :@url, :@vendor, :@version,
197
- :@config_files, :@staging_path
200
+ :@directories, :@staging_path
198
201
  ]
199
202
  ivars.each do |ivar|
200
203
  #@logger.debug("Copying ivar", :ivar => ivar, :value => instance_variable_get(ivar),
@@ -502,9 +505,17 @@ class FPM::Package
502
505
  end
503
506
  end # def output_path
504
507
 
508
+ def provides=(value)
509
+ if !value.is_a?(Array)
510
+ @provides = [value]
511
+ else
512
+ @provides = value
513
+ end
514
+ end
515
+
505
516
  # General public API
506
517
  public(:type, :initialize, :convert, :input, :output, :to_s, :cleanup, :files,
507
- :version, :script)
518
+ :version, :script, :provides=)
508
519
 
509
520
  # Package internal public api
510
521
  public(:cleanup_staging, :cleanup_build, :staging_path, :converted_from,
@@ -170,6 +170,7 @@ class FPM::Package::Deb < FPM::Package
170
170
  self.name = parse.call("Package")
171
171
  self.url = parse.call("Homepage")
172
172
  self.vendor = parse.call("Vendor") || self.vendor
173
+ self.provides = parse.call("Provides") || self.provides
173
174
 
174
175
  # The description field is a special flower, parse it that way.
175
176
  # The description is the first line as a normal Description field, but also continues
@@ -286,14 +287,6 @@ class FPM::Package::Deb < FPM::Package
286
287
  @logger.log("Created deb package", :path => output_path)
287
288
  end # def output
288
289
 
289
- def default_output
290
- if iteration
291
- "#{name}_#{version}-#{iteration}_#{architecture}.#{type}"
292
- else
293
- "#{name}_#{version}_#{architecture}.#{type}"
294
- end
295
- end # def default_output
296
-
297
290
  def converted_from(origin)
298
291
  self.dependencies = self.dependencies.collect do |dep|
299
292
  fix_dependency(dep)
@@ -51,12 +51,7 @@ class FPM::Package::Gem < FPM::Package
51
51
  def download_if_necessary(gem, gem_version)
52
52
  path = gem
53
53
  if !File.exists?(path)
54
- looks_like_name_re = /^[A-Za-z0-9_-]+$/
55
- if path =~ looks_like_name_re
56
- path = download(gem, gem_version)
57
- else
58
- raise FPM::Package::InvalidArgument.new("Gem '#{gem}' doesn't appear to be a valid rubygem file or name?")
59
- end
54
+ path = download(gem, gem_version)
60
55
  end
61
56
 
62
57
  @logger.info("Using gem file", :path => path)
@@ -112,7 +107,13 @@ class FPM::Package::Gem < FPM::Package
112
107
 
113
108
  #self.name = [attributes[:gem_package_name_prefix], spec.name].join("-")
114
109
  self.license = (spec.license or "no license listed in #{File.basename(file)}")
115
- self.version = spec.version.to_s
110
+
111
+ # expand spec's version to match RationalVersioningPolicy to prevent cases
112
+ # where missing 'build' number prevents correct dependency resolution by target
113
+ # package manager. Ie. for dpkg 1.1 != 1.1.0
114
+ m = spec.version.to_s.match /^(\d)?.?(\d+)?.?(\d+)?/
115
+ self.version = m.captures.map {|m| m ? m : 0}.join('.')
116
+
116
117
  self.vendor = spec.author
117
118
  self.url = spec.homepage
118
119
  self.category = "Languages/Development/Ruby"
@@ -167,6 +167,7 @@ class FPM::Package::RPM < FPM::Package
167
167
  #input.replaces += replaces
168
168
 
169
169
  self.config_files += rpm.config_files
170
+ self.directories += rpm.directories
170
171
 
171
172
  # Extract to the staging directory
172
173
  rpm.extract(staging_path)
@@ -16,7 +16,9 @@ Conflicts: <%= conflicts.join(", ") %>
16
16
  #Pre-Depends: <%#= properpredeps.flatten.join(", ") %>
17
17
  <%# end -%>
18
18
  <% if !provides.empty? -%>
19
- Provides: <%= provides.join(", ") %>
19
+ <%# Turn each provides from 'foo = 123' to simply 'foo' because Debian :\ -%>
20
+ <%# http://www.debian.org/doc/debian-policy/ch-relationships.html %>
21
+ Provides: <%= provides.first.split(" ").first %>
20
22
  <% end -%>
21
23
  <% if !replaces.empty? -%>
22
24
  Replaces: <%= replaces.join(", ") %>
@@ -107,6 +107,9 @@ fi
107
107
  <% config_files.each do |path| -%>
108
108
  %config(noreplace) <%= File.join(prefix, path) %>
109
109
  <% end -%>
110
+ <% directories.each do |path| -%>
111
+ %dir <%= File.join(prefix, path) %>
112
+ <% end -%>
110
113
  <%# list only files, not directories? -%>
111
114
  <%=
112
115
  # Reject config files already listed or parent directories, then prefix files
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.20
4
+ version: 0.4.21
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: 2012-10-05 00:00:00.000000000 Z
12
+ date: 2012-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -152,28 +152,28 @@ files:
152
152
  - lib/fpm/command.rb
153
153
  - lib/fpm/namespace.rb
154
154
  - lib/fpm/package.rb
155
- - lib/fpm/errors.rb
156
- - lib/fpm/package/gem.rb
157
- - lib/fpm/package/dir.rb
158
- - lib/fpm/package/pyfpm/__init__.pyc
159
155
  - lib/fpm/package/pyfpm/get_metadata.pyc
160
156
  - lib/fpm/package/pyfpm/get_metadata.py
157
+ - lib/fpm/package/pyfpm/__init__.pyc
161
158
  - lib/fpm/package/pyfpm/__init__.py
162
- - lib/fpm/package/npm.rb
163
- - lib/fpm/package/pear.rb
159
+ - lib/fpm/package/tar.rb
164
160
  - lib/fpm/package/deb.rb
165
- - lib/fpm/package/python.rb
166
- - lib/fpm/package/rpm.rb
161
+ - lib/fpm/package/dir.rb
167
162
  - lib/fpm/package/puppet.rb
168
- - lib/fpm/package/tar.rb
163
+ - lib/fpm/package/gem.rb
164
+ - lib/fpm/package/python.rb
169
165
  - lib/fpm/package/solaris.rb
166
+ - lib/fpm/package/rpm.rb
167
+ - lib/fpm/package/npm.rb
168
+ - lib/fpm/package/pear.rb
169
+ - lib/fpm/errors.rb
170
170
  - lib/fpm/util.rb
171
171
  - lib/fpm.rb
172
172
  - bin/fpm-npm
173
173
  - bin/fpm
174
- - templates/deb.erb
175
- - templates/rpm.erb
176
174
  - templates/solaris.erb
175
+ - templates/rpm.erb
176
+ - templates/deb.erb
177
177
  - templates/puppet/package/remove.pp.erb
178
178
  - templates/puppet/package.pp.erb
179
179
  - LICENSE
@@ -205,4 +205,3 @@ signing_key:
205
205
  specification_version: 3
206
206
  summary: fpm - package building and mangling
207
207
  test_files: []
208
- has_rdoc: