Commit Graph

1342 Commits

Author SHA1 Message Date
Jordan Sissel 45f78973e7 Set pre-release version 2025-10-02 11:56:05 -07:00
Jordan Sissel e0c3a1fc1a Only show the general options in the 'general options' docs entry. Before this, *all* flags were included and that was not intentional. 2025-10-02 11:38:19 -07:00
Jordan Sissel e1113c24e0 Release prep - generate docs and bump version 2025-10-02 11:04:42 -07:00
Jordan Sissel c6069f5584 Replace ostruct with a custom class that acts almost the same.
This removes a warning in 3.4.0 and prepares for Ruby 3.5.0:
> warning: ostruct was loaded from the standard library, but will no longer
> be part of the default gems since Ruby 3.5.0. Add ostruct to your Gemfile or gemspec.

This seems preferable to adding ostruct as a gem dependency especially
since older rubies may not support the gem version of ostruct.
2025-10-01 22:36:03 -07:00
Jordan Sissel aa55aaca93 Python pyproject.toml and requirements.txt improvements
* --python-obey-requirements-txt behavior and tests. I swear this was
  working previously but the tests failed.
* Now supports packaging local python project directories containing
  a pyproject.toml
2025-10-01 22:13:44 -07:00
Jordan Sissel 23e7e0f554 Remove unused code and comments (fpm uses python to process dependency env markers) 2025-10-01 22:13:44 -07:00
Alexandr Zarubkin dd58d6714e Copy config file to staging if it doesn't exist there.
Fix #1823.
2025-10-01 17:36:56 -07:00
Jordan Sissel c76917a4e1 Add support for some uncommon package downloads.
* amqplib 1.0.2 downloads a file ending in .tgz instead of expected .tar.gz
* dnspython 1.15.0 has METADATA which includes a description body, but
  the metadata version is 2.0, and python core-metadata docs indicate
  v2.1 added support for description body. In this case, if the metadata
  version is 2.0, fpm now accepts a description body.

Reference: python core-metadata:
> Changed in version 2.1: This field may be specified in the message body instead.

Original report and fixes for this by @bugfood in #2002.
2025-09-30 15:25:44 -07:00
Jordan Sissel 17bc375e0b Add line continuation to keep ruby-lsp from warning about useless void context. 2025-09-30 15:25:44 -07:00
Jordan Sissel 42808ab943 Fix failing virtualenv tests
I hope this works? It works on my machine... :\

virtualenv and virtualenv-tools seem to be lesser-used these days. I
wonder if it'll be more useful to move to a different tool like venv...
2025-09-30 15:25:44 -07:00
Jordan Sissel 8b24206e19 Fix typo 2025-09-30 15:25:44 -07:00
Jordan Sissel f0e5b8abc0 Use python to parse python requires syntax and evaluate markers.
Not supported yet:
* Custom environment for marker evaluation.
* "extras" markers

Restore function to `--python-obey-requirements-txt`. This flag will
only work on python inputs that are provided as a directory, not a
wheel/tar.gz/etc.

Tests pass including the obey requirements.txt ones.

* Fix bug 'else File.directory?` -> `elsif File.directory?...` lol oops.
* Use Dir.entries instead of Dir.glob to allow python package extra
  syntax, with names like `django[bcrypt]` (Note, extras in requirements
  aren't evaluated yet)
2025-09-30 15:25:44 -07:00
Jordan Sissel b328c15ff6 Fix typo 2025-09-30 15:25:44 -07:00
Jordan Sissel 010093698a Work continues to center python package work around `pip` and away from setup.py
Working: Most python tests except for the --obey-requirements-text one
Breaking: Broke support for requirements.txt, for now.

* Deprecate --python-install-{bin,data,lib} flags since those are only
  supported by setup.py. `pip` just supports `--prefix` and maybe that's ok.
* Deprecate --python-scripts-executable for similar reasons. I don't
  think pip supports this?
* Add notes about unsupported Python dependency markers
* PythonMetadata is now a class with accessors providing name, version,
  requirements, homepage, maintainer, etc.
* Moved package url/homepage selection into PythonMetadata
* Fix bug where dependency list would have trailing spaces.
* Updated test suite with new python package name prefix selection
  (detecting python3, etc)
2025-09-30 15:25:44 -07:00
Jordan Sissel 002b42e98e Add accessors for parts of python metadata that we can use with fpm.
(Note: Not all parts of the metadata are used, and some could be used
that are not yet used...)

* Add more tests for parsing and PythonMetadata members
* maintainer: Use Maintainer-email if present, otherwise use Author-email
* license: Try the best field for using as the license label
  (License-Expression, License, or a Classifier entry)
* homepage: Try to pick the right value for the homepage, or close
  enough, since python packages can have multiple urls as project urls.
2025-09-30 15:25:44 -07:00
Jordan Sissel bc75218f37 Improvements to python wheel processing
Parsing Python METADATA files:
* Treat any 'multiple use' fields (as documented in the python
  core-metadata spec) as arrays at all times.
* If METADATA has a body, use it as the description (per spec)
* If Description comes from a header, then strip leading space-pipe text
  as per spec.
* Allow the last header (field: value) to end without a newline.
  (Using \Z regex)
  This allows the parser to process both METADATA and WHEEL files.
* Only use Project-URL as package url if one is given in METADATA
* Set package maintainer based on Maintainer-Email field

Python Environment:
* Move default python detection to a separate method

Also:
* Fix typo in `pip wheel` invocation with wrong variable name
* Remove 'json' require since it's no longer used.
2025-09-30 15:25:44 -07:00
Jordan Sissel fcee26e979 WIP to update python support to rely more on `pip`
Breaking:
* Removed calls to `setup.py` since this seems deprecated/unusable in
  almost any modern python package. [2]
* No longer work: `--python-install-data`, `--python-install-lib`, and
  `--python-install-bin`. The reason: `pip install ...` doesn't seem to
  support such flags, so there's no way to use these flags. Instead,
  you must set `--prefix` if you want to choose where the package
  installs if not the default location

New Behavior:
* When --python-bin isn't given to fpm, automatically try to find a
  correct python executable name[1]
* When --python-package-name-prefix isn't given, set a default based on
  the default --python-bin. That is, if python3 is being used, packages
  should default to a name prefix of "python3-"
* Package 'architecture' now will be "all" or "native" depending on the
  wheel file's `Root-Is-Purelib` field. It's unclear if this is the correct
  way to determine this, though.

Implementation Details:
* Parse package metadata from the wheel (METADATA and WHEEL files)
* Download pypi packages as wheels when available. Previously, fpm would
  specify `--no-binary :all:`, but no longer does.
* When source packages are only available, build a wheel locally.

Not yet tested:
* Not yet tested: Package a python module that exists in a local directory

[1] Python is sometimes available as python3, etc.
[2] https://packaging.python.org/en/latest/discussions/setup-py-deprecated/
2025-09-30 15:25:44 -07:00
Jordan Sissel 9a77831902 Move command running to verbose/info log instead of debug. 2025-09-30 15:25:44 -07:00
Jordan Sissel 1c3cfe741e Change log message to note hardlink 2025-09-26 20:15:54 -07:00
Jordan Sissel 6025469d52 Only hardlink if the source file appears to be a hardlink and we have already copied one of it into the destination. This should fix #2102 2025-09-26 20:15:54 -07:00
Jordan Sissel fdfc384e71 Rely on copy_entry's logic to handle copying vs hardlinking. 2025-09-26 20:15:54 -07:00
Jordan Sissel 82ddba7a8c remove 'ostruct' require. ostruct's being moved out of ruby core, so this will help remove deprecation/move warnings 2025-09-26 20:15:54 -07:00
André Kelpe 7ef007ef5f fix RPM documentation links in docs and code (#2092)
The previous versions where all returning 404. This change points to the
new correct locations.
2025-03-05 20:42:25 -08:00
Markson Hon 3f044a426f
pacman.rb: fix aarch64 & arm7hf (#2017) 2025-03-05 20:18:15 -08:00
Jordan Sissel 2c301c733d Try to make {} file names work in RPM v4.18 and older.
RPM 4.19 added some changes to make it easier or at least more
consistent to escape 'unusual' filename characters. However, RPM v4.18
and earlier do not benefit from this change, so I'm hoping that
replacing {} with ? (wild-card single) characters will work on those
versions. It works fine on v4.19.
2024-12-20 20:52:45 -08:00
Jordan Sissel 93ac15729b Escape { and } characters in filenames
* Add test coverage for escaping { and } filename characters

Fixes #2087
2024-12-19 12:59:07 -08:00
Jordan Sissel 08dc21b8f1 Version bump and generate docs 2024-12-08 23:22:18 -08:00
Jordan Sissel f714f4b4f1
Merge pull request #2084 from jordansissel/pull/2009
When using zstd, use tar flags that are compatible with both gnu tar and bsdtar (#2009)
2024-12-08 22:53:24 -08:00
Jordan Sissel 28fea4c930
Merge pull request #2085 from jordansissel/feature/add-rpm-old-perl-flag
Add flag to allow using older 'perl' rpm dependency name for systems which do not have 'perl-interpreter' dependency available. (#2066)
2024-12-08 22:53:09 -08:00
Jordan Sissel b2f2fc6624
Merge branch 'main' into pull/2009 2024-12-08 22:45:49 -08:00
Jordan Sissel e7e7449815
Merge pull request #2053 from JordanStopford/main
Fix for #1627
2024-12-08 22:42:37 -08:00
Jordan Sissel 862a6863cd Add flag to allow using older 'perl' rpm dependency name for systems which do not have 'perl-interpreter' dependency available. (#2066) 2024-12-08 22:21:30 -08:00
Jordan Sissel 858d1c1419
Merge pull request #2066 from kduret/fix-rpm-perl-dependency-name
fix(rpm): replace perl dependency by perl-interpreter
2024-12-08 22:20:34 -08:00
Jordan Sissel 512f4a9eb3 Fix syntax I broke when doing a merge conflict 2024-12-07 23:28:42 -08:00
Jordan Sissel 8acb2f51d7
Merge branch 'main' into chouquette/add_compression_level 2024-12-07 23:24:39 -08:00
Jordan Sissel 468f455862
Merge pull request #2041 from UiP9AV6Y/feature_rpm_changelog
rpm: generate changelog if none is provided
2024-12-07 23:17:00 -08:00
Jordan Sissel e6b83c4788
Merge pull request #2062 from willaerk/main
Escape the pylib path when using it in a shell command
2024-12-07 23:12:58 -08:00
Jordan Sissel 572cf390a7
Merge branch 'main' into systemd-path-flag 2024-12-07 23:09:53 -08:00
Jordan Sissel ad4402f3bf
Merge pull request #2068 from mattaezell/pip_zip
Support pip download returning a zip file
2024-12-07 22:56:43 -08:00
Jordan Sissel c326b39d95 When using zstd, use tar flags that are compatible with both gnu tar and bsdtar (#2009) 2024-12-07 22:43:00 -08:00
Jordan Sissel e66a359a10
Merge pull request #2009 from SaltwaterC/main
Add support for zstd compression for deb packages.
2024-12-07 22:42:46 -08:00
Wayne Heaney 0fb0d26152
Update rpm.rb
Leave old `--define` argument in place for `buildroot`
2024-11-04 22:02:31 -08:00
Wayne Heaney b852c59b02
Update rpm.rb
Fix how buildroot is specified to better conform with the rpmbuild CLI. The old way was failing with `File not found` errors.
2024-10-29 13:45:47 -07:00
Matt Ezell 790f53c766 Support pip download returning a zip file
Signed-off-by: Matt Ezell <ezellma@ornl.gov>
2024-09-23 10:33:57 -04:00
Jordan Sissel d81a1ad1ac
Merge pull request #2064 from TwitchCaptain/main
Create FreeBSD packages with correct architecture
2024-09-12 10:56:52 -07:00
Jordan Sissel e94f56c01e Flag errors should use FPM::Package::InvalidArgument 2024-09-12 10:48:55 -07:00
Jordan Sissel 843c729b16 Configuration errors should raise a specific exception
Raising FPM::InvalidPackageConfiguration will allow the fpm command-line
to print an error message and exit non-zero.

Raising other exceptions will often produce a crash-like behavior which
prints the exception and a stack trace. Stack traces are not helpful
content in situations where a user has made a configuration error.
2024-09-12 10:39:55 -07:00
Kevin Duret e7903804af fix(rpm): replace perl dependency by perl-interpreter 2024-09-06 09:22:28 +02:00
Phillipp Röll 6957220642 Add support for .timer units to --deb-systemd
Before the change, when using an option --deb-systemd myunit.timer,
the actual file created would be
/lib/systemd/system/myunit.timer.service

Because of that, systemd would then not find the timer.

With this change, the correct extension is extracted from the file,
defaulting to .service.

Typically, there would be two files for installing a timer:

--deb-systemd myunit.service (where .service could be omitted) and
--deb-systemd myunit.timer

So that the .timer references a .service file.
2024-08-12 14:47:47 +02:00
David Newhall II bf0aa55655 build proper freebsd package 2024-08-08 06:07:24 -07:00