fpm 1.12.0 → 1.13.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28f939bd20768768cb05026a39c8a270596368c654ec5606a43a0e75afa845ad
4
- data.tar.gz: 0d7eea7108832e79994ba3ee9511c3715b384906f7ef3a2ab5e907cfc764609a
3
+ metadata.gz: f231a03d2baac73ae0f4f8f15094237ca94ec43de51ef0b86dde886a8647efa2
4
+ data.tar.gz: 91666a6a7b09b6f3ab3bb6dccf32e647d58a43754d2163a4748ae8a2e14515e8
5
5
  SHA512:
6
- metadata.gz: 555edd6cd5d4b0098e075011e48db96e52c454b8557735a51202307dcaeb4920a5efe93bb6d99cedf9d3ff95ff445c37059e1fc308e0602482977587d532e4b1
7
- data.tar.gz: 2803ea8cb3af495d5fd20e75bee0eba11dc262ac59b86e63b75ef3cef7417440e88e1fec9172f7a1ea5cf0705e2ce36bc65e7b9c1c5469eb0e78b292ac822716
6
+ metadata.gz: b21d482730c5e532f9bf6f9e7faf51bf712aa9f75ebab9b8453d1f1b9cd9f1e0ef5a32bb84f18808bc5bc8c15a8e1c47546ad1d474e9c3c581eaa7afe85e80b9
7
+ data.tar.gz: 72963da4b7601fa8d416ab20ce26e15838960b7dca9c364b38312266857e3beb9b11b32a9c708ff393a612f0e5ff350b6098fd794c4b5b05fe767c0a4323dfdd
data/CHANGELOG.rst CHANGED
@@ -1,6 +1,21 @@
1
1
  Release Notes and Change Log
2
2
  ============================
3
3
 
4
+ 1.13.0 (June 19, 2021)
5
+ ^^^^^^^^^^^^^^^^^^^^^^
6
+ * Apple M1 users should now work (`#1772`_, `#1785`_, `#1786`_; Jordan Sissel)
7
+ * Removed `ffi` ruby library as a dependency. This should make it easier to support a wider range of Ruby versions (Ruby 2.2, 3.0, etc) and platforms (like arm64, Apple M1, etc) in the future. (`#1785`_, `#1786`_; Jordan Sissel)
8
+ * Now uses the correct architecture synonym for ARM 64 systems. Debian uses `arm64` as a synonym for what other systems call `aarch64` (linux kernel, RPM, Arch Linux). (`#1775`_; Steve Kamerman)
9
+ * Docs: Fix a typo in an example (`#1785`_; Zoe O'Connell)
10
+ * rpm: File paths can now contain single-quote characters (`#1774`_; Jordan Sissel)
11
+ * rpm: Use correct SPEC syntax when using --after-upgrade or similar features (`#1761`_; Jo Vandeginste. Robert Fielding)
12
+ * Ruby 3.0 support: Added `rexml` as a runtime dependency. In Ruby 2.0, `rexml` came by default, but in Ruby 3.0, `rexml` is now a bundled gem and some distributiosn do not include it by default. (`#1794`_; Jordan Sissel)
13
+ * Fix error "git: not found (Git::GitExecuteError)". Now loads `git` library only when using git features. (`#1753`_, `#1748`_, `#1751`_, `#1766`_; Jordan Sissel, Cameron Nemo, Jason Rogers, Luke Short)
14
+ * deb: Fix syntax error in `postinst` (`--after-install`) script. (`#1752`_, `#1749`_, `#1764`_; rmanus, Adam Mohammed, Elliot Murphy, kimw, Jordan Sissel)
15
+ * deb: --deb-compression now uses the same compression and file suffix on the control.tar file (`#1760`_; Philippe Poilbarbe
16
+ )
17
+
18
+
4
19
  1.12.0 (January 19, 2021)
5
20
  ^^^^^^^^^^^^^^^^^^^^^^^^^
6
21
 
@@ -178,7 +178,7 @@ class FPM::Package::Deb < FPM::Package
178
178
  end
179
179
 
180
180
  option "--systemd", "FILEPATH", "Add FILEPATH as a systemd script",
181
- :multivalued => true do |file|
181
+ :multivalued => true do |file|
182
182
  next File.expand_path(file)
183
183
  end
184
184
 
@@ -228,6 +228,9 @@ class FPM::Package::Deb < FPM::Package
228
228
  when "x86_64"
229
229
  # Debian calls x86_64 "amd64"
230
230
  @architecture = "amd64"
231
+ when "aarch64"
232
+ # Debian calls aarch64 "arm64"
233
+ @architecture = "arm64"
231
234
  when "noarch"
232
235
  # Debian calls noarch "all"
233
236
  @architecture = "all"
@@ -588,15 +591,19 @@ class FPM::Package::Deb < FPM::Package
588
591
  case self.attributes[:deb_compression]
589
592
  when "gz", nil
590
593
  datatar = build_path("data.tar.gz")
594
+ controltar = build_path("control.tar.gz")
591
595
  compression = "-z"
592
596
  when "bzip2"
593
597
  datatar = build_path("data.tar.bz2")
598
+ controltar = build_path("control.tar.bz2")
594
599
  compression = "-j"
595
600
  when "xz"
596
601
  datatar = build_path("data.tar.xz")
602
+ controltar = build_path("control.tar.xz")
597
603
  compression = "-J"
598
604
  when "none"
599
605
  datatar = build_path("data.tar")
606
+ controltar = build_path("control.tar")
600
607
  compression = ""
601
608
  else
602
609
  raise FPM::InvalidPackageConfiguration,
@@ -616,7 +623,7 @@ class FPM::Package::Deb < FPM::Package
616
623
  # the 'debian-binary' file has to be first
617
624
  File.expand_path(output_path).tap do |output_path|
618
625
  ::Dir.chdir(build_path) do
619
- safesystem(*ar_cmd, output_path, "debian-binary", "control.tar.gz", datatar)
626
+ safesystem(*ar_cmd, output_path, "debian-binary", controltar, datatar)
620
627
  end
621
628
  end
622
629
 
@@ -17,10 +17,6 @@ class FPM::Package::FreeBSD < FPM::Package
17
17
  :default => "fpm/<name>"
18
18
 
19
19
  def output(output_path)
20
- # See https://github.com/jordansissel/fpm/issues/1090
21
- # require xz later, because this triggers a load of liblzma.so.5 that is
22
- # unavailable on older CentOS/RH distros.
23
- require "xz"
24
20
  output_check(output_path)
25
21
 
26
22
  # Build the packaging metadata files.
@@ -80,22 +76,19 @@ class FPM::Package::FreeBSD < FPM::Package
80
76
  file.write(pkgdata.to_json + "\n")
81
77
  end
82
78
 
83
- # Create the .txz package archive from the files in staging_path.
84
- File.open(output_path, "wb") do |file|
85
- XZ::StreamWriter.new(file) do |xz|
86
- FPM::Util::TarWriter.new(xz) do |tar|
87
- # The manifests must come first for pkg.
88
- add_path(tar, "+COMPACT_MANIFEST",
89
- File.join(staging_path, "+COMPACT_MANIFEST"))
90
- add_path(tar, "+MANIFEST",
91
- File.join(staging_path, "+MANIFEST"))
92
-
93
- checksums.keys.each do |path|
94
- add_path(tar, "/" + path, File.join(staging_path, path))
95
- end
96
- end
97
- end
79
+ file_list = File.new(build_path("file_list"), "w")
80
+ files.each do |i|
81
+ file_list.puts(i)
98
82
  end
83
+ file_list.close
84
+
85
+ # Create the .txz package archive from the files in staging_path.
86
+ # We use --files-from here to keep the tar entries from having `./` as the prefix.
87
+ # This is done as a best effor to mimic what FreeBSD packages do, having everything at the top-level as
88
+ # file names, like "+MANIFEST" instead of "./+MANIFEST"
89
+ # Note: This will include top-level files like "/usr/bin/foo" listed in the tar as "usr/bin/fo" without
90
+ # a leading slash. I don't know if this has any negative impact on freebsd packages.
91
+ safesystem("tar", "-Jcf", output_path, "-C", staging_path, "--files-from", build_path("file_list"))
99
92
  end # def output
100
93
 
101
94
  # Handle architecture naming conversion:
@@ -110,6 +103,8 @@ class FPM::Package::FreeBSD < FPM::Package
110
103
  wordsize = case @architecture
111
104
  when nil, 'native'
112
105
  %x{getconf LONG_BIT}.chomp # 'native' is current arch
106
+ when 'arm64'
107
+ '64'
113
108
  when 'amd64'
114
109
  '64'
115
110
  when 'i386'
@@ -4,7 +4,6 @@ require "rubygems"
4
4
  require "fileutils"
5
5
  require "fpm/util"
6
6
  require "yaml"
7
- require "git"
8
7
 
9
8
  # A rubygems package.
10
9
  #
@@ -105,6 +104,7 @@ class FPM::Package::Gem < FPM::Package
105
104
  FileUtils.mkdir(download_dir) unless File.directory?(download_dir)
106
105
 
107
106
  if attributes[:gem_git_repo]
107
+ require "git"
108
108
  logger.debug("Git cloning in directory #{download_dir}")
109
109
  g = Git.clone(attributes[:gem_git_repo],gem_name,:path => download_dir)
110
110
  if attributes[:gem_git_branch]
@@ -190,14 +190,15 @@ class FPM::Package::RPM < FPM::Package
190
190
  # Replace ? with [?] to make rpm not use globs
191
191
  # Replace % with [%] to make rpm not expand macros
192
192
  def rpm_fix_name(name)
193
- name = name.gsub(/(\ |\[|\]|\*|\?|\%|\$)/, {
193
+ name = name.gsub(/(\ |\[|\]|\*|\?|\%|\$|')/, {
194
194
  ' ' => '?',
195
195
  '%' => '[%]',
196
196
  '$' => '[$]',
197
197
  '?' => '[?]',
198
198
  '*' => '[*]',
199
199
  '[' => '[\[]',
200
- ']' => '[\]]'
200
+ ']' => '[\]]',
201
+ "'" => "\\'",
201
202
  })
202
203
  end
203
204
 
@@ -239,6 +240,8 @@ class FPM::Package::RPM < FPM::Package
239
240
  return %x{uname -m}.chomp # default to current arch
240
241
  when "amd64" # debian and redhat disagree on architecture names
241
242
  return "x86_64"
243
+ when "arm64" # debian and redhat disagree on architecture names
244
+ return "aarch64"
242
245
  when "native"
243
246
  return %x{uname -m}.chomp # 'native' is current arch
244
247
  when "all"
data/lib/fpm/util.rb CHANGED
@@ -1,21 +1,8 @@
1
1
  require "fpm/namespace"
2
- require "childprocess"
3
- require "ffi"
4
2
  require "fileutils"
5
3
 
6
4
  # Some utility functions
7
5
  module FPM::Util
8
- extend FFI::Library
9
- ffi_lib FFI::Library::LIBC
10
-
11
- # mknod is __xmknod in glibc a wrapper around mknod to handle
12
- # various stat struct formats. See bits/stat.h in glibc source
13
- begin
14
- attach_function :mknod, :mknod, [:string, :uint, :ulong], :int
15
- rescue FFI::NotFoundError
16
- # glibc/io/xmknod.c int __xmknod (int vers, const char *path, mode_t mode, dev_t *dev)
17
- attach_function :xmknod, :__xmknod, [:int, :string, :uint, :pointer], :int
18
- end
19
6
 
20
7
  # Raised if safesystem cannot find the program to run.
21
8
  class ExecutableNotFound < StandardError; end
@@ -23,6 +10,12 @@ module FPM::Util
23
10
  # Raised if a safesystem program exits nonzero
24
11
  class ProcessFailed < StandardError; end
25
12
 
13
+ # Raised when a named pipe cannot be copied due to missing functions in fpm and ruby.
14
+ class NamedPipeCannotBeCopied < StandardError; end
15
+
16
+ # Raised when an attempting to copy a special file such as a block device.
17
+ class UnsupportedSpecialFile < StandardError; end
18
+
26
19
  # Is the given program in the system's PATH?
27
20
  def program_in_path?(program)
28
21
  # return false if path is not set
@@ -146,31 +139,22 @@ module FPM::Util
146
139
 
147
140
  stdout_r, stdout_w = IO.pipe
148
141
  stderr_r, stderr_w = IO.pipe
142
+ stdin_r, stdin_w = IO.pipe
149
143
 
150
- process = ChildProcess.build(*args2)
151
- process.environment.merge!(env)
152
-
153
- process.io.stdout = stdout_w
154
- process.io.stderr = stderr_w
155
-
156
- if block_given? and opts[:stdin]
157
- process.duplex = true
158
- end
159
-
160
- process.start
144
+ pid = Process.spawn(env, *args2, :out => stdout_w, :err => stderr_w, :in => stdin_r)
161
145
 
162
146
  stdout_w.close; stderr_w.close
163
- logger.debug("Process is running", :pid => process.pid)
147
+ logger.debug("Process is running", :pid => pid)
164
148
  if block_given?
165
149
  args3 = []
166
150
  args3.push(process) if opts[:process]
167
- args3.push(process.io.stdin) if opts[:stdin]
151
+ args3.push(stdin_w) if opts[:stdin]
168
152
  args3.push(stdout_r) if opts[:stdout]
169
153
  args3.push(stderr_r) if opts[:stderr]
170
154
 
171
155
  yield(*args3)
172
156
 
173
- process.io.stdin.close if opts[:stdin] and not process.io.stdin.closed?
157
+ stdin_w_close if opts[:stdin] and not stdin_w.closed?
174
158
  stdout_r.close unless stdout_r.closed?
175
159
  stderr_r.close unless stderr_r.closed?
176
160
  else
@@ -179,9 +163,10 @@ module FPM::Util
179
163
  logger.pipe(stdout_r => :info, stderr_r => :info)
180
164
  end
181
165
 
182
- process.wait if process.alive?
166
+ Process.waitpid(pid)
167
+ status = $?
183
168
 
184
- return process.exit_code
169
+ return status.exitstatus
185
170
  end # def execmd
186
171
 
187
172
  # Run a command safely in a way that gets reports useful errors.
@@ -316,19 +301,6 @@ module FPM::Util
316
301
  return @@tar_cmd_deterministic
317
302
  end
318
303
 
319
- # wrapper around mknod ffi calls
320
- def mknod_w(path, mode, dev)
321
- rc = -1
322
- case %x{uname -s}.chomp
323
- when 'Linux'
324
- # bits/stat.h #define _MKNOD_VER_LINUX 0
325
- rc = xmknod(0, path, mode, FFI::MemoryPointer.new(dev))
326
- else
327
- rc = mknod(path, mode, dev)
328
- end
329
- rc
330
- end
331
-
332
304
  def copy_metadata(source, destination)
333
305
  source_stat = File::lstat(source)
334
306
  dest_stat = File::lstat(destination)
@@ -354,10 +326,21 @@ module FPM::Util
354
326
 
355
327
  def copy_entry(src, dst, preserve=false, remove_destination=false)
356
328
  case File.ftype(src)
357
- when 'fifo', 'characterSpecial', 'blockSpecial', 'socket'
358
- st = File.stat(src)
359
- rc = mknod_w(dst, st.mode, st.dev)
360
- raise SystemCallError.new("mknod error", FFI.errno) if rc == -1
329
+ when 'fifo'
330
+ if File.respond_to?(:mkfifo)
331
+ File.mkfifo(dst)
332
+ elsif program_exists?("mkfifo")
333
+ safesystem("mkfifo", dst)
334
+ else
335
+ raise NamedPipeCannotBeCopied("Unable to copy. Cannot find program 'mkfifo' and Ruby is missing the 'File.mkfifo' method: #{src}")
336
+ end
337
+ when 'socket'
338
+ require "socket"
339
+ # In 2019, Ruby's FileUtils added this as a way to "copy" a unix socket.
340
+ # Reference: https://github.com/ruby/fileutils/pull/36/files
341
+ UNIXServer.new(dst).close()
342
+ when 'characterSpecial', 'blockSpecial'
343
+ raise UnsupportedSpecialFile.new("File is device which fpm doesn't know how to copy (#{File.ftype(src)}): #{src}")
361
344
  when 'directory'
362
345
  FileUtils.mkdir(dst) unless File.exists? dst
363
346
  else
data/lib/fpm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module FPM
2
- VERSION = "1.12.0"
2
+ VERSION = "1.13.0"
3
3
  end
@@ -20,6 +20,7 @@ debsystemctl=$(command -v deb-systemd-invoke || echo systemctl)
20
20
  <% attributes[:deb_systemd].each do |service| -%>
21
21
  if ! systemctl is-enabled <%= service %> >/dev/null
22
22
  then
23
+ : # Ensure this if-clause is not empty. If it were empty, and we had an 'else', then it is an error in shell syntax
23
24
  <% if attributes[:deb_systemd_enable?]-%>
24
25
  systemctl enable <%= service %> >/dev/null || true
25
26
  <% end -%>
data/templates/rpm.erb CHANGED
@@ -126,7 +126,7 @@ Obsoletes: <%= repl %>
126
126
  -%>
127
127
  <% if script?(:before_upgrade) or script?(:after_upgrade) -%>
128
128
  <% if script?(:before_upgrade) or script?(:before_install) -%>
129
- %pre <% if attributes[:rpm_macro_expansion?] -%><%= " -e " %> <% end -%>
129
+ %pre <% if attributes[:rpm_macro_expansion?] -%><%= " -e " %> <% end %>
130
130
  upgrade() {
131
131
  <%# Making sure that at least one command is in the function -%>
132
132
  <%# avoids a lot of potential errors, including the case that -%>
@@ -156,7 +156,7 @@ then
156
156
  fi
157
157
  <% end -%>
158
158
  <% if script?(:after_upgrade) or script?(:after_install) -%>
159
- %post <% if attributes[:rpm_macro_expansion?] -%><%= " -e " %> <% end -%>
159
+ %post <% if attributes[:rpm_macro_expansion?] -%><%= " -e " %> <% end %>
160
160
  upgrade() {
161
161
  <%# Making sure that at least one command is in the function -%>
162
162
  <%# avoids a lot of potential errors, including the case that -%>
@@ -186,7 +186,7 @@ then
186
186
  fi
187
187
  <% end -%>
188
188
  <% if script?(:before_remove) -%>
189
- %preun <% if attributes[:rpm_macro_expansion?] -%><%= " -e " %> <% end -%>
189
+ %preun <% if attributes[:rpm_macro_expansion?] -%><%= " -e " %> <% end %>
190
190
  if [ "${1}" -eq 0 ]
191
191
  then
192
192
  <%# Making sure that at least one command is in the function -%>
@@ -197,7 +197,7 @@ then
197
197
  fi
198
198
  <% end -%>
199
199
  <% if script?(:after_remove) -%>
200
- %postun <% if attributes[:rpm_macro_expansion?] -%><%= " -e " %> <% end -%>
200
+ %postun <% if attributes[:rpm_macro_expansion?] -%><%= " -e " %> <% end %>
201
201
  if [ "${1}" -eq 0 ]
202
202
  then
203
203
  <%# Making sure that at least one command is in the function -%>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.0
4
+ version: 1.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Sissel
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-19 00:00:00.000000000 Z
11
+ date: 2021-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -64,14 +64,14 @@ dependencies:
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: 0.0.10
67
+ version: 0.0.11
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: 0.0.10
74
+ version: 0.0.11
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: clamp
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -86,34 +86,6 @@ dependencies:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: 1.0.0
89
- - !ruby/object:Gem::Dependency
90
- name: childprocess
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - "<"
94
- - !ruby/object:Gem::Version
95
- version: 1.0.0
96
- type: :runtime
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - "<"
101
- - !ruby/object:Gem::Version
102
- version: 1.0.0
103
- - !ruby/object:Gem::Dependency
104
- name: ffi
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: 1.12.0
110
- type: :runtime
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - "~>"
115
- - !ruby/object:Gem::Version
116
- version: 1.12.0
117
89
  - !ruby/object:Gem::Dependency
118
90
  name: rake
119
91
  requirement: !ruby/object:Gem::Requirement
@@ -128,20 +100,6 @@ dependencies:
128
100
  - - "~>"
129
101
  - !ruby/object:Gem::Version
130
102
  version: '10'
131
- - !ruby/object:Gem::Dependency
132
- name: ruby-xz
133
- requirement: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - "~>"
136
- - !ruby/object:Gem::Version
137
- version: 0.2.3
138
- type: :runtime
139
- prerelease: false
140
- version_requirements: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - "~>"
143
- - !ruby/object:Gem::Version
144
- version: 0.2.3
145
103
  - !ruby/object:Gem::Dependency
146
104
  name: pleaserun
147
105
  requirement: !ruby/object:Gem::Requirement
@@ -190,6 +148,20 @@ dependencies:
190
148
  - - ">="
191
149
  - !ruby/object:Gem::Version
192
150
  version: '0'
151
+ - !ruby/object:Gem::Dependency
152
+ name: rexml
153
+ requirement: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ type: :runtime
159
+ prerelease: false
160
+ version_requirements: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ version: '0'
193
165
  - !ruby/object:Gem::Dependency
194
166
  name: rspec
195
167
  requirement: !ruby/object:Gem::Requirement
@@ -306,7 +278,7 @@ homepage: https://github.com/jordansissel/fpm
306
278
  licenses:
307
279
  - MIT-like
308
280
  metadata: {}
309
- post_install_message:
281
+ post_install_message:
310
282
  rdoc_options: []
311
283
  require_paths:
312
284
  - lib
@@ -322,9 +294,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
322
294
  - !ruby/object:Gem::Version
323
295
  version: '0'
324
296
  requirements: []
325
- rubyforge_project:
326
- rubygems_version: 2.7.6
327
- signing_key:
297
+ rubygems_version: 3.2.15
298
+ signing_key:
328
299
  specification_version: 4
329
300
  summary: fpm - package building and mangling
330
301
  test_files: []