fpm 0.2.21 → 0.2.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- @architecture = source[:architecture] || %x{uname -m}.chomp
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]
@@ -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'
@@ -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 == "x86_64"
9
- "amd64"
10
- else
11
- @architecture
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
- end
22
+
23
+ return @architecture
24
+ end # def architecture
14
25
 
15
26
  def specfile(builddir)
16
27
  "#{builddir}/control"
@@ -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: 61
5
- prerelease:
4
+ hash: 59
5
+ prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 21
10
- version: 0.2.21
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-11 00:00:00 -07:00
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.6.2
92
+ rubygems_version: 1.3.7
93
93
  signing_key:
94
94
  specification_version: 3
95
95
  summary: fpm - package building and mangling