fpm 1.13.1 → 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: a51484aca566bb4b8a1362c216c96aeb3fe0400abc44befefe32152624e99148
4
- data.tar.gz: 1ae93c91155b91e8decc380fa502ed8e38dd14d74df232bf29ece3c89f34ca4a
3
+ metadata.gz: '0970e7bbf6bfc2becbfc2c4ed787bb08eb8eef555b6cc969f219685dc67c8056'
4
+ data.tar.gz: 1472f32b8133588cb6ce39311c1f2e16fbbe86204c65b4ec5fc9ed7181fd6550
5
5
  SHA512:
6
- metadata.gz: dbca18e4c26ed2d88e9918985288617e8678e5a8d2872170ea5b1a35ac63e740c317513faa5ed9d9c12efef9dc464e09f324e94b2504ceaddf58c02aeecd2ec8
7
- data.tar.gz: 0f1865843b14ac86cd4d8fdf0a7b71d1dfd2c5912e9b66dd7e2169a659646afbfc7adc61da55e9ac8414944e717a7b90c7ea5b3d6994301549e5af73b88994b0
6
+ metadata.gz: 336e859e103edc0c76fa9f89f4dbfc1d9c9a183d7314e405ff8ddafe24134655cfb90c8121566173a4986ad72064b108d89d81e06426e2b3586ec0110d132f9e
7
+ data.tar.gz: 1e7e9fb8f0eff4dcbf4aa45c526b5295b8534c83d97555d7322e69b6b6a6738494a6fac872aec85a3c94b0b5c86720bef52271d2ae75bb2e8916c4978968ed9f
data/CHANGELOG.rst CHANGED
@@ -1,11 +1,25 @@
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
+
4
18
  1.13.1 (July 6, 2021)
5
19
  ^^^^^^^^^^^^^^^^^^^^^
6
20
  * deb: The `--provides` flag now allows for versions. Previously, fpm would
7
21
  remove the version part of a provides field when generating deb packages.
8
- (`#1788`_, `#1803`_; Jordan Sissel, Phil Schwarz, tympanix)
22
+ (`#1788`_, `#1803`_; Jordan Sissel, Phil Schwartz, tympanix)
9
23
  * osxpkg: Update documentation to include installing `rpm` tools on OSX
10
24
  (`#1797`_; allen joslin)
11
25
 
@@ -20,8 +34,7 @@ Release Notes and Change Log
20
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)
21
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)
22
36
  * deb: Fix syntax error in `postinst` (`--after-install`) script. (`#1752`_, `#1749`_, `#1764`_; rmanus, Adam Mohammed, Elliot Murphy, kimw, Jordan Sissel)
23
- * deb: --deb-compression now uses the same compression and file suffix on the control.tar file (`#1760`_; Philippe Poilbarbe
24
- )
37
+ * deb: --deb-compression now uses the same compression and file suffix on the control.tar file (`#1760`_; Philippe Poilbarbe)
25
38
 
26
39
 
27
40
  1.12.0 (January 19, 2021)
@@ -59,7 +72,7 @@ Release Notes and Change Log
59
72
  * cpan: Adds `--[no-]cpan-verbose` flag which, when set, runs `cpanm` with the `--verbose` flag (`#1511`_; William N. Braswell, Jr)
60
73
 
61
74
  1.10.0 (May 21, 2018)
62
- ^^^^^^^^^^^^^^^^^^^^
75
+ ^^^^^^^^^^^^^^^^^^^^^
63
76
 
64
77
  * Pin `ruby-xz` dependency to one which allows Ruby versions older than 2.3.0 (`#1494`_; Marat Sharafutdinov)
65
78
  * Documentation improvements: `#1488`_; Arthur Burkart. `#1384`_; Justin Kolberg. `#1452`_; Anatoli Babenia.
@@ -87,7 +100,7 @@ Release Notes and Change Log
87
100
  * rpm: Fix `--config-files` handling (`#1390`_, `#1391`_; Jordan Sissel)
88
101
 
89
102
  1.9.1 (July 28, 2017) happy sysadmin day!
90
- ^^^^^^^^^^^^^^^^^^^^^
103
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
91
104
 
92
105
  * Documentation improvements: `#1291`_; Pablo Castellano. `#1321`_; ge-fa. `#1309`_; jesusbagpuss. `#1349`_; Perry Stole. `#1352`_, Jordan Sissel. `#1384`_; Justin Kolberg.
93
106
  * Testing improvements: `#1320`_; Rob Young. `#1266`_; Ryan Parman. `#1374`_; Thiago Figueiró.
@@ -116,9 +129,9 @@ Release Notes and Change Log
116
129
  * Other: Remove unused archive-tar-minitar as a dependency of fpm (`#1355`_; Diego Martins)
117
130
  * Other: Add stud as a runtime dependency (`#1354`_; Elan Ruusamäe)
118
131
 
119
- .. _reproducible_builds:: https://reproducible-builds.org/
120
- .. _path mapping:: http://fpm.readthedocs.io/en/latest/source/dir.html#path-mapping
121
- .. _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
122
135
 
123
136
  1.9.0 (July 28, 2017)
124
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
@@ -25,6 +25,17 @@ class FPM::Package::Deb < FPM::Package
25
25
  # The list of supported compression types. Default is gz (gzip)
26
26
  COMPRESSION_TYPES = [ "gz", "bzip2", "xz", "none" ]
27
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
+
28
39
  option "--ignore-iteration-in-dependencies", :flag,
29
40
  "For '=' (equal) dependencies, allow iterations on the specified " \
30
41
  "version. Default is to be specific. This option allows the same " \
@@ -427,6 +438,12 @@ class FPM::Package::Deb < FPM::Package
427
438
 
428
439
  def output(output_path)
429
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
430
447
  output_check(output_path)
431
448
  # Abort if the target path already exists.
432
449
 
@@ -595,7 +612,7 @@ class FPM::Package::Deb < FPM::Package
595
612
  compression = "-z"
596
613
  when "bzip2"
597
614
  datatar = build_path("data.tar.bz2")
598
- controltar = build_path("control.tar.bz2")
615
+ controltar = build_path("control.tar.gz")
599
616
  compression = "-j"
600
617
  when "xz"
601
618
  datatar = build_path("data.tar.xz")
@@ -660,6 +677,43 @@ class FPM::Package::Deb < FPM::Package
660
677
  fix_provides(provides)
661
678
  end.flatten
662
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
+
663
717
  if origin == FPM::Package::Deb
664
718
  changelog_path = staging_path("usr/share/doc/#{name}/changelog.Debian.gz")
665
719
  if File.exists?(changelog_path)
@@ -774,6 +828,32 @@ class FPM::Package::Deb < FPM::Package
774
828
  end
775
829
  end # def fix_dependency
776
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
+
777
857
  def fix_provides(provides)
778
858
  name_re = /^[^ \(]+/
779
859
  name = provides[name_re]
@@ -820,12 +900,9 @@ class FPM::Package::Deb < FPM::Package
820
900
 
821
901
  # Tar up the staging_path into control.tar.{compression type}
822
902
  case self.attributes[:deb_compression]
823
- when "gz", nil
903
+ when "gz", "bzip2", nil
824
904
  controltar = "control.tar.gz"
825
905
  compression = "-z"
826
- when "bzip2"
827
- controltar = "control.tar.bz2"
828
- compression = "-j"
829
906
  when "xz"
830
907
  controltar = "control.tar.xz"
831
908
  compression = "-J"
@@ -930,7 +1007,7 @@ class FPM::Package::Deb < FPM::Package
930
1007
  etcfiles = []
931
1008
  # Add everything in /etc
932
1009
  begin
933
- if !attributes[:deb_no_default_config_files?]
1010
+ if !attributes[:deb_no_default_config_files?] && File.exists?(staging_path("/etc"))
934
1011
  logger.warn("Debian packaging tools generally labels all files in /etc as config files, " \
935
1012
  "as mandated by policy, so fpm defaults to this behavior for deb packages. " \
936
1013
  "You can disable this default behavior with --deb-no-default-config-files flag")
@@ -4,6 +4,18 @@ require "backports/latest"
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
@@ -86,9 +86,7 @@ class FPM::Package::FreeBSD < FPM::Package
86
86
  # We use --files-from here to keep the tar entries from having `./` as the prefix.
87
87
  # This is done as a best effor to mimic what FreeBSD packages do, having everything at the top-level as
88
88
  # file names, like "+MANIFEST" instead of "./+MANIFEST"
89
- # Note: This will include top-level files like "/usr/bin/foo" listed in the tar as "usr/bin/fo" without
90
- # a leading slash. I don't know if this has any negative impact on freebsd packages.
91
- safesystem("tar", "-Jcf", output_path, "-C", staging_path, "--files-from", build_path("file_list"))
89
+ safesystem("tar", "-Jcf", output_path, "-C", staging_path, "--files-from", build_path("file_list"), "--transform", 's|^\([^+]\)|/\1|')
92
90
  end # def output
93
91
 
94
92
  # Handle architecture naming conversion:
@@ -90,6 +90,11 @@ class get_metadata(Command):
90
90
  for dep in pkg_resources.parse_requirements(
91
91
  self.distribution.install_requires):
92
92
  final_deps.extend(self.process_dep(dep))
93
+ if getattr(self.distribution, 'extras_require', None):
94
+ for dep in pkg_resources.parse_requirements(
95
+ v for k, v in self.distribution.extras_require.items()
96
+ if k.startswith(':') and pkg_resources.evaluate_marker(k[1:])):
97
+ final_deps.extend(self.process_dep(dep))
93
98
 
94
99
  data["dependencies"] = final_deps
95
100
 
@@ -79,7 +79,11 @@ class FPM::Package::Python < FPM::Package
79
79
  option "--setup-py-arguments", "setup_py_argument",
80
80
  "Arbitrary argument(s) to be passed to setup.py",
81
81
  :multivalued => true, :attribute_name => :python_setup_py_arguments,
82
- :default => []
82
+ :default => []
83
+ option "--internal-pip", :flag,
84
+ "Use the pip module within python to install modules - aka 'python -m pip'. This is the recommended usage since Python 3.4 (2014) instead of invoking the 'pip' script",
85
+ :attribute_name => :python_internal_pip,
86
+ :default => true
83
87
 
84
88
  private
85
89
 
@@ -130,23 +134,24 @@ class FPM::Package::Python < FPM::Package
130
134
  target = build_path(package)
131
135
  FileUtils.mkdir(target) unless File.directory?(target)
132
136
 
133
- if attributes[:python_pip].nil?
134
- # no pip, use easy_install
135
- logger.debug("no pip, defaulting to easy_install", :easy_install => attributes[:python_easyinstall])
136
- safesystem(attributes[:python_easyinstall], "-i",
137
- attributes[:python_pypi], "--editable", "-U",
138
- "--build-directory", target, want_pkg)
139
- else
137
+ if attributes[:python_internal_pip?]
138
+ # XXX: Should we detect if internal pip is available?
139
+ attributes[:python_pip] = [ attributes[:python_bin], "-m", "pip"]
140
+ end
141
+
142
+ # attributes[:python_pip] -- expected to be a path
143
+ if attributes[:python_pip]
140
144
  logger.debug("using pip", :pip => attributes[:python_pip])
141
145
  # TODO: Support older versions of pip
142
146
 
147
+ pip = [attributes[:python_pip]] if pip.is_a?(String)
143
148
  setup_cmd = [
144
- attributes[:python_pip],
149
+ *attributes[:python_pip],
145
150
  "download",
146
151
  "--no-clean",
147
152
  "--no-deps",
148
- "--no-binary",
149
- ":all:",
153
+ "--no-binary", ":all:",
154
+ "-d", build_path,
150
155
  "-i", attributes[:python_pypi],
151
156
  ]
152
157
 
@@ -164,6 +169,12 @@ class FPM::Package::Python < FPM::Package
164
169
  ]
165
170
 
166
171
  safesystem(*setup_cmd)
172
+ else
173
+ # no pip, use easy_install
174
+ logger.debug("no pip, defaulting to easy_install", :easy_install => attributes[:python_easyinstall])
175
+ safesystem(attributes[:python_easyinstall], "-i",
176
+ attributes[:python_pypi], "--editable", "-U",
177
+ "--build-directory", target, want_pkg)
167
178
  end
168
179
 
169
180
  # easy_install will put stuff in @tmpdir/packagename/, so find that:
@@ -254,6 +254,12 @@ class FPM::Package::RPM < FPM::Package
254
254
 
255
255
  # This method ensures a default value for iteration if none is provided.
256
256
  def iteration
257
+ if @iteration.kind_of?(String) and @iteration.include?("-")
258
+ logger.warn("Package iteration '#{@iteration}' includes dashes, converting" \
259
+ " to underscores. rpmbuild does not allow the dashes in the package iteration (called 'Release' in rpm)")
260
+ @iteration = @iteration.gsub(/-/, "_")
261
+ end
262
+
257
263
  return @iteration ? @iteration : 1
258
264
  end # def iteration
259
265
 
data/lib/fpm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module FPM
2
- VERSION = "1.13.1"
2
+ VERSION = "1.14.0"
3
3
  end
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.13.1
4
+ version: 1.14.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: 2021-07-06 00:00:00.000000000 Z
11
+ date: 2021-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -86,20 +86,6 @@ dependencies:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: 1.0.0
89
- - !ruby/object:Gem::Dependency
90
- name: rake
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - "~>"
94
- - !ruby/object:Gem::Version
95
- version: '10'
96
- type: :development
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: '10'
103
89
  - !ruby/object:Gem::Dependency
104
90
  name: pleaserun
105
91
  requirement: !ruby/object:Gem::Requirement
@@ -294,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
294
280
  - !ruby/object:Gem::Version
295
281
  version: '0'
296
282
  requirements: []
297
- rubygems_version: 3.2.15
283
+ rubygems_version: 3.2.31
298
284
  signing_key:
299
285
  specification_version: 4
300
286
  summary: fpm - package building and mangling