fpm 0.2.21 → 0.2.22
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fpm/package.rb +7 -1
- data/lib/fpm/source/gem.rb +8 -1
- data/lib/fpm/target/deb.rb +17 -6
- data/lib/fpm/target/rpm.rb +14 -0
- metadata +6 -6
data/lib/fpm/package.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "fpm/namespace"
|
2
2
|
require "socket" # for Socket.gethostname
|
3
|
+
require "logger"
|
3
4
|
|
4
5
|
class FPM::Package
|
5
6
|
# The name of this package
|
@@ -55,6 +56,7 @@ class FPM::Package
|
|
55
56
|
|
56
57
|
def initialize(source)
|
57
58
|
@source = source
|
59
|
+
@logger = Logger.new(STDERR)
|
58
60
|
|
59
61
|
@name = source[:name] # || fail
|
60
62
|
|
@@ -70,7 +72,11 @@ class FPM::Package
|
|
70
72
|
@category = source[:category] || "default"
|
71
73
|
@license = source[:license] || "unknown"
|
72
74
|
@maintainer = source[:maintainer] || "<#{ENV["USER"]}@#{Socket.gethostname}>"
|
73
|
-
|
75
|
+
|
76
|
+
# If @architecture is nil, the target package should provide a default.
|
77
|
+
# Special 'architecture' values include "all" (aka rpm's noarch, debian's all)
|
78
|
+
# Another special includes "native" which will be the current platform's arch.
|
79
|
+
@architecture = source[:architecture]
|
74
80
|
@description = source[:description] || "no description given"
|
75
81
|
@provides = source[:provides] || []
|
76
82
|
@scripts = source[:scripts]
|
data/lib/fpm/source/gem.rb
CHANGED
@@ -26,7 +26,7 @@ class FPM::Source::Gem < FPM::Source
|
|
26
26
|
# Code use permissible by rubygems's "GPL or these conditions below"
|
27
27
|
# http://rubygems.rubyforge.org/rubygems-update/LICENSE_txt.html
|
28
28
|
|
29
|
-
puts "Trying to download #{gem_name} (version=#{version})"
|
29
|
+
puts "Trying to download #{gem_name} (version=#{version || 'latest'})"
|
30
30
|
dep = ::Gem::Dependency.new gem_name, version
|
31
31
|
# How to handle prerelease? Some extra magic options?
|
32
32
|
#dep.prerelease = options[:prerelease]
|
@@ -71,6 +71,13 @@ class FPM::Source::Gem < FPM::Source
|
|
71
71
|
# package managers. Need to decide how to handle this.
|
72
72
|
self[:category] = 'Languages/Development/Ruby'
|
73
73
|
|
74
|
+
# if the gemspec has extensions defined, then this should be a 'native' arch.
|
75
|
+
if !spec.extensions.empty?
|
76
|
+
self[:architecture] = "native"
|
77
|
+
else
|
78
|
+
self[:architecture] = "all"
|
79
|
+
end
|
80
|
+
|
74
81
|
self[:dependencies] = []
|
75
82
|
spec.runtime_dependencies.map do |dep|
|
76
83
|
# rubygems 1.3.5 doesn't have 'Gem::Dependency#requirement'
|
data/lib/fpm/target/deb.rb
CHANGED
@@ -3,14 +3,25 @@ require "fpm/namespace"
|
|
3
3
|
require "fpm/package"
|
4
4
|
|
5
5
|
class FPM::Target::Deb < FPM::Package
|
6
|
-
# Debian calls x86_64 "amd64"
|
7
6
|
def architecture
|
8
|
-
if @architecture == "
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
if @architecture.nil? or @architecture == "native"
|
8
|
+
# Default architecture should be 'native' which we'll need
|
9
|
+
# to ask the system about.
|
10
|
+
arch = %x{dpkg --print-architecture}.chomp
|
11
|
+
if $?.exitstatus != 0
|
12
|
+
arch = %x{uname -m}
|
13
|
+
@logger.warn("Can't find 'dpkg' tool (need it to get default " \
|
14
|
+
"architecture!). Please specificy --architecture " \
|
15
|
+
"specifically. (Defaulting now to #{arch})")
|
16
|
+
end
|
17
|
+
@architecture = arch
|
18
|
+
elsif @architecture == "x86_64"
|
19
|
+
# Debian calls x86_64 "amd64"
|
20
|
+
@architecture = "amd64"
|
12
21
|
end
|
13
|
-
|
22
|
+
|
23
|
+
return @architecture
|
24
|
+
end # def architecture
|
14
25
|
|
15
26
|
def specfile(builddir)
|
16
27
|
"#{builddir}/control"
|
data/lib/fpm/target/rpm.rb
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
require "fpm/package"
|
2
2
|
|
3
3
|
class FPM::Target::Rpm < FPM::Package
|
4
|
+
def architecture
|
5
|
+
case @architecture
|
6
|
+
when nil
|
7
|
+
return %x{uname -m}.chomp # default to current arch
|
8
|
+
when "native"
|
9
|
+
return %x{uname -m}.chomp # 'native' is current arch
|
10
|
+
when "all"
|
11
|
+
# Translate fpm "all" arch to what it means in RPM.
|
12
|
+
return "noarch"
|
13
|
+
else
|
14
|
+
return @architecture
|
15
|
+
end
|
16
|
+
end # def architecture
|
17
|
+
|
4
18
|
def specfile(builddir)
|
5
19
|
"#{builddir}/#{name}.spec"
|
6
20
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 59
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 22
|
10
|
+
version: 0.2.22
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jordan Sissel
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-05-
|
18
|
+
date: 2011-05-12 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
requirements: []
|
90
90
|
|
91
91
|
rubyforge_project:
|
92
|
-
rubygems_version: 1.
|
92
|
+
rubygems_version: 1.3.7
|
93
93
|
signing_key:
|
94
94
|
specification_version: 3
|
95
95
|
summary: fpm - package building and mangling
|