Commit Graph

2296 Commits

Author SHA1 Message Date
Jordan Sissel d22f95263a Fix failing test when run on arm64/aarch64 systems - this was a bug in the test suite 2023-02-07 00:25:03 -08:00
Jordan Sissel 18233c334d Version bump 1.15.1 2023-01-31 19:49:10 -08:00
Nicholas Hubbard d0c139aea4 Replace deprecated {File,Dir}.exists? with {File,Dir}.exist? 2023-01-31 18:08:38 -08:00
Jordan Sissel 31506109ff Add test coverage for debian version field validation
For #1847
2022-12-03 18:26:30 -08:00
Jordan Sissel f898ef8232 Reject invalid Debian version values.
A hopefully-actionable error message is provided when an invalid version
is given when making a Debian package.

To aid readability, rewrote the relationship pattern as a multiline regex. Added separate pattern for version field.

Test coverage added for #1969's "v" prefix removal.

For #1847
2022-12-03 18:26:30 -08:00
Gábor Lipták c9a5cb4628 Update GHA build
Signed-off-by: Gábor Lipták <gliptak@gmail.com>
2022-12-03 18:25:54 -08:00
Gábor Lipták ada6012b5b Drop leading v from version for Debian
Signed-off-by: Gábor Lipták <gliptak@gmail.com>
2022-12-03 16:46:29 -08:00
Jordan Sissel db06af3c03 Only try splitting the license text if there's actually a license given. This avoids a crash. 2022-11-28 17:48:15 -08:00
Jordan Sissel dcbe0425db Close the file to make Python flush any pending writes. Without this, some versions of python will /not/ write anything to our file which makes it empty and causes a failure in fpm. 2022-11-28 17:48:15 -08:00
Jordan Sissel df26ed08f7 Fix typo in changelog 2022-11-13 23:48:41 -08:00
Jordan Sissel 906cf8054a Release 1.15.0 2022-11-13 23:25:55 -08:00
Jordan Sissel fdd5e559ac Version bump 2022-11-13 23:25:07 -08:00
Jordan Sissel 10c8471179 Change docs tooling to use podman instead of docker 2022-11-13 23:24:21 -08:00
Jordan Sissel 42f2660a58 Regenerate docs with new flag sorting method. 2022-11-13 23:07:42 -08:00
Jordan Sissel d8bc03a63c Try to more-reliably sort options by name
New feature here is that --foo and --[no-]foo are both sorted as "foo",
so flags should be reasonably grouped together now.
2022-11-13 23:07:42 -08:00
Jordan Sissel 15aaf1cfce Add LOAD_PATH flag for cli generator 2022-11-13 23:07:42 -08:00
Jordan Sissel 601cfda057 Update changelog 2022-11-13 23:07:42 -08:00
C. Cooke 88c1e6ab0a Fix Debain package name relation regex
- Package names must start with an alphanumeric
- Package names must be at least two characters
- Package names may include a '.'
2022-11-13 21:14:33 -08:00
Gnought 72ccedc45d chore: refactor Dockerfile
- change base image to ubuntu:20.04
- support ruby 2.7
- docker lint
2022-11-13 21:11:51 -08:00
Jordan Sissel 5b104bccf0 Error if --workdir flag points somewhere that doesn't exist or is not a directory.
Fixes #1938
2022-11-13 20:23:59 -08:00
Nicholas Hubbard 3ba61bc0bd Test that the logger pipe method is invoked during safesystem 2022-11-13 17:54:10 -08:00
Nicholas Hubbard 8a6460d0d3 Test to ensure safesystem does not prompt user for input 2022-11-13 17:54:10 -08:00
Nicholas Hubbard b0ca926d49 execmd: close stdin for writing if called non-interactively 2022-11-13 17:54:10 -08:00
Jordan Sissel 3653f1a10c Use pkgbuild's --install-location flag when fpm's --prefix is given.
A user reported that on macOS Catalina, the default pkgbuild install
location may result in a .pkg file which cannot be installed.

This change makes fpm's `--prefix` option pass through to `pkgbuild`'s
`--install-location` flag

> With macOS Catalina, you can no longer store files or data in the read-only system volume, nor can you write to the "root" directory ( / ) from the command line, such as with Terminal.

References:
* macOS Catalina's new read-only root filesystem: https://support.apple.com/en-us/HT210650

Fixes #1908
2022-11-09 22:43:35 -08:00
Jordan Sissel 63d4ac8dfc Move `require` closer to where it is used.
This helps avoid a startup crash on Ruby 1.9.3 where the `rexml` gem
crashes when loaded due to syntax errors.

Fixes #1798, #1800, #1784
2022-11-02 21:49:17 -07:00
Jordan Sissel ad2b1a8966 Call String#dup on RUBY_VERSION to avoid crashing on older ruby versions
On older versions of rubygems, `Gem::Version.new(...)` calls
`String#strip!` on the argument in the constructor. This causes a
problem on Ruby 1.9.3 where the RUBY_VERSION constant is a frozen
string.

The workaround is to make a copy of this string that is unfrozen, and
`String#dup` seems to work :)
2022-11-02 21:49:17 -07:00
Jordan Sissel d9ba0b4545 Remove 'json' gem dependency.
The original `json` gem dependency was added in the original fpm.gemspec
because, at the time, Ruby 1.8.7 was common and required an external
`json` dependency for parsing JSON.

Later, Ruby releases since 1.9.1 have bundled `json`[1].

Therefore, it feels safe to remove this dependency. As a bonus, the
rubygems `json` gem places requirements on the minimum version of Ruby.
At this time, the latest `json` gem requires Ruby >= 2.3.

If the `json` gem dependency is removed, fpm will still retain the
ability to process JSON while lowering the minimum required Ruby version
to Ruby 1.9.x -- It's not perfect, but it's a start! :)

[1] https://docs.ruby-lang.org/en/2.3.0/NEWS-1_9_1.html

The idea for this change change came originally from a discussion
with @edolnx in #1949

Fixes #1741, #1264, #1949
2022-11-02 21:49:17 -07:00
Nicholas Hubbard 56a97c43be Fixed typo: stdin_w_close -> stdin_w.close 2022-10-31 15:17:48 -07:00
Jordan Sissel cd7a6855d3 Try to improve the flag description 2022-10-28 23:11:25 -07:00
Jordan Sissel c6b85be6a2 Improve tests and raise exception when the flags file is too large. 2022-10-28 23:11:25 -07:00
Jordan Sissel ce8fd6cb64 Remove debug print 2022-10-28 23:11:25 -07:00
Jordan Sissel 16c7e280a7 Support single-character flags in option files. 2022-10-28 23:11:25 -07:00
Jordan Sissel 7d6b5cd58c Add test coverage for --fpm-options-file
Cases:
* Option ordering (the flag operates in-place)
* Multiple --long-flags on a single line
* Multiple single flags on a single line (both like '-ff' and '-f -f')
* File self-reference errors
2022-10-28 23:11:25 -07:00
Jordan Sissel ec82bc649b Add option --fpm-options-file
This option flag will cause fpm to load additional flags, in place, from
the given file.

For example, if a file "foo" contains one line, "--version 5.10", then
`fpm -s empty -t deb -n example --fpm-options-file foo` act as if
`--version 5.10` was given on the command-line in the same position as
the `--fpm-options-file` flag.

Error conditions checked:
* Has the file already been loaded?
* Does the file exist?
* Is the file readable?

No tests included at this time. This code is likely missing some edge
cases (combined single-letter flags, multiple flag entries on a line,
etc).
2022-10-28 23:11:25 -07:00
Nicholas Hubbard 110419b695 Test unpack method directly 2022-10-28 16:06:34 -07:00
Nicholas Hubbard 11175cc47f Add test for building Alien::astyle version 0.010000 2022-10-28 16:06:34 -07:00
Nicholas Hubbard c8d364b0ab Fix broken tar command 2022-10-28 16:06:34 -07:00
Jordan Sissel 3fcaefb9fd Remove `git` gem dependency.
Folks are reporting that fpm cannot be installed easily (or at all) on
older systems because a transitive dependency(1) rejects ruby versions
older than 2.6.

(1) rubygem git depends on addressable which depends on public_suffix

Since the `git` dependency is only used in the `gem` source when
using a git repo as a installation source, and that usage seems pretty
simple -- clone a repo, checkout a branch, etc -- it feels safe to
remove this dependency while still keeping the same functionality.

Fixes #1923
2022-10-26 14:48:12 -07:00
Jordan Sissel d16b531a2f Trying GitHub Actions for testing
Attempting to figure out why rspec passes but the action still fails.
2022-10-24 20:38:08 -07:00
Jordan Sissel 6c87589f32
Update ruby.yml 2022-10-24 19:07:08 -07:00
Jordan Sissel 72b2f26ad3
Create ruby.yml 2022-10-24 19:04:51 -07:00
Nicholas Hubbard bfb192c417 Add test for CPAN dist with missing author 2022-10-21 17:23:36 -07:00
Jordan Sissel f168571abf Support newer version of lintian in the test suite.
Fixes #1907
2022-10-16 17:44:17 -07:00
Nicholas Hubbard 409a3b27df Prevent crash if CPAN distribution has blank author field 2022-10-16 16:23:07 -07:00
loic.chabert 788387c0d2 Add space on changes.erb to conform with debian specs 2022-10-03 13:34:22 -07:00
loic.chabert 37f56269c3 Replace whatever in changelog.erb and deb.changes.erb
In order to support packaging upload, the distribution must be
set/aligned in changelog and changes files.
Required for example inside dput-ng repo upload app.
2022-10-03 13:34:22 -07:00
Evgeny Stambulchik c40f6818f8 Recognize "--pleaserun-user" option 2022-07-05 16:26:24 -07:00
Chris Novakovic 9b32d9a116 Change default Debian package priority to optional
Since Debian Policy version 4.0.1, the "extra" priority has been
deprecated and replaced with "optional"; this triggers Lintian warnings
for Debian packages built by FPM. Make this the new default for Debian
package outputs when no value of --deb-priority is given.

Fixes #1398.
2022-06-24 13:49:32 -07:00
Jordan Sissel 40795d4d85 Load gem specifications using YAML's safe loading
On older rubies, YAML.load _is_ the unsafe load method. At some point,
Ruby 3.1.0 / Psych 4(?) made two renames:

* YAML.load -> YAML.unsafe_load
* YAML.safe_load -> YAML.load

A quick test is to try converting a gem. This would fail if `YAML.load`
was the "safe" method because it would fail with this message:

    Tried to load unspecified class: Gem::Specification (Psych::DisallowedClass

`fpm -s gem -t empty rails` will crash on Ruby 3.1.0 prior to this
commit.

Fixes #1895

Add necessary classes to safely load yaml from gem specs
2022-05-19 20:19:44 -07:00
Jordan Sissel 7881705985 Call ERB.new correctly depending on the RUBY_VERSION
* On Ruby 3.0.x and older, call ERB.new(template_code, nil, "-")
* On Ruby 3.1.0 and newer, call ERB.new(template_code, trim_mode: "-")

Fixes #1894
2022-05-01 22:39:04 -07:00