fpm 0.4.9 → 0.4.10

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELIST CHANGED
@@ -1,3 +1,17 @@
1
+ 0.4.10 (May 25, 2012)
2
+ - Fix python package support for python3 (#212, patch by Slezhuk Evgeniy)
3
+ - Preserve file metadata (time, owner, etc) when copying with the dir
4
+ package. (#217, patch by Marshall T. Vandegrift)
5
+ - Missing executables will now error more readably in fpm.
6
+ - Fix gem and python 'version' selection (#215, #204)
7
+ - Dependencies using '!=' will now map to 'Conflicts' in deb packages. (#221,
8
+ patch by Sven Fischer)
9
+ - Allow setting default user/group for files in rpm packages (#208, patch by
10
+ Jason Rogers). Note: This adds --user and --group flags to effect this.
11
+ These flags may go away in the future, but if they do, they will be
12
+ - In python packages set 'install-data' correctly. (#223, patch by Jamie
13
+ Scheinblum)
14
+
1
15
  0.4.9 (April 25, 2012)
2
16
  - Fix --prefix support when building gems (#213, patch by Jan Vansteenkiste)
3
17
 
@@ -1,4 +1,5 @@
1
- The following fine folks have contributed patches or things to fpm:
1
+ The following awesome folks have contributed ideas,
2
+ bug reports, code, or other to fpm:
2
3
 
3
4
  anthezium
4
5
  Curt Micol
@@ -14,3 +15,4 @@ Aleix Conchillo Flaqué (github: aconchillo)
14
15
  Luke Macken (github: lmacken)
15
16
  Matt Blair (github: mblair)
16
17
  Thomas Meson (github: zllak)
18
+ Oliver Hookins (github: ohookins)
@@ -229,6 +229,11 @@ class FPM::Command < Clamp::Command
229
229
  #
230
230
  # In the case of 'flag' options, the accessor is actually 'foo_bar?'
231
231
  # instead of just 'foo_bar'
232
+
233
+ # If the instance variable @{attr} is defined, then
234
+ # it means the flag was given on the command line.
235
+ flag_given = instance_variable_defined?("@#{attr}")
236
+ input.attributes["#{attr}_given?".to_sym] = flag_given
232
237
  attr = "#{attr}?" if !respond_to?(attr) # handle boolean :flag cases
233
238
  input.attributes[attr.to_sym] = send(attr) if respond_to?(attr)
234
239
  @logger.debug("Setting attribute", attr.to_sym => send(attr))
@@ -328,6 +333,9 @@ class FPM::Command < Clamp::Command
328
333
  end
329
334
 
330
335
  return 0
336
+ rescue FPM::Util::ExecutableNotFound => e
337
+ @logger.error("Need executable '#{e}' to convert #{input_type} to #{output_type}")
338
+ return 1
331
339
  ensure
332
340
  input.cleanup unless input.nil?
333
341
  output.cleanup unless output.nil?
@@ -420,8 +420,25 @@ class FPM::Package
420
420
  end # def self.type
421
421
  end # class << self
422
422
 
423
+ # Get the version of this package
424
+ def version
425
+ if instance_variable_defined?(:@version) && !@version.nil?
426
+ return @version
427
+ elsif attributes[:version_given?]
428
+ # 'version_given?' will be true in cases where the
429
+ # fpm command-line tool has been given '-v' or '--version' settings
430
+ # We do this check because the default version is "1.0"
431
+ # on the fpm command line.
432
+ return attributes.fetch(:version)
433
+ end
434
+
435
+ # No version yet, nil.
436
+ return nil
437
+ end # def version
438
+
423
439
  # General public API
424
- public(:type, :initialize, :convert, :input, :output, :to_s, :cleanup, :files)
440
+ public(:type, :initialize, :convert, :input, :output, :to_s, :cleanup, :files,
441
+ :version)
425
442
 
426
443
  # Package internal public api
427
444
  public(:cleanup_staging, :cleanup_build, :staging_path, :converted_from,
@@ -261,6 +261,10 @@ class FPM::Package::Deb < FPM::Package
261
261
  nextversion[l-1] = 0
262
262
  nextversion = nextversion.join(".")
263
263
  return ["#{name} (>= #{version})", "#{name} (<< #{nextversion})"]
264
+ elsif (m = dep.match(/(\S+)\s+\(!= (.+)\)/))
265
+ # Append this to conflicts
266
+ self.conflicts += [dep.gsub(/!=/,"=")]
267
+ return []
264
268
  elsif (m = dep.match(/(\S+)\s+\(= (.+)\)/)) and
265
269
  self.attributes[:deb_ignore_iteration_in_dependencies?]
266
270
  # Convert 'foo (= x)' to 'foo (>= x)' and 'foo (<< x+1)'
@@ -107,7 +107,27 @@ class FPM::Package::Dir < FPM::Package
107
107
  FileUtils.copy_entry(source, destination)
108
108
  end
109
109
  end
110
+
111
+ copy_metadata(source, destination)
110
112
  end # def copy
111
113
 
114
+ def copy_metadata(source, destination)
115
+ source_stat = File::lstat(source)
116
+ dest_stat = File::lstat(destination)
117
+
118
+ # If this is a hard-link, there's no metadata to copy.
119
+ return if source_stat.ino == dest_stat.ino
120
+
121
+ File.utime(source_stat.atime, source_stat.mtime, destination)
122
+ begin
123
+ File.chown(source_stat.uid, source_stat.gid, destination)
124
+ rescue Errno::EPERM
125
+ # clear setuid/setgid
126
+ File.chmod(source_stat.mode & 01777, destination)
127
+ else
128
+ File.chmod(source_stat.mode, destination)
129
+ end
130
+ end # def copy_metadata
131
+
112
132
  public(:input, :output)
113
133
  end # class FPM::Package::Dir
@@ -65,9 +65,9 @@ class get_metadata(Command):
65
65
 
66
66
  #print json.dumps(data, indent=2)
67
67
  try:
68
- print json.dumps(data, indent=2)
69
- except AttributeError, e:
68
+ print(json.dumps(data, indent=2))
69
+ except AttributeError as e:
70
70
  # For Python 2.5 and Debian's python-json
71
- print json.write(data)
71
+ print(json.write(data))
72
72
  # def run
73
73
  # class list_dependencies
@@ -183,7 +183,7 @@ class FPM::Package::Python < FPM::Package
183
183
  # Ask python where libraries are installed to.
184
184
  # This line is unusually long because I don't have a shorter way to express it.
185
185
  attributes[:python_install_lib] = %x{
186
- #{attributes[:python_bin]} -c 'from distutils.sysconfig import get_python_lib; print get_python_lib()'
186
+ #{attributes[:python_bin]} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())'
187
187
  }.chomp
188
188
  @logger.info("Setting default :python_install_lib attribute",
189
189
  :value => attributes[:python_install_lib])
@@ -194,6 +194,7 @@ class FPM::Package::Python < FPM::Package
194
194
  safesystem(attributes[:python_bin], "setup.py", "install",
195
195
  "--root", staging_path,
196
196
  "--install-lib", File.join(prefix, attributes[:python_install_lib]),
197
+ "--install-data", File.join(prefix, attributes[:python_install_lib]),
197
198
  "--install-scripts", File.join(prefix, attributes[:python_install_bin]))
198
199
  end
199
200
  end # def install_to_staging
@@ -29,6 +29,17 @@ class FPM::Package::RPM < FPM::Package
29
29
  "bzip2" => "w9.bzdio"
30
30
  } unless defined?(COMPRESSION_MAP)
31
31
 
32
+ option "--user", "USER",
33
+ "Set the user to USER in the %files section.",
34
+ :default => 'root' do |value|
35
+ value
36
+ end
37
+
38
+ option "--group", "GROUP",
39
+ "Set the group to GROUP in the %files section.",
40
+ :default => 'root' do |value|
41
+ value
42
+ end
32
43
 
33
44
  option "--rpmbuild-define", "DEFINITION",
34
45
  "Pass a --define argument to rpmbuild." do |define|
@@ -96,7 +96,7 @@ fi
96
96
 
97
97
  <% end -%>
98
98
  %files
99
- %defattr(-,root,root,-)
99
+ %defattr(-,<%= attributes[:rpm_user] %>,<%= attributes[:rpm_group] %>,-)
100
100
  <%# Output config files and then regular files. -%>
101
101
  <% config_files.each do |path| -%>
102
102
  %config(noreplace) <%= path %>
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.9
4
+ version: 0.4.10
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: 2012-04-26 00:00:00.000000000 Z
12
+ date: 2012-05-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
201
  version: '0'
202
202
  requirements: []
203
203
  rubyforge_project:
204
- rubygems_version: 1.8.21
204
+ rubygems_version: 1.8.24
205
205
  signing_key:
206
206
  specification_version: 3
207
207
  summary: fpm - package building and mangling