fpm 0.4.36 → 0.4.37
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.
- data/CHANGELIST +8 -0
- data/lib/fpm/package/cpan.rb +42 -12
- data/lib/fpm/package/deb.rb +16 -3
- data/lib/fpm/package/npm.rb +1 -9
- data/lib/fpm/package/pear.rb +3 -10
- data/lib/fpm/util.rb +35 -0
- data/lib/fpm/version.rb +1 -1
- data/templates/deb.erb +3 -0
- metadata +6 -6
data/CHANGELIST
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
0.4.37 (May 30, 2013)
|
2
|
+
- deb: fix creation failures on OS X (#450, patch by Anthony Scalisi and
|
3
|
+
Matthew M. Boedicker)
|
4
|
+
- deb: you can now set --deb-build-depends. This is generally for extremely
|
5
|
+
rare use cases. (#451, patch by torrancew)
|
6
|
+
- perl: add --cpan-perl-lib-path for a custom perl library installation path
|
7
|
+
(#447, patch by Brett Gailey)
|
8
|
+
|
1
9
|
0.4.36 (May 15, 2013)
|
2
10
|
- pear: only do channel-discover if necessary (#438, patch by Hatt)
|
3
11
|
- cpan: now supports cpan modules that use Module::Build
|
data/lib/fpm/package/cpan.rb
CHANGED
@@ -13,9 +13,17 @@ class FPM::Package::CPAN < FPM::Package
|
|
13
13
|
option "--package-name-prefix", "NAME_PREFIX", "Name to prefix the package " \
|
14
14
|
"name with.", :default => "perl"
|
15
15
|
option "--test", :flag, "Run the tests before packaging?", :default => true
|
16
|
+
option "--perl-lib-path", "PERL_LIB_PATH", "Path of target Perl Libraries"
|
16
17
|
|
17
18
|
private
|
18
19
|
def input(package)
|
20
|
+
if RUBY_VERSION =~ /^1\.8/
|
21
|
+
raise FPM::Package::InvalidArgument,
|
22
|
+
"Sorry, CPAN support requires ruby 1.9 or higher. You have " \
|
23
|
+
"#{RUBY_VERSION}. If this negatively impacts you, please let " \
|
24
|
+
"me know by filing an issue: " \
|
25
|
+
"https://github.com/jordansissel/fpm/issues"
|
26
|
+
end
|
19
27
|
require "ftw" # for http access
|
20
28
|
require "json"
|
21
29
|
|
@@ -108,12 +116,20 @@ class FPM::Package::CPAN < FPM::Package
|
|
108
116
|
# Try Makefile.PL, Build.PL
|
109
117
|
#
|
110
118
|
if File.exists?("Makefile.PL")
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
119
|
+
if attributes[:cpan_perl_lib_path]
|
120
|
+
perl_lib_path = attributes[:cpan_perl_lib_path]
|
121
|
+
safesystem(attributes[:cpan_perl_bin],
|
122
|
+
"-Mlocal::lib=#{build_path("cpan")}",
|
123
|
+
"Makefile.PL", "PREFIX=#{prefix}", "LIB=#{perl_lib_path}",
|
124
|
+
# Empty install_base to avoid local::lib being used.
|
125
|
+
"INSTALL_BASE=")
|
126
|
+
else
|
127
|
+
safesystem(attributes[:cpan_perl_bin],
|
128
|
+
"-Mlocal::lib=#{build_path("cpan")}",
|
129
|
+
"Makefile.PL", "PREFIX=#{prefix}",
|
130
|
+
# Empty install_base to avoid local::lib being used.
|
131
|
+
"INSTALL_BASE=")
|
132
|
+
end
|
117
133
|
make = [ "make" ]
|
118
134
|
safesystem(*make)
|
119
135
|
safesystem(*(make + ["test"])) if attributes[:cpan_test?]
|
@@ -128,16 +144,29 @@ class FPM::Package::CPAN < FPM::Package
|
|
128
144
|
if attributes[:cpan_test?]
|
129
145
|
safesystem("./Build", "test")
|
130
146
|
end
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
147
|
+
if attributes[:cpan_perl_lib_path]
|
148
|
+
perl_lib_path = attributes[:cpan_perl_lib_path]
|
149
|
+
safesystem("./Build install --install_path lib=#{perl_lib_path} \
|
150
|
+
--destdir #{staging_path} --prefix #{prefix} --destdir #{staging_path}")
|
151
|
+
else
|
152
|
+
safesystem("./Build", "install",
|
153
|
+
"--prefix", prefix, "--destdir", staging_path,
|
154
|
+
# Empty install_base to avoid local::lib being used.
|
155
|
+
"--install_base", "")
|
156
|
+
end
|
136
157
|
else
|
137
158
|
raise FPM::InvalidPackageConfiguration,
|
138
159
|
"I don't know how to build #{name}. No Makefile.PL nor " \
|
139
160
|
"Build.PL found"
|
140
161
|
end
|
162
|
+
|
163
|
+
# Fix any files likely to cause conflicts.
|
164
|
+
# https://github.com/jordansissel/fpm/issues/443
|
165
|
+
::Dir.glob(File.join(staging_path, prefix, "lib/perl/*/perllocal.pod")).each do |path|
|
166
|
+
@logger.debug("Removing useless file.",
|
167
|
+
:path => path.gsub(staging_path, ""))
|
168
|
+
File.unlink(path)
|
169
|
+
end
|
141
170
|
end
|
142
171
|
|
143
172
|
|
@@ -176,7 +205,8 @@ class FPM::Package::CPAN < FPM::Package
|
|
176
205
|
version = metadata["version"] if version.nil?
|
177
206
|
|
178
207
|
tarball = "#{distribution}-#{version}.tar.gz"
|
179
|
-
url = "http://
|
208
|
+
url = "http://www.cpan.org/CPAN/authors/id/#{author[0,1]}/#{author[0,2]}/#{author}/#{tarball}"
|
209
|
+
@logger.debug("Fetching perl module", :url => url)
|
180
210
|
response = agent.get!(url)
|
181
211
|
if response.error?
|
182
212
|
@logger.error("Download failed", :error => response.status_line,
|
data/lib/fpm/package/deb.rb
CHANGED
@@ -28,6 +28,12 @@ class FPM::Package::Deb < FPM::Package
|
|
28
28
|
"version. Default is to be specific. This option allows the same " \
|
29
29
|
"version of a package but any iteration is permitted"
|
30
30
|
|
31
|
+
option "--build-depends", "DEPENDENCY",
|
32
|
+
"Add DEPENDENCY as a Build-Depends" do |dep|
|
33
|
+
@build_depends ||= []
|
34
|
+
@build_depends << dep
|
35
|
+
end
|
36
|
+
|
31
37
|
option "--pre-depends", "DEPENDENCY",
|
32
38
|
"Add DEPENDENCY as a Pre-Depends" do |dep|
|
33
39
|
@pre_depends ||= []
|
@@ -316,12 +322,17 @@ class FPM::Package::Deb < FPM::Package
|
|
316
322
|
raise FPM::InvalidPackageConfiguration,
|
317
323
|
"Unknown compression type '#{self.attributes[:deb_compression]}'"
|
318
324
|
end
|
325
|
+
|
319
326
|
tar_flags = []
|
320
327
|
if !attributes[:deb_user].nil?
|
321
328
|
tar_flags += [ "--owner", attributes[:deb_user] ]
|
322
329
|
end
|
323
330
|
if !attributes[:deb_group].nil?
|
324
|
-
|
331
|
+
if attributes[:deb_group] == 'root'
|
332
|
+
tar_flags += [ "--numeric-owner", "--group", "0" ]
|
333
|
+
else
|
334
|
+
tar_flags += [ "--group", attributes[:deb_group] ]
|
335
|
+
end
|
325
336
|
end
|
326
337
|
|
327
338
|
if attributes[:deb_changelog]
|
@@ -437,8 +448,10 @@ class FPM::Package::Deb < FPM::Package
|
|
437
448
|
# Make the control.tar.gz
|
438
449
|
with(build_path("control.tar.gz")) do |controltar|
|
439
450
|
@logger.info("Creating", :path => controltar, :from => control_path)
|
440
|
-
|
441
|
-
|
451
|
+
|
452
|
+
args = [ tar_cmd, "-C", control_path, "-zcf", controltar,
|
453
|
+
"--owner=0", "--group=0", "--numeric-owner", "." ]
|
454
|
+
safesystem(*args)
|
442
455
|
end
|
443
456
|
|
444
457
|
@logger.debug("Removing no longer needed control dir", :path => control_path)
|
data/lib/fpm/package/npm.rb
CHANGED
@@ -56,15 +56,7 @@ class FPM::Package::NPM < FPM::Package
|
|
56
56
|
# Query details about our now-installed package.
|
57
57
|
# We do this by using 'npm ls' with json + long enabled to query details
|
58
58
|
# about the installed package.
|
59
|
-
|
60
|
-
npm_ls_fd = IO.popen(npm_ls_cmd)
|
61
|
-
npm_ls_out = npm_ls_fd.read()
|
62
|
-
pid, status = Process.waitpid2(npm_ls_fd.pid)
|
63
|
-
if !status.success?
|
64
|
-
raise FPM::Util::ProcessFailed.new("#{npm_ls_cmd.first} failed (exit " \
|
65
|
-
"code #{status.exitstatus}). " \
|
66
|
-
"Full command was: #{npm_ls_cmd.inspect}")
|
67
|
-
end
|
59
|
+
npm_ls_out = safesystemout(attributes[:npm_bin], "ls", "--json", "--long", package, *npm_flags)
|
68
60
|
npm_ls = JSON.parse(npm_ls_out)
|
69
61
|
name, info = npm_ls["dependencies"].first
|
70
62
|
|
data/lib/fpm/package/pear.rb
CHANGED
@@ -59,16 +59,9 @@ class FPM::Package::PEAR < FPM::Package
|
|
59
59
|
# do channel-discover if required
|
60
60
|
if !attributes[:pear_channel].nil?
|
61
61
|
@logger.info("Custom channel specified", :channel => attributes[:pear_channel])
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
pid, status = Process.waitpid2(pear_lc_fd.pid)
|
66
|
-
if !status.success?
|
67
|
-
raise FPM::Util::ProcessFailed.new("#{pear_ls_cmd.first} failed (exit " \
|
68
|
-
"code #{status.exitstatus}). " \
|
69
|
-
"Full command was: #{pear_ls_cmd.inspect}")
|
70
|
-
end
|
71
|
-
if !pear_lc_out =~ /#{Regexp.quote(attributes[:pear_channel])}/
|
62
|
+
channel_list = safesystemout("pear", "-c", config, "list-channels")
|
63
|
+
|
64
|
+
if !channel_list =~ /#{Regexp.quote(attributes[:pear_channel])}/
|
72
65
|
@logger.info("Discovering new channel", :channel => attributes[:pear_channel])
|
73
66
|
safesystem("pear", "-c", config, "channel-discover", attributes[:pear_channel])
|
74
67
|
end
|
data/lib/fpm/util.rb
CHANGED
@@ -58,6 +58,41 @@ module FPM::Util
|
|
58
58
|
return success
|
59
59
|
end # def safesystem
|
60
60
|
|
61
|
+
# Run a command safely in a way that captures output and status.
|
62
|
+
def safesystemout(*args)
|
63
|
+
if args.size == 1
|
64
|
+
args = [ ENV["SHELL"], "-c", args[0] ]
|
65
|
+
end
|
66
|
+
program = args[0]
|
67
|
+
|
68
|
+
if !program.include?("/") and !program_in_path?(program)
|
69
|
+
raise ExecutableNotFound.new(program)
|
70
|
+
end
|
71
|
+
|
72
|
+
@logger.debug("Running command", :args => args)
|
73
|
+
|
74
|
+
stdout_r, stdout_w = IO.pipe
|
75
|
+
stderr_r, stderr_w = IO.pipe
|
76
|
+
|
77
|
+
process = ChildProcess.build(*args)
|
78
|
+
process.io.stdout = stdout_w
|
79
|
+
process.io.stderr = stderr_w
|
80
|
+
|
81
|
+
process.start
|
82
|
+
stdout_w.close; stderr_w.close
|
83
|
+
@logger.debug("Process is running", :pid => process.pid)
|
84
|
+
|
85
|
+
process.wait
|
86
|
+
success = (process.exit_code == 0)
|
87
|
+
|
88
|
+
if !success
|
89
|
+
raise ProcessFailed.new("#{program} failed (exit code #{process.exit_code})" \
|
90
|
+
". Full command was:#{args.inspect}")
|
91
|
+
end
|
92
|
+
|
93
|
+
return :stdout_r
|
94
|
+
end # def safesystemout
|
95
|
+
|
61
96
|
# Get the recommended 'tar' command for this platform.
|
62
97
|
def tar_cmd
|
63
98
|
# Rely on gnu tar for solaris and OSX.
|
data/lib/fpm/version.rb
CHANGED
data/templates/deb.erb
CHANGED
@@ -17,6 +17,9 @@ Breaks: <%= attributes[:deb_breaks].collect { |d| fix_dependency(d) }.flatten.jo
|
|
17
17
|
<% if attributes[:deb_pre_depends_given?] -%>
|
18
18
|
Pre-Depends: <%= attributes[:deb_pre_depends].collect { |d| fix_dependency(d) }.flatten.join(", ") %>
|
19
19
|
<% end -%>
|
20
|
+
<% if attributes[:deb_build_depends_given?] -%>
|
21
|
+
Build-Depends: <%= attributes[:deb_build_depends].collect { |d| fix_dependency(d) }.flatten.join(", ") %>
|
22
|
+
<% end -%>
|
20
23
|
<% if !provides.empty? -%>
|
21
24
|
<%# Turn each provides from 'foo = 123' to simply 'foo' because Debian :\ -%>
|
22
25
|
<%# http://www.debian.org/doc/debian-policy/ch-relationships.html -%>
|
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.
|
4
|
+
version: 0.4.37
|
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-05-
|
12
|
+
date: 2013-05-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -96,17 +96,17 @@ dependencies:
|
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
99
|
-
- -
|
99
|
+
- - ~>
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 0.6
|
101
|
+
version: '0.6'
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0.6
|
109
|
+
version: '0.6'
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: childprocess
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|