fpm 1.6.2 → 1.6.3

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: 667a4cf02480d4f1e0765b61a7e10d738f97979d
4
- data.tar.gz: 2876ef0ca281d507aa190f4bb51a8f36d6da2da6
3
+ metadata.gz: 3ed6597fd964dd4f0e04832217258a80134af1e0
4
+ data.tar.gz: da1d4aab01fd06e27e71d8d225f99d23ef7f7204
5
5
  SHA512:
6
- metadata.gz: 9d55a2990a70e521030c5832a5bc609e83f433914e0a6bda63924cf97e0b826b4950190a58c27733559f0e06f4fc5aeb0187c3fc3ef6e5f61ec0465589320769
7
- data.tar.gz: 54c20001e7840427fe4d819636131d727ef6f7c5ad729e59670893851355cb1f6313d6e398fb3321915cd90f589658e65e39111890d3e2df4b88926eb7623436
6
+ metadata.gz: 1722137bd9f0359ca24a390d9be83a1115f9514dbbfef2dae19b14f4f88f673d31241131fa5d998225c6d4b0dea6f1e5ca075b19b5cbc64fbaa3ddbc9b39d4ba
7
+ data.tar.gz: 9ebd3febbf7c703ff55c91f33bb89adc9074bb8f05c8f2595b552b10497bd1f63289d409bbe3e8aa8f4f53115830d57887d01f1075e486f5696246bad9ea46f0
data/CHANGELIST CHANGED
@@ -1,7 +1,10 @@
1
+ 1.6.3 (September 15, 2016)
2
+ - Fix bug in fpm's release that accidentally included a few `.pyc` files (#1191)
3
+
1
4
  1.6.2 (July 1, 2016)
2
5
  - Reduce `json` dependency version to avoid requiring Ruby 2.0 (#1146, #1147;
3
6
  patch by Matt Hoffman)
4
- - pacman: skip automatic dependnecies if --no-auto-depends is given (Leo P)
7
+ - pacman: skip automatic dependencies if --no-auto-depends is given (Leo P)
5
8
  - rpm: Fix bug where --rpm-tag was accidentally ignored (#1134, Michal Mach)
6
9
  - deb: Omit certain fields from control file if (Breaks, Depends, Recommends,
7
10
  etc) if there are no values to put in that field. (#1113, TomyLobo)
data/lib/fpm.rb CHANGED
@@ -17,3 +17,4 @@ require "fpm/package/solaris"
17
17
  require "fpm/package/p5p"
18
18
  require "fpm/package/pkgin"
19
19
  require "fpm/package/freebsd"
20
+ require "fpm/package/apk"
@@ -45,13 +45,13 @@ class FPM::Command < Clamp::Command
45
45
  return lines.join("\n")
46
46
  end # def help
47
47
 
48
- option "-t", "OUTPUT_TYPE",
48
+ option ["-t", "--output-type"], "OUTPUT_TYPE",
49
49
  "the type of package you want to create (deb, rpm, solaris, etc)",
50
50
  :attribute_name => :output_type
51
- option "-s", "INPUT_TYPE",
51
+ option ["-s", "--input-type"], "INPUT_TYPE",
52
52
  "the package type to use as input (gem, rpm, python, etc)",
53
53
  :attribute_name => :input_type
54
- option "-C", "CHDIR",
54
+ option ["-C", "--chdir"], "CHDIR",
55
55
  "Change directory to here before searching for files",
56
56
  :attribute_name => :chdir
57
57
  option "--prefix", "PREFIX",
@@ -256,12 +256,6 @@ class FPM::Command < Clamp::Command
256
256
 
257
257
  # Execute this command. See Clamp::Command#execute and Clamp's documentation
258
258
  def execute
259
- # Short-circuit if someone simply runs `fpm --version`
260
- if ARGV == [ "--version" ]
261
- puts FPM::VERSION
262
- return 0
263
- end
264
-
265
259
  logger.level = :warn
266
260
  logger.level = :info if verbose? # --verbose
267
261
  logger.level = :debug if debug? # --debug
@@ -269,7 +263,6 @@ class FPM::Command < Clamp::Command
269
263
  logger.level = log_level.to_sym
270
264
  end
271
265
 
272
-
273
266
  if (stray_flags = args.grep(/^-/); stray_flags.any?)
274
267
  logger.warn("All flags should be before the first argument " \
275
268
  "(stray flags found: #{stray_flags}")
@@ -514,9 +507,16 @@ class FPM::Command < Clamp::Command
514
507
  end
515
508
  end # def execute
516
509
 
517
- def run(*run_args)
510
+ def run(run_args)
518
511
  logger.subscribe(STDOUT)
519
512
 
513
+ # Short circuit for a `fpm --version` or `fpm -v` short invocation that
514
+ # is the user asking us for the version of fpm.
515
+ if run_args == [ "-v" ] || run_args == [ "--version" ]
516
+ puts FPM::VERSION
517
+ return 0
518
+ end
519
+
520
520
  # fpm initialization files, note the order of the following array is
521
521
  # important, try .fpm in users home directory first and then the current
522
522
  # directory
@@ -557,7 +557,7 @@ class FPM::Command < Clamp::Command
557
557
 
558
558
  ARGV.unshift(*flags)
559
559
  ARGV.push(*args)
560
- super(*run_args)
560
+ super(run_args)
561
561
  rescue FPM::Package::InvalidArgument => e
562
562
  logger.error("Invalid package argument: #{e}")
563
563
  return 1
@@ -8,6 +8,7 @@ require "socket" # stdlib, for Socket.gethostname
8
8
  require "shellwords" # stdlib, for Shellwords.escape
9
9
  require "erb" # stdlib, for template processing
10
10
  require "cabin" # gem "cabin"
11
+ require "stud/temporary"
11
12
 
12
13
  # This class is the parent of all packages.
13
14
  # If you want to implement an FPM package type, you'll inherit from this.
@@ -249,7 +250,7 @@ class FPM::Package
249
250
  end # def output
250
251
 
251
252
  def staging_path(path=nil)
252
- @staging_path ||= ::Dir.mktmpdir("package-#{type}-staging") #, ::Dir.pwd)
253
+ @staging_path ||= Stud::Temporary.directory("package-#{type}-staging")
253
254
 
254
255
  if path.nil?
255
256
  return @staging_path
@@ -259,7 +260,7 @@ class FPM::Package
259
260
  end # def staging_path
260
261
 
261
262
  def build_path(path=nil)
262
- @build_path ||= ::Dir.mktmpdir("package-#{type}-build") #, ::Dir.pwd)
263
+ @build_path ||= Stud::Temporary.directory("package-#{type}-build")
263
264
 
264
265
  if path.nil?
265
266
  return @build_path
@@ -3,6 +3,7 @@ require "fpm/package"
3
3
  require "fpm/util"
4
4
  require "fileutils"
5
5
  require "find"
6
+ require "pathname"
6
7
 
7
8
  class FPM::Package::CPAN < FPM::Package
8
9
  # Flags '--foo' will be accessable as attributes[:npm_foo]
@@ -133,8 +134,19 @@ class FPM::Package::CPAN < FPM::Package
133
134
  safesystem(attributes[:cpan_cpanm_bin], *cpanm_flags)
134
135
 
135
136
  if !attributes[:no_auto_depends?]
136
- unless metadata["requires"].nil?
137
- metadata["requires"].each do |dep_name, version|
137
+ found_dependencies = {}
138
+ if metadata["requires"]
139
+ found_dependencies.merge!(metadata["requires"])
140
+ end
141
+ if metadata["prereqs"]
142
+ if metadata["prereqs"]["runtime"]
143
+ if metadata["prereqs"]["runtime"]["requires"]
144
+ found_dependencies.merge!(metadata["prereqs"]["runtime"]["requires"])
145
+ end
146
+ end
147
+ end
148
+ unless found_dependencies.empty?
149
+ found_dependencies.each do |dep_name, version|
138
150
  # Special case for representing perl core as a version.
139
151
  if dep_name == "perl"
140
152
  self.dependencies << "#{dep_name} >= #{version}"
@@ -246,6 +258,21 @@ class FPM::Package::CPAN < FPM::Package
246
258
  :path => path.gsub(staging_path, ""))
247
259
  File.unlink(path)
248
260
  end
261
+
262
+ # Remove useless .packlist files and their empty parent folders
263
+ # https://github.com/jordansissel/fpm/issues/1179
264
+ ::Dir.glob(File.join(staging_path, glob_prefix, "**/.packlist")).each do |path|
265
+ logger.debug("Removing useless file.",
266
+ :path => path.gsub(staging_path, ""))
267
+ File.unlink(path)
268
+ Pathname.new(path).parent.ascend do |parent|
269
+ if ::Dir.entries(parent).sort == ['.', '..'].sort
270
+ FileUtils.rmdir parent
271
+ else
272
+ break
273
+ end
274
+ end
275
+ end
249
276
  end
250
277
 
251
278
 
@@ -30,6 +30,9 @@ class FPM::Package::Gem < FPM::Package
30
30
  option "--gem", "PATH_TO_GEM",
31
31
  "The path to the 'gem' tool (defaults to 'gem' and searches " \
32
32
  "your $PATH)", :default => "gem"
33
+ option "--shebang", "SHEBANG",
34
+ "Replace the shebang in the executables in the bin path with a " \
35
+ "custom string", :default => nil
33
36
  option "--fix-name", :flag, "Should the target package name be prefixed?",
34
37
  :default => true
35
38
  option "--fix-dependencies", :flag, "Should the package dependencies be " \
@@ -196,6 +199,22 @@ class FPM::Package::Gem < FPM::Package
196
199
  args << gem_path
197
200
  safesystem(*args)
198
201
 
202
+ # Replace the shebangs in the executables
203
+ if attributes[:gem_shebang]
204
+ ::Dir.entries(bin_path).each do |file_name|
205
+ # exclude . and ..
206
+ next if ['.', '..'].include?(file_name)
207
+ # exclude everything which is not a file
208
+ file_path = File.join(bin_path, file_name)
209
+ next unless File.ftype(file_path) == 'file'
210
+ # replace shebang in files if there is one
211
+ file = File.read(file_path)
212
+ if file.gsub!(/\A#!.*$/, "#!#{attributes[:gem_shebang]}")
213
+ File.open(file_path, 'w'){|f| f << file}
214
+ end
215
+ end
216
+ end
217
+
199
218
  # Delete bin_path if it's empty, and any empty parents (#612)
200
219
  # Above, we mkdir_p bin_path because rubygems aborts if the parent
201
220
  # directory doesn't exist, for example:
@@ -58,7 +58,7 @@ class FPM::Package::Pacman < FPM::Package
58
58
  end # def config_files
59
59
 
60
60
  def dependencies
61
- bogus_regex = /[^\sA-Za-z0-9><=-]/
61
+ bogus_regex = /[^\sA-Za-z0-9><=+._@-]/
62
62
  # Actually modifies depencies if they are not right
63
63
  bogus_dependencies = @dependencies.grep bogus_regex
64
64
  if bogus_dependencies.any?
@@ -537,7 +537,7 @@ class FPM::Package::RPM < FPM::Package
537
537
 
538
538
  def summary
539
539
  if !attributes[:rpm_summary]
540
- return @description.split("\n").first || "_"
540
+ return @description.split("\n").find { |line| !line.strip.empty? } || "_"
541
541
  end
542
542
 
543
543
  return attributes[:rpm_summary]
@@ -1,3 +1,3 @@
1
1
  module FPM
2
- VERSION = "1.6.2"
2
+ VERSION = "1.6.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Sissel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-30 00:00:00.000000000 Z
11
+ date: 2016-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -260,9 +260,7 @@ files:
260
260
  - lib/fpm/package/pleaserun.rb
261
261
  - lib/fpm/package/puppet.rb
262
262
  - lib/fpm/package/pyfpm/__init__.py
263
- - lib/fpm/package/pyfpm/__init__.pyc
264
263
  - lib/fpm/package/pyfpm/get_metadata.py
265
- - lib/fpm/package/pyfpm/get_metadata.pyc
266
264
  - lib/fpm/package/python.rb
267
265
  - lib/fpm/package/rpm.rb
268
266
  - lib/fpm/package/sh.rb
@@ -322,3 +320,4 @@ signing_key:
322
320
  specification_version: 4
323
321
  summary: fpm - package building and mangling
324
322
  test_files: []
323
+ has_rdoc: