fpm 1.11.0 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24a4dd08de1d4ad02888c110b88ab0d6fd590d4d913aba61ec459d126fb84d40
4
- data.tar.gz: d8c7e7867cff9198ee1d170a17534946a8cb82c1217ddb09d316f061e3be86d2
3
+ metadata.gz: 28f939bd20768768cb05026a39c8a270596368c654ec5606a43a0e75afa845ad
4
+ data.tar.gz: 0d7eea7108832e79994ba3ee9511c3715b384906f7ef3a2ab5e907cfc764609a
5
5
  SHA512:
6
- metadata.gz: df2cbe11e18c252ef87d75f724abb3de218be2b9050e8d1918c6d323ab49e02b84793a4de327f522f04eca2fa56d90d5ba50a56f49fb36f6d5e976f10a6b4e56
7
- data.tar.gz: 3b93a0208cb451ee13c4cdc65adec6e68c46e2619f2d54114cfa6e4745be52d28ba12223701fc496866c4878b914f896232a389b0f37f07667c80224f6724933
6
+ metadata.gz: 555edd6cd5d4b0098e075011e48db96e52c454b8557735a51202307dcaeb4920a5efe93bb6d99cedf9d3ff95ff445c37059e1fc308e0602482977587d532e4b1
7
+ data.tar.gz: 2803ea8cb3af495d5fd20e75bee0eba11dc262ac59b86e63b75ef3cef7417440e88e1fec9172f7a1ea5cf0705e2ce36bc65e7b9c1c5469eb0e78b292ac822716
@@ -1,6 +1,23 @@
1
1
  Release Notes and Change Log
2
2
  ============================
3
3
 
4
+ 1.12.0 (January 19, 2021)
5
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
6
+
7
+ * Pin ffi dependency to ruby ffi 1.12.x to try keeping fpm compatible with older/abandoned rubies like 2.0 and 2.1. (`#1709`_; Matt Patterson)
8
+ * deb: New flag to add 'set -e' to all scripts. `--deb-maintainerscripts-force-errorchecks` which defaults to off. (`#1697`_; Andreas Ulm)
9
+ * deb: Fix bug when converting rubygems to debs where certain constraints like `~>1` would generate a deb dependency that couldn't be satisfied. (`#1699`_; Vlastimil Holer)
10
+ * deb: Fix error 'uninitialized constant FPM::Package::Deb::Zlib' (`#1739`_, `#1740`_; Federico Lancerin)
11
+ * python: Prepend to PYTHONPATH instead of replacing it. This should help on platforms that rely heavily on PYTHONPATH, such as NixOSX (`#1711`_, `#1710`_; anarg)
12
+ * python: Add `--python-trusted-host` flag which passes `--trusted-host` flag to `pip` (`#1737`_; Vladimir Ponarevsky)
13
+ * Documentation improvements (`#1724`_, `#1738`_, `#1667`_, `#1636`_)
14
+ * Dockerfile updated to Alpine 3.12 (`#1745`_; Cameron Nemo)
15
+ * Remove the 'backports' deprecation warning (`#1727`_; Jose Galvez)
16
+ * sh: Performance improvement when printing package metadata (`#1729`_; James Logsdon, Ed Healy)
17
+ * rpm: Add support for `xzmt` compression (multithreaded xz compressor) to help when creating very large packages (several gigabytes). (`#1447`_, `#1419`_; amnobc)
18
+ * rpm: Add `--rpm-macro-expansion` flag to enable macro expansion in scripts during rpmbuild. See https://rpm.org/user_doc/scriptlet_expansion.html for more details. (`#1642`_; juliantrzeciak)
19
+ * deb: use correct control.tar filename (`#1668`_; Mike Perham)
20
+
4
21
  1.11.0 (January 30, 2019)
5
22
  ^^^^^^^^^^^^^^^^^^^^^^^^^
6
23
 
@@ -4,7 +4,7 @@ require "pathname" # stdlib
4
4
  require "find"
5
5
  require "tmpdir" # stdlib
6
6
  require "ostruct"
7
- require "backports/2.0.0/stdlib/ostruct"
7
+ require "backports/latest"
8
8
  require "socket" # stdlib, for Socket.gethostname
9
9
  require "shellwords" # stdlib, for Shellwords.escape
10
10
  require "erb" # stdlib, for template processing
@@ -316,7 +316,7 @@ class FPM::Package
316
316
  # the path before returning.
317
317
  #
318
318
  # Wrapping Find.find in an Enumerator is required for sane operation in ruby 1.8.7,
319
- # but requires the 'backports' gem (which is used in other places in fpm)
319
+ # but requires the 'backports/latest' gem (which is used in other places in fpm)
320
320
  return Enumerator.new { |y| Find.find(staging_path) { |path| y << path } } \
321
321
  .select { |path| path != staging_path } \
322
322
  .select { |path| is_leaf.call(path) } \
@@ -3,7 +3,7 @@ require "fpm/namespace"
3
3
  require "fpm/package"
4
4
  require "fpm/errors"
5
5
  require "fpm/util"
6
- require "backports"
6
+ require "backports/latest"
7
7
  require "fileutils"
8
8
  require "digest"
9
9
  require 'digest/sha1'
@@ -3,9 +3,10 @@ require "fpm/namespace"
3
3
  require "fpm/package"
4
4
  require "fpm/errors"
5
5
  require "fpm/util"
6
- require "backports"
6
+ require "backports/latest"
7
7
  require "fileutils"
8
8
  require "digest"
9
+ require "zlib"
9
10
 
10
11
  # Support for debian packages (.deb files)
11
12
  #
@@ -181,6 +182,10 @@ class FPM::Package::Deb < FPM::Package
181
182
  next File.expand_path(file)
182
183
  end
183
184
 
185
+ option "--systemd-enable", :flag , "Enable service on install or upgrade", :default => false
186
+
187
+ option "--systemd-auto-start", :flag , "Start service after install or upgrade", :default => false
188
+
184
189
  option "--systemd-restart-after-upgrade", :flag , "Restart service after upgrade", :default => true
185
190
 
186
191
  option "--after-purge", "FILE",
@@ -189,6 +194,11 @@ class FPM::Package::Deb < FPM::Package
189
194
  File.expand_path(val) # Get the full path to the script
190
195
  end # --after-purge
191
196
 
197
+ option "--maintainerscripts-force-errorchecks", :flag ,
198
+ "Activate errexit shell option according to lintian. " \
199
+ "https://lintian.debian.org/tags/maintainer-script-ignores-errors.html",
200
+ :default => false
201
+
192
202
  def initialize(*args)
193
203
  super(*args)
194
204
  attributes[:deb_priority] = "extra"
@@ -453,6 +463,7 @@ class FPM::Package::Deb < FPM::Package
453
463
  raise "#{name}: tar is insufficient to support source_date_epoch."
454
464
  end
455
465
 
466
+ attributes[:deb_systemd] = []
456
467
  attributes.fetch(:deb_systemd_list, []).each do |systemd|
457
468
  name = File.basename(systemd, ".service")
458
469
  dest_systemd = staging_path("lib/systemd/system/#{name}.service")
@@ -460,19 +471,19 @@ class FPM::Package::Deb < FPM::Package
460
471
  FileUtils.cp(systemd, dest_systemd)
461
472
  File.chmod(0644, dest_systemd)
462
473
 
463
- # set the attribute with the systemd service name
464
- attributes[:deb_systemd] = name
474
+ # add systemd service name to attribute
475
+ attributes[:deb_systemd] << name
465
476
  end
466
477
 
467
- if script?(:before_upgrade) or script?(:after_upgrade) or attributes[:deb_systemd]
478
+ if script?(:before_upgrade) or script?(:after_upgrade) or attributes[:deb_systemd].any?
468
479
  puts "Adding action files"
469
480
  if script?(:before_install) or script?(:before_upgrade)
470
481
  scripts[:before_install] = template("deb/preinst_upgrade.sh.erb").result(binding)
471
482
  end
472
- if script?(:before_remove) or attributes[:deb_systemd]
483
+ if script?(:before_remove) or not attributes[:deb_systemd].empty?
473
484
  scripts[:before_remove] = template("deb/prerm_upgrade.sh.erb").result(binding)
474
485
  end
475
- if script?(:after_install) or script?(:after_upgrade) or attributes[:deb_systemd]
486
+ if script?(:after_install) or script?(:after_upgrade) or attributes[:deb_systemd].any?
476
487
  scripts[:after_install] = template("deb/postinst_upgrade.sh.erb").result(binding)
477
488
  end
478
489
  if script?(:after_remove)
@@ -710,8 +721,13 @@ class FPM::Package::Deb < FPM::Package
710
721
  name, version = dep.gsub(/[()~>]/, "").split(/ +/)[0..1]
711
722
  nextversion = version.split(".").collect { |v| v.to_i }
712
723
  l = nextversion.length
713
- nextversion[l-2] += 1
714
- nextversion[l-1] = 0
724
+ if l > 1
725
+ nextversion[l-2] += 1
726
+ nextversion[l-1] = 0
727
+ else
728
+ # Single component versions ~> 1
729
+ nextversion[l-1] += 1
730
+ end
715
731
  nextversion = nextversion.join(".")
716
732
  return ["#{name} (>= #{version})", "#{name} (<< #{nextversion})"]
717
733
  elsif (m = dep.match(/(\S+)\s+\(!= (.+)\)/))
@@ -780,16 +796,16 @@ class FPM::Package::Deb < FPM::Package
780
796
  # Tar up the staging_path into control.tar.{compression type}
781
797
  case self.attributes[:deb_compression]
782
798
  when "gz", nil
783
- controltar = build_path("control.tar.gz")
799
+ controltar = "control.tar.gz"
784
800
  compression = "-z"
785
801
  when "bzip2"
786
- controltar = build_path("control.tar.bz2")
802
+ controltar = "control.tar.bz2"
787
803
  compression = "-j"
788
804
  when "xz"
789
- controltar = build_path("control.tar.xz")
805
+ controltar = "control.tar.xz"
790
806
  compression = "-J"
791
807
  when "none"
792
- controltar = build_path("control.tar")
808
+ controltar = "control.tar"
793
809
  compression = ""
794
810
  else
795
811
  raise FPM::InvalidPackageConfiguration,
@@ -797,7 +813,7 @@ class FPM::Package::Deb < FPM::Package
797
813
  end
798
814
 
799
815
  # Make the control.tar.gz
800
- build_path("control.tar.gz").tap do |controltar|
816
+ build_path(controltar).tap do |controltar|
801
817
  logger.info("Creating", :path => controltar, :from => control_path)
802
818
 
803
819
  args = [ tar_cmd, "-C", control_path, compression, "-cf", controltar,
@@ -1,6 +1,6 @@
1
1
  require "fpm/package"
2
2
  require "fpm/util"
3
- require "backports"
3
+ require "backports/latest"
4
4
  require "fileutils"
5
5
  require "find"
6
6
  require "socket"
@@ -83,8 +83,8 @@ class FPM::Package::Dir < FPM::Package
83
83
  # can include license data from themselves (rpms, gems, etc),
84
84
  # but to make sure a simple dir -> rpm works without having
85
85
  # to specify a license.
86
- self.license = "unknown"
87
- self.vendor = [ENV["USER"], Socket.gethostname].join("@")
86
+ self.license ||= "unknown"
87
+ self.vendor ||= [ENV["USER"], Socket.gethostname].join("@")
88
88
  ensure
89
89
  # Clean up any logger context we added.
90
90
  logger.remove("method")
@@ -1,5 +1,5 @@
1
1
  require "fpm/package"
2
- require "backports"
2
+ require "backports/latest"
3
3
 
4
4
  # Empty Package type. For strict/meta/virtual package creation
5
5
 
@@ -1,4 +1,4 @@
1
- require "backports" # gem backports
1
+ require "backports/latest" # gem backports/latest
2
2
  require "fpm/package"
3
3
  require "fpm/util"
4
4
  require "digest"
@@ -4,6 +4,7 @@ require "rubygems"
4
4
  require "fileutils"
5
5
  require "fpm/util"
6
6
  require "yaml"
7
+ require "git"
7
8
 
8
9
  # A rubygems package.
9
10
  #
@@ -53,6 +54,15 @@ class FPM::Package::Gem < FPM::Package
53
54
  "The directory where fpm installs the gem temporarily before conversion. " \
54
55
  "Normally a random subdirectory of workdir."
55
56
 
57
+ option "--git-repo", "GIT_REPO",
58
+ "Use this git repo address as the source of the gem instead of " \
59
+ "rubygems.org.", :default => nil
60
+
61
+ option "--git-branch", "GIT_BRANCH",
62
+ "When using a git repo as the source of the gem instead of " \
63
+ "rubygems.org, use this git branch.",
64
+ :default => nil
65
+
56
66
  # Override parent method
57
67
  def staging_path(path=nil)
58
68
  @gem_staging_path ||= attributes[:gem_stagingdir] || Stud::Temporary.directory("package-#{type}-staging")
@@ -91,21 +101,33 @@ class FPM::Package::Gem < FPM::Package
91
101
 
92
102
  logger.info("Trying to download", :gem => gem_name, :version => gem_version)
93
103
 
94
- gem_fetch = [ "#{attributes[:gem_gem]}", "fetch", gem_name]
95
-
96
- gem_fetch += ["--prerelease"] if attributes[:gem_prerelease?]
97
- gem_fetch += ["--version", gem_version] if gem_version
98
-
99
104
  download_dir = build_path(gem_name)
100
105
  FileUtils.mkdir(download_dir) unless File.directory?(download_dir)
101
106
 
102
- ::Dir.chdir(download_dir) do |dir|
103
- logger.debug("Downloading in directory #{dir}")
104
- safesystem(*gem_fetch)
107
+ if attributes[:gem_git_repo]
108
+ logger.debug("Git cloning in directory #{download_dir}")
109
+ g = Git.clone(attributes[:gem_git_repo],gem_name,:path => download_dir)
110
+ if attributes[:gem_git_branch]
111
+ g.branch(attributes[:gem_git_branch]).checkout
112
+ g.pull('origin',attributes[:gem_git_branch])
113
+ end
114
+ gem_build = [ "#{attributes[:gem_gem]}", "build", "#{g.dir.to_s}/#{gem_name}.gemspec"]
115
+ ::Dir.chdir(g.dir.to_s) do |dir|
116
+ logger.debug("Building in directory #{dir}")
117
+ safesystem(*gem_build)
118
+ end
119
+ gem_files = ::Dir.glob(File.join(g.dir.to_s, "*.gem"))
120
+ else
121
+ gem_fetch = [ "#{attributes[:gem_gem]}", "fetch", gem_name]
122
+ gem_fetch += ["--prerelease"] if attributes[:gem_prerelease?]
123
+ gem_fetch += ["--version", gem_version] if gem_version
124
+ ::Dir.chdir(download_dir) do |dir|
125
+ logger.debug("Downloading in directory #{dir}")
126
+ safesystem(*gem_fetch)
127
+ end
128
+ gem_files = ::Dir.glob(File.join(download_dir, "*.gem"))
105
129
  end
106
130
 
107
- gem_files = ::Dir.glob(File.join(download_dir, "*.gem"))
108
-
109
131
  if gem_files.length != 1
110
132
  raise "Unexpected number of gem files in #{download_dir}, #{gem_files.length} should be 1"
111
133
  end
@@ -198,8 +220,13 @@ class FPM::Package::Gem < FPM::Package
198
220
 
199
221
  ::FileUtils.mkdir_p(installdir)
200
222
  # TODO(sissel): Allow setting gem tool path
201
- args = [attributes[:gem_gem], "install", "--quiet", "--no-ri", "--no-rdoc",
202
- "--no-user-install", "--install-dir", installdir]
223
+ args = [attributes[:gem_gem], "install", "--quiet", "--no-user-install", "--install-dir", installdir]
224
+ if ::Gem::VERSION =~ /^[012]\./
225
+ args += [ "--no-ri", "--no-rdoc" ]
226
+ else
227
+ # Rubygems 3.0.0 changed --no-ri to --no-document
228
+ args += [ "--no-document" ]
229
+ end
203
230
 
204
231
  if !attributes[:gem_embed_dependencies?]
205
232
  args += ["--ignore-dependencies"]
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require "fpm/package"
3
3
  require "fpm/util"
4
- require "backports"
4
+ require "backports/latest"
5
5
  require "fileutils"
6
6
  require "find"
7
7
 
@@ -18,10 +18,10 @@ class FPM::Package::Pacman < FPM::Package
18
18
  option "--group", "GROUP", "The group owner of files in this package", :default => 'root'
19
19
 
20
20
  # The list of supported compression types. Default is xz (LZMA2)
21
- COMPRESSION_TYPES = [ "gz", "bzip2", "xz", "none" ]
21
+ COMPRESSION_TYPES = [ "gz", "bzip2", "xz", "zstd", "none" ]
22
22
 
23
23
  option "--compression", "COMPRESSION", "The compression type to use, must " \
24
- "be one of #{COMPRESSION_TYPES.join(", ")}.", :default => "xz" do |value|
24
+ "be one of #{COMPRESSION_TYPES.join(", ")}.", :default => "zstd" do |value|
25
25
  if !COMPRESSION_TYPES.include?(value)
26
26
  raise ArgumentError, "Pacman compression value of '#{value}' is invalid. " \
27
27
  "Must be one of #{COMPRESSION_TYPES.join(", ")}"
@@ -209,31 +209,39 @@ class FPM::Package::Pacman < FPM::Package
209
209
 
210
210
  def compression_option
211
211
  case self.attributes[:pacman_compression]
212
- when nil, "xz"
213
- return "--xz"
212
+ when nil, "zstd"
213
+ return "--zstd"
214
214
  when "none"
215
215
  return ""
216
216
  when "gz"
217
217
  return "-z"
218
+ when "xz"
219
+ return "--xz"
218
220
  when "bzip2"
219
221
  return "-j"
222
+ when "zstd"
223
+ return "--zstd"
220
224
  else
221
- return "--xz"
225
+ return "--zstd"
222
226
  end
223
227
  end
224
228
 
225
229
  def compression_ending
226
230
  case self.attributes[:pacman_compression]
227
- when nil, "xz"
228
- return ".xz"
231
+ when nil, "zstd"
232
+ return ".zst"
229
233
  when "none"
230
234
  return ""
231
235
  when "gz"
232
236
  return ".gz"
237
+ when "zx"
238
+ return ".xz"
233
239
  when "bzip2"
234
240
  return ".bz2"
241
+ when "zstd"
242
+ return ".zst"
235
243
  else
236
- return ".xz"
244
+ return ".zst"
237
245
  end
238
246
  end
239
247
 
@@ -245,7 +253,11 @@ class FPM::Package::Pacman < FPM::Package
245
253
  Find.find(staging_path) do |path|
246
254
  src = path.gsub(/^#{staging_path}/, '')
247
255
  dst = build_path(src)
248
- copy_entry(path, dst, preserve=true, remove_destination=true)
256
+ begin
257
+ copy_entry(path, dst, preserve=true, remove_destination=true)
258
+ rescue
259
+ copy_entry(path, dst, preserve=false, remove_destination=true)
260
+ end
249
261
  copy_metadata(path, dst)
250
262
  end
251
263
 
@@ -29,6 +29,9 @@ class FPM::Package::Python < FPM::Package
29
29
  option "--pypi", "PYPI_URL",
30
30
  "PyPi Server uri for retrieving packages.",
31
31
  :default => "https://pypi.python.org/simple"
32
+ option "--trusted-host", "PYPI_TRUSTED",
33
+ "Mark this host or host:port pair as trusted for pip",
34
+ :default => nil
32
35
  option "--package-prefix", "NAMEPREFIX",
33
36
  "(DEPRECATED, use --package-name-prefix) Name to prefix the package " \
34
37
  "name with." do |value|
@@ -136,7 +139,31 @@ class FPM::Package::Python < FPM::Package
136
139
  else
137
140
  logger.debug("using pip", :pip => attributes[:python_pip])
138
141
  # TODO: Support older versions of pip
139
- safesystem(attributes[:python_pip], "download", "--no-clean", "--no-deps", "--no-binary", ":all:", "-i", attributes[:python_pypi], "--build", target, want_pkg)
142
+
143
+ setup_cmd = [
144
+ attributes[:python_pip],
145
+ "download",
146
+ "--no-clean",
147
+ "--no-deps",
148
+ "--no-binary",
149
+ ":all:",
150
+ "-i", attributes[:python_pypi],
151
+ ]
152
+
153
+ if attributes[:python_trusted_host]
154
+ setup_cmd += [
155
+ "--trusted-host",
156
+ attributes[:python_trusted_host],
157
+ ]
158
+ end
159
+
160
+ setup_cmd += [
161
+ "--build",
162
+ target,
163
+ want_pkg,
164
+ ]
165
+
166
+ safesystem(*setup_cmd)
140
167
  end
141
168
 
142
169
  # easy_install will put stuff in @tmpdir/packagename/, so find that:
@@ -183,7 +210,7 @@ class FPM::Package::Python < FPM::Package
183
210
 
184
211
  output = ::Dir.chdir(setup_dir) do
185
212
  tmp = build_path("metadata.json")
186
- setup_cmd = "env PYTHONPATH=#{pylib} #{attributes[:python_bin]} " \
213
+ setup_cmd = "env PYTHONPATH=#{pylib}:$PYTHONPATH #{attributes[:python_bin]} " \
187
214
  "setup.py --command-packages=pyfpm get_metadata --output=#{tmp}"
188
215
 
189
216
  if attributes[:python_obey_requirements_txt?]
@@ -1,5 +1,5 @@
1
1
  require "fpm/package"
2
- require "backports"
2
+ require "backports/latest"
3
3
  require "fileutils"
4
4
  require "find"
5
5
  require "arr-pm/file" # gem 'arr-pm'
@@ -24,10 +24,10 @@ class FPM::Package::RPM < FPM::Package
24
24
 
25
25
  COMPRESSION_MAP = {
26
26
  "none" => "w0.gzdio",
27
- "xz" => "w9.xzdio",
28
- "xzmt" => "w9T.xzdio",
29
- "gzip" => "w9.gzdio",
30
- "bzip2" => "w9.bzdio"
27
+ "xz" => ".xzdio",
28
+ "xzmt" => "T.xzdio",
29
+ "gzip" => ".gzdio",
30
+ "bzip2" => ".bzdio"
31
31
  } unless defined?(COMPRESSION_MAP)
32
32
 
33
33
  option "--use-file-permissions", :flag,
@@ -68,6 +68,15 @@ class FPM::Package::RPM < FPM::Package
68
68
  value.downcase
69
69
  end
70
70
 
71
+ option "--compression-level", "[0-9]", "Select a compression level. 0 is store-only. 9 is max compression.",
72
+ :default => "9" do |value|
73
+ valint = value.to_i
74
+ unless value =~ /^\d$/ && valint >= 0 && valint <= 9
75
+ raise "Invalid compression level '#{value}'. Valid values are integers between 0 and 9 inclusive."
76
+ end
77
+ valint
78
+ end
79
+
71
80
  option "--compression", COMPRESSION_MAP.keys.join("|"),
72
81
  "Select a compression method. gzip works on the most platforms.",
73
82
  :default => "gzip" do |value|
@@ -142,6 +151,10 @@ class FPM::Package::RPM < FPM::Package
142
151
  "names in rpm requires instead of the redhat style " \
143
152
  "rubygem(foo).", :default => false
144
153
 
154
+ option "--macro-expansion", :flag,
155
+ "install-time macro expansion in %pre %post %preun %postun scripts " \
156
+ "(see: https://rpm.org/user_doc/scriptlet_expansion.html)", :default => false
157
+
145
158
  option "--verifyscript", "FILE",
146
159
  "a script to be run on verification" do |val|
147
160
  File.expand_path(val) # Get the full path to the script
@@ -598,7 +611,12 @@ class FPM::Package::RPM < FPM::Package
598
611
  end # def to_s
599
612
 
600
613
  def payload_compression
601
- return COMPRESSION_MAP[attributes[:rpm_compression]]
614
+ if attributes[:rpm_compression] == 'none'
615
+ # when 'none' ignore any compression level and return w0.gzdio
616
+ return COMPRESSION_MAP[attributes[:rpm_compression]]
617
+ else
618
+ return "w#{attributes[:rpm_compression_level]}" + COMPRESSION_MAP[attributes[:rpm_compression]]
619
+ end
602
620
  end # def payload_compression
603
621
 
604
622
  def digest_algorithm
@@ -3,7 +3,7 @@ require "fpm/namespace"
3
3
  require "fpm/package"
4
4
  require "fpm/errors"
5
5
  require "fpm/util"
6
- require "backports"
6
+ require "backports/latest"
7
7
  require "fileutils"
8
8
  require "digest"
9
9
 
@@ -1,4 +1,4 @@
1
- require "backports" # gem backports
1
+ require "backports/latest" # gem backports/latest
2
2
  require "fpm/package"
3
3
  require "fpm/util"
4
4
  require "fileutils"
@@ -1,4 +1,4 @@
1
- require "backports" # gem backports
1
+ require "backports/latest" # gem backports/latest
2
2
  require "fpm/package"
3
3
  require "fpm/util"
4
4
  require "fileutils"
@@ -29,7 +29,7 @@ end # module FPM
29
29
 
30
30
  module FPM; module Util; end; end
31
31
 
32
- # Like the ::Gem::Package::TarWriter but contains some backports and bug fixes
32
+ # Like the ::Gem::Package::TarWriter but contains some backports/latest and bug fixes
33
33
  class FPM::Util::TarWriter < ::Gem::Package::TarWriter
34
34
  if FPM::Issues::TarWriter.has_issues_with_split_name?
35
35
  def split_name(name)
@@ -1,3 +1,3 @@
1
1
  module FPM
2
- VERSION = "1.11.0"
2
+ VERSION = "1.12.0"
3
3
  end
@@ -1,4 +1,9 @@
1
1
  #!/bin/sh
2
+
3
+ <% if attributes[:deb_maintainerscripts_force_errorchecks?] -%>
4
+ set -e
5
+ <% end -%>
6
+
2
7
  after_upgrade() {
3
8
  <%# Making sure that at least one command is in the function -%>
4
9
  <%# avoids a lot of potential errors, including the case that -%>
@@ -8,18 +13,26 @@ after_upgrade() {
8
13
  <%= script(:after_upgrade) %>
9
14
  <% end -%>
10
15
 
11
- <% if attributes[:deb_systemd] -%>
16
+ <%# if any systemd services specified, loop through and start them -%>
17
+ <% if attributes[:deb_systemd].any? -%>
12
18
  systemctl --system daemon-reload >/dev/null || true
13
- if ! systemctl is-enabled <%= attributes[:deb_systemd] %> >/dev/null
19
+ debsystemctl=$(command -v deb-systemd-invoke || echo systemctl)
20
+ <% attributes[:deb_systemd].each do |service| -%>
21
+ if ! systemctl is-enabled <%= service %> >/dev/null
14
22
  then
15
- systemctl enable <%= attributes[:deb_systemd] %> >/dev/null || true
16
- systemctl start <%= attributes[:deb_systemd] %> >/dev/null || true
23
+ <% if attributes[:deb_systemd_enable?]-%>
24
+ systemctl enable <%= service %> >/dev/null || true
25
+ <% end -%>
26
+ <% if attributes[:deb_systemd_auto_start?]-%>
27
+ $debsystemctl start <%= service %> >/dev/null || true
28
+ <% end -%>
17
29
  <% if attributes[:deb_systemd_restart_after_upgrade?] -%>
18
30
  else
19
- systemctl restart <%= attributes[:deb_systemd] %> >/dev/null || true
31
+ $debsystemctl restart <%= service %> >/dev/null || true
20
32
  <% end -%>
21
33
  fi
22
34
  <% end -%>
35
+ <% end -%>
23
36
  }
24
37
 
25
38
  after_install() {
@@ -31,10 +44,18 @@ after_install() {
31
44
  <%= script(:after_install) %>
32
45
  <% end -%>
33
46
 
34
- <% if attributes[:deb_systemd] -%>
47
+ <%# if any systemd services specified, loop through and start them -%>
48
+ <% if attributes[:deb_systemd].any? -%>
35
49
  systemctl --system daemon-reload >/dev/null || true
36
- systemctl enable <%= attributes[:deb_systemd] %> >/dev/null || true
37
- systemctl start <%= attributes[:deb_systemd] %> >/dev/null || true
50
+ debsystemctl=$(command -v deb-systemd-invoke || echo systemctl)
51
+ <% attributes[:deb_systemd].each do |service| -%>
52
+ <% if attributes[:deb_systemd_enable?]-%>
53
+ systemctl enable <%= service %> >/dev/null || true
54
+ <% end -%>
55
+ <% if attributes[:deb_systemd_auto_start?]-%>
56
+ $debsystemctl start <%= service %> >/dev/null || true
57
+ <% end -%>
58
+ <% end -%>
38
59
  <% end -%>
39
60
  }
40
61
 
@@ -1,4 +1,9 @@
1
1
  #!/bin/sh
2
+
3
+ <% if attributes[:deb_maintainerscripts_force_errorchecks?] -%>
4
+ set -e
5
+ <% end -%>
6
+
2
7
  after_remove() {
3
8
  <%# Making sure that at least one command is in the function -%>
4
9
  <%# avoids a lot of potential errors, including the case that -%>
@@ -1,4 +1,9 @@
1
1
  #!/bin/sh
2
+
3
+ <% if attributes[:deb_maintainerscripts_force_errorchecks?] -%>
4
+ set -e
5
+ <% end -%>
6
+
2
7
  before_upgrade() {
3
8
  <%# Making sure that at least one command is in the function -%>
4
9
  <%# avoids a lot of potential errors, including the case that -%>
@@ -1,4 +1,9 @@
1
1
  #!/bin/sh
2
+
3
+ <% if attributes[:deb_maintainerscripts_force_errorchecks?] -%>
4
+ set -e
5
+ <% end -%>
6
+
2
7
  before_remove() {
3
8
  <%# Making sure that at least one command is in the function -%>
4
9
  <%# avoids a lot of potential errors, including the case that -%>
@@ -8,10 +13,13 @@ before_remove() {
8
13
  <%= script(:before_remove) %>
9
14
  <% end -%>
10
15
 
11
- <%# Removing the systemd service-%>
12
- <% if attributes[:deb_systemd] -%>
13
- systemctl stop <%= attributes[:deb_systemd] %> >/dev/null || true
14
- systemctl disable <%= attributes[:deb_systemd] %> >/dev/null || true
16
+ <%# Stop and remove any systemd services that were installed-%>
17
+ <% if attributes[:deb_systemd].any? -%>
18
+ debsystemctl=$(command -v deb-systemd-invoke || echo systemctl)
19
+ <% attributes[:deb_systemd].each do |service| -%>
20
+ $debsystemctl stop <%= service %> >/dev/null || true
21
+ systemctl disable <%= service %> >/dev/null || true
22
+ <% end -%>
15
23
  systemctl --system daemon-reload >/dev/null || true
16
24
  <% end -%>
17
25
  }
@@ -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
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
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
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
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 -%>
@@ -219,7 +219,7 @@ fi
219
219
  -%>
220
220
  <% scriptmap.each do |name, rpmname| -%>
221
221
  <% if script?(name) -%>
222
- %<%= rpmname %>
222
+ %<%= rpmname -%> <%= ' -e' if attributes[:rpm_macro_expansion?] %>
223
223
  <%= script(name) %>
224
224
  <% end -%>
225
225
  <% end -%>
@@ -268,7 +268,12 @@ function clean_out_old_releases(){
268
268
  function print_package_metadata(){
269
269
  local metadata_line=$(grep -a -n -m1 '__METADATA__$' $0 | sed 's/:.*//')
270
270
  local archive_line=$(grep -a -n -m1 '__ARCHIVE__$' $0 | sed 's/:.*//')
271
- sed -n "$((metadata_line + 1)),$((archive_line - 1)) p" $0
271
+
272
+ # This used to be a sed call but it was taking _forever_ and this method is super fast
273
+ local start_at=$((metadata_line + 1))
274
+ local take_num=$((archive_line - start_at))
275
+
276
+ head -n${start_at} $0 | tail -n${take_num}
272
277
  }
273
278
 
274
279
  function print_usage(){
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.11.0
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Sissel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-30 00:00:00.000000000 Z
11
+ date: 2021-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 1.7.7
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '2.0'
22
+ version: '3.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 1.7.7
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '2.0'
32
+ version: '3.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: cabin
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -90,30 +90,30 @@ dependencies:
90
90
  name: childprocess
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - '='
93
+ - - "<"
94
94
  - !ruby/object:Gem::Version
95
- version: 0.9.0
95
+ version: 1.0.0
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - '='
100
+ - - "<"
101
101
  - !ruby/object:Gem::Version
102
- version: 0.9.0
102
+ version: 1.0.0
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: ffi
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - ">="
107
+ - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: '0'
109
+ version: 1.12.0
110
110
  type: :runtime
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - ">="
114
+ - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '0'
116
+ version: 1.12.0
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: rake
119
119
  requirement: !ruby/object:Gem::Requirement
@@ -156,6 +156,26 @@ dependencies:
156
156
  - - "~>"
157
157
  - !ruby/object:Gem::Version
158
158
  version: 0.0.29
159
+ - !ruby/object:Gem::Dependency
160
+ name: git
161
+ requirement: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: 1.3.0
166
+ - - "<"
167
+ - !ruby/object:Gem::Version
168
+ version: '2.0'
169
+ type: :runtime
170
+ prerelease: false
171
+ version_requirements: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: 1.3.0
176
+ - - "<"
177
+ - !ruby/object:Gem::Version
178
+ version: '2.0'
159
179
  - !ruby/object:Gem::Dependency
160
180
  name: stud
161
181
  requirement: !ruby/object:Gem::Requirement
@@ -302,7 +322,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
302
322
  - !ruby/object:Gem::Version
303
323
  version: '0'
304
324
  requirements: []
305
- rubygems_version: 3.0.1
325
+ rubyforge_project:
326
+ rubygems_version: 2.7.6
306
327
  signing_key:
307
328
  specification_version: 4
308
329
  summary: fpm - package building and mangling