fpm 0.4.23 → 0.4.24

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,13 @@
1
+ 0.4.xx (???)
2
+ - Don't include an empty url in rpm spec (#296, #276; patch by Pranay Kanwar)
3
+ - Don't require extra parameters if you use --inputs (#278, #297; Patch by
4
+ Pranay Kanwar)
5
+ - python: supports requirements.txt now for dependency information.
6
+ - python: supports pip now. Use '--python-pip path/to/pip' to have fpm use
7
+ it instead of easy_install.
8
+ - solaris: package building works again (#216, #299, patch by Pierre-Yves
9
+ Ritschard)
10
+
1
11
  0.4.23 (November 26, 2012)
2
12
  - The --directories flag is now recursive when the output package is rpm.
3
13
  This makes all directories under a given path as owned by the package
@@ -325,7 +325,7 @@ class FPM::Command < Clamp::Command
325
325
  # Read each line as a path
326
326
  File.new(inputs, "r").each_line do |line|
327
327
  # Handle each line as if it were an argument
328
- input.input(line)
328
+ input.input(line.strip)
329
329
  end
330
330
  end
331
331
 
@@ -483,7 +483,11 @@ class FPM::Command < Clamp::Command
483
483
  end
484
484
  end
485
485
 
486
- mandatory(@command.args.any?,
486
+ if @command.inputs
487
+ mandatory(@command.input_type == "dir", "--inputs is only valid with -s dir")
488
+ end
489
+
490
+ mandatory(@command.args.any? || @command.inputs,
487
491
  "No parameters given. You need to pass additional command " \
488
492
  "arguments so that I know what you want to build packages " \
489
493
  "from. For example, for '-s dir' you would pass a list of " \
@@ -23,6 +23,9 @@ class FPM::Package::Python < FPM::Package
23
23
  "The path to the python executable you wish to run.", :default => "python"
24
24
  option "--easyinstall", "EASYINSTALL_EXECUTABLE",
25
25
  "The path to the easy_install executable tool", :default => "easy_install"
26
+ option "--pip", "PIP_EXECUTABLE",
27
+ "The path to the pip executable tool. If not specified, easy_install " \
28
+ "is used instead", :default => nil
26
29
  option "--pypi", "PYPI_URL",
27
30
  "PyPi Server uri for retrieving packages.",
28
31
  :default => "http://pypi.python.org/simple"
@@ -100,8 +103,17 @@ class FPM::Package::Python < FPM::Package
100
103
  target = build_path(package)
101
104
  FileUtils.mkdir(target) unless File.directory?(target)
102
105
 
103
- safesystem(attributes[:python_easyinstall], "-i", attributes[:python_pypi],
104
- "--editable", "-U", "--build-directory", target, want_pkg)
106
+ if attributes[:python_pip].nil?
107
+ # no pip, use easy_install
108
+ puts "EASY_INSTALL"
109
+ safesystem(attributes[:python_easyinstall], "-i",
110
+ attributes[:python_pypi], "--editable", "-U",
111
+ "--build-directory", target, want_pkg)
112
+ else
113
+ puts "PIP PIP CHEERIOS"
114
+ safesystem(attributes[:python_pip], "install", "--no-install",
115
+ "-U", "--build", target, want_pkg)
116
+ end
105
117
 
106
118
  # easy_install will put stuff in @tmpdir/packagename/, so find that:
107
119
  # @tmpdir/somepackage/setup.py
@@ -123,13 +135,21 @@ class FPM::Package::Python < FPM::Package
123
135
 
124
136
  # chdir to the directory holding setup.py because some python setup.py's assume that you are
125
137
  # in the same directory.
126
- output = ::Dir.chdir(File.dirname(setup_py)) do
138
+ setup_dir = File.dirname(setup_py)
139
+
140
+ output = ::Dir.chdir(setup_dir) do
127
141
  setup_cmd = "env PYTHONPATH=#{pylib} #{attributes[:python_bin]} " \
128
142
  "setup.py --command-packages=pyfpm get_metadata"
129
143
  # Capture the output, which will be JSON metadata describing this python
130
144
  # package. See fpm/lib/fpm/package/pyfpm/get_metadata.py for more
131
145
  # details.
132
- `#{setup_cmd}`
146
+ output = `#{setup_cmd}`
147
+ if !$?.success?
148
+ @logger.error("setup.py get_metadata failed", :command => setup_cmd,
149
+ :exitcode => $?.exitcode)
150
+ raise "An unexpected error occurred while processing the setup.py file"
151
+ end
152
+ output
133
153
  end
134
154
  @logger.debug("full text from `setup.py get_metadata`", :data => output)
135
155
  metadata = JSON.parse(output[/\{.*\}/msx])
@@ -149,8 +169,26 @@ class FPM::Package::Python < FPM::Package
149
169
  self.name = metadata["name"]
150
170
  end
151
171
 
172
+ requirements_txt = File.join(setup_dir, "requirements.txt")
173
+ if File.exists?(requirements_txt)
174
+ @logger.info("Found requirements.txt, using it instead of setup.py " \
175
+ "for dependency information", :path => requirements_txt)
176
+ @logger.debug("Clearing dependency list (from setup.py) in prep for " \
177
+ "reading requirements.txt")
178
+ # Best I can tell, requirements.txt are a superset of what
179
+ # is already supported as 'dependencies' in setup.py
180
+ # So we'll parse them the same way below.
181
+ metadata["dependencies"] = File.read(requirements_txt).split("\n")
182
+ end
183
+
152
184
  self.dependencies += metadata["dependencies"].collect do |dep|
153
- name, cmp, version = dep.split
185
+ dep_re = /^([^<>= ]+)\s*(?:([<>=]{1,2})\s*(.*))?$/
186
+ match = dep_re.match(dep)
187
+ if match.nil?
188
+ @logger.error("Unable to parse dependency", :dependency => dep)
189
+ raise FPM::InvalidPackageConfiguration, "Invalid dependency '#{dep}'"
190
+ end
191
+ name, cmp, version = match.captures
154
192
  # dependency name prefixing is optional, if enabled, a name 'foo' will
155
193
  # become 'python-foo' (depending on what the python_package_name_prefix
156
194
  # is)
@@ -22,14 +22,14 @@ class FPM::Package::Solaris < FPM::Package
22
22
  "#{builddir}/pkginfo"
23
23
  end
24
24
 
25
- def build!(params)
25
+ def output(output_path)
26
26
  self.scripts.each do |name, path|
27
27
  case name
28
28
  when "pre-install"
29
- safesystem("cp #{path} ./preinstall")
29
+ safesystem("cp", path, "./preinstall")
30
30
  File.chmod(0755, "./preinstall")
31
31
  when "post-install"
32
- safesystem("cp #{path} ./postinstall")
32
+ safesystem("cp", path, "./postinstall")
33
33
  File.chmod(0755, "./postinstall")
34
34
  when "pre-uninstall"
35
35
  raise FPM::InvalidPackageConfiguration.new(
@@ -42,25 +42,21 @@ class FPM::Package::Solaris < FPM::Package
42
42
  end # case name
43
43
  end # self.scripts.each
44
44
 
45
- # Unpack data.tar.gz so we can build a package from it.
46
- Dir.mkdir("data")
47
- safesystem("gzip -d data.tar.gz");
48
- Dir.chdir("data") do
49
- safesystem("tar -xf ../data.tar");
45
+ template = template("solaris.erb")
46
+ File.open("#{build_path}/pkginfo", "w") do |pkginfo|
47
+ pkginfo.puts template.result(binding)
50
48
  end
51
49
 
52
- #system("(echo 'i pkginfo'; pkgproto data=/) > Prototype")
53
-
54
50
  # Generate the package 'Prototype' file
55
51
  # TODO(sissel): allow setting default file owner.
56
- File.open("Prototype", "w") do |prototype|
52
+ File.open("#{build_path}/Prototype", "w") do |prototype|
57
53
  prototype.puts("i pkginfo")
58
54
  prototype.puts("i preinstall") if self.scripts["pre-install"]
59
55
  prototype.puts("i postinstall") if self.scripts["post-install"]
60
56
 
61
57
  # TODO(sissel): preinstall/postinstall
62
58
  # strip @prefix, since BASEDIR will set prefix via the pkginfo file
63
- IO.popen("pkgproto data/#{@prefix}=").each_line do |line|
59
+ IO.popen("pkgproto #{staging_path}/#{@prefix}=").each_line do |line|
64
60
  type, klass, path, mode, user, group = line.split
65
61
  # Override stuff in pkgproto
66
62
  # TODO(sissel): Make this tunable?
@@ -70,12 +66,16 @@ class FPM::Package::Solaris < FPM::Package
70
66
  end # popen "pkgproto ..."
71
67
  end # File prototype
72
68
 
73
- # Should create a package directory named by the package name.
74
- safesystem("pkgmk -o -d .")
69
+ ::Dir.chdir staging_path do
70
+ # Should create a package directory named by the package name.
71
+ safesystem("pkgmk", "-o", "-f", "#{build_path}/Prototype", "-d", build_path)
72
+ end
73
+
75
74
 
76
75
  # Convert the 'package directory' built above to a real solaris package.
77
- safesystem("pkgtrans -s . #{params[:output]} #{name}")
78
- end # def build
76
+ safesystem("pkgtrans", "-s", build_path, output_path, name)
77
+ safesystem("cp", "#{build_path}/#{output_path}", output_path)
78
+ end # def output
79
79
 
80
80
  def default_output
81
81
  v = version
@@ -1,3 +1,3 @@
1
1
  module FPM
2
- VERSION = "0.4.23"
2
+ VERSION = "0.4.24"
3
3
  end
@@ -40,7 +40,11 @@ License: <%= license.gsub("\n", " ") %>
40
40
  <% if !vendor.nil? and !vendor.empty? -%>
41
41
  Vendor: <%= vendor %>
42
42
  <% end -%>
43
- URL: <%= url or "http://nourlgiven.example.com/" %>
43
+ <% if !url.nil? and !url.empty? -%>
44
+ URL: <%= url %>
45
+ <%else -%>
46
+ URL: http://nourlgiven.example.com/
47
+ <% end -%>
44
48
  Packager: <%= maintainer %>
45
49
 
46
50
  <% if !attributes[:no_depends?] -%>
@@ -1,7 +1,7 @@
1
1
  CLASSES=none
2
- BASEDIR=<%= prefix %>
3
2
  TZ=PST
4
3
  PATH=/sbin:/usr/sbin:/usr/bin:/usr/sadm/install/bin
4
+ BASEDIR=/
5
5
  PKG=<%= name %>
6
6
  NAME=<%= name %>
7
7
  ARCH=<%= architecture %>
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.23
4
+ version: 0.4.24
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-11-27 00:00:00.000000000 Z
12
+ date: 2012-11-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -149,32 +149,34 @@ executables:
149
149
  extensions: []
150
150
  extra_rdoc_files: []
151
151
  files:
152
- - lib/fpm.rb
153
- - lib/fpm/errors.rb
152
+ - lib/fpm/command.rb
154
153
  - lib/fpm/namespace.rb
155
154
  - lib/fpm/package.rb
155
+ - lib/fpm/package/pyfpm/get_metadata.pyc
156
+ - lib/fpm/package/pyfpm/get_metadata.py
157
+ - lib/fpm/package/pyfpm/__init__.pyc
158
+ - lib/fpm/package/pyfpm/__init__.py
159
+ - lib/fpm/package/tar.rb
156
160
  - lib/fpm/package/deb.rb
157
161
  - lib/fpm/package/dir.rb
158
- - lib/fpm/package/npm.rb
159
- - lib/fpm/package/pear.rb
160
162
  - lib/fpm/package/puppet.rb
161
- - lib/fpm/package/pyfpm/__init__.py
162
- - lib/fpm/package/pyfpm/get_metadata.py
163
+ - lib/fpm/package/gem.rb
163
164
  - lib/fpm/package/python.rb
164
- - lib/fpm/package/rpm.rb
165
165
  - lib/fpm/package/solaris.rb
166
- - lib/fpm/package/tar.rb
167
- - lib/fpm/package/gem.rb
168
- - lib/fpm/util.rb
169
- - lib/fpm/command.rb
166
+ - lib/fpm/package/rpm.rb
167
+ - lib/fpm/package/npm.rb
168
+ - lib/fpm/package/pear.rb
170
169
  - lib/fpm/version.rb
171
- - bin/fpm
170
+ - lib/fpm/errors.rb
171
+ - lib/fpm/util.rb
172
+ - lib/fpm.rb
172
173
  - bin/fpm-npm
173
- - templates/deb.erb
174
- - templates/puppet/package.pp.erb
175
- - templates/puppet/package/remove.pp.erb
174
+ - bin/fpm
176
175
  - templates/solaris.erb
177
176
  - templates/rpm.erb
177
+ - templates/deb.erb
178
+ - templates/puppet/package/remove.pp.erb
179
+ - templates/puppet/package.pp.erb
178
180
  - LICENSE
179
181
  - CONTRIBUTORS
180
182
  - CHANGELIST