1
0
mirror of https://github.com/jordansissel/fpm synced 2025-04-28 14:48:00 +02:00
Commit Graph

271 Commits

Author SHA1 Message Date
Jordan Sissel
ad6b18a0aa Fix failing test when run on arm64/aarch64 systems - this was a bug in the test suite 2023-02-07 00:27:29 -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
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
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
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
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
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
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
5d2b4854d3 Fix failing test.
Looks like at some point django changed the admin tool from
"django-admin" to "django-admin.py"

Possibly this changed in upstream in Django on this commit, though I
don't know for certain:
85efc14a2e
2022-05-01 21:53:54 -07:00
Jordan Sissel
0dfe21bab7 Add test case for files with spaces and quotatation marks.
Testing, this new test case fails on v1.14.1 and *succeeds* as expected
after #1882 was merged.

Fixes #1886
2022-03-30 23:50:55 -07:00
Jordan Sissel
c1930fc465 Try to find the right python executable. Also don't require easy_install anymore.
As part of making "internal pip" the default (#1820), the test suite
needed two main changes:
1) Don't check for easy_install anymore
2) Try to find the right python executable.

On my Ubuntu 20.04 system, installing Python gives Python v3 which only
makes the "python3" executable available. To compensate, the test suite
now tries to find any of "python", "python2", or "python3" to use with
the test suite. When found, it will set the appropriate `--python-bin`
flag in fpm for each test.

For #1820
2021-11-09 21:29:41 -08:00
Jordan Sissel
9e3f75b628 By default, use pip for fetching and installing python packages.
This adds a new flag, --python-internal-pip, which is enabled by default.

"internal pip" means using 'python -m pip' to invoke pip. Ideally this will make fpm more correctly use pip.

Tested on python 2.7.17 and 3.6.9 on Ubuntu 18.04

All python tests passing 👍👍

Fixes #1820
2021-11-09 21:29:41 -08:00
Jordan Sissel
052656b480 'empty' packages now default to "all" architecture.
This feels like the right default because empty packages have no files
(especially no binary, architecture-specific files) and therefore should
be installable on any architecture.

Fixes #1846
2021-11-09 21:02:17 -08:00
Jordan Sissel
809c726944 Use correct constant name 2021-11-09 16:47:02 -08:00
seph
d69e648ce0 Skip tests which cannot be run due to missing dependencies.
Also fix at a failing deb lintian test which was failing due to a
missing 'lsb-base' dependency
2021-11-09 16:47:02 -08:00
Jordan Sissel
c4c0b32cfc Add test case for #1840 (deb compression creating invalid control.tar files)
Identified in #1840/#1841, `lintian` will error due to invalid
control.tar file, as shown below.

This test ensures that `lintian` will not crash. There were two options
I found: First, to run `lintian` and, when it crashes, it exits code 2.
Second, to run `lintian` with a single always-successful check. I chose
the second option because this allows me to rely on success/failure
(exit code 0 vs non-zero) in the event that `lintian` ever changes its
exit code, or that the crash exit code changes across older versions of
Debian.

```
% lintian example_1.0_amd64.deb
dpkg-deb: error: archive '/home/jls/projects/fpm/example_1.0_amd64.deb' uses unknown compression for member 'control.tar.bz2', giving up
/bin/tar: This does not look like a tar archive
/bin/tar: *control: Not found in archive
/bin/tar: Exiting with failure status due to previous errors
Skipping example_1.0_amd64.deb: could not read control data in /home/jls/projects/fpm/example_1.0_amd64.deb:  at /usr/share/perl5/Lintian/ProcessablePool.pm line 93.
```
2021-11-02 21:52:58 -07:00
Andrey Tikhonov
97dfed35ae When bzip2 is used for compression, use gzip on the control.tar.
This fixes a bug where fpm would create an invalid debian package file.
When `--deb-compression bzip2` was used, fpm would create
'control.tar.bz2' file inside the debian package. Debian does not
support bzip2-compressed control files. Per the deb(5) manpage:

> The second required member is named control.tar. It is a tar archive containing the package control information, either not compressed (supported since dpkg 1.17.6), or compressed with gzip (with .gz extension) or xz (with .xz extension, supported since 1.17.6)

With this commit, when bzip2 is chosen for data compression, fpm will
use gzip compression on the control.tar file.
2021-11-02 21:40:24 -07:00
Jordan Sissel
60de482c2c Make sure files we add to the package actually show up in the resulting output 2021-10-30 16:10:49 -07:00
Jordan Sissel
48200286c1 Add tests for FreeBSD packages.
- Files in the tarball should begin with / (#1811, #1844)
- Assert certain top-level manifest fields
- Assert manifest files are present

Idea from #1844
2021-10-30 16:10:49 -07:00
Jordan Sissel
4f51caf8fc rpm: Replace dash with underscore.
(note: fpm calls 'iteration' what rpm calls 'release')

rpmbuild will reject the `Release` tag containing a dash with the
following error (via fpm --verbose):

```
error: line 41: Illegal char '-' (0x2d) in: Release: 1-1 {:level=>:info}
Process failed: rpmbuild failed (exit code 1).
```

This patch copies the dash-to-underscore operation that is already
applied to the version field.

Adds tests for both iteration and version field.

Fixes: #1833
2021-09-22 00:09:42 -07:00
Jordan Sissel
16f1b4357f Reject invalid Provides fields for Debian packages
This resolves an issue caused by #1803 where a user was, historically, passing `--provides 'foo (<< 1.2.3)'` which was working correctly in prior versions of fpm but creating invalid Debian packages in the newer release.

This is a funny issue because previously fpm was removing the relationship text '(<< 1.2.3)' so it never made it into the resulting Debian package. Due to #1803, this text is now passed into the resulting package, and Debian package tooling rejects it.

Added tests to cover a few valid and invalid cases.

This change also adds code to validate other relationship fields (Depends, Suggests, etc) but does not actually do any validation.
2021-09-04 22:51:38 -07:00
Jordan Sissel
c7e7b18731 Fix failing test.
This test was failing on a lintian check which reports:

```
E: name: init.d-script-needs-depends-on-lsb-base etc/init.d/test (line 14)
```

Added `lsb-base` dependency to resolve it.
2021-09-04 17:32:39 -07:00
Jordan Sissel
541550a74d Allow versions in Provides field for Debian packages
This fixes #1788. This also reverts #280. For #280, at the time, this
change to ignore versions was correct. Two years after #280, Debian
began allowing `Provides` field to have versions.

This change also fixes bug in gem-to-deb conversion where previously an
incorrect Provides syntax would be generated (but thanks to #280,
removed), so this bug was only noticed after #280 was undone!

Computers are hard sometimes.

Added tests for gem-to-deb conversion specifically for the Provides
field.

Tested manually with Docker on Ubuntu 14.04 and 18.04 and results meet
expectations.

The history here is follows:
* In 2012, fpm was patched to remove version specifiers in Provides
  field because Debian didn't support it.
* In 2014, Debian dpkg[1] added support for versions in Provides field
* Somewhere between 2015-2018, Debian and Ubuntu included this new
  version of dpkg.
* Debian packaging policy docs (v4.4.0) was updated to allow versions
  in the Provides field.

Expected impacts:
* Older versions of dpkg/etc should _ignore_ the presence of a version
  specifier. Testing on Ubuntu 14.04 confirmed this.
* Newer versions of dpkg/etc should respect the presence of a version
  specifier. Testing on Ubuntu 18.04 confirmed this.

[1] https://launchpad.net/debian/+source/dpkg/1.17.11
2021-07-06 14:25:06 -07:00
Jordan Sissel
60bf90ae3c Only cleanup if needed
This fixes a warning when running `rspec`
2021-07-06 14:25:06 -07:00
Jordan Sissel
82580bb8e7 Add --deb-compression test coverage for #1760 2021-06-19 00:39:19 -07:00
Jordan Sissel
2b6e70b6fa Use rspec's skip feature to help show any skipped tests.
The previous method using :if actually hides the test entirely from the run.
Now an rspec run will correctly(I hope?) show any skipped tests. The
goal is to remind me that sometimes my dev environment is missing
important tooling needed to fully test fpm.

Also: Skip pacman tests if bsdtar and zstd programs are missing.
2021-06-19 00:09:49 -07:00
Steve Kamerman
cc0a4e7369 Fixed Debian platform tag for aarch64/arm64 2021-06-17 07:58:02 -07:00
Jose
9a16e43e4e changed xz for zst 2021-01-19 13:06:50 -08:00
Jordan Sissel
fbbb80fd53 Skip snap package tests on ruby 1.9 and 2.0 2019-02-23 22:00:15 -08:00
Jordan Sissel
3895fccec9 Typo. I forgot String#any? doesn't exist. 2019-02-23 22:00:15 -08:00
Jordan Sissel
b269c81ebe Fix travis check 2019-02-23 22:00:15 -08:00
Jordan Sissel
62fcf8c230 Disable another test that fails on travis, but not locally... 2019-02-23 22:00:15 -08:00
Jordan Sissel
e8be82ebdc Disable certain tests on travis because they fail, and we don't have private access to the debug feature, so there's nothing we can do to debug it at this time. 2019-02-23 22:00:15 -08:00
Jordan Sissel
b8fc631327 Disable triggerflags and triggerindex checks to make tests pass.
I'm not sure why this fails, but it seems to fail mostly on newer
rpm/rpmbuild systems. Maybe my arr-pm library is incorrectly parsing
these rpms somehow? Anyway... the tests are passing now.
2019-02-23 22:00:15 -08:00
Jordan Sissel
51067be1a5 Fix regression in python scripts #! line.
* Target python3 (newer djangos require it)
* Hardcode the django-admin path because easy_install's path/to/bin
  discovery is not working anymore.
2019-02-23 22:00:15 -08:00
Jordan Sissel
7a4372eaa0 Fix .attributes default value test
I think this test regression was introduced in 8f2dd451.
2019-02-23 22:00:15 -08:00
Morgan Rhodes
1f2f950581 Use fix_dependency when populating debian Replaces field (#1442)
The `Replaces` field needs to be formated 'package (operator version)'.
This makes use of the `fix_dependency` method for consistent formatting
with other dependencies.
2018-10-25 10:23:16 -07:00
Kyle Fazzari
8f6f285271 Introduce support for snap packages (#1490)
[Snaps][1] are self-contained squashfs images. Add basic support for
using them as inputs and outputs.

Typically Snapcraft is used to create snaps, but #1149 indicated a
desire to not use Snapcraft, so the snap is created natively, using
mksquashfs at the end to actually create the squashfs image. This may
not work for all use-cases (e.g. when the source doesn't already have
its dependencies bundled).

[1]: https://snapcraft.io/

Resolve #1181

Signed-off-by: Kyle Fazzari <kyrofa@ubuntu.com>
2018-10-16 15:59:17 -07:00
Omer Katz
446b49c7c4 Added ruby 2.5 to the build matrix (#1532)
* Added ruby 2.5 to the build matrix.

* Require "date" since it's missing and failing a test.
2018-10-15 21:14:04 -07:00
Jordan Sissel
3ab03e495f Set --no-cpan-test aka attributes[:cpan_test?]=false when doing a test package for cpan. This should make the test suite pass. 2018-07-03 22:05:59 -07:00
Alexey Stepanov
384f54769f Add tests for python PEP0508 tags 2018-04-14 19:55:08 -07:00
Nemanja Boric
139793c8b3 Allow source=dest/ syntax for symlinks
PR #1253, while fixed the bug where `source.link=dest/source.link`
resulted in `source.link=dest/source.link/source.link` introduced a bug
where `source=dest/` syntax stopped working for symlinks (it is ok for
files). This is now fixed, as the symlink source now behaves the same as
it would with a single file input. Test case testing this behaviour is
also added.

Fixes #1395
2017-09-11 09:36:10 -07:00