fpm 0.4.42 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MWE4OWM3Y2MxMzdkOGY3ZWE0MmFkYWRmNGExNTQ1OThkNThjYjlmOA==
5
+ data.tar.gz: !binary |-
6
+ YTEwZWJjNGQ1MDA0M2E0YzEyZDJiMzVhMTdmYWU0MTZmOGNkMTdhNg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NzdlOTZlNTA5NDhhYzIzMjJlMzQ5NzE1ZmE5M2RhNzk3MTUwNjVjMjZmNWJh
10
+ OWEwYjNhYjA2OTcxNmNkOGY2ZGFkYWQ4NzkxZThlZDRkYzhiNDE2ZmJkMWNk
11
+ YTE3OGEzN2MxOGNlOTAyOWI4MjZhNjllNDJlNzM4MDc2YjMxMzc=
12
+ data.tar.gz: !binary |-
13
+ YTI2OWMyNjE3N2U1NzlkNTdhNTg1OTU3Njc2ZDJlZWVkYWI1MTc0OGFlN2U5
14
+ OWEzYmMxNjQ4N2VlZDhmMzk1MzBlZTRjOWY0OGNiMmIwMWNmM2EzNTgxMjEz
15
+ YzQ4NmY1ZDFlOWQ3MGVkYzY3MjdkNThmNmYzN2U3ODdlMGU4ZGM=
data/CHANGELIST CHANGED
@@ -1,3 +1,57 @@
1
+ 1.0.0 (December 5, 2013)
2
+ - Config file of flags is now supported. Searches for $HOME/.fpm and
3
+ $PWD/.fpm. If both exist, $HOME is loaded first so $PWD can override.
4
+ (Pranay Kanwar)
5
+ - pkgin: Basic support for SmartOS/pkgsrc's pkgin format. (#567, Brian Akins)
6
+ - cpan: catch more cases of perllocal.pod and delete them
7
+ (#510, Jordan Sissel)
8
+ - cpan: Correctly support module version selection (#518, Matt Sharpe)
9
+ - cpan: include builddeps in PERL5LIB when running cpan tests
10
+ (#500, Matt Sharpe)
11
+ - cpan: Avoid old system perl modules when doing module builds
12
+ (#442, #513; Matt Sharpe)
13
+ - python: safer gathering of python module dependencies.
14
+ - python: better handling of unicode strings in python package metadata
15
+ (#575, Bruno Renié)
16
+ - cpan: Support 'http_proxy' env var. (#491, Patrick Cable)
17
+ - deb: --deb-user and --deb-group both default to 'root' now
18
+ (#504, Pranay Kanwar)
19
+ - deb: convert '>' to '>>' in deb version constraints
20
+ (#503, #439, Pranay Kanwar)
21
+ - deb: Warn if epoch is set. Just so you know what's going on, since
22
+ the default filename doesn't include the epoch. (#502, Pranay Kanwar)
23
+ - deb,rpm: --config-files is now recursive if you give it a directory.
24
+ This seems to be the most expected behavior by users.
25
+ (#171, #506; Pranay Kanwar)
26
+ - dir: Respect -C when using path mapping (#498, #507; Pranay Kanwar)
27
+ - rpm: Add --rpm-ignore-iteration-in-dependencies to let you to depend
28
+ on any release (aka iteration) of the same version of a package.
29
+ (#364, #508; Pranay Kanwar)
30
+ - dir: Handle copying of special files when possible
31
+ (#347, #511, #539, #561; Pranay Kanwar)
32
+ - rpm: Don't mistake symlinks as actual directories (#521, Nathan Huff)
33
+ - npm: Choose an alternate npm registry with --npm-registry (#445, #524;
34
+ Matt Sharpe)
35
+ - cpan: Choose an alternate cpan server with --cpan-mirror. Additionally, you
36
+ can use --cpan-mirror-only to only use this mirror for metadata queries.
37
+ (#524, Matt Sharpe)
38
+ - deb: Fix broken --deb-changelog flag (#543, #544; Tray Torrance)
39
+ - deb: When --deb-upstart is given, automatically create an upstart-sysv
40
+ symlink /etc/init.d/<name> to /lib/init/upstart-job (#545, Igor Galić)
41
+ - rpm: Fix bug when generating spec file listings on files with strange
42
+ characters in the names. (#547, Chris Chandler)
43
+ - dir: Fix bug where the new directory mapping feature would cause you not
44
+ to be able to select files with '=' in the name for packaging.
45
+ (#556, #554; Pranay Kanwar)
46
+ - python: Fix some unicode string issues in package metadata
47
+ (#575, Bruno Renié)
48
+ - gem-rpm: Now respects the --gem-package-name-prefix when generating the
49
+ 'rubygem(name)' provides statement (#585, Stepan Stipl)
50
+ - deb: Downcase and replace underscores with dashes in 'provides' list.
51
+ (#591, Eric Connell)
52
+ - deb: Fix a lintian complaint about md5sums permissions (#593, Sam Crang)
53
+ - cpan: Modules with 'MYMETA' files are now supported (#573, Michael Donlon)
54
+
1
55
  0.4.42 (July 23, 2013)
2
56
  - dir: make source=destination mappings behave the same way 'rsync -a' does
3
57
  with respect to source and destination paths.
data/lib/fpm.rb CHANGED
@@ -14,3 +14,4 @@ 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/pkgin"
@@ -52,7 +52,7 @@ class FPM::Command < Clamp::Command
52
52
  :attribute_name => :chdir
53
53
  option "--prefix", "PREFIX",
54
54
  "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 will" \
55
+ "be necessary for all input packages. For example, the 'gem' type will " \
56
56
  "prefix with your gem directory automatically."
57
57
  option ["-p", "--package"], "OUTPUT", "The package file path to output."
58
58
  option ["-f", "--force"], :flag, "Force output even if it will overwrite an " \
@@ -103,7 +103,7 @@ class FPM::Command < Clamp::Command
103
103
  " in debs and %config in rpm. If you have multiple files to mark as " \
104
104
  "configuration files, specify this flag multiple times.",
105
105
  :multivalued => true, :attribute_name => :config_files
106
- option "--directories", "DIRECTORIES", "Mark a directory as being owned " \
106
+ option "--directories", "DIRECTORIES", "Recursively mark a directory as being owned " \
107
107
  "by the package", :multivalued => true, :attribute_name => :directories
108
108
  option ["-a", "--architecture"], "ARCHITECTURE",
109
109
  "The architecture name. Usually matches 'uname -m'. For automatic values," \
@@ -217,8 +217,6 @@ class FPM::Command < Clamp::Command
217
217
 
218
218
  # Execute this command. See Clamp::Command#execute and Clamp's documentation
219
219
  def execute
220
- @logger = Cabin::Channel.get
221
- @logger.subscribe(STDOUT)
222
220
  @logger.level = :warn
223
221
 
224
222
  if (stray_flags = args.grep(/^-/); stray_flags.any?)
@@ -415,6 +413,29 @@ class FPM::Command < Clamp::Command
415
413
  output.cleanup unless output.nil?
416
414
  end # def execute
417
415
 
416
+ def run(*args)
417
+ @logger = Cabin::Channel.get
418
+ @logger.subscribe(STDOUT)
419
+
420
+ # fpm initialization files, note the order of the following array is
421
+ # important, try .fpm in users home directory first and then the current
422
+ # directory
423
+ rc_files = [File.join(ENV['HOME'],'.fpm'), '.fpm']
424
+
425
+ rc_files.each do |rc_file|
426
+ if File.readable? rc_file
427
+ @logger.warn("Loading flags from rc file #{rc_file}")
428
+ File.readlines(rc_file).each do |line|
429
+ Shellwords.shellsplit(line).each do |e|
430
+ ARGV << e
431
+ end
432
+ end
433
+ end
434
+ end
435
+
436
+ super(*args)
437
+ end # def run
438
+
418
439
  # A simple flag validator
419
440
  #
420
441
  # The goal of this class is to ensure the flags and arguments given
@@ -195,7 +195,7 @@ class FPM::Package
195
195
 
196
196
  # copy other bits
197
197
  ivars = [
198
- :@architecture, :@attributes, :@category, :@config_files, :@conflicts,
198
+ :@architecture, :@category, :@config_files, :@conflicts,
199
199
  :@dependencies, :@description, :@epoch, :@iteration, :@license, :@maintainer,
200
200
  :@name, :@provides, :@replaces, :@scripts, :@url, :@vendor, :@version,
201
201
  :@directories, :@staging_path
@@ -206,6 +206,11 @@ class FPM::Package
206
206
  pkg.instance_variable_set(ivar, instance_variable_get(ivar))
207
207
  end
208
208
 
209
+ # Attributes are special! We do not want to remove the default values of
210
+ # the destination package type unless their value is specified on the
211
+ # source package object.
212
+ pkg.attributes.merge!(self.attributes)
213
+
209
214
  pkg.converted_from(self.class)
210
215
  return pkg
211
216
  end # def convert
@@ -366,7 +371,7 @@ class FPM::Package
366
371
  end
367
372
 
368
373
  Find.find(installdir) do |path|
369
- match_path = path.sub("#{installdir}/", '')
374
+ match_path = path.sub("#{installdir.chomp('/')}/", '')
370
375
 
371
376
  attributes[:excludes].each do |wildcard|
372
377
  @logger.debug("Checking path against wildcard", :path => match_path, :wildcard => wildcard)
@@ -8,12 +8,24 @@ class FPM::Package::CPAN < FPM::Package
8
8
  # Flags '--foo' will be accessable as attributes[:npm_foo]
9
9
  option "--perl-bin", "PERL_EXECUTABLE",
10
10
  "The path to the perl executable you wish to run.", :default => "perl"
11
+
11
12
  option "--cpanm-bin", "CPANM_EXECUTABLE",
12
13
  "The path to the cpanm executable you wish to run.", :default => "cpanm"
13
- option "--package-name-prefix", "NAME_PREFIX", "Name to prefix the package " \
14
- "name with.", :default => "perl"
15
- option "--test", :flag, "Run the tests before packaging?", :default => true
16
- option "--perl-lib-path", "PERL_LIB_PATH", "Path of target Perl Libraries"
14
+
15
+ option "--mirror", "CPAN_MIRROR",
16
+ "The CPAN mirror to use instead of the default."
17
+
18
+ option "--mirror-only", :flag,
19
+ "Only use the specified mirror for metadata.", :default => false
20
+
21
+ option "--package-name-prefix", "NAME_PREFIX",
22
+ "Name to prefix the package name with.", :default => "perl"
23
+
24
+ option "--test", :flag,
25
+ "Run the tests before packaging?", :default => true
26
+
27
+ option "--perl-lib-path", "PERL_LIB_PATH",
28
+ "Path of target Perl Libraries"
17
29
 
18
30
  private
19
31
  def input(package)
@@ -28,9 +40,13 @@ class FPM::Package::CPAN < FPM::Package
28
40
  require "net/http"
29
41
  require "json"
30
42
 
31
- result = search(package)
32
- tarball = download(result)
33
- moduledir = unpack(tarball)
43
+ if (attributes[:cpan_local_module?])
44
+ moduledir = package
45
+ else
46
+ result = search(package)
47
+ tarball = download(result, version)
48
+ moduledir = unpack(tarball)
49
+ end
34
50
 
35
51
  # Read package metadata (name, version, etc)
36
52
  if File.exists?(File.join(moduledir, "META.json"))
@@ -38,6 +54,11 @@ class FPM::Package::CPAN < FPM::Package
38
54
  elsif File.exists?(File.join(moduledir, ("META.yml")))
39
55
  require "yaml"
40
56
  metadata = YAML.load_file(File.join(moduledir, ("META.yml")))
57
+ elsif File.exists?(File.join(moduledir, "MYMETA.json"))
58
+ metadata = JSON.parse(File.read(File.join(moduledir, ("MYMETA.json"))))
59
+ elsif File.exists?(File.join(moduledir, ("MYMETA.yml")))
60
+ require "yaml"
61
+ metadata = YAML.load_file(File.join(moduledir, ("MYMETA.yml")))
41
62
  else
42
63
  raise FPM::InvalidPackageConfiguration,
43
64
  "Could not find package metadata. Checked for META.json and META.yml"
@@ -73,14 +94,15 @@ class FPM::Package::CPAN < FPM::Package
73
94
  # We'll install to a temporary directory.
74
95
  @logger.info("Installing any build or configure dependencies")
75
96
 
76
- if attributes[:cpan_test?]
77
- safesystem(attributes[:cpan_cpanm_bin], "-L", build_path("cpan"), moduledir)
78
- else
79
- safesystem(attributes[:cpan_cpanm_bin], "-nL", build_path("cpan"), moduledir)
80
- end
97
+ cpanm_flags = ["-L", build_path("cpan"), moduledir]
98
+ cpanm_flags += ["-n"] if attributes[:cpan_test?]
99
+ cpanm_flags += ["--mirror", "#{attributes[:cpan_mirror]}"] if !attributes[:cpan_mirror].nil?
100
+ cpanm_flags += ["--mirror-only"] if attributes[:cpan_mirror_only?] && !attributes[:cpan_mirror].nil?
101
+
102
+ safesystem(attributes[:cpan_cpanm_bin], *cpanm_flags)
81
103
 
82
104
  if !attributes[:no_auto_depends?]
83
- if metadata.include?("requires")
105
+ if metadata.include?("requires") && !metadata["requires"].nil?
84
106
  metadata["requires"].each do |dep_name, version|
85
107
  # Special case for representing perl core as a version.
86
108
  if dep_name == "perl"
@@ -143,7 +165,11 @@ class FPM::Package::CPAN < FPM::Package
143
165
  # Empty install_base to avoid local::lib being used.
144
166
  "INSTALL_BASE=")
145
167
  end
146
- make = [ "make" ]
168
+ if attributes[:cpan_test?]
169
+ make = [ "env", "PERL5LIB=#{build_path("cpan/lib/perl5")}", "make" ]
170
+ else
171
+ make = [ "make" ]
172
+ end
147
173
  safesystem(*make)
148
174
  safesystem(*(make + ["test"])) if attributes[:cpan_test?]
149
175
  safesystem(*(make + ["DESTDIR=#{staging_path}", "install"]))
@@ -152,10 +178,14 @@ class FPM::Package::CPAN < FPM::Package
152
178
  safesystem(attributes[:cpan_perl_bin],
153
179
  "-Mlocal::lib=#{build_path("cpan")}",
154
180
  "Build.PL")
155
- safesystem("./Build")
181
+ safesystem(attributes[:cpan_perl_bin],
182
+ "-Mlocal::lib=#{build_path("cpan")}",
183
+ "./Build")
156
184
 
157
185
  if attributes[:cpan_test?]
158
- safesystem("./Build", "test")
186
+ safesystem(attributes[:cpan_perl_bin],
187
+ "-Mlocal::lib=#{build_path("cpan")}",
188
+ "./Build", "test")
159
189
  end
160
190
  if attributes[:cpan_perl_lib_path]
161
191
  perl_lib_path = attributes[:cpan_perl_lib_path]
@@ -173,9 +203,11 @@ class FPM::Package::CPAN < FPM::Package
173
203
  "Build.PL found"
174
204
  end
175
205
 
176
- # Fix any files likely to cause conflicts.
206
+ # Fix any files likely to cause conflicts that are duplicated
207
+ # across packages.
177
208
  # https://github.com/jordansissel/fpm/issues/443
178
- ::Dir.glob(File.join(staging_path, prefix, "lib*/perl/*/perllocal.pod")).each do |path|
209
+ # https://github.com/jordansissel/fpm/issues/510
210
+ ::Dir.glob(File.join(staging_path, prefix, "**/perllocal.pod")).each do |path|
179
211
  @logger.debug("Removing useless file.",
180
212
  :path => path.gsub(staging_path, ""))
181
213
  File.unlink(path)
@@ -207,17 +239,25 @@ class FPM::Package::CPAN < FPM::Package
207
239
  return directory
208
240
  end
209
241
 
210
- def download(metadata)
242
+ def download(metadata, cpan_version=nil)
211
243
  distribution = metadata["distribution"]
212
244
  author = metadata["author"]
213
245
  @logger.info("Downloading perl module",
214
246
  :distribution => distribution,
215
- :version => version)
247
+ :version => cpan_version)
216
248
 
217
249
  # default to latest versionunless we specify one
218
- version = metadata["version"] if version.nil?
250
+ if cpan_version.nil?
251
+ self.version = metadata["version"]
252
+ else
253
+ if metadata["version"] =~ /^v\d/
254
+ self.version = "v#{cpan_version}"
255
+ else
256
+ self.version = cpan_version
257
+ end
258
+ end
219
259
 
220
- tarball = "#{distribution}-#{version}.tar.gz"
260
+ tarball = "#{distribution}-#{self.version}.tar.gz"
221
261
  #url = "http://www.cpan.org/CPAN/authors/id/#{author[0,1]}/#{author[0,2]}/#{author}/#{tarball}"
222
262
  url = "http://www.cpan.org/authors/id/#{author[0,1]}/#{author[0,2]}/#{author}/#{tarball}"
223
263
  @logger.debug("Fetching perl module", :url => url)
@@ -259,12 +299,20 @@ class FPM::Package::CPAN < FPM::Package
259
299
  end # def metadata
260
300
 
261
301
  def fix_name(name)
262
- return [attributes[:cpan_package_name_prefix], name].join("-").gsub("::", "-")
302
+ case name
303
+ when "perl"; return "perl"
304
+ else; return [attributes[:cpan_package_name_prefix], name].join("-").gsub("::", "-")
305
+ end
263
306
  end # def fix_name
264
307
 
265
308
  def httpfetch(url)
266
309
  uri = URI.parse(url)
267
- http = Net::HTTP.new(uri.host, uri.port)
310
+ if ENV['http_proxy']
311
+ proxy = URI.parse(ENV['http_proxy'])
312
+ http = Net::HTTP.Proxy(proxy.host,proxy.port,proxy.user,proxy.password).new(uri.host, uri.port)
313
+ else
314
+ http = Net::HTTP.new(uri.host, uri.port)
315
+ end
268
316
  response = http.request(Net::HTTP::Get.new(uri.request_uri))
269
317
  case response
270
318
  when Net::HTTPSuccess; return response
@@ -76,9 +76,9 @@ class FPM::Package::Deb < FPM::Package
76
76
  option "--priority", "PRIORITY",
77
77
  "The debian package 'priority' value.", :default => "extra"
78
78
 
79
- option "--user", "USER", "The owner of files in this package"
79
+ option "--user", "USER", "The owner of files in this package", :default => 'root'
80
80
 
81
- option "--group", "GROUP", "The group owner of files in this package"
81
+ option "--group", "GROUP", "The group owner of files in this package", :default => 'root'
82
82
 
83
83
  option "--changelog", "FILEPATH", "Add FILEPATH as debian changelog" do |file|
84
84
  File.expand_path(file)
@@ -225,7 +225,10 @@ class FPM::Package::Deb < FPM::Package
225
225
  self.name = parse.call("Package")
226
226
  self.url = parse.call("Homepage")
227
227
  self.vendor = parse.call("Vendor") || self.vendor
228
- self.provides = parse.call("Provides") || self.provides
228
+ with(parse.call("Provides")) do |provides_str|
229
+ next if provides_str.nil?
230
+ self.provides = provides_str.split(/\s*,\s*/)
231
+ end
229
232
 
230
233
  # The description field is a special flower, parse it that way.
231
234
  # The description is the first line as a normal Description field, but also continues
@@ -297,6 +300,7 @@ class FPM::Package::Deb < FPM::Package
297
300
  end # def extract_files
298
301
 
299
302
  def output(output_path)
303
+ self.provides = self.provides.collect { |p| fix_provides(p) }
300
304
  output_check(output_path)
301
305
  # Abort if the target path already exists.
302
306
 
@@ -340,8 +344,13 @@ class FPM::Package::Deb < FPM::Package
340
344
 
341
345
  tar_flags = []
342
346
  if !attributes[:deb_user].nil?
343
- tar_flags += [ "--owner", attributes[:deb_user] ]
347
+ if attributes[:deb_user] == 'root'
348
+ tar_flags += [ "--numeric-owner", "--owner", "0" ]
349
+ else
350
+ tar_flags += [ "--owner", attributes[:deb_user] ]
351
+ end
344
352
  end
353
+
345
354
  if !attributes[:deb_group].nil?
346
355
  if attributes[:deb_group] == 'root'
347
356
  tar_flags += [ "--numeric-owner", "--group", "0" ]
@@ -351,7 +360,7 @@ class FPM::Package::Deb < FPM::Package
351
360
  end
352
361
 
353
362
  if attributes[:deb_changelog]
354
- dest_changelog = File.join(staging_path, "usr/share/doc/#{attributes[:name]}/changelog.Debian")
363
+ dest_changelog = File.join(staging_path, "usr/share/doc/#{name}/changelog.Debian")
355
364
  FileUtils.mkdir_p(File.dirname(dest_changelog))
356
365
  FileUtils.cp attributes[:deb_changelog], dest_changelog
357
366
  File.chmod(0644, dest_changelog)
@@ -376,10 +385,15 @@ class FPM::Package::Deb < FPM::Package
376
385
 
377
386
  attributes.fetch(:deb_upstart_list, []).each do |upstart|
378
387
  name = File.basename(upstart, ".upstart")
379
- dest_upstart = File.join(staging_path, "etc/init/#{name}.conf")
388
+ dest_upstart = staging_path("etc/init/#{name}.conf")
380
389
  FileUtils.mkdir_p(File.dirname(dest_upstart))
381
- FileUtils.cp upstart, dest_upstart
390
+ FileUtils.cp(upstart, dest_upstart)
382
391
  File.chmod(0644, dest_upstart)
392
+
393
+ # Install an init.d shim that calls upstart
394
+ dest_init = staging_path("/etc/init.d/#{name}")
395
+ FileUtils.mkdir_p(File.dirname(dest_init))
396
+ FileUtils.ln_s("/lib/init/upstart-job", dest_init)
383
397
  end
384
398
 
385
399
  args = [ tar_cmd, "-C", staging_path, compression ] + tar_flags + [ "-cf", datatar, "." ]
@@ -399,6 +413,10 @@ class FPM::Package::Deb < FPM::Package
399
413
  self.dependencies = self.dependencies.collect do |dep|
400
414
  fix_dependency(dep)
401
415
  end.flatten
416
+ self.provides = self.provides.collect do |provides|
417
+ fix_provides(provides)
418
+ end.flatten
419
+
402
420
  end # def converted_from
403
421
 
404
422
  def debianize_op(op)
@@ -430,7 +448,7 @@ class FPM::Package::Deb < FPM::Package
430
448
  end
431
449
 
432
450
  if dep.include?("_")
433
- @logger.warn("Replacing underscores with dashes in '#{dep}' because " \
451
+ @logger.warn("Replacing dependency underscores with dashes in '#{dep}' because " \
434
452
  "debs don't like underscores")
435
453
  dep = dep.gsub("_", "-")
436
454
  end
@@ -458,12 +476,33 @@ class FPM::Package::Deb < FPM::Package
458
476
  nextversion[-1] += 1
459
477
  nextversion = nextversion.join(".")
460
478
  return ["#{name} (>= #{version})", "#{name} (<< #{nextversion})"]
479
+ elsif (m = dep.match(/(\S+)\s+\(> (.+)\)/))
480
+ # Convert 'foo (> x) to 'foo (>> x)'
481
+ name, version = m[1..2]
482
+ return ["#{name} (>> #{version})"]
461
483
  else
462
484
  # otherwise the dep is probably fine
463
485
  return dep.rstrip
464
486
  end
465
487
  end # def fix_dependency
466
488
 
489
+ def fix_provides(provides)
490
+ name_re = /^[^ \(]+/
491
+ name = provides[name_re]
492
+ if name =~ /[A-Z]/
493
+ @logger.warn("Downcasing provides '#{name}' because deb packages " \
494
+ " don't work so good with uppercase names")
495
+ provides = provides.gsub(name_re) { |n| n.downcase }
496
+ end
497
+
498
+ if provides.include?("_")
499
+ @logger.warn("Replacing 'provides' underscores with dashes in '#{provides}' because " \
500
+ "debs don't like underscores")
501
+ provides = provides.gsub("_", "-")
502
+ end
503
+ return provides.rstrip
504
+ end
505
+
467
506
  def control_path(path=nil)
468
507
  @control_path ||= build_path("control")
469
508
  FileUtils.mkdir(@control_path) if !File.directory?(@control_path)
@@ -499,6 +538,9 @@ class FPM::Package::Deb < FPM::Package
499
538
  end # def write_control_tarball
500
539
 
501
540
  def write_control
541
+ # warn user if epoch is set
542
+ @logger.warn("epoch in Version is set", :epoch => self.epoch) if self.epoch
543
+
502
544
  # calculate installed-size if necessary:
503
545
  if attributes[:deb_installed_size].nil?
504
546
  @logger.info("No deb_installed_size set, calculating now.")
@@ -549,10 +591,26 @@ class FPM::Package::Deb < FPM::Package
549
591
 
550
592
  def write_conffiles
551
593
  return unless config_files.any?
594
+
595
+ # scan all conf file paths for files and add them
596
+ allconfigs = []
597
+ config_files.each do |path|
598
+ cfg_path = File.expand_path(path, staging_path)
599
+ begin
600
+ Find.find(cfg_path) do |p|
601
+ allconfigs << p.gsub("#{staging_path}/", '') if File.file? p
602
+ end
603
+ rescue Errno::ENOENT => e
604
+ raise FPM::InvalidPackageConfiguration,
605
+ "Error trying to use '#{cfg_path}' as a config file in the package. Does it exist?"
606
+ end
607
+ end
608
+ allconfigs.sort!.uniq!
609
+
552
610
  File.open(control_path("conffiles"), "w") do |out|
553
611
  # 'config_files' comes from FPM::Package and is usually set with
554
612
  # FPM::Command's --config-files flag
555
- config_files.each { |cf| out.puts(cf) }
613
+ allconfigs.each { |cf| out.puts(cf) }
556
614
  end
557
615
  end # def write_conffiles
558
616
 
@@ -593,6 +651,7 @@ class FPM::Package::Deb < FPM::Package
593
651
  out.puts "#{md5} #{path}"
594
652
  end
595
653
  end
654
+ File.chmod(0644, control_path("md5sums"))
596
655
  end
597
656
  end # def write_md5sums
598
657