fpm 1.10.2 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.rst +24 -0
- data/lib/fpm/package/apk.rb +1 -1
- data/lib/fpm/package/deb.rb +80 -17
- data/lib/fpm/package/dir.rb +3 -3
- data/lib/fpm/package/empty.rb +1 -1
- data/lib/fpm/package/freebsd.rb +1 -1
- data/lib/fpm/package/gem.rb +39 -12
- data/lib/fpm/package/pacman.rb +22 -10
- data/lib/fpm/package/python.rb +29 -2
- data/lib/fpm/package/rpm.rb +26 -7
- data/lib/fpm/package/sh.rb +1 -1
- data/lib/fpm/package/snap.rb +130 -0
- data/lib/fpm/package/tar.rb +1 -1
- data/lib/fpm/package/virtualenv.rb +1 -2
- data/lib/fpm/package/zip.rb +1 -1
- data/lib/fpm/package.rb +2 -2
- data/lib/fpm/util/tar_writer.rb +1 -1
- data/lib/fpm/version.rb +1 -1
- data/lib/fpm.rb +1 -0
- data/templates/deb/deb.changes.erb +2 -3
- data/templates/deb/postinst_upgrade.sh.erb +29 -8
- data/templates/deb/postrm_upgrade.sh.erb +5 -0
- data/templates/deb/preinst_upgrade.sh.erb +5 -0
- data/templates/deb/prerm_upgrade.sh.erb +12 -4
- data/templates/deb.erb +1 -1
- data/templates/rpm.erb +5 -5
- data/templates/sh.erb +6 -1
- metadata +34 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 28f939bd20768768cb05026a39c8a270596368c654ec5606a43a0e75afa845ad
|
4
|
+
data.tar.gz: 0d7eea7108832e79994ba3ee9511c3715b384906f7ef3a2ab5e907cfc764609a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 555edd6cd5d4b0098e075011e48db96e52c454b8557735a51202307dcaeb4920a5efe93bb6d99cedf9d3ff95ff445c37059e1fc308e0602482977587d532e4b1
|
7
|
+
data.tar.gz: 2803ea8cb3af495d5fd20e75bee0eba11dc262ac59b86e63b75ef3cef7417440e88e1fec9172f7a1ea5cf0705e2ce36bc65e7b9c1c5469eb0e78b292ac822716
|
data/CHANGELOG.rst
CHANGED
@@ -1,6 +1,29 @@
|
|
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
|
+
|
21
|
+
1.11.0 (January 30, 2019)
|
22
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^
|
23
|
+
|
24
|
+
* snap: Snap packages can now be created! (`#1490`_; kyrofa)
|
25
|
+
* Fix an installation problem where a dependency (childprocess) fails to install correctly. (#1592; Jordan Sissel)
|
26
|
+
|
4
27
|
1.10.2 (July 3, 2018)
|
5
28
|
^^^^^^^^^^^^^^^^^^^^^
|
6
29
|
|
@@ -25,6 +48,7 @@ Release Notes and Change Log
|
|
25
48
|
* rpm: fix shell function name `install` conflicting with `install` program. In
|
26
49
|
postinst (after-install), the function is now called `_install` to avoid
|
27
50
|
conflicting with `/usr/bin/install` (`#1434`_; Torsten Schmidt)
|
51
|
+
* rpm: Allow binary "arch dependent" files in noarch rpms (Jordan Sissel)
|
28
52
|
* - deb: --config-files ? (`#1440`_, `#1443`_; NoBodyCam)
|
29
53
|
* FPM source repo now contains a Brewfile for use with Homebrew.
|
30
54
|
* FPM source repo has a Dockerfile for invoking fpm with docker. (`#1484`_, ;Allan Lewis
|
data/lib/fpm/package/apk.rb
CHANGED
data/lib/fpm/package/deb.rb
CHANGED
@@ -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
|
#
|
@@ -22,7 +23,7 @@ class FPM::Package::Deb < FPM::Package
|
|
22
23
|
} unless defined?(SCRIPT_MAP)
|
23
24
|
|
24
25
|
# The list of supported compression types. Default is gz (gzip)
|
25
|
-
COMPRESSION_TYPES = [ "gz", "bzip2", "xz" ]
|
26
|
+
COMPRESSION_TYPES = [ "gz", "bzip2", "xz", "none" ]
|
26
27
|
|
27
28
|
option "--ignore-iteration-in-dependencies", :flag,
|
28
29
|
"For '=' (equal) dependencies, allow iterations on the specified " \
|
@@ -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"
|
@@ -265,10 +275,32 @@ class FPM::Package::Deb < FPM::Package
|
|
265
275
|
end # def input
|
266
276
|
|
267
277
|
def extract_info(package)
|
278
|
+
compression = `#{ar_cmd[0]} t #{package}`.split("\n").grep(/control.tar/).first.split(".").last
|
279
|
+
case compression
|
280
|
+
when "gz"
|
281
|
+
controltar = "control.tar.gz"
|
282
|
+
compression = "-z"
|
283
|
+
when "bzip2","bz2"
|
284
|
+
controltar = "control.tar.bz2"
|
285
|
+
compression = "-j"
|
286
|
+
when "xz"
|
287
|
+
controltar = "control.tar.xz"
|
288
|
+
compression = "-J"
|
289
|
+
when 'tar'
|
290
|
+
controltar = "control.tar"
|
291
|
+
compression = ""
|
292
|
+
when nil
|
293
|
+
raise FPM::InvalidPackageConfiguration, "Missing control.tar in deb source package #{package}"
|
294
|
+
else
|
295
|
+
raise FPM::InvalidPackageConfiguration,
|
296
|
+
"Unknown compression type '#{compression}' for control.tar in deb source package #{package}"
|
297
|
+
end
|
298
|
+
|
268
299
|
build_path("control").tap do |path|
|
269
300
|
FileUtils.mkdir(path) if !File.directory?(path)
|
301
|
+
# unpack the control.tar.{,gz,bz2,xz} from the deb package into staging_path
|
270
302
|
# Unpack the control tarball
|
271
|
-
safesystem(ar_cmd[0] + " p #{package}
|
303
|
+
safesystem(ar_cmd[0] + " p #{package} #{controltar} | tar #{compression} -xf - -C #{path}")
|
272
304
|
|
273
305
|
control = File.read(File.join(path, "control"))
|
274
306
|
|
@@ -376,15 +408,18 @@ class FPM::Package::Deb < FPM::Package
|
|
376
408
|
when "xz"
|
377
409
|
datatar = "data.tar.xz"
|
378
410
|
compression = "-J"
|
411
|
+
when 'tar'
|
412
|
+
datatar = "data.tar"
|
413
|
+
compression = ""
|
414
|
+
when nil
|
415
|
+
raise FPM::InvalidPackageConfiguration, "Missing data.tar in deb source package #{package}"
|
379
416
|
else
|
380
417
|
raise FPM::InvalidPackageConfiguration,
|
381
|
-
"Unknown compression type '#{
|
382
|
-
"in deb source package #{package}"
|
418
|
+
"Unknown compression type '#{compression}' for data.tar in deb source package #{package}"
|
383
419
|
end
|
384
420
|
|
385
421
|
# unpack the data.tar.{gz,bz2,xz} from the deb package into staging_path
|
386
|
-
safesystem(ar_cmd[0] + " p #{package} #{datatar} "
|
387
|
-
"| tar #{compression} -xf - -C #{staging_path}")
|
422
|
+
safesystem(ar_cmd[0] + " p #{package} #{datatar} | tar #{compression} -xf - -C #{staging_path}")
|
388
423
|
end # def extract_files
|
389
424
|
|
390
425
|
def output(output_path)
|
@@ -428,6 +463,7 @@ class FPM::Package::Deb < FPM::Package
|
|
428
463
|
raise "#{name}: tar is insufficient to support source_date_epoch."
|
429
464
|
end
|
430
465
|
|
466
|
+
attributes[:deb_systemd] = []
|
431
467
|
attributes.fetch(:deb_systemd_list, []).each do |systemd|
|
432
468
|
name = File.basename(systemd, ".service")
|
433
469
|
dest_systemd = staging_path("lib/systemd/system/#{name}.service")
|
@@ -435,19 +471,19 @@ class FPM::Package::Deb < FPM::Package
|
|
435
471
|
FileUtils.cp(systemd, dest_systemd)
|
436
472
|
File.chmod(0644, dest_systemd)
|
437
473
|
|
438
|
-
#
|
439
|
-
attributes[:deb_systemd]
|
474
|
+
# add systemd service name to attribute
|
475
|
+
attributes[:deb_systemd] << name
|
440
476
|
end
|
441
477
|
|
442
|
-
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?
|
443
479
|
puts "Adding action files"
|
444
480
|
if script?(:before_install) or script?(:before_upgrade)
|
445
481
|
scripts[:before_install] = template("deb/preinst_upgrade.sh.erb").result(binding)
|
446
482
|
end
|
447
|
-
if script?(:before_remove) or attributes[:deb_systemd]
|
483
|
+
if script?(:before_remove) or not attributes[:deb_systemd].empty?
|
448
484
|
scripts[:before_remove] = template("deb/prerm_upgrade.sh.erb").result(binding)
|
449
485
|
end
|
450
|
-
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?
|
451
487
|
scripts[:after_install] = template("deb/postinst_upgrade.sh.erb").result(binding)
|
452
488
|
end
|
453
489
|
if script?(:after_remove)
|
@@ -559,6 +595,9 @@ class FPM::Package::Deb < FPM::Package
|
|
559
595
|
when "xz"
|
560
596
|
datatar = build_path("data.tar.xz")
|
561
597
|
compression = "-J"
|
598
|
+
when "none"
|
599
|
+
datatar = build_path("data.tar")
|
600
|
+
compression = ""
|
562
601
|
else
|
563
602
|
raise FPM::InvalidPackageConfiguration,
|
564
603
|
"Unknown compression type '#{self.attributes[:deb_compression]}'"
|
@@ -682,8 +721,13 @@ class FPM::Package::Deb < FPM::Package
|
|
682
721
|
name, version = dep.gsub(/[()~>]/, "").split(/ +/)[0..1]
|
683
722
|
nextversion = version.split(".").collect { |v| v.to_i }
|
684
723
|
l = nextversion.length
|
685
|
-
|
686
|
-
|
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
|
687
731
|
nextversion = nextversion.join(".")
|
688
732
|
return ["#{name} (>= #{version})", "#{name} (<< #{nextversion})"]
|
689
733
|
elsif (m = dep.match(/(\S+)\s+\(!= (.+)\)/))
|
@@ -749,11 +793,30 @@ class FPM::Package::Deb < FPM::Package
|
|
749
793
|
write_triggers # write trigger config to 'triggers' file
|
750
794
|
write_md5sums # write the md5sums file
|
751
795
|
|
796
|
+
# Tar up the staging_path into control.tar.{compression type}
|
797
|
+
case self.attributes[:deb_compression]
|
798
|
+
when "gz", nil
|
799
|
+
controltar = "control.tar.gz"
|
800
|
+
compression = "-z"
|
801
|
+
when "bzip2"
|
802
|
+
controltar = "control.tar.bz2"
|
803
|
+
compression = "-j"
|
804
|
+
when "xz"
|
805
|
+
controltar = "control.tar.xz"
|
806
|
+
compression = "-J"
|
807
|
+
when "none"
|
808
|
+
controltar = "control.tar"
|
809
|
+
compression = ""
|
810
|
+
else
|
811
|
+
raise FPM::InvalidPackageConfiguration,
|
812
|
+
"Unknown compression type '#{self.attributes[:deb_compression]}'"
|
813
|
+
end
|
814
|
+
|
752
815
|
# Make the control.tar.gz
|
753
|
-
build_path(
|
816
|
+
build_path(controltar).tap do |controltar|
|
754
817
|
logger.info("Creating", :path => controltar, :from => control_path)
|
755
818
|
|
756
|
-
args = [ tar_cmd, "-C", control_path, "-
|
819
|
+
args = [ tar_cmd, "-C", control_path, compression, "-cf", controltar,
|
757
820
|
"--owner=0", "--group=0", "--numeric-owner", "." ]
|
758
821
|
if tar_cmd_supports_sort_names_and_set_mtime? and not attributes[:source_date_epoch].nil?
|
759
822
|
# Force deterministic file order and timestamp
|
@@ -931,7 +994,7 @@ class FPM::Package::Deb < FPM::Package
|
|
931
994
|
|
932
995
|
if attributes[:deb_templates]
|
933
996
|
FileUtils.cp(attributes[:deb_templates], control_path("templates"))
|
934
|
-
File.chmod(
|
997
|
+
File.chmod(0644, control_path("templates"))
|
935
998
|
end
|
936
999
|
end # def write_debconf
|
937
1000
|
|
data/lib/fpm/package/dir.rb
CHANGED
@@ -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
|
87
|
-
self.vendor
|
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")
|
data/lib/fpm/package/empty.rb
CHANGED
data/lib/fpm/package/freebsd.rb
CHANGED
data/lib/fpm/package/gem.rb
CHANGED
@@ -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
|
-
|
103
|
-
logger.debug("
|
104
|
-
|
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-
|
202
|
-
|
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"]
|
data/lib/fpm/package/pacman.rb
CHANGED
@@ -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 => "
|
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, "
|
213
|
-
return "--
|
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 "--
|
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, "
|
228
|
-
return ".
|
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 ".
|
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
|
-
|
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
|
|
data/lib/fpm/package/python.rb
CHANGED
@@ -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
|
-
|
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?]
|
data/lib/fpm/package/rpm.rb
CHANGED
@@ -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" => "
|
28
|
-
"xzmt" => "
|
29
|
-
"gzip" => "
|
30
|
-
"bzip2" => "
|
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
|
@@ -516,10 +529,11 @@ class FPM::Package::RPM < FPM::Package
|
|
516
529
|
end
|
517
530
|
|
518
531
|
# copy all files from staging to BUILD dir
|
532
|
+
# [#1538] Be sure to preserve the original timestamps.
|
519
533
|
Find.find(staging_path) do |path|
|
520
534
|
src = path.gsub(/^#{staging_path}/, '')
|
521
535
|
dst = File.join(build_path, build_sub_dir, src)
|
522
|
-
copy_entry(path, dst)
|
536
|
+
copy_entry(path, dst, preserve=true)
|
523
537
|
end
|
524
538
|
|
525
539
|
rpmspec = template("rpm.erb").result(binding)
|
@@ -597,7 +611,12 @@ class FPM::Package::RPM < FPM::Package
|
|
597
611
|
end # def to_s
|
598
612
|
|
599
613
|
def payload_compression
|
600
|
-
|
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
|
601
620
|
end # def payload_compression
|
602
621
|
|
603
622
|
def digest_algorithm
|
data/lib/fpm/package/sh.rb
CHANGED
@@ -0,0 +1,130 @@
|
|
1
|
+
require "yaml"
|
2
|
+
|
3
|
+
require "fpm/package"
|
4
|
+
require "fpm/util"
|
5
|
+
require "fileutils"
|
6
|
+
require "fpm/package/dir"
|
7
|
+
|
8
|
+
# Support for snaps (.snap files).
|
9
|
+
#
|
10
|
+
# This supports the input and output of snaps.
|
11
|
+
class FPM::Package::Snap < FPM::Package
|
12
|
+
|
13
|
+
option "--yaml", "FILEPATH",
|
14
|
+
"Custom version of the snap.yaml file." do | snap_yaml |
|
15
|
+
File.expand_path(snap_yaml)
|
16
|
+
end
|
17
|
+
|
18
|
+
option "--confinement", "CONFINEMENT",
|
19
|
+
"Type of confinement to use for this snap.",
|
20
|
+
default: "devmode" do | confinement |
|
21
|
+
if ['strict', 'devmode', 'classic'].include? confinement
|
22
|
+
confinement
|
23
|
+
else
|
24
|
+
raise "Unsupported confinement type '#{confinement}'"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
option "--grade", "GRADE", "Grade of this snap.",
|
29
|
+
default: "devel" do | grade |
|
30
|
+
if ['stable', 'devel'].include? grade
|
31
|
+
grade
|
32
|
+
else
|
33
|
+
raise "Unsupported grade type '#{grade}'"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Input a snap
|
38
|
+
def input(input_snap)
|
39
|
+
extract_snap_to_staging input_snap
|
40
|
+
extract_snap_metadata_from_staging
|
41
|
+
end # def input
|
42
|
+
|
43
|
+
# Output a snap.
|
44
|
+
def output(output_snap)
|
45
|
+
output_check(output_snap)
|
46
|
+
|
47
|
+
write_snap_yaml
|
48
|
+
|
49
|
+
# Create the snap from the staging path
|
50
|
+
safesystem("mksquashfs", staging_path, output_snap, "-noappend", "-comp",
|
51
|
+
"xz", "-no-xattrs", "-no-fragments", "-all-root")
|
52
|
+
end # def output
|
53
|
+
|
54
|
+
def to_s(format=nil)
|
55
|
+
# Default format if nil
|
56
|
+
# name_version_arch.snap
|
57
|
+
return super(format.nil? ? "NAME_FULLVERSION_ARCH.EXTENSION" : format)
|
58
|
+
end # def to_s
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def extract_snap_to_staging(snap_path)
|
63
|
+
safesystem("unsquashfs", "-f", "-d", staging_path, snap_path)
|
64
|
+
end
|
65
|
+
|
66
|
+
def extract_snap_metadata_from_staging
|
67
|
+
metadata = YAML.safe_load(File.read(
|
68
|
+
staging_path(File.join("meta", "snap.yaml"))))
|
69
|
+
|
70
|
+
self.name = metadata["name"]
|
71
|
+
self.version = metadata["version"]
|
72
|
+
self.description = metadata["summary"] + "\n" + metadata["description"]
|
73
|
+
self.architecture = metadata["architectures"][0]
|
74
|
+
self.attributes[:snap_confinement] = metadata["confinement"]
|
75
|
+
self.attributes[:snap_grade] = metadata["grade"]
|
76
|
+
|
77
|
+
if metadata["apps"].nil?
|
78
|
+
attributes[:snap_apps] = []
|
79
|
+
else
|
80
|
+
attributes[:snap_apps] = metadata["apps"]
|
81
|
+
end
|
82
|
+
|
83
|
+
if metadata["hooks"].nil?
|
84
|
+
attributes[:snap_hooks] = []
|
85
|
+
else
|
86
|
+
attributes[:snap_hooks] = metadata["hooks"]
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def write_snap_yaml
|
91
|
+
# Write the snap.yaml
|
92
|
+
if attributes[:snap_yaml]
|
93
|
+
logger.debug("Using '#{attributes[:snap_yaml]}' as the snap.yaml")
|
94
|
+
yaml_data = File.read(attributes[:snap_yaml])
|
95
|
+
else
|
96
|
+
summary, *remainder = (self.description or "no summary given").split("\n")
|
97
|
+
description = "no description given"
|
98
|
+
if remainder.any?
|
99
|
+
description = remainder.join("\n")
|
100
|
+
end
|
101
|
+
|
102
|
+
yaml_data = {
|
103
|
+
"name" => self.name,
|
104
|
+
"version" => self.version,
|
105
|
+
"summary" => summary,
|
106
|
+
"description" => description,
|
107
|
+
"architectures" => [self.architecture],
|
108
|
+
"confinement" => self.attributes[:snap_confinement],
|
109
|
+
"grade" => self.attributes[:snap_grade],
|
110
|
+
}
|
111
|
+
|
112
|
+
unless attributes[:snap_apps].nil? or attributes[:snap_apps].empty?
|
113
|
+
yaml_data["apps"] = attributes[:snap_apps]
|
114
|
+
end
|
115
|
+
|
116
|
+
unless attributes[:snap_hooks].nil? or attributes[:snap_hooks].empty?
|
117
|
+
yaml_data["hooks"] = attributes[:snap_hooks]
|
118
|
+
end
|
119
|
+
|
120
|
+
yaml_data = yaml_data.to_yaml
|
121
|
+
end
|
122
|
+
|
123
|
+
FileUtils.mkdir_p(staging_path("meta"))
|
124
|
+
snap_yaml_path = staging_path(File.join("meta", "snap.yaml"))
|
125
|
+
logger.debug("Writing snap.yaml", :path => snap_yaml_path)
|
126
|
+
File.write(snap_yaml_path, yaml_data)
|
127
|
+
File.chmod(0644, snap_yaml_path)
|
128
|
+
edit_file(snap_yaml_path) if attributes[:edit?]
|
129
|
+
end # def write_snap_yaml
|
130
|
+
end # class FPM::Package::Snap
|
data/lib/fpm/package/tar.rb
CHANGED
@@ -111,8 +111,7 @@ class FPM::Package::Virtualenv < FPM::Package
|
|
111
111
|
# Why is this hack here? It looks important, so I'll keep it in.
|
112
112
|
safesystem(python_exe, pip_exe, "install", "-U", "-i",
|
113
113
|
attributes[:virtualenv_pypi],
|
114
|
-
"pip"
|
115
|
-
safesystem(python_exe, pip_exe, "uninstall", "-y", "distribute")
|
114
|
+
"pip")
|
116
115
|
|
117
116
|
extra_index_url_args = []
|
118
117
|
if attributes[:virtualenv_pypi_extra_index_urls]
|
data/lib/fpm/package/zip.rb
CHANGED
data/lib/fpm/package.rb
CHANGED
@@ -4,7 +4,7 @@ require "pathname" # stdlib
|
|
4
4
|
require "find"
|
5
5
|
require "tmpdir" # stdlib
|
6
6
|
require "ostruct"
|
7
|
-
require "backports/
|
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) } \
|
data/lib/fpm/util/tar_writer.rb
CHANGED
@@ -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)
|
data/lib/fpm/version.rb
CHANGED
data/lib/fpm.rb
CHANGED
@@ -14,9 +14,8 @@ Description: <%= firstline %>
|
|
14
14
|
<%= remainder.collect { |l| l =~ /^ *$/ ? " ." : " #{l}" }.join("\n") %>
|
15
15
|
<% end -%>
|
16
16
|
Changes:
|
17
|
-
<%= name %> (<%= "#{epoch}:" if epoch %><%= version %><%= "-" + iteration.to_s if iteration %>) whatever; urgency=medium
|
18
|
-
.
|
19
|
-
* Package created with FPM.
|
17
|
+
<%= name %> (<%= "#{epoch}:" if epoch %><%= version %><%= "-" + iteration.to_s if iteration %>) whatever; urgency=medium
|
18
|
+
* Package created with FPM.
|
20
19
|
Checksums-Sha1:
|
21
20
|
<% changes_files.each do |file| -%>
|
22
21
|
<%= file[:sha1sum] %> <%= file[:size] %> <%= file[:name] %>
|
@@ -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
|
-
|
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
|
-
|
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
|
-
|
16
|
-
systemctl
|
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
|
-
|
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
|
-
|
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
|
-
|
37
|
-
|
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
|
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
|
-
<%#
|
12
|
-
<% if attributes[:deb_systemd] -%>
|
13
|
-
|
14
|
-
|
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
|
}
|
data/templates/deb.erb
CHANGED
@@ -28,7 +28,7 @@ Build-Depends: <%= attributes[:deb_build_depends].collect { |d| fix_dependency(d
|
|
28
28
|
Provides: <%= provides.map {|p| p.split(" ").first}.join ", " %>
|
29
29
|
<% end -%>
|
30
30
|
<% if !replaces.empty? -%>
|
31
|
-
Replaces: <%= replaces.join(", ") %>
|
31
|
+
Replaces: <%= replaces.collect { |d| fix_dependency(d) }.flatten.join(", ") %>
|
32
32
|
<% end -%>
|
33
33
|
<% if attributes[:deb_recommends] and !attributes[:deb_recommends].empty? -%>
|
34
34
|
Recommends: <%= attributes[:deb_recommends].collect { |d| fix_dependency(d) }.flatten.join(", ") %>
|
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
|
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 -%>
|
data/templates/sh.erb
CHANGED
@@ -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
|
-
|
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.
|
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:
|
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: '
|
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: '
|
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:
|
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:
|
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:
|
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:
|
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
|
@@ -250,6 +270,7 @@ files:
|
|
250
270
|
- lib/fpm/package/python.rb
|
251
271
|
- lib/fpm/package/rpm.rb
|
252
272
|
- lib/fpm/package/sh.rb
|
273
|
+
- lib/fpm/package/snap.rb
|
253
274
|
- lib/fpm/package/solaris.rb
|
254
275
|
- lib/fpm/package/tar.rb
|
255
276
|
- lib/fpm/package/virtualenv.rb
|
@@ -302,7 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
302
323
|
version: '0'
|
303
324
|
requirements: []
|
304
325
|
rubyforge_project:
|
305
|
-
rubygems_version: 2.6
|
326
|
+
rubygems_version: 2.7.6
|
306
327
|
signing_key:
|
307
328
|
specification_version: 4
|
308
329
|
summary: fpm - package building and mangling
|