fpm 1.10.1 → 1.13.1

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
- SHA1:
3
- metadata.gz: 628976fa0ada7a760e93bb6caa541529fe23221c
4
- data.tar.gz: 3612ee1afeddbc8a971afb25b8da61f20c311e69
2
+ SHA256:
3
+ metadata.gz: a51484aca566bb4b8a1362c216c96aeb3fe0400abc44befefe32152624e99148
4
+ data.tar.gz: 1ae93c91155b91e8decc380fa502ed8e38dd14d74df232bf29ece3c89f34ca4a
5
5
  SHA512:
6
- metadata.gz: 4c068d932e567f422e367fd0e7e6d508a9d2d4eaf71d6a7d44c0b4dad1b722932a7d4645193f5bcf2d737f48a0aa91ba419afc7a2fde4aa3522d927c274dfa90
7
- data.tar.gz: 2835d7a4611aabd05a9db4cb416e70d9238583ecc8c6e00155fc01ed9f1532d779e1f2d0b13ec6aef59f1cdc0db2e8c05c4ba3c570ae3baf7aa27475c61e3dae
6
+ metadata.gz: dbca18e4c26ed2d88e9918985288617e8678e5a8d2872170ea5b1a35ac63e740c317513faa5ed9d9c12efef9dc464e09f324e94b2504ceaddf58c02aeecd2ec8
7
+ data.tar.gz: 0f1865843b14ac86cd4d8fdf0a7b71d1dfd2c5912e9b66dd7e2169a659646afbfc7adc61da55e9ac8414944e717a7b90c7ea5b3d6994301549e5af73b88994b0
data/CHANGELOG.rst CHANGED
@@ -1,6 +1,57 @@
1
1
  Release Notes and Change Log
2
2
  ============================
3
3
 
4
+ 1.13.1 (July 6, 2021)
5
+ ^^^^^^^^^^^^^^^^^^^^^
6
+ * deb: The `--provides` flag now allows for versions. Previously, fpm would
7
+ remove the version part of a provides field when generating deb packages.
8
+ (`#1788`_, `#1803`_; Jordan Sissel, Phil Schwarz, tympanix)
9
+ * osxpkg: Update documentation to include installing `rpm` tools on OSX
10
+ (`#1797`_; allen joslin)
11
+
12
+ 1.13.0 (June 19, 2021)
13
+ ^^^^^^^^^^^^^^^^^^^^^^
14
+ * Apple M1 users should now work (`#1772`_, `#1785`_, `#1786`_; Jordan Sissel)
15
+ * 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)
16
+ * 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)
17
+ * Docs: Fix a typo in an example (`#1785`_; Zoe O'Connell)
18
+ * rpm: File paths can now contain single-quote characters (`#1774`_; Jordan Sissel)
19
+ * rpm: Use correct SPEC syntax when using --after-upgrade or similar features (`#1761`_; Jo Vandeginste. Robert Fielding)
20
+ * 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
+ * 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
+ * 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
+ )
25
+
26
+
27
+ 1.12.0 (January 19, 2021)
28
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
29
+
30
+ * 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)
31
+ * deb: New flag to add 'set -e' to all scripts. `--deb-maintainerscripts-force-errorchecks` which defaults to off. (`#1697`_; Andreas Ulm)
32
+ * 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)
33
+ * deb: Fix error 'uninitialized constant FPM::Package::Deb::Zlib' (`#1739`_, `#1740`_; Federico Lancerin)
34
+ * python: Prepend to PYTHONPATH instead of replacing it. This should help on platforms that rely heavily on PYTHONPATH, such as NixOSX (`#1711`_, `#1710`_; anarg)
35
+ * python: Add `--python-trusted-host` flag which passes `--trusted-host` flag to `pip` (`#1737`_; Vladimir Ponarevsky)
36
+ * Documentation improvements (`#1724`_, `#1738`_, `#1667`_, `#1636`_)
37
+ * Dockerfile updated to Alpine 3.12 (`#1745`_; Cameron Nemo)
38
+ * Remove the 'backports' deprecation warning (`#1727`_; Jose Galvez)
39
+ * sh: Performance improvement when printing package metadata (`#1729`_; James Logsdon, Ed Healy)
40
+ * rpm: Add support for `xzmt` compression (multithreaded xz compressor) to help when creating very large packages (several gigabytes). (`#1447`_, `#1419`_; amnobc)
41
+ * 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)
42
+ * deb: use correct control.tar filename (`#1668`_; Mike Perham)
43
+
44
+ 1.11.0 (January 30, 2019)
45
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
46
+
47
+ * snap: Snap packages can now be created! (`#1490`_; kyrofa)
48
+ * Fix an installation problem where a dependency (childprocess) fails to install correctly. (#1592; Jordan Sissel)
49
+
50
+ 1.10.2 (July 3, 2018)
51
+ ^^^^^^^^^^^^^^^^^^^^^
52
+
53
+ * cpan: Fix a crash where fpm would crash trying to parse a perl version string (`#1515`_, `#1514`; Jordan Sissel, William N. Braswell, Jr)
54
+
4
55
  1.10.1 (July 3, 2018)
5
56
  ^^^^^^^^^^^^^^^^^^^^^
6
57
 
@@ -20,6 +71,7 @@ Release Notes and Change Log
20
71
  * rpm: fix shell function name `install` conflicting with `install` program. In
21
72
  postinst (after-install), the function is now called `_install` to avoid
22
73
  conflicting with `/usr/bin/install` (`#1434`_; Torsten Schmidt)
74
+ * rpm: Allow binary "arch dependent" files in noarch rpms (Jordan Sissel)
23
75
  * - deb: --config-files ? (`#1440`_, `#1443`_; NoBodyCam)
24
76
  * FPM source repo now contains a Brewfile for use with Homebrew.
25
77
  * FPM source repo has a Dockerfile for invoking fpm with docker. (`#1484`_, ;Allan Lewis
@@ -42,7 +94,7 @@ Release Notes and Change Log
42
94
  * Fix bug so fpm can now copy symlinks correctly (`#1348`_; ServiusHack)
43
95
  * apk: Improve performance (`#1358`_; Jan Delgado)
44
96
  * cpan: Fix crash when CPAN query returns a version value that was a number and fpm was expecting a string. (`#1344`_, `#1343`_; liger1978)
45
- * cpan: Fix MetaCPAN searches to use v1 of MetaCPAN's API. The v0 API is no longer provided by MetaCPAN. (`#1341`_, `#1339`; Bob Bell)
97
+ * cpan: Fix MetaCPAN searches to use v1 of MetaCPAN's API. The v0 API is no longer provided by MetaCPAN. (`#1341`_, `#1339`_; Bob Bell)
46
98
  * cpan: Have perl modules implicitly "provide" (`--provides`) capabilities. (`#1340`_; Bob Bell. `#1345`_; liger1978)
47
99
  * cpan: Now transforms perl version values like "5.008001" to "5.8.1" (`#1342`_; Bob Bell)
48
100
  * cpan: Use `>=` ("this version or newer") for package dependencies instead of `=` ("exactly this version"). (`#1338`_; Bob Bell)
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
data/lib/fpm.rb CHANGED
@@ -18,3 +18,4 @@ require "fpm/package/p5p"
18
18
  require "fpm/package/pkgin"
19
19
  require "fpm/package/freebsd"
20
20
  require "fpm/package/apk"
21
+ require "fpm/package/snap"
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/2.0.0/stdlib/ostruct"
7
+ require "backports/latest"
8
8
  require "socket" # stdlib, for Socket.gethostname
9
9
  require "shellwords" # stdlib, for Shellwords.escape
10
10
  require "erb" # stdlib, for template processing
@@ -316,7 +316,7 @@ class FPM::Package
316
316
  # the path before returning.
317
317
  #
318
318
  # Wrapping Find.find in an Enumerator is required for sane operation in ruby 1.8.7,
319
- # but requires the 'backports' gem (which is used in other places in fpm)
319
+ # but requires the 'backports/latest' gem (which is used in other places in fpm)
320
320
  return Enumerator.new { |y| Find.find(staging_path) { |path| y << path } } \
321
321
  .select { |path| path != staging_path } \
322
322
  .select { |path| is_leaf.call(path) } \
@@ -3,7 +3,7 @@ require "fpm/namespace"
3
3
  require "fpm/package"
4
4
  require "fpm/errors"
5
5
  require "fpm/util"
6
- require "backports"
6
+ require "backports/latest"
7
7
  require "fileutils"
8
8
  require "digest"
9
9
  require 'digest/sha1'
@@ -160,7 +160,7 @@ class FPM::Package::CPAN < FPM::Package
160
160
  found_dependencies.each do |dep_name, version|
161
161
  # Special case for representing perl core as a version.
162
162
  if dep_name == "perl"
163
- m = version.match(/^(\d)\.(\d{3})(\d{3})$/)
163
+ m = version.to_s.match(/^(\d)\.(\d{3})(\d{3})$/)
164
164
  if m
165
165
  version = m[1] + '.' + m[2].sub(/^0*/, '') + '.' + m[3].sub(/^0*/, '')
166
166
  end
@@ -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 " \
@@ -177,10 +178,14 @@ class FPM::Package::Deb < FPM::Package
177
178
  end
178
179
 
179
180
  option "--systemd", "FILEPATH", "Add FILEPATH as a systemd script",
180
- :multivalued => true do |file|
181
+ :multivalued => true do |file|
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"
@@ -218,6 +228,9 @@ class FPM::Package::Deb < FPM::Package
218
228
  when "x86_64"
219
229
  # Debian calls x86_64 "amd64"
220
230
  @architecture = "amd64"
231
+ when "aarch64"
232
+ # Debian calls aarch64 "arm64"
233
+ @architecture = "arm64"
221
234
  when "noarch"
222
235
  # Debian calls noarch "all"
223
236
  @architecture = "all"
@@ -265,10 +278,32 @@ class FPM::Package::Deb < FPM::Package
265
278
  end # def input
266
279
 
267
280
  def extract_info(package)
281
+ compression = `#{ar_cmd[0]} t #{package}`.split("\n").grep(/control.tar/).first.split(".").last
282
+ case compression
283
+ when "gz"
284
+ controltar = "control.tar.gz"
285
+ compression = "-z"
286
+ when "bzip2","bz2"
287
+ controltar = "control.tar.bz2"
288
+ compression = "-j"
289
+ when "xz"
290
+ controltar = "control.tar.xz"
291
+ compression = "-J"
292
+ when 'tar'
293
+ controltar = "control.tar"
294
+ compression = ""
295
+ when nil
296
+ raise FPM::InvalidPackageConfiguration, "Missing control.tar in deb source package #{package}"
297
+ else
298
+ raise FPM::InvalidPackageConfiguration,
299
+ "Unknown compression type '#{compression}' for control.tar in deb source package #{package}"
300
+ end
301
+
268
302
  build_path("control").tap do |path|
269
303
  FileUtils.mkdir(path) if !File.directory?(path)
304
+ # unpack the control.tar.{,gz,bz2,xz} from the deb package into staging_path
270
305
  # Unpack the control tarball
271
- safesystem(ar_cmd[0] + " p #{package} control.tar.gz | tar -zxf - -C #{path}")
306
+ safesystem(ar_cmd[0] + " p #{package} #{controltar} | tar #{compression} -xf - -C #{path}")
272
307
 
273
308
  control = File.read(File.join(path, "control"))
274
309
 
@@ -376,15 +411,18 @@ class FPM::Package::Deb < FPM::Package
376
411
  when "xz"
377
412
  datatar = "data.tar.xz"
378
413
  compression = "-J"
414
+ when 'tar'
415
+ datatar = "data.tar"
416
+ compression = ""
417
+ when nil
418
+ raise FPM::InvalidPackageConfiguration, "Missing data.tar in deb source package #{package}"
379
419
  else
380
420
  raise FPM::InvalidPackageConfiguration,
381
- "Unknown compression type '#{self.attributes[:deb_compression]}' "
382
- "in deb source package #{package}"
421
+ "Unknown compression type '#{compression}' for data.tar in deb source package #{package}"
383
422
  end
384
423
 
385
424
  # 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}")
425
+ safesystem(ar_cmd[0] + " p #{package} #{datatar} | tar #{compression} -xf - -C #{staging_path}")
388
426
  end # def extract_files
389
427
 
390
428
  def output(output_path)
@@ -428,6 +466,7 @@ class FPM::Package::Deb < FPM::Package
428
466
  raise "#{name}: tar is insufficient to support source_date_epoch."
429
467
  end
430
468
 
469
+ attributes[:deb_systemd] = []
431
470
  attributes.fetch(:deb_systemd_list, []).each do |systemd|
432
471
  name = File.basename(systemd, ".service")
433
472
  dest_systemd = staging_path("lib/systemd/system/#{name}.service")
@@ -435,19 +474,19 @@ class FPM::Package::Deb < FPM::Package
435
474
  FileUtils.cp(systemd, dest_systemd)
436
475
  File.chmod(0644, dest_systemd)
437
476
 
438
- # set the attribute with the systemd service name
439
- attributes[:deb_systemd] = name
477
+ # add systemd service name to attribute
478
+ attributes[:deb_systemd] << name
440
479
  end
441
480
 
442
- if script?(:before_upgrade) or script?(:after_upgrade) or attributes[:deb_systemd]
481
+ if script?(:before_upgrade) or script?(:after_upgrade) or attributes[:deb_systemd].any?
443
482
  puts "Adding action files"
444
483
  if script?(:before_install) or script?(:before_upgrade)
445
484
  scripts[:before_install] = template("deb/preinst_upgrade.sh.erb").result(binding)
446
485
  end
447
- if script?(:before_remove) or attributes[:deb_systemd]
486
+ if script?(:before_remove) or not attributes[:deb_systemd].empty?
448
487
  scripts[:before_remove] = template("deb/prerm_upgrade.sh.erb").result(binding)
449
488
  end
450
- if script?(:after_install) or script?(:after_upgrade) or attributes[:deb_systemd]
489
+ if script?(:after_install) or script?(:after_upgrade) or attributes[:deb_systemd].any?
451
490
  scripts[:after_install] = template("deb/postinst_upgrade.sh.erb").result(binding)
452
491
  end
453
492
  if script?(:after_remove)
@@ -552,13 +591,20 @@ class FPM::Package::Deb < FPM::Package
552
591
  case self.attributes[:deb_compression]
553
592
  when "gz", nil
554
593
  datatar = build_path("data.tar.gz")
594
+ controltar = build_path("control.tar.gz")
555
595
  compression = "-z"
556
596
  when "bzip2"
557
597
  datatar = build_path("data.tar.bz2")
598
+ controltar = build_path("control.tar.bz2")
558
599
  compression = "-j"
559
600
  when "xz"
560
601
  datatar = build_path("data.tar.xz")
602
+ controltar = build_path("control.tar.xz")
561
603
  compression = "-J"
604
+ when "none"
605
+ datatar = build_path("data.tar")
606
+ controltar = build_path("control.tar")
607
+ compression = ""
562
608
  else
563
609
  raise FPM::InvalidPackageConfiguration,
564
610
  "Unknown compression type '#{self.attributes[:deb_compression]}'"
@@ -577,7 +623,7 @@ class FPM::Package::Deb < FPM::Package
577
623
  # the 'debian-binary' file has to be first
578
624
  File.expand_path(output_path).tap do |output_path|
579
625
  ::Dir.chdir(build_path) do
580
- safesystem(*ar_cmd, output_path, "debian-binary", "control.tar.gz", datatar)
626
+ safesystem(*ar_cmd, output_path, "debian-binary", controltar, datatar)
581
627
  end
582
628
  end
583
629
 
@@ -641,6 +687,19 @@ class FPM::Package::Deb < FPM::Package
641
687
  File.unlink(changelog_path)
642
688
  end
643
689
  end
690
+
691
+ if origin == FPM::Package::Gem
692
+ # fpm's gem input will have provides as "rubygem-name = version"
693
+ # and we need to convert this to Debian-style "rubygem-name (= version)"
694
+ self.provides = self.provides.collect do |provides|
695
+ m = /^(#{attributes[:gem_package_name_prefix]})-([^\s]+)\s*=\s*(.*)$/.match(provides)
696
+ if m
697
+ "#{m[1]}-#{m[2]} (= #{m[3]})"
698
+ else
699
+ provides
700
+ end
701
+ end
702
+ end
644
703
  end # def converted_from
645
704
 
646
705
  def debianize_op(op)
@@ -682,8 +741,13 @@ class FPM::Package::Deb < FPM::Package
682
741
  name, version = dep.gsub(/[()~>]/, "").split(/ +/)[0..1]
683
742
  nextversion = version.split(".").collect { |v| v.to_i }
684
743
  l = nextversion.length
685
- nextversion[l-2] += 1
686
- nextversion[l-1] = 0
744
+ if l > 1
745
+ nextversion[l-2] += 1
746
+ nextversion[l-1] = 0
747
+ else
748
+ # Single component versions ~> 1
749
+ nextversion[l-1] += 1
750
+ end
687
751
  nextversion = nextversion.join(".")
688
752
  return ["#{name} (>= #{version})", "#{name} (<< #{nextversion})"]
689
753
  elsif (m = dep.match(/(\S+)\s+\(!= (.+)\)/))
@@ -724,6 +788,11 @@ class FPM::Package::Deb < FPM::Package
724
788
  "debs don't like underscores")
725
789
  provides = provides.gsub("_", "-")
726
790
  end
791
+
792
+ if m = provides.match(/^([A-Za-z0-9_-]+)\s*=\s*(\d+.*$)/)
793
+ logger.warn("Replacing 'provides' entry #{provides} with syntax 'name (= version)'")
794
+ provides = "#{m[1]} (= #{m[2]})"
795
+ end
727
796
  return provides.rstrip
728
797
  end
729
798
 
@@ -749,11 +818,30 @@ class FPM::Package::Deb < FPM::Package
749
818
  write_triggers # write trigger config to 'triggers' file
750
819
  write_md5sums # write the md5sums file
751
820
 
821
+ # Tar up the staging_path into control.tar.{compression type}
822
+ case self.attributes[:deb_compression]
823
+ when "gz", nil
824
+ controltar = "control.tar.gz"
825
+ compression = "-z"
826
+ when "bzip2"
827
+ controltar = "control.tar.bz2"
828
+ compression = "-j"
829
+ when "xz"
830
+ controltar = "control.tar.xz"
831
+ compression = "-J"
832
+ when "none"
833
+ controltar = "control.tar"
834
+ compression = ""
835
+ else
836
+ raise FPM::InvalidPackageConfiguration,
837
+ "Unknown compression type '#{self.attributes[:deb_compression]}'"
838
+ end
839
+
752
840
  # Make the control.tar.gz
753
- build_path("control.tar.gz").tap do |controltar|
841
+ build_path(controltar).tap do |controltar|
754
842
  logger.info("Creating", :path => controltar, :from => control_path)
755
843
 
756
- args = [ tar_cmd, "-C", control_path, "-zcf", controltar,
844
+ args = [ tar_cmd, "-C", control_path, compression, "-cf", controltar,
757
845
  "--owner=0", "--group=0", "--numeric-owner", "." ]
758
846
  if tar_cmd_supports_sort_names_and_set_mtime? and not attributes[:source_date_epoch].nil?
759
847
  # Force deterministic file order and timestamp
@@ -931,7 +1019,7 @@ class FPM::Package::Deb < FPM::Package
931
1019
 
932
1020
  if attributes[:deb_templates]
933
1021
  FileUtils.cp(attributes[:deb_templates], control_path("templates"))
934
- File.chmod(0755, control_path("templates"))
1022
+ File.chmod(0644, control_path("templates"))
935
1023
  end
936
1024
  end # def write_debconf
937
1025
 
@@ -1,6 +1,6 @@
1
1
  require "fpm/package"
2
2
  require "fpm/util"
3
- require "backports"
3
+ require "backports/latest"
4
4
  require "fileutils"
5
5
  require "find"
6
6
  require "socket"
@@ -83,8 +83,8 @@ class FPM::Package::Dir < FPM::Package
83
83
  # can include license data from themselves (rpms, gems, etc),
84
84
  # but to make sure a simple dir -> rpm works without having
85
85
  # to specify a license.
86
- self.license = "unknown"
87
- self.vendor = [ENV["USER"], Socket.gethostname].join("@")
86
+ self.license ||= "unknown"
87
+ self.vendor ||= [ENV["USER"], Socket.gethostname].join("@")
88
88
  ensure
89
89
  # Clean up any logger context we added.
90
90
  logger.remove("method")
@@ -1,5 +1,5 @@
1
1
  require "fpm/package"
2
- require "backports"
2
+ require "backports/latest"
3
3
 
4
4
  # Empty Package type. For strict/meta/virtual package creation
5
5
 
@@ -1,4 +1,4 @@
1
- require "backports" # gem backports
1
+ require "backports/latest" # gem backports/latest
2
2
  require "fpm/package"
3
3
  require "fpm/util"
4
4
  require "digest"
@@ -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,19 @@ 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
+ # 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"))
99
92
  end # def output
100
93
 
101
94
  # Handle architecture naming conversion:
@@ -110,6 +103,8 @@ class FPM::Package::FreeBSD < FPM::Package
110
103
  wordsize = case @architecture
111
104
  when nil, 'native'
112
105
  %x{getconf LONG_BIT}.chomp # 'native' is current arch
106
+ when 'arm64'
107
+ '64'
113
108
  when 'amd64'
114
109
  '64'
115
110
  when 'i386'