fpm 1.13.1 → 1.14.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a51484aca566bb4b8a1362c216c96aeb3fe0400abc44befefe32152624e99148
4
- data.tar.gz: 1ae93c91155b91e8decc380fa502ed8e38dd14d74df232bf29ece3c89f34ca4a
3
+ metadata.gz: 8d9090d2dd285f34892443936dfd389afe4f566eadc9cc3eb8cdc2103f93f712
4
+ data.tar.gz: 44e67a378384be66baddf1c5dfcb1a2ed88f1b512ed84b9bba7c823866e71e31
5
5
  SHA512:
6
- metadata.gz: dbca18e4c26ed2d88e9918985288617e8678e5a8d2872170ea5b1a35ac63e740c317513faa5ed9d9c12efef9dc464e09f324e94b2504ceaddf58c02aeecd2ec8
7
- data.tar.gz: 0f1865843b14ac86cd4d8fdf0a7b71d1dfd2c5912e9b66dd7e2169a659646afbfc7adc61da55e9ac8414944e717a7b90c7ea5b3d6994301549e5af73b88994b0
6
+ metadata.gz: 68e628235ec80373159575e51ece876047f12fc9a149c03c4652424ad29605059e83483e0d1dcae2e85fba9bbe53989a6489d9b18f23e699afd787401c215264
7
+ data.tar.gz: 873f374ccb59dcdd95bf0f586a007a46cc0a4a9d28ebdb616dc829d8b3f8fbf80b9231b0625050d4d1b6e0153ee0df168eaac712c436a6724cd70d7116311b7d
data/CHANGELOG.rst CHANGED
@@ -1,11 +1,38 @@
1
1
  Release Notes and Change Log
2
2
  ============================
3
3
 
4
+ 1.14.2 (March 30, 2022)
5
+ ^^^^^^^^^^^^^^^^^^^^^^^
6
+ * deb: fix bug causing ``--deb-compression none`` to invoke ``tar`` incorrectly (`#1879`_; John Howard)
7
+ * rpm: Better support for paths that have spaces and mixed quotation marks in them. (`#1882`_, `#1886`_, `#1385`_; John Bollinger and Jordan Sissel)
8
+ * pacman: Fix typo preventing the use of ``--pacman-compression xz`` (`#1876`_; mszprejda)
9
+ * docs: All supported package types now have dedicated documentation pages. Some pages are small stubs and would benefit from future improvement. (`#1884`_; mcandre, Jordan Sissel)
10
+ * docs: Small but lovely documentation fixes (`#1875`_ by Corey Quinn, `#1864`_ by Geoff Beier)
11
+ * Fixed mistake causing the test suite to fail when ``rake`` wasn't available. (`#1877`_; Jordan Sissel)
12
+
13
+ 1.14.1 (November 10, 2021)
14
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
15
+ * Fix a bug that impacted fpm api usage (from other ruby programs) that caused an error "NameError: uninitialized constant FPM::Package::CPAN" when trying to output a Deb package. (`#1854`_, `#1856`_; Karol Bucek, Jordan Sissel)
16
+
17
+ 1.14.0 (November 9, 2021)
18
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
19
+ * 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)
20
+ * python: Support extras_require build markers in python packages (`#1307`_, `#1816`_; Joris Vandermeersch)
21
+ * 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)
22
+ * 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)
23
+ * deb: Only show a warning about /etc and config files if there are files in /etc (`#1852`_, `#1851`_; Jordan Sissel)
24
+
25
+ * rpm: replace dash with underscore in rpm's "Release" field aka what fpm calls ``--iteration``. (`#1834`_, `#1833`_; Jordan Sissel)
26
+ * empty: `fpm -s empty ...` now defaults to "all" architecture instead of "native". (`#1850`_, `#1846`_; Jordan Sissel)
27
+ * 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)
28
+ * Typo fixes in documentation are always appreciated! (`#1842`_; Clayton Wong)
29
+ * fpm can now (we hope!) now be tested more easily from docker (`#1818`_, `#1682`_, `#1453`_; @directionless, Jordan Sissel, Douglas Muth)
30
+
4
31
  1.13.1 (July 6, 2021)
5
32
  ^^^^^^^^^^^^^^^^^^^^^
6
33
  * deb: The `--provides` flag now allows for versions. Previously, fpm would
7
34
  remove the version part of a provides field when generating deb packages.
8
- (`#1788`_, `#1803`_; Jordan Sissel, Phil Schwarz, tympanix)
35
+ (`#1788`_, `#1803`_; Jordan Sissel, Phil Schwartz, tympanix)
9
36
  * osxpkg: Update documentation to include installing `rpm` tools on OSX
10
37
  (`#1797`_; allen joslin)
11
38
 
@@ -20,8 +47,7 @@ Release Notes and Change Log
20
47
  * 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
48
  * 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
49
  * 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
- )
50
+ * deb: --deb-compression now uses the same compression and file suffix on the control.tar file (`#1760`_; Philippe Poilbarbe)
25
51
 
26
52
 
27
53
  1.12.0 (January 19, 2021)
@@ -59,7 +85,7 @@ Release Notes and Change Log
59
85
  * cpan: Adds `--[no-]cpan-verbose` flag which, when set, runs `cpanm` with the `--verbose` flag (`#1511`_; William N. Braswell, Jr)
60
86
 
61
87
  1.10.0 (May 21, 2018)
62
- ^^^^^^^^^^^^^^^^^^^^
88
+ ^^^^^^^^^^^^^^^^^^^^^
63
89
 
64
90
  * Pin `ruby-xz` dependency to one which allows Ruby versions older than 2.3.0 (`#1494`_; Marat Sharafutdinov)
65
91
  * Documentation improvements: `#1488`_; Arthur Burkart. `#1384`_; Justin Kolberg. `#1452`_; Anatoli Babenia.
@@ -87,7 +113,7 @@ Release Notes and Change Log
87
113
  * rpm: Fix `--config-files` handling (`#1390`_, `#1391`_; Jordan Sissel)
88
114
 
89
115
  1.9.1 (July 28, 2017) happy sysadmin day!
90
- ^^^^^^^^^^^^^^^^^^^^^
116
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
91
117
 
92
118
  * Documentation improvements: `#1291`_; Pablo Castellano. `#1321`_; ge-fa. `#1309`_; jesusbagpuss. `#1349`_; Perry Stole. `#1352`_, Jordan Sissel. `#1384`_; Justin Kolberg.
93
119
  * Testing improvements: `#1320`_; Rob Young. `#1266`_; Ryan Parman. `#1374`_; Thiago Figueiró.
@@ -116,9 +142,9 @@ Release Notes and Change Log
116
142
  * Other: Remove unused archive-tar-minitar as a dependency of fpm (`#1355`_; Diego Martins)
117
143
  * Other: Add stud as a runtime dependency (`#1354`_; Elan Ruusamäe)
118
144
 
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
145
+ .. _reproducible_builds: https://reproducible-builds.org/
146
+ .. _path mapping: source/dir.html#path-mapping
147
+ .. _Deterministic output: source/gem.html
122
148
 
123
149
  1.9.0 (July 28, 2017)
124
150
  ^^^^^^^^^^^^^^^^^^^^^
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
@@ -8,6 +8,10 @@ require "fileutils"
8
8
  require "digest"
9
9
  require "zlib"
10
10
 
11
+ # For handling conversion
12
+ require "fpm/package/cpan"
13
+ require "fpm/package/gem"
14
+
11
15
  # Support for debian packages (.deb files)
12
16
  #
13
17
  # This class supports both input and output of packages.
@@ -25,6 +29,17 @@ class FPM::Package::Deb < FPM::Package
25
29
  # The list of supported compression types. Default is gz (gzip)
26
30
  COMPRESSION_TYPES = [ "gz", "bzip2", "xz", "none" ]
27
31
 
32
+ # https://www.debian.org/doc/debian-policy/ch-relationships.html#syntax-of-relationship-fields
33
+ # Example value with version relationship: libc6 (>= 2.2.1)
34
+ # Example value: libc6
35
+
36
+ # Version string docs here: https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-version
37
+ # The format is: [epoch:]upstream_version[-debian_revision].
38
+ # epoch - This is a single (generally small) unsigned integer
39
+ # upstream_version - must contain only alphanumerics 6 and the characters . + - ~
40
+ # debian_revision - only alphanumerics and the characters + . ~
41
+ RELATIONSHIP_FIELD_PATTERN = /^(?<name>[A-z0-9_-]+)(?: *\((?<relation>[<>=]+) *(?<version>(?:[0-9]+:)?[0-9A-Za-z+~.-]+(?:-[0-9A-Za-z+~.]+)?)\))?$/
42
+
28
43
  option "--ignore-iteration-in-dependencies", :flag,
29
44
  "For '=' (equal) dependencies, allow iterations on the specified " \
30
45
  "version. Default is to be specific. This option allows the same " \
@@ -427,6 +442,12 @@ class FPM::Package::Deb < FPM::Package
427
442
 
428
443
  def output(output_path)
429
444
  self.provides = self.provides.collect { |p| fix_provides(p) }
445
+
446
+ self.provides.each do |provide|
447
+ if !valid_provides_field?(provide)
448
+ raise FPM::InvalidPackageConfiguration, "Found invalid Provides field values (#{provide.inspect}). This is not valid in a Debian package."
449
+ end
450
+ end
430
451
  output_check(output_path)
431
452
  # Abort if the target path already exists.
432
453
 
@@ -592,25 +613,24 @@ class FPM::Package::Deb < FPM::Package
592
613
  when "gz", nil
593
614
  datatar = build_path("data.tar.gz")
594
615
  controltar = build_path("control.tar.gz")
595
- compression = "-z"
616
+ compression_flags = ["-z"]
596
617
  when "bzip2"
597
618
  datatar = build_path("data.tar.bz2")
598
- controltar = build_path("control.tar.bz2")
599
- compression = "-j"
619
+ controltar = build_path("control.tar.gz")
620
+ compression_flags = ["-j"]
600
621
  when "xz"
601
622
  datatar = build_path("data.tar.xz")
602
623
  controltar = build_path("control.tar.xz")
603
- compression = "-J"
624
+ compression_flags = ["-J"]
604
625
  when "none"
605
626
  datatar = build_path("data.tar")
606
627
  controltar = build_path("control.tar")
607
- compression = ""
628
+ compression_flags = []
608
629
  else
609
630
  raise FPM::InvalidPackageConfiguration,
610
631
  "Unknown compression type '#{self.attributes[:deb_compression]}'"
611
632
  end
612
-
613
- args = [ tar_cmd, "-C", staging_path, compression ] + data_tar_flags + [ "-cf", datatar, "." ]
633
+ args = [ tar_cmd, "-C", staging_path ] + compression_flags + data_tar_flags + [ "-cf", datatar, "." ]
614
634
  if tar_cmd_supports_sort_names_and_set_mtime? and not attributes[:source_date_epoch].nil?
615
635
  # Use gnu tar options to force deterministic file order and timestamp
616
636
  args += ["--sort=name", ("--mtime=@%s" % attributes[:source_date_epoch])]
@@ -660,6 +680,43 @@ class FPM::Package::Deb < FPM::Package
660
680
  fix_provides(provides)
661
681
  end.flatten
662
682
 
683
+ if origin == FPM::Package::CPAN
684
+ # The fpm cpan code presents dependencies and provides fields as perl(ModuleName)
685
+ # so we'll need to convert them to something debian supports.
686
+
687
+ # Replace perl(ModuleName) > 1.0 with Debian-style perl-ModuleName (> 1.0)
688
+ perldepfix = lambda do |dep|
689
+ m = dep.match(/perl\((?<name>[A-Za-z0-9_:]+)\)\s*(?<op>.*$)/)
690
+ if m.nil?
691
+ # 'dep' syntax didn't look like 'perl(Name) > 1.0'
692
+ dep
693
+ else
694
+ # Also replace '::' in the perl module name with '-'
695
+ modulename = m["name"].gsub("::", "-")
696
+
697
+ # Fix any upper-casing or other naming concerns Debian has about packages
698
+ name = "#{attributes[:cpan_package_name_prefix]}-#{modulename}"
699
+
700
+ if m["op"].empty?
701
+ name
702
+ else
703
+ # 'dep' syntax was like this (version constraint): perl(Module) > 1.0
704
+ "#{name} (#{m["op"]})"
705
+ end
706
+ end
707
+ end
708
+
709
+ rejects = [ "perl(vars)", "perl(warnings)", "perl(strict)", "perl(Config)" ]
710
+ self.dependencies = self.dependencies.reject do |dep|
711
+ # Reject non-module Perl dependencies like 'vars' and 'warnings'
712
+ rejects.include?(dep)
713
+ end.collect(&perldepfix).collect(&method(:fix_dependency))
714
+
715
+ # Also fix the Provides field 'perl(ModuleName) = version' to be 'perl-modulename (= version)'
716
+ self.provides = self.provides.collect(&perldepfix).collect(&method(:fix_provides))
717
+
718
+ end # if origin == FPM::Packagin::CPAN
719
+
663
720
  if origin == FPM::Package::Deb
664
721
  changelog_path = staging_path("usr/share/doc/#{name}/changelog.Debian.gz")
665
722
  if File.exists?(changelog_path)
@@ -774,6 +831,32 @@ class FPM::Package::Deb < FPM::Package
774
831
  end
775
832
  end # def fix_dependency
776
833
 
834
+ def valid_provides_field?(text)
835
+ m = RELATIONSHIP_FIELD_PATTERN.match(text)
836
+ if m.nil?
837
+ logger.error("Invalid relationship field for debian package: #{text}")
838
+ return false
839
+ end
840
+
841
+ # Per Debian Policy manual, https://www.debian.org/doc/debian-policy/ch-relationships.html#syntax-of-relationship-fields
842
+ # >> The relations allowed are <<, <=, =, >= and >> for strictly earlier, earlier or equal,
843
+ # >> exactly equal, later or equal and strictly later, respectively. The exception is the
844
+ # >> Provides field, for which only = is allowed
845
+ if m["relation"] == "=" || m["relation"] == nil
846
+ return true
847
+ end
848
+ return false
849
+ end
850
+
851
+ def valid_relationship_field?(text)
852
+ m = RELATIONSHIP_FIELD_PATTERN.match(text)
853
+ if m.nil?
854
+ logger.error("Invalid relationship field for debian package: #{text}")
855
+ return false
856
+ end
857
+ return true
858
+ end
859
+
777
860
  def fix_provides(provides)
778
861
  name_re = /^[^ \(]+/
779
862
  name = provides[name_re]
@@ -820,18 +903,15 @@ class FPM::Package::Deb < FPM::Package
820
903
 
821
904
  # Tar up the staging_path into control.tar.{compression type}
822
905
  case self.attributes[:deb_compression]
823
- when "gz", nil
906
+ when "gz", "bzip2", nil
824
907
  controltar = "control.tar.gz"
825
- compression = "-z"
826
- when "bzip2"
827
- controltar = "control.tar.bz2"
828
- compression = "-j"
908
+ compression_flags = ["-z"]
829
909
  when "xz"
830
910
  controltar = "control.tar.xz"
831
- compression = "-J"
911
+ compression_flags = ["-J"]
832
912
  when "none"
833
913
  controltar = "control.tar"
834
- compression = ""
914
+ compression_flags = []
835
915
  else
836
916
  raise FPM::InvalidPackageConfiguration,
837
917
  "Unknown compression type '#{self.attributes[:deb_compression]}'"
@@ -841,7 +921,7 @@ class FPM::Package::Deb < FPM::Package
841
921
  build_path(controltar).tap do |controltar|
842
922
  logger.info("Creating", :path => controltar, :from => control_path)
843
923
 
844
- args = [ tar_cmd, "-C", control_path, compression, "-cf", controltar,
924
+ args = [ tar_cmd, "-C", control_path ] + compression_flags + [ "-cf", controltar,
845
925
  "--owner=0", "--group=0", "--numeric-owner", "." ]
846
926
  if tar_cmd_supports_sort_names_and_set_mtime? and not attributes[:source_date_epoch].nil?
847
927
  # Force deterministic file order and timestamp
@@ -930,7 +1010,7 @@ class FPM::Package::Deb < FPM::Package
930
1010
  etcfiles = []
931
1011
  # Add everything in /etc
932
1012
  begin
933
- if !attributes[:deb_no_default_config_files?]
1013
+ if !attributes[:deb_no_default_config_files?] && File.exists?(staging_path("/etc"))
934
1014
  logger.warn("Debian packaging tools generally labels all files in /etc as config files, " \
935
1015
  "as mandated by policy, so fpm defaults to this behavior for deb packages. " \
936
1016
  "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:
@@ -234,7 +234,7 @@ class FPM::Package::Pacman < FPM::Package
234
234
  return ""
235
235
  when "gz"
236
236
  return ".gz"
237
- when "zx"
237
+ when "xz"
238
238
  return ".xz"
239
239
  when "bzip2"
240
240
  return ".bz2"
@@ -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:
@@ -4,6 +4,9 @@ require "fileutils"
4
4
  require "find"
5
5
  require "arr-pm/file" # gem 'arr-pm'
6
6
 
7
+ # For conversion handling
8
+ require "fpm/package/gem"
9
+
7
10
  # RPM Package type.
8
11
  #
9
12
  # Build RPMs without having to waste hours reading Maximum-RPM.
@@ -189,17 +192,26 @@ class FPM::Package::RPM < FPM::Package
189
192
  # Replace * with [*] to make rpm not use globs
190
193
  # Replace ? with [?] to make rpm not use globs
191
194
  # Replace % with [%] to make rpm not expand macros
195
+ # Replace whitespace with ? to make rpm not split the filename
196
+ # If and only if any of the above are done, then also replace ' with \', " with \", and \ with \\\\
197
+ # to accommodate escape and quote processing that rpm will perform in that case (but not otherwise)
192
198
  def rpm_fix_name(name)
193
- name = name.gsub(/(\ |\[|\]|\*|\?|\%|\$|')/, {
194
- ' ' => '?',
195
- '%' => '[%]',
196
- '$' => '[$]',
197
- '?' => '[?]',
198
- '*' => '[*]',
199
- '[' => '[\[]',
200
- ']' => '[\]]',
201
- "'" => "\\'",
202
- })
199
+ if name.match?(/[ \t*?%$\[\]]/)
200
+ name = name.gsub(/(\ |\t|\[|\]|\*|\?|\%|\$|'|"|\\)/, {
201
+ ' ' => '?',
202
+ "\t" => '?',
203
+ '%' => '[%]',
204
+ '$' => '[$]',
205
+ '?' => '[?]',
206
+ '*' => '[*]',
207
+ '[' => '[\[]',
208
+ ']' => '[\]]',
209
+ '"' => '\\"',
210
+ "'" => "\\'",
211
+ '\\' => '\\\\\\\\',
212
+ })
213
+ end
214
+ name
203
215
  end
204
216
 
205
217
  def rpm_file_entry(file)
@@ -254,6 +266,12 @@ class FPM::Package::RPM < FPM::Package
254
266
 
255
267
  # This method ensures a default value for iteration if none is provided.
256
268
  def iteration
269
+ if @iteration.kind_of?(String) and @iteration.include?("-")
270
+ logger.warn("Package iteration '#{@iteration}' includes dashes, converting" \
271
+ " to underscores. rpmbuild does not allow the dashes in the package iteration (called 'Release' in rpm)")
272
+ @iteration = @iteration.gsub(/-/, "_")
273
+ end
274
+
257
275
  return @iteration ? @iteration : 1
258
276
  end # def iteration
259
277
 
@@ -2,6 +2,8 @@ require "fpm/namespace"
2
2
  require "fpm/package"
3
3
  require "fpm/util"
4
4
 
5
+ require "fpm/package/dir"
6
+
5
7
  # Support for python virtualenv packages.
6
8
  #
7
9
  # This supports input, but not output.
data/lib/fpm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module FPM
2
- VERSION = "1.13.1"
2
+ VERSION = "1.14.2"
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.2
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: 2022-03-31 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
@@ -204,6 +190,20 @@ dependencies:
204
190
  - - ">="
205
191
  - !ruby/object:Gem::Version
206
192
  version: '0'
193
+ - !ruby/object:Gem::Dependency
194
+ name: rake
195
+ requirement: !ruby/object:Gem::Requirement
196
+ requirements:
197
+ - - ">="
198
+ - !ruby/object:Gem::Version
199
+ version: '0'
200
+ type: :development
201
+ prerelease: false
202
+ version_requirements: !ruby/object:Gem::Requirement
203
+ requirements:
204
+ - - ">="
205
+ - !ruby/object:Gem::Version
206
+ version: '0'
207
207
  description: Convert directories, rpms, python eggs, rubygems, and more to rpms, debs,
208
208
  solaris packages and more. Win at package management without wasting pointless hours
209
209
  debugging bad rpm specs!
@@ -294,7 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
294
294
  - !ruby/object:Gem::Version
295
295
  version: '0'
296
296
  requirements: []
297
- rubygems_version: 3.2.15
297
+ rubygems_version: 3.2.31
298
298
  signing_key:
299
299
  specification_version: 4
300
300
  summary: fpm - package building and mangling