fpm 1.11.0 → 1.14.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: 24a4dd08de1d4ad02888c110b88ab0d6fd590d4d913aba61ec459d126fb84d40
4
- data.tar.gz: d8c7e7867cff9198ee1d170a17534946a8cb82c1217ddb09d316f061e3be86d2
3
+ metadata.gz: '0970e7bbf6bfc2becbfc2c4ed787bb08eb8eef555b6cc969f219685dc67c8056'
4
+ data.tar.gz: 1472f32b8133588cb6ce39311c1f2e16fbbe86204c65b4ec5fc9ed7181fd6550
5
5
  SHA512:
6
- metadata.gz: df2cbe11e18c252ef87d75f724abb3de218be2b9050e8d1918c6d323ab49e02b84793a4de327f522f04eca2fa56d90d5ba50a56f49fb36f6d5e976f10a6b4e56
7
- data.tar.gz: 3b93a0208cb451ee13c4cdc65adec6e68c46e2619f2d54114cfa6e4745be52d28ba12223701fc496866c4878b914f896232a389b0f37f07667c80224f6724933
6
+ metadata.gz: 336e859e103edc0c76fa9f89f4dbfc1d9c9a183d7314e405ff8ddafe24134655cfb90c8121566173a4986ad72064b108d89d81e06426e2b3586ec0110d132f9e
7
+ data.tar.gz: 1e7e9fb8f0eff4dcbf4aa45c526b5295b8534c83d97555d7322e69b6b6a6738494a6fac872aec85a3c94b0b5c86720bef52271d2ae75bb2e8916c4978968ed9f
data/CHANGELOG.rst CHANGED
@@ -1,6 +1,59 @@
1
1
  Release Notes and Change Log
2
2
  ============================
3
3
 
4
+ 1.14.0 (November 9, 2021)
5
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
6
+ * python: Use pip by default for fetching Python packages. This matches the Python 3 "installation" docs which recommend calling pip as ``python -m pip`` where ``python`` depends on ``--python-bin`` (default "python"). Previous default was to use `easy_install` which is no longer available on many newer systems. To use easy_install, you can set ``--no-python-internal-pip`` to revert this pip default. Further, you can specify your own pip path instead of using ``python -m pip`` with the ``--python-pip /path/to/pip`` flag. (`#1820`_, `#1821`_; Jordan Sissel)
7
+ * python: Support extras_require build markers in python packages (`#1307`_, `#1816`_; Joris Vandermeersch)
8
+ * freebsd: Fix bug which caused fpm to generate incorrect FreeBSD packages "missing leading `/`" (`#1811`_, `#1812`_, `#1844`_, `#1832`_, `#1845`_; Vlastimil Holer, Clayton Wong, Markus Ueberall, Jordan Sissel)
9
+ * deb: In order to only allow fpm to create valid packages, fpm now rejects packages with invalid "provides" (``--provides``) values. (`#1829`_, `#1825`_; Jordan Sissel, Peter Teichman)
10
+ * deb: Only show a warning about /etc and config files if there are files in /etc (`#1852`_, `#1851`_; Jordan Sissel)
11
+
12
+ * rpm: replace dash with underscore in rpm's "Release" field aka what fpm calls ``--iteration``. (`#1834`_, `#1833`_; Jordan Sissel)
13
+ * empty: `fpm -s empty ...` now defaults to "all" architecture instead of "native". (`#1850`_, `#1846`_; Jordan Sissel)
14
+ * Significant documentation improvements rewriting most of the documentation. New overview pages, full CLI flag listing, and new sections dedicated package types (rpm, cpan, deb, etc). (`#1815`_, `#1817`_, `#1838`_; Vedant K, Jordan Sissel)
15
+ * Typo fixes in documentation are always appreciated! (`#1842`_; Clayton Wong)
16
+ * fpm can now (we hope!) now be tested more easily from docker (`#1818`_, `#1682`_, `#1453`_; @directionless, Jordan Sissel, Douglas Muth)
17
+
18
+ 1.13.1 (July 6, 2021)
19
+ ^^^^^^^^^^^^^^^^^^^^^
20
+ * deb: The `--provides` flag now allows for versions. Previously, fpm would
21
+ remove the version part of a provides field when generating deb packages.
22
+ (`#1788`_, `#1803`_; Jordan Sissel, Phil Schwartz, tympanix)
23
+ * osxpkg: Update documentation to include installing `rpm` tools on OSX
24
+ (`#1797`_; allen joslin)
25
+
26
+ 1.13.0 (June 19, 2021)
27
+ ^^^^^^^^^^^^^^^^^^^^^^
28
+ * Apple M1 users should now work (`#1772`_, `#1785`_, `#1786`_; Jordan Sissel)
29
+ * 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)
30
+ * 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)
31
+ * Docs: Fix a typo in an example (`#1785`_; Zoe O'Connell)
32
+ * rpm: File paths can now contain single-quote characters (`#1774`_; Jordan Sissel)
33
+ * rpm: Use correct SPEC syntax when using --after-upgrade or similar features (`#1761`_; Jo Vandeginste. Robert Fielding)
34
+ * 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)
35
+ * 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)
36
+ * deb: Fix syntax error in `postinst` (`--after-install`) script. (`#1752`_, `#1749`_, `#1764`_; rmanus, Adam Mohammed, Elliot Murphy, kimw, Jordan Sissel)
37
+ * deb: --deb-compression now uses the same compression and file suffix on the control.tar file (`#1760`_; Philippe Poilbarbe)
38
+
39
+
40
+ 1.12.0 (January 19, 2021)
41
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
42
+
43
+ * 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)
44
+ * deb: New flag to add 'set -e' to all scripts. `--deb-maintainerscripts-force-errorchecks` which defaults to off. (`#1697`_; Andreas Ulm)
45
+ * 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)
46
+ * deb: Fix error 'uninitialized constant FPM::Package::Deb::Zlib' (`#1739`_, `#1740`_; Federico Lancerin)
47
+ * python: Prepend to PYTHONPATH instead of replacing it. This should help on platforms that rely heavily on PYTHONPATH, such as NixOSX (`#1711`_, `#1710`_; anarg)
48
+ * python: Add `--python-trusted-host` flag which passes `--trusted-host` flag to `pip` (`#1737`_; Vladimir Ponarevsky)
49
+ * Documentation improvements (`#1724`_, `#1738`_, `#1667`_, `#1636`_)
50
+ * Dockerfile updated to Alpine 3.12 (`#1745`_; Cameron Nemo)
51
+ * Remove the 'backports' deprecation warning (`#1727`_; Jose Galvez)
52
+ * sh: Performance improvement when printing package metadata (`#1729`_; James Logsdon, Ed Healy)
53
+ * rpm: Add support for `xzmt` compression (multithreaded xz compressor) to help when creating very large packages (several gigabytes). (`#1447`_, `#1419`_; amnobc)
54
+ * 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)
55
+ * deb: use correct control.tar filename (`#1668`_; Mike Perham)
56
+
4
57
  1.11.0 (January 30, 2019)
5
58
  ^^^^^^^^^^^^^^^^^^^^^^^^^
6
59
 
@@ -19,7 +72,7 @@ Release Notes and Change Log
19
72
  * cpan: Adds `--[no-]cpan-verbose` flag which, when set, runs `cpanm` with the `--verbose` flag (`#1511`_; William N. Braswell, Jr)
20
73
 
21
74
  1.10.0 (May 21, 2018)
22
- ^^^^^^^^^^^^^^^^^^^^
75
+ ^^^^^^^^^^^^^^^^^^^^^
23
76
 
24
77
  * Pin `ruby-xz` dependency to one which allows Ruby versions older than 2.3.0 (`#1494`_; Marat Sharafutdinov)
25
78
  * Documentation improvements: `#1488`_; Arthur Burkart. `#1384`_; Justin Kolberg. `#1452`_; Anatoli Babenia.
@@ -47,7 +100,7 @@ Release Notes and Change Log
47
100
  * rpm: Fix `--config-files` handling (`#1390`_, `#1391`_; Jordan Sissel)
48
101
 
49
102
  1.9.1 (July 28, 2017) happy sysadmin day!
50
- ^^^^^^^^^^^^^^^^^^^^^
103
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
51
104
 
52
105
  * Documentation improvements: `#1291`_; Pablo Castellano. `#1321`_; ge-fa. `#1309`_; jesusbagpuss. `#1349`_; Perry Stole. `#1352`_, Jordan Sissel. `#1384`_; Justin Kolberg.
53
106
  * Testing improvements: `#1320`_; Rob Young. `#1266`_; Ryan Parman. `#1374`_; Thiago Figueiró.
@@ -76,9 +129,9 @@ Release Notes and Change Log
76
129
  * Other: Remove unused archive-tar-minitar as a dependency of fpm (`#1355`_; Diego Martins)
77
130
  * Other: Add stud as a runtime dependency (`#1354`_; Elan Ruusamäe)
78
131
 
79
- .. _reproducible_builds:: https://reproducible-builds.org/
80
- .. _path mapping:: http://fpm.readthedocs.io/en/latest/source/dir.html#path-mapping
81
- .. _Deterministic output:: http://fpm.readthedocs.io/en/latest/source/gem.html
132
+ .. _reproducible_builds: https://reproducible-builds.org/
133
+ .. _path mapping: source/dir.html#path-mapping
134
+ .. _Deterministic output: source/gem.html
82
135
 
83
136
  1.9.0 (July 28, 2017)
84
137
  ^^^^^^^^^^^^^^^^^^^^^
data/CONTRIBUTORS CHANGED
@@ -21,6 +21,7 @@ sbuss
21
21
  Brett Gailey (github: dnbert)
22
22
  Daniel Haskin (github: djhaskin987)
23
23
  Richard Grainger (github: liger1978)
24
+ seph (github: directionless)
24
25
 
25
26
  If you have contributed (bug reports, feature requests, help in IRC, blog
26
27
  posts, code, etc) and aren't listed here, please let me know if you wish to be
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (This is an MIT-style license)
2
2
 
3
- Copyright (c) 2011-2017 Jordan Sissel and contributors.
3
+ Copyright (c) 2011-2021 Jordan Sissel and contributors.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -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
  #
@@ -24,6 +25,17 @@ class FPM::Package::Deb < FPM::Package
24
25
  # The list of supported compression types. Default is gz (gzip)
25
26
  COMPRESSION_TYPES = [ "gz", "bzip2", "xz", "none" ]
26
27
 
28
+ # https://www.debian.org/doc/debian-policy/ch-relationships.html#syntax-of-relationship-fields
29
+ # Example value with version relationship: libc6 (>= 2.2.1)
30
+ # Example value: libc6
31
+
32
+ # Version string docs here: https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-version
33
+ # The format is: [epoch:]upstream_version[-debian_revision].
34
+ # epoch - This is a single (generally small) unsigned integer
35
+ # upstream_version - must contain only alphanumerics 6 and the characters . + - ~
36
+ # debian_revision - only alphanumerics and the characters + . ~
37
+ RELATIONSHIP_FIELD_PATTERN = /^(?<name>[A-z0-9_-]+)(?: *\((?<relation>[<>=]+) *(?<version>(?:[0-9]+:)?[0-9A-Za-z+~.-]+(?:-[0-9A-Za-z+~.]+)?)\))?$/
38
+
27
39
  option "--ignore-iteration-in-dependencies", :flag,
28
40
  "For '=' (equal) dependencies, allow iterations on the specified " \
29
41
  "version. Default is to be specific. This option allows the same " \
@@ -177,10 +189,14 @@ class FPM::Package::Deb < FPM::Package
177
189
  end
178
190
 
179
191
  option "--systemd", "FILEPATH", "Add FILEPATH as a systemd script",
180
- :multivalued => true do |file|
192
+ :multivalued => true do |file|
181
193
  next File.expand_path(file)
182
194
  end
183
195
 
196
+ option "--systemd-enable", :flag , "Enable service on install or upgrade", :default => false
197
+
198
+ option "--systemd-auto-start", :flag , "Start service after install or upgrade", :default => false
199
+
184
200
  option "--systemd-restart-after-upgrade", :flag , "Restart service after upgrade", :default => true
185
201
 
186
202
  option "--after-purge", "FILE",
@@ -189,6 +205,11 @@ class FPM::Package::Deb < FPM::Package
189
205
  File.expand_path(val) # Get the full path to the script
190
206
  end # --after-purge
191
207
 
208
+ option "--maintainerscripts-force-errorchecks", :flag ,
209
+ "Activate errexit shell option according to lintian. " \
210
+ "https://lintian.debian.org/tags/maintainer-script-ignores-errors.html",
211
+ :default => false
212
+
192
213
  def initialize(*args)
193
214
  super(*args)
194
215
  attributes[:deb_priority] = "extra"
@@ -218,6 +239,9 @@ class FPM::Package::Deb < FPM::Package
218
239
  when "x86_64"
219
240
  # Debian calls x86_64 "amd64"
220
241
  @architecture = "amd64"
242
+ when "aarch64"
243
+ # Debian calls aarch64 "arm64"
244
+ @architecture = "arm64"
221
245
  when "noarch"
222
246
  # Debian calls noarch "all"
223
247
  @architecture = "all"
@@ -414,6 +438,12 @@ class FPM::Package::Deb < FPM::Package
414
438
 
415
439
  def output(output_path)
416
440
  self.provides = self.provides.collect { |p| fix_provides(p) }
441
+
442
+ self.provides.each do |provide|
443
+ if !valid_provides_field?(provide)
444
+ raise FPM::InvalidPackageConfiguration, "Found invalid Provides field values (#{provide.inspect}). This is not valid in a Debian package."
445
+ end
446
+ end
417
447
  output_check(output_path)
418
448
  # Abort if the target path already exists.
419
449
 
@@ -453,6 +483,7 @@ class FPM::Package::Deb < FPM::Package
453
483
  raise "#{name}: tar is insufficient to support source_date_epoch."
454
484
  end
455
485
 
486
+ attributes[:deb_systemd] = []
456
487
  attributes.fetch(:deb_systemd_list, []).each do |systemd|
457
488
  name = File.basename(systemd, ".service")
458
489
  dest_systemd = staging_path("lib/systemd/system/#{name}.service")
@@ -460,19 +491,19 @@ class FPM::Package::Deb < FPM::Package
460
491
  FileUtils.cp(systemd, dest_systemd)
461
492
  File.chmod(0644, dest_systemd)
462
493
 
463
- # set the attribute with the systemd service name
464
- attributes[:deb_systemd] = name
494
+ # add systemd service name to attribute
495
+ attributes[:deb_systemd] << name
465
496
  end
466
497
 
467
- if script?(:before_upgrade) or script?(:after_upgrade) or attributes[:deb_systemd]
498
+ if script?(:before_upgrade) or script?(:after_upgrade) or attributes[:deb_systemd].any?
468
499
  puts "Adding action files"
469
500
  if script?(:before_install) or script?(:before_upgrade)
470
501
  scripts[:before_install] = template("deb/preinst_upgrade.sh.erb").result(binding)
471
502
  end
472
- if script?(:before_remove) or attributes[:deb_systemd]
503
+ if script?(:before_remove) or not attributes[:deb_systemd].empty?
473
504
  scripts[:before_remove] = template("deb/prerm_upgrade.sh.erb").result(binding)
474
505
  end
475
- if script?(:after_install) or script?(:after_upgrade) or attributes[:deb_systemd]
506
+ if script?(:after_install) or script?(:after_upgrade) or attributes[:deb_systemd].any?
476
507
  scripts[:after_install] = template("deb/postinst_upgrade.sh.erb").result(binding)
477
508
  end
478
509
  if script?(:after_remove)
@@ -577,15 +608,19 @@ class FPM::Package::Deb < FPM::Package
577
608
  case self.attributes[:deb_compression]
578
609
  when "gz", nil
579
610
  datatar = build_path("data.tar.gz")
611
+ controltar = build_path("control.tar.gz")
580
612
  compression = "-z"
581
613
  when "bzip2"
582
614
  datatar = build_path("data.tar.bz2")
615
+ controltar = build_path("control.tar.gz")
583
616
  compression = "-j"
584
617
  when "xz"
585
618
  datatar = build_path("data.tar.xz")
619
+ controltar = build_path("control.tar.xz")
586
620
  compression = "-J"
587
621
  when "none"
588
622
  datatar = build_path("data.tar")
623
+ controltar = build_path("control.tar")
589
624
  compression = ""
590
625
  else
591
626
  raise FPM::InvalidPackageConfiguration,
@@ -605,7 +640,7 @@ class FPM::Package::Deb < FPM::Package
605
640
  # the 'debian-binary' file has to be first
606
641
  File.expand_path(output_path).tap do |output_path|
607
642
  ::Dir.chdir(build_path) do
608
- safesystem(*ar_cmd, output_path, "debian-binary", "control.tar.gz", datatar)
643
+ safesystem(*ar_cmd, output_path, "debian-binary", controltar, datatar)
609
644
  end
610
645
  end
611
646
 
@@ -642,6 +677,43 @@ class FPM::Package::Deb < FPM::Package
642
677
  fix_provides(provides)
643
678
  end.flatten
644
679
 
680
+ if origin == FPM::Package::CPAN
681
+ # The fpm cpan code presents dependencies and provides fields as perl(ModuleName)
682
+ # so we'll need to convert them to something debian supports.
683
+
684
+ # Replace perl(ModuleName) > 1.0 with Debian-style perl-ModuleName (> 1.0)
685
+ perldepfix = lambda do |dep|
686
+ m = dep.match(/perl\((?<name>[A-Za-z0-9_:]+)\)\s*(?<op>.*$)/)
687
+ if m.nil?
688
+ # 'dep' syntax didn't look like 'perl(Name) > 1.0'
689
+ dep
690
+ else
691
+ # Also replace '::' in the perl module name with '-'
692
+ modulename = m["name"].gsub("::", "-")
693
+
694
+ # Fix any upper-casing or other naming concerns Debian has about packages
695
+ name = "#{attributes[:cpan_package_name_prefix]}-#{modulename}"
696
+
697
+ if m["op"].empty?
698
+ name
699
+ else
700
+ # 'dep' syntax was like this (version constraint): perl(Module) > 1.0
701
+ "#{name} (#{m["op"]})"
702
+ end
703
+ end
704
+ end
705
+
706
+ rejects = [ "perl(vars)", "perl(warnings)", "perl(strict)", "perl(Config)" ]
707
+ self.dependencies = self.dependencies.reject do |dep|
708
+ # Reject non-module Perl dependencies like 'vars' and 'warnings'
709
+ rejects.include?(dep)
710
+ end.collect(&perldepfix).collect(&method(:fix_dependency))
711
+
712
+ # Also fix the Provides field 'perl(ModuleName) = version' to be 'perl-modulename (= version)'
713
+ self.provides = self.provides.collect(&perldepfix).collect(&method(:fix_provides))
714
+
715
+ end # if origin == FPM::Packagin::CPAN
716
+
645
717
  if origin == FPM::Package::Deb
646
718
  changelog_path = staging_path("usr/share/doc/#{name}/changelog.Debian.gz")
647
719
  if File.exists?(changelog_path)
@@ -669,6 +741,19 @@ class FPM::Package::Deb < FPM::Package
669
741
  File.unlink(changelog_path)
670
742
  end
671
743
  end
744
+
745
+ if origin == FPM::Package::Gem
746
+ # fpm's gem input will have provides as "rubygem-name = version"
747
+ # and we need to convert this to Debian-style "rubygem-name (= version)"
748
+ self.provides = self.provides.collect do |provides|
749
+ m = /^(#{attributes[:gem_package_name_prefix]})-([^\s]+)\s*=\s*(.*)$/.match(provides)
750
+ if m
751
+ "#{m[1]}-#{m[2]} (= #{m[3]})"
752
+ else
753
+ provides
754
+ end
755
+ end
756
+ end
672
757
  end # def converted_from
673
758
 
674
759
  def debianize_op(op)
@@ -710,8 +795,13 @@ class FPM::Package::Deb < FPM::Package
710
795
  name, version = dep.gsub(/[()~>]/, "").split(/ +/)[0..1]
711
796
  nextversion = version.split(".").collect { |v| v.to_i }
712
797
  l = nextversion.length
713
- nextversion[l-2] += 1
714
- nextversion[l-1] = 0
798
+ if l > 1
799
+ nextversion[l-2] += 1
800
+ nextversion[l-1] = 0
801
+ else
802
+ # Single component versions ~> 1
803
+ nextversion[l-1] += 1
804
+ end
715
805
  nextversion = nextversion.join(".")
716
806
  return ["#{name} (>= #{version})", "#{name} (<< #{nextversion})"]
717
807
  elsif (m = dep.match(/(\S+)\s+\(!= (.+)\)/))
@@ -738,6 +828,32 @@ class FPM::Package::Deb < FPM::Package
738
828
  end
739
829
  end # def fix_dependency
740
830
 
831
+ def valid_provides_field?(text)
832
+ m = RELATIONSHIP_FIELD_PATTERN.match(text)
833
+ if m.nil?
834
+ logger.error("Invalid relationship field for debian package: #{text}")
835
+ return false
836
+ end
837
+
838
+ # Per Debian Policy manual, https://www.debian.org/doc/debian-policy/ch-relationships.html#syntax-of-relationship-fields
839
+ # >> The relations allowed are <<, <=, =, >= and >> for strictly earlier, earlier or equal,
840
+ # >> exactly equal, later or equal and strictly later, respectively. The exception is the
841
+ # >> Provides field, for which only = is allowed
842
+ if m["relation"] == "=" || m["relation"] == nil
843
+ return true
844
+ end
845
+ return false
846
+ end
847
+
848
+ def valid_relationship_field?(text)
849
+ m = RELATIONSHIP_FIELD_PATTERN.match(text)
850
+ if m.nil?
851
+ logger.error("Invalid relationship field for debian package: #{text}")
852
+ return false
853
+ end
854
+ return true
855
+ end
856
+
741
857
  def fix_provides(provides)
742
858
  name_re = /^[^ \(]+/
743
859
  name = provides[name_re]
@@ -752,6 +868,11 @@ class FPM::Package::Deb < FPM::Package
752
868
  "debs don't like underscores")
753
869
  provides = provides.gsub("_", "-")
754
870
  end
871
+
872
+ if m = provides.match(/^([A-Za-z0-9_-]+)\s*=\s*(\d+.*$)/)
873
+ logger.warn("Replacing 'provides' entry #{provides} with syntax 'name (= version)'")
874
+ provides = "#{m[1]} (= #{m[2]})"
875
+ end
755
876
  return provides.rstrip
756
877
  end
757
878
 
@@ -779,17 +900,14 @@ class FPM::Package::Deb < FPM::Package
779
900
 
780
901
  # Tar up the staging_path into control.tar.{compression type}
781
902
  case self.attributes[:deb_compression]
782
- when "gz", nil
783
- controltar = build_path("control.tar.gz")
903
+ when "gz", "bzip2", nil
904
+ controltar = "control.tar.gz"
784
905
  compression = "-z"
785
- when "bzip2"
786
- controltar = build_path("control.tar.bz2")
787
- compression = "-j"
788
906
  when "xz"
789
- controltar = build_path("control.tar.xz")
907
+ controltar = "control.tar.xz"
790
908
  compression = "-J"
791
909
  when "none"
792
- controltar = build_path("control.tar")
910
+ controltar = "control.tar"
793
911
  compression = ""
794
912
  else
795
913
  raise FPM::InvalidPackageConfiguration,
@@ -797,7 +915,7 @@ class FPM::Package::Deb < FPM::Package
797
915
  end
798
916
 
799
917
  # Make the control.tar.gz
800
- build_path("control.tar.gz").tap do |controltar|
918
+ build_path(controltar).tap do |controltar|
801
919
  logger.info("Creating", :path => controltar, :from => control_path)
802
920
 
803
921
  args = [ tar_cmd, "-C", control_path, compression, "-cf", controltar,
@@ -889,7 +1007,7 @@ class FPM::Package::Deb < FPM::Package
889
1007
  etcfiles = []
890
1008
  # Add everything in /etc
891
1009
  begin
892
- if !attributes[:deb_no_default_config_files?]
1010
+ if !attributes[:deb_no_default_config_files?] && File.exists?(staging_path("/etc"))
893
1011
  logger.warn("Debian packaging tools generally labels all files in /etc as config files, " \
894
1012
  "as mandated by policy, so fpm defaults to this behavior for deb packages. " \
895
1013
  "You can disable this default behavior with --deb-no-default-config-files flag")
@@ -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,9 +1,21 @@
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
 
6
6
  class FPM::Package::Empty < FPM::Package
7
+ def initialize(*args)
8
+ super(*args)
9
+
10
+ # Override FPM::Package's default "native" architecture value
11
+ # This feels like the right default because an empty package has no
12
+ # architecture-specific files, and in most cases an empty package should be
13
+ # installable anywhere.
14
+ #
15
+ # https://github.com/jordansissel/fpm/issues/1846
16
+ @architecture = "all"
17
+ end
18
+
7
19
  def output(output_path)
8
20
  logger.warn("Your package has gone into the void.")
9
21
  end
@@ -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"
@@ -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,17 @@ 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
+ safesystem("tar", "-Jcf", output_path, "-C", staging_path, "--files-from", build_path("file_list"), "--transform", 's|^\([^+]\)|/\1|')
99
90
  end # def output
100
91
 
101
92
  # Handle architecture naming conversion:
@@ -110,6 +101,8 @@ class FPM::Package::FreeBSD < FPM::Package
110
101
  wordsize = case @architecture
111
102
  when nil, 'native'
112
103
  %x{getconf LONG_BIT}.chomp # 'native' is current arch
104
+ when 'arm64'
105
+ '64'
113
106
  when 'amd64'
114
107
  '64'
115
108
  when 'i386'
@@ -53,6 +53,15 @@ class FPM::Package::Gem < FPM::Package
53
53
  "The directory where fpm installs the gem temporarily before conversion. " \
54
54
  "Normally a random subdirectory of workdir."
55
55
 
56
+ option "--git-repo", "GIT_REPO",
57
+ "Use this git repo address as the source of the gem instead of " \
58
+ "rubygems.org.", :default => nil
59
+
60
+ option "--git-branch", "GIT_BRANCH",
61
+ "When using a git repo as the source of the gem instead of " \
62
+ "rubygems.org, use this git branch.",
63
+ :default => nil
64
+
56
65
  # Override parent method
57
66
  def staging_path(path=nil)
58
67
  @gem_staging_path ||= attributes[:gem_stagingdir] || Stud::Temporary.directory("package-#{type}-staging")
@@ -91,21 +100,34 @@ class FPM::Package::Gem < FPM::Package
91
100
 
92
101
  logger.info("Trying to download", :gem => gem_name, :version => gem_version)
93
102
 
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
103
  download_dir = build_path(gem_name)
100
104
  FileUtils.mkdir(download_dir) unless File.directory?(download_dir)
101
105
 
102
- ::Dir.chdir(download_dir) do |dir|
103
- logger.debug("Downloading in directory #{dir}")
104
- safesystem(*gem_fetch)
106
+ if attributes[:gem_git_repo]
107
+ require "git"
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"]