fpm 0.4.1 → 0.4.2

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 CHANGED
@@ -1,3 +1,16 @@
1
+ 0.4.2 (March 21, 2012)
2
+ - Set default temporary directory to /tmp
3
+ (https://github.com/jordansissel/fpm/issues/174)
4
+ - Improve symlink handling (patch by Aleix Conchillo Flaqué, pull/177))
5
+ - Python package support changes (thanks to input by Luke Macken):
6
+ * New flag: --python-install-bin. Sets the location for python package
7
+ scripts (default: /usr/bin)
8
+ * New flag: --python-install-lib. Sets the location for the python
9
+ package to install libs to, default varies by system. Usually something
10
+ like /usr/lib/python2.7/site-packages.
11
+ * Fix up --prefix support
12
+ * Improve staged package installation
13
+
1
14
  0.4.1 (March 19, 2012)
2
15
  - Fix fpm so it works in ruby 1.8 again.
3
16
  Tests run, and passing:
@@ -10,3 +10,6 @@ Pierre-Yves Ritschard
10
10
  sabowski
11
11
  Thomas Haggett
12
12
  Pieter Loubser
13
+ Aleix Conchillo Flaqué (github: aconchillo)
14
+ Luke Macken (github: lmacken)
15
+ Matt Blair (github: mblair)
@@ -205,17 +205,29 @@ class FPM::Command < Clamp::Command
205
205
  # They are stored in 'settings' as :gem_foo_bar.
206
206
  input.attributes ||= {}
207
207
 
208
- # Iterate over all the options
208
+ # Iterate over all the options and set their values in the package's
209
+ # attribute hash.
210
+ #
211
+ # Things like '--foo-bar' will be available as pkg.attributes[:foo_bar]
209
212
  self.class.declared_options.each do |option|
210
213
  with(option.attribute_name) do |attr|
214
+ next if attr == "help"
211
215
  # clamp makes option attributes available as accessor methods
212
- # do --foo-bar is available as 'foo_bar'
213
- # make these available as package attributes.
214
- attr = "#{attr}?" if !respond_to?(attr)
216
+ # --foo-bar is available as 'foo_bar'. Put these in the package
217
+ # attributes hash. (See FPM::Package#attributes)
218
+ #
219
+ # In the case of 'flag' options, the accessor is actually 'foo_bar?'
220
+ # instead of just 'foo_bar'
221
+ attr = "#{attr}?" if !respond_to?(attr) # handle boolean :flag cases
215
222
  input.attributes[attr.to_sym] = send(attr) if respond_to?(attr)
223
+ @logger.debug("Setting attribute", attr.to_sym => send(attr))
216
224
  end
217
225
  end
218
226
 
227
+ # Each remaining command line parameter is used as an 'input' argument.
228
+ # For directories, this means paths. For things like gem and python, this
229
+ # means package name or paths to the packages (rails, foo-1.0.gem, django,
230
+ # bar/setup.py, etc)
219
231
  args.each do |arg|
220
232
  input.input(arg)
221
233
  end
@@ -228,7 +240,10 @@ class FPM::Command < Clamp::Command
228
240
  end
229
241
 
230
242
  # Read each line as a path
231
- File.new(inputs, "r").each_line { |path| input.input(path) }
243
+ File.new(inputs, "r").each_line do |line|
244
+ # Handle each line as if it were an argument
245
+ input.input(line)
246
+ end
232
247
  end
233
248
 
234
249
  # Override package settings if they are not the default flag values
@@ -223,7 +223,7 @@ class FPM::Package
223
223
  end # def output
224
224
 
225
225
  def staging_path(path=nil)
226
- @staging_path ||= ::Dir.mktmpdir("package-#{type}-staging", ::Dir.pwd)
226
+ @staging_path ||= ::Dir.mktmpdir("package-#{type}-staging") #, ::Dir.pwd)
227
227
 
228
228
  if path.nil?
229
229
  return @staging_path
@@ -233,7 +233,7 @@ class FPM::Package
233
233
  end # def staging_path
234
234
 
235
235
  def build_path(path=nil)
236
- @build_path ||= ::Dir.mktmpdir("package-#{type}-build", ::Dir.pwd)
236
+ @build_path ||= ::Dir.mktmpdir("package-#{type}-build") #, ::Dir.pwd)
237
237
 
238
238
  if path.nil?
239
239
  return @build_path
@@ -333,7 +333,13 @@ class FPM::Package
333
333
  flag = [flag]
334
334
  end
335
335
 
336
- flag = flag.collect { |f| "--#{type}-#{f.gsub(/^--/, "")}" }
336
+ if param == :flag
337
+ # Automatically make 'flag' (boolean) options tunable with '--[no-]...'
338
+ flag = flag.collect { |f| "--[no-]#{type}-#{f.gsub(/^--/, "")}" }
339
+ else
340
+ flag = flag.collect { |f| "--#{type}-#{f.gsub(/^--/, "")}" }
341
+ end
342
+
337
343
  help = "(#{type} only) #{help}"
338
344
  @options << [flag, param, help, options, block]
339
345
  end # def options
@@ -353,13 +359,7 @@ class FPM::Package
353
359
  @options ||= []
354
360
  @options.each do |args|
355
361
  flag, param, help, options, block = args
356
- clampcommand.option(flag, param, help, options) do |value|
357
- # This is run in the scope of FPM::Command
358
- value = block.call(value) unless block.nil?
359
- # flag is an array, use the first flag as the attribute name
360
- attr = flag.first[2..-1].gsub(/-+/, "_").to_sym
361
- settings[attr] = value
362
- end
362
+ clampcommand.option(flag, param, help, options, &block)
363
363
  end
364
364
  end # def apply_options
365
365
 
@@ -91,16 +91,17 @@ class FPM::Package::Dir < FPM::Package
91
91
  end
92
92
 
93
93
  # Create a directory if this path is a directory
94
- if File.directory?(source)
94
+ if File.directory?(source) and !File.symlink?(source)
95
95
  @logger.debug("Creating", :directory => destination)
96
96
  FileUtils.mkdir(destination)
97
97
  else
98
98
  # Otherwise try copying the file.
99
- @logger.debug("Copying", :source => source, :destination => destination)
100
99
  begin
100
+ @logger.debug("Linking", :source => source, :destination => destination)
101
101
  File.link(source, destination)
102
102
  rescue Errno::EXDEV
103
103
  # Hardlink attempt failed, copy it instead
104
+ @logger.debug("Copying", :source => source, :destination => destination)
104
105
  FileUtils.copy(source, destination)
105
106
  end
106
107
  end
@@ -40,6 +40,13 @@ class FPM::Package::Python < FPM::Package
40
40
  option "--fix-dependencies", :flag, "Should the package dependencies be " \
41
41
  "prefixed?", :default => true
42
42
 
43
+ option "--install-bin", "BIN_PATH", "The path to where python scripts " \
44
+ "should be installed to.", :default => "/usr/bin"
45
+ option "--install-lib", "LIB_PATH", "The path to where python libs " \
46
+ "should be installed to (default depends on your python installation). " \
47
+ "Want to what your target platform is using? Run this: " \
48
+ "python -c 'from distutils.sysconfig import get_python_lib; " \
49
+ "print get_python_lib()'"
43
50
 
44
51
  private
45
52
 
@@ -156,22 +163,29 @@ class FPM::Package::Python < FPM::Package
156
163
 
157
164
  # Install this package to the staging directory
158
165
  def install_to_staging(setup_py)
159
- dir = File.dirname(setup_py)
160
-
166
+ project_dir = File.dirname(setup_py)
167
+
168
+ prefix = "/"
169
+ prefix = attributes[:prefix] unless attributes[:prefix].nil?
170
+
171
+ # Set the default install library location (like
172
+ # /usr/lib/python2.7/site-packages) if it is not given
173
+ if attributes[:python_install_lib].nil?
174
+ # Ask python where libraries are installed to.
175
+ # This line is unusually long because I don't have a shorter way to express it.
176
+ attributes[:python_install_lib] = %x{
177
+ #{attributes[:python_bin]} -c 'from distutils.sysconfig import get_python_lib; print get_python_lib()'
178
+ }.chomp
179
+ @logger.info("Setting default :python_install_lib attribute",
180
+ :value => attributes[:python_install_lib])
181
+ end
161
182
  # Some setup.py's assume $PWD == current directory of setup.py, so let's
162
183
  # chdir first.
163
- ::Dir.chdir(dir) do
164
-
165
- # Install with a specific prefix if requested
166
- if attributes[:prefix]
167
- safesystem(attributes[:python_bin], "setup.py", "install", "--prefix",
168
- File.join(staging_path, attributes[:prefix]))
169
- else
170
- # Otherwise set the root in staging_path
171
- # TODO(sissel): there needs to be a way to force
172
- safesystem(attributes[:python_bin], "setup.py", "install", "--root",
173
- staging_path)
174
- end
184
+ ::Dir.chdir(project_dir) do
185
+ safesystem(attributes[:python_bin], "setup.py", "install",
186
+ "--root", staging_path,
187
+ "--install-lib", File.join(prefix, attributes[:python_install_lib]),
188
+ "--install-scripts", File.join(prefix, attributes[:python_install_bin]))
175
189
  end
176
190
  end # def install_to_staging
177
191
 
@@ -56,8 +56,8 @@ Obsoletes: <%= repl %>
56
56
  <% target = File.join(build_path, "BUILD", path) -%>
57
57
  <% dir = File.dirname(target) %>
58
58
  mkdir -p "<%= dir %>"
59
- if [ -f "<%= source %>" ] ; then
60
- cp "<%= source %>" "<%= target %>"
59
+ if [ -f "<%= source %>" ] || [ -h "<%= source %>" ] ; then
60
+ cp -d "<%= source %>" "<%= target %>"
61
61
  elif [ -d "<%= source %>" ] ; then
62
62
  mkdir "<%= target %>"
63
63
  fi
@@ -96,7 +96,7 @@ fi
96
96
  <%=
97
97
  # Reject directories or config files already listed, then prefix files with
98
98
  # "/", then make sure paths with spaces are quoted. I hate rpm so much.
99
- files.reject { |f| File.directory?(File.join(staging_path, f)) } \
99
+ files.reject { |f| x = File.join(staging_path, f); File.directory?(x) && !File.symlink?(x) } \
100
100
  .collect { |f| "/#{f}" } \
101
101
  .reject { |f| config_files.include?(f) } \
102
102
  .collect { |f| f[/\s/] and "\"#{f}\"" or f } \
metadata CHANGED
@@ -1,152 +1,154 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: fpm
3
- version: !ruby/object:Gem::Version
4
- hash: 13
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.2
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 4
9
- - 1
10
- version: 0.4.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Jordan Sissel
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-03-19 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-03-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: json
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: cabin
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: cabin
32
+ requirement: !ruby/object:Gem::Requirement
38
33
  none: false
39
- requirements:
34
+ requirements:
40
35
  - - ~>
41
- - !ruby/object:Gem::Version
42
- hash: 9
43
- segments:
44
- - 0
45
- - 4
46
- - 3
36
+ - !ruby/object:Gem::Version
47
37
  version: 0.4.3
48
38
  type: :runtime
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: backports
52
39
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
56
- - - "="
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 2
61
- - 3
62
- - 0
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.4.3
46
+ - !ruby/object:Gem::Dependency
47
+ name: backports
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - '='
52
+ - !ruby/object:Gem::Version
63
53
  version: 2.3.0
64
54
  type: :runtime
65
- version_requirements: *id003
66
- - !ruby/object:Gem::Dependency
67
- name: arr-pm
68
55
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
70
57
  none: false
71
- requirements:
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.3.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: arr-pm
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
72
67
  - - ~>
73
- - !ruby/object:Gem::Version
74
- hash: 17
75
- segments:
76
- - 0
77
- - 0
78
- - 7
68
+ - !ruby/object:Gem::Version
79
69
  version: 0.0.7
80
70
  type: :runtime
81
- version_requirements: *id004
82
- - !ruby/object:Gem::Dependency
83
- name: clamp
84
71
  prerelease: false
85
- requirement: &id005 !ruby/object:Gem::Requirement
86
- none: false
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- hash: 3
91
- segments:
92
- - 0
93
- version: "0"
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.0.7
78
+ - !ruby/object:Gem::Dependency
79
+ name: clamp
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
94
86
  type: :runtime
95
- version_requirements: *id005
96
- - !ruby/object:Gem::Dependency
97
- name: rush
98
87
  prerelease: false
99
- requirement: &id006 !ruby/object:Gem::Requirement
100
- none: false
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- hash: 3
105
- segments:
106
- - 0
107
- version: "0"
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: rush
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
108
102
  type: :development
109
- version_requirements: *id006
110
- - !ruby/object:Gem::Dependency
111
- name: rspec
112
103
  prerelease: false
113
- requirement: &id007 !ruby/object:Gem::Requirement
114
- none: false
115
- requirements:
116
- - - ">="
117
- - !ruby/object:Gem::Version
118
- hash: 3
119
- segments:
120
- - 0
121
- version: "0"
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: rspec
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
122
118
  type: :development
123
- version_requirements: *id007
124
- - !ruby/object:Gem::Dependency
125
- name: insist
126
119
  prerelease: false
127
- requirement: &id008 !ruby/object:Gem::Requirement
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: insist
128
+ requirement: !ruby/object:Gem::Requirement
128
129
  none: false
129
- requirements:
130
+ requirements:
130
131
  - - ~>
131
- - !ruby/object:Gem::Version
132
- hash: 21
133
- segments:
134
- - 0
135
- - 0
136
- - 5
132
+ - !ruby/object:Gem::Version
137
133
  version: 0.0.5
138
134
  type: :development
139
- version_requirements: *id008
140
- description: Convert directories, rpms, python eggs, rubygems, and more to rpms, debs, solaris packages and more. Win at package management without wasting pointless hours debugging bad rpm specs!
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: 0.0.5
142
+ description: Convert directories, rpms, python eggs, rubygems, and more to rpms, debs,
143
+ solaris packages and more. Win at package management without wasting pointless hours
144
+ debugging bad rpm specs!
141
145
  email: jls@semicomplete.com
142
- executables:
146
+ executables:
143
147
  - fpm
144
148
  - fpm-npm
145
149
  extensions: []
146
-
147
150
  extra_rdoc_files: []
148
-
149
- files:
151
+ files:
150
152
  - lib/fpm/errors.rb
151
153
  - lib/fpm/util.rb
152
154
  - lib/fpm/command.rb
@@ -180,37 +182,28 @@ files:
180
182
  - CHANGELIST
181
183
  homepage: https://github.com/jordansissel/fpm
182
184
  licenses: []
183
-
184
185
  post_install_message:
185
186
  rdoc_options: []
186
-
187
- require_paths:
187
+ require_paths:
188
188
  - lib
189
189
  - lib
190
- required_ruby_version: !ruby/object:Gem::Requirement
190
+ required_ruby_version: !ruby/object:Gem::Requirement
191
191
  none: false
192
- requirements:
193
- - - ">="
194
- - !ruby/object:Gem::Version
195
- hash: 3
196
- segments:
197
- - 0
198
- version: "0"
199
- required_rubygems_version: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ! '>='
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
196
+ required_rubygems_version: !ruby/object:Gem::Requirement
200
197
  none: false
201
- requirements:
202
- - - ">="
203
- - !ruby/object:Gem::Version
204
- hash: 3
205
- segments:
206
- - 0
207
- version: "0"
198
+ requirements:
199
+ - - ! '>='
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
208
202
  requirements: []
209
-
210
203
  rubyforge_project:
211
- rubygems_version: 1.8.19
204
+ rubygems_version: 1.8.18
212
205
  signing_key:
213
206
  specification_version: 3
214
207
  summary: fpm - package building and mangling
215
208
  test_files: []
216
-
209
+ has_rdoc: