Compare commits

...

320 Commits

Author SHA1 Message Date
Jordan Sissel e69cdca562 v1.17.0 :) 2025-10-02 16:37:32 -07:00
Jordan Sissel 5b9d922c84
Merge pull request #2109 from jordansissel/cleanup/remove-old-unused-files
Remove some older unused things
2025-10-02 13:33:29 -07:00
Jordan Sissel 93eaefd383 Remove some older unused things 2025-10-02 13:29:24 -07:00
Jordan Sissel 4cf32c5bc7 Update version in docs 2025-10-02 12:41:05 -07:00
Jordan Sissel 6115fe4c44
Merge pull request #2108 from jordansissel/issue/fix-readthedocs
Make readthedocs.org build the docs once again.
2025-10-02 12:30:06 -07:00
Jordan Sissel 781108fbf6 Update sphinx's project version to match fpm's just in case it's still used anywhere 2025-10-02 12:27:25 -07:00
Jordan Sissel 9c78876415 Fix?
> ModuleNotFoundError: No module named 'sphinx_rtd_theme'
2025-10-02 12:22:15 -07:00
Jordan Sissel a066c4447d Try to fix another error
>     sphinx.errors.ThemeError: no theme named 'sphinx_rtd_theme' found (missing theme.toml?)
2025-10-02 12:20:32 -07:00
Jordan Sissel e42a069c4f Update copyright text 2025-10-02 12:12:55 -07:00
Jordan Sissel 829b897456 A new error -
> ImportError: cannot import name 'Meta' from 'docutils.parsers.rst.directives.misc' (

This commit tries to resolve this by removing the 'docutils<0.18'
requirements entry.
2025-10-02 12:11:03 -07:00
Jordan Sissel 08e663916d Another missing required setting that wasn't required previously..
> Missing Sphinx configuration key The sphinx.configuration key is missing.

Reference: https://about.readthedocs.com/blog/2024/12/deprecate-config-files-without-sphinx-or-mkdocs-config/
2025-10-02 12:07:51 -07:00
Jordan Sissel e15d2c3a1f `build.tools` setting is also required. 2025-10-02 12:05:27 -07:00
Jordan Sissel 249d3b997f Try to fix readthedocs build error
> Config file validation error Config validation error in build.os. Value build not found.
2025-10-02 12:01:04 -07:00
Jordan Sissel bdbe351796
Merge pull request #2107 from jordansissel/release-prep/1.17.0
Release prep for v1.17.0
2025-10-02 11:56:31 -07:00
Jordan Sissel 45f78973e7 Set pre-release version 2025-10-02 11:56:05 -07:00
Jordan Sissel db535710f7 Fix link syntax 2025-10-02 11:53:58 -07:00
Jordan Sissel 6bf2885139 Generate docs 2025-10-02 11:49:16 -07:00
Jordan Sissel 644e538311 Add docs building to release-prep 2025-10-02 11:48:59 -07:00
Jordan Sissel 9c415246f2 Fix reST syntax 2025-10-02 11:48:37 -07:00
Jordan Sissel e8cd0920d7 s/podman/docker/ 2025-10-02 11:43:22 -07:00
Jordan Sissel 22d44e1c49 Use debian/apt packages for python deps instead of pip... mainly because Debian's pip3 errors when you try to use it warning to use venv instead... 2025-10-02 11:43:04 -07:00
Jordan Sissel ef63628054 Fix Sphinx warning that language needs to be set to something 2025-10-02 11:42:22 -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 290fe0741c Reformat changelog entries slightly (no wrapping). Also found an identical PR for #2011 in #2054 and noted that w/ contributor details 2025-10-02 10:12:25 -07:00
Jordan Sissel b69b7e5787 More changelog updates 2025-10-02 10:02:20 -07:00
Jordan Sissel feecdfe87b WIP release changelog updates. 2025-10-02 10:02:20 -07:00
Jordan Sissel de7a214bf5 Work in progress - Prepare v1.17.0 release 2025-10-02 10:02:20 -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 583f7e4ba0 If the action runs with debug logging, run fpm specs with debug logging enabled 2025-10-01 22:13:44 -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 8e54e5ca49 Update rspec in order to use satisfy(description, &block)
Older rspec didn't allow a description to be given to satisfy(), but
newer ones do. I think I forgot to include this rspec version update
in PR #2103
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 873bff3820 Update cabin to fix Ruby ostruct deprecation/stdlib warning 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
Jordan Sissel 7cc4aa7509 Add two tests to cover parts of #2102. The 'normal files' test covers the reported issue in #2102 and fails in this commit. 2025-09-26 20:15:54 -07:00
Jordan Sissel 207bd73577 Add ruby 3.4 and also run apt-get update to try and work around "apt-get install ..." failing sometimes unpredictably? 2025-09-22 13:38:06 -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 4beb98f193
Merge pull request #2088 from jordansissel/issue/2087
rpm: Escape { and } characters in filenames
2025-03-05 20:15:07 -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 b10350b913 Fix bug causing DEBUG logging not to work in rspec 2024-12-19 13:34:08 -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 f817f7a5da Update changelog prep for release. 2024-12-08 23:21:12 -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 98cc060ede Merge branch 'chouquette/add_compression_level' (#2036) 2024-12-07 23:28:55 -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 13a3c6992e
Merge pull request #2063 from skoef/systemd-path-flag
Add option --deb-systemd-path
2024-12-07 23:11:12 -08:00
Jordan Sissel 572cf390a7
Merge branch 'main' into systemd-path-flag 2024-12-07 23:09:53 -08:00
Jordan Sissel d30e641bb8 Update changelog 2024-12-07 23:00:04 -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
Jordan Sissel c028e71206
Merge pull request #2082 from wheaney/patch-1
Update rpm.rb
2024-12-02 10:17:07 -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 fd06d93533
Merge pull request #2067 from jordansissel/improvement/errors-not-exceptions
Configuration problems should print errors, not stack traces.
2024-09-12 10:52:50 -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
Jordan Sissel 18e04a70e1
Merge pull request #2065 from phillipp/main
Add support for .timer units to --deb-systemd
2024-09-12 10:20:56 -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
Reinier Schoof 5092c5f659 Add option --deb-systemd-path
This option will allow you to override the path within the staging directory
systemd service files are moved to in debian packages.

On some systems systemd should not go in the hardcoded /lib/systemd/system but
in /usr/lib/systemd/system instead. Many systems have the both symlinked, but
not all so assuming /lib/systemd/system can be dangerous.

Signed-off-by: Reinier Schoof <reinier@skoef.nl>
2024-06-26 15:54:02 +02:00
Kristof Willaert 5960c8c4a7 Escape the pylib path when using it in a shell command 2024-05-16 18:13:54 +02:00
Jordan Stopford eb56972540 Fix for #1627
Strip rpmlib dependencies
2024-04-23 17:30:48 +01:00
Jordan Stopford 20aa78c72c Fix for #1627
When packaging a deb sometimes a path to a binary comes into the requires field i.e. /bin/sh but this isn't valid for control files. Strip this out
2024-04-23 16:33:39 +01:00
Jordan Stopford ae8205261a Fix for #1627
When packaging a deb sometimes a path to a binary comes into the requires field i.e. /bin/sh but this isn't valid for control files. Strip this out
2024-04-23 16:01:42 +01:00
Jordan Stopford 0cba81fbe4
Merge branch 'jordansissel:main' into main 2024-04-17 16:31:26 +01:00
Jordan Sissel 9d3d96a93d
Merge pull request #2057 from brad/patch-1
fix the link to ruby installation instructions
2024-04-11 08:54:05 -07:00
Brad Pitcher 86be3cc802
fix the link to ruby installation instructions 2024-04-11 08:06:02 -06:00
Jordan Sissel 13228bf566
Merge pull request #2023 from cwegener/main
chore: relax 'clamp' version pin
2024-04-08 21:28:38 -07:00
Christoph Wegener d0884e8903 chore: relax 'clamp' version pin
Ubuntu 22.04 LTS comes with ruby-clamp 1.1.1 which seems to work just
fine with fpm 1.15.1

Relaxing the version pin seems to be the right thing to do.
2024-04-09 10:31:22 +10:00
Jordan Stopford 3b2b258020 Fix for #1627
When packaging a deb sometimes the architecture comes through as part of the provides (not sure why) but this causes problems with the deb package as it seems to only ever expect one set of round brackets which is the version indicator
2024-03-08 10:37:34 +00:00
Natanael Arndt 847ded9eba Update dir.rst
Fix formatting for `--prefix`
2024-01-02 07:08:01 -08:00
Gordon Bleux c9d749a3a7 rpm: generate changelog if none is provided
`rpmlint` considers a lack of a changelog an error.

this is a similar behaviour to the DEB packager, where a generic
default changelog is generated unless one is provided explicitly.
2023-12-14 21:21:33 +01:00
Hugo Beauzée-Luyssen 49093c3533
deb: add a --compression-level option
Fix #2006
2023-11-24 09:17:18 +01:00
SaltwaterC e0edc7e559 Add support for zstd compression for deb packages. 2023-04-28 20:25:00 +01:00
Jordan Sissel b085edc49c Check if an option has a default value before we try to look it up.
This fixes fpm when used with clamp 1.3.0 or above.

Fixes #1543
2023-03-25 23:17:34 -07:00
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
Jordan Sissel 066b9b561a Use a temporary path when testing archive commands.
Previously, fpm would write to the current directory when using methods to check for the correct `ar` and `tar` commands.

This now uses Stud::Temporary to get a random path in the system temporary directory.

I found this error in the test suite when the fpm git workspace was not
writable -- for example, when mounted read-only through a container.

Error message, for posterity:

    1) FPM::Command -p | --package when given a directory should write the package to the given directory.
       Failure/Error: cmd.run(["-s", "empty", "-t", "deb", "-n", "example", "-p", path])
       Errno::EACCES:
         Permission denied @ rb_sysopen - fpm-dummy.tmp
2023-02-07 00:13:16 -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
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 7f4718f9c2 Run `pip` without the `--build` flag
Previously, fpm would use `pip download ... --build ...` to instruct pip
to unpack a given python package to a specific directory for the purpose
of running something like `python setup.py` from it.

However, somewhere in 2021, pip removed this flag. First, I think, it
was deprecated and ignored, then finally removed. One reference to
this removal in the upstream pip project is this issue:
https://github.com/pypa/pip/issues/8333

Without `--build`, pip will place a single tarball in the destination
directory. Fpm cannot easily predict the name of this file because we
don't know the "real" name of the python package nor do we know the
version number being downloaded.

For example:

```
% python3 -m pip download --no-binary :all: --no-deps --no-clean django
...
Successfully downloaded django
% ls
Django-4.0.4.tar.gz
```

Best guess:
* we can expect exactly one file in the previously-empty target directory
* we can also expect that it is a .tar.gz

I don't know if these guesses are always correct, but it's a start.

As of this commit, the following command generates a Debian package:

`fpm -s python --python-bin python3 -t deb django`

Prior to this commit, with a newer version of pip, the command would
fail.

Fixes #1831
2022-05-01 21:53:54 -07:00
Jordan Sissel 82284c7a4b Rerun `make release-prep` 2022-03-31 00:15:23 -07:00
Jordan Sissel 60b4bd30b3 Add additional changelog entries 2022-03-31 00:09:25 -07:00
Jordan Sissel 377fcaf871 Add note about new documentation pages 2022-03-31 00:09:25 -07:00
Jordan Sissel 2943d82581 Version bump and update changelog 2022-03-31 00:09:25 -07:00
mszprejda f5d07520b7 pacman.rb: Fix typo in compression type matching 2022-03-30 23:52:51 -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
John Bollinger b2ba5c4a59 Fix filename mangling for RPM targets
Fixes the mangling FPM performs on the contents of RPM %files lists
to better match RPM's idiosyncratic filename handling.  FPM now
recognizes more cases that require special handling, and it
correctly distinguishes between the glob and non-glob cases,
which RPM itself treates differently.

Fixes #1385
2022-03-30 23:47:02 -07:00
Jordan Sissel 521d030420 Fix reStructuredText header length syntax 2022-03-30 23:15:59 -07:00
Jordan Sissel 106828fc12 Add description in header 2022-03-30 23:15:59 -07:00
Jordan Sissel 0c84173de0 Add description in header 2022-03-30 23:15:59 -07:00
Jordan Sissel 9b9a1b365f Add very basic package docs for each type of package.
Thanks to @alanc and _msw_ for quickly helping me figure out good words
to write to describe Solaris' p5p format.

For #1884.
2022-03-30 23:15:59 -07:00
John Howard eb5370d16e Fix `--deb-compression none`
Previously, we would pass the literal `""` as an argument to `tar`.
`tar` would interpret this as a file name, which does not exist, and
fail.

This fixes the command to just pass no compression flag at all to tar
when `--deb-compression none` is set.

I did not add tests since I couldn't figure out how to execute them -
this is my first time working in ruby.
2022-03-21 15:20:08 -07:00
Jordan Sissel 92886d922d Restore development_dependency on `rake`
A prior commit removed `rake` as a development dependency on the
assumption that nothing in fpm's development process actually required
the use of `rake`.

However, I had forgotten about #756 (year 2014) which adds FPM::RakeTask
and some test coverage. FPM::RakeTask was added to allow folks to more
easily invoke FPM from within a Rake task.

At this time, I see no reason to remove FPM::RakeTask. Further, because
`rake` is typically (in my experience) used only in development
environments. Therefore, I believe the right solution is to restore
`rake` as a development_dependency in order to allow the test suite to
pass. For users of FPM::RakeTask, I would assume (hopefully correctly!)
that they already have `rake` installed as a dependency in their own
project, so the `fpm` gem has no need to specify `rake` as a general-use
dependency.

When studying newer versions of Rake, I found:
* Rake v13 requires Ruby 2.2 or newer.
* Rake v12.xx and older are flagged as having security vulnerabilities.

In order to minimize chaos, this commit adds an unversioned dependency
on rake. This is to help fpm service more versions of Ruby and resist
efforts by any dependency to dictate which version of Ruby is used.

This reverts db9db670c3.

Fixes #1877
2022-02-23 18:04:51 -08:00
Corey Quinn 9aa1c1cb64 Update README to modernize the given example. 2022-02-07 15:26:36 -08:00
Geoff Beier 7a1302d1e8 fix typo in "perl" 2022-01-26 12:22:04 -08:00
Jordan Sissel 53f669219c Version bump 2021-11-10 15:01:34 -08:00
Jordan Sissel 20e754adfb Update changelog after #1854 was fixed. 2021-11-10 15:01:04 -08:00
Jordan Sissel d819e59a80 Require fpm/package/dir to make FPM::Package::Dir available (for #1854) 2021-11-10 14:58:50 -08:00
Jordan Sissel 021fc45047 Add requires so that other package types are available
When converting, we check if the original package was of a certain type.
In order for those types/constants to be available, we have to require
those files.

Test cases which now work correctly with this commit, but had failed
prior:

    % bundle exec ruby -r./lib/fpm/package/rpm.rb -e 'FPM::Package::RPM.new.tap { |x| x.name = "fancy" }.convert(FPM::Package::RPM)'
    % bundle exec ruby -r./lib/fpm/package/deb.rb -e 'FPM::Package::Deb.new.tap { |x| x.name = "fancy" }.convert(FPM::Package::Deb)'

Fixes #1854
2021-11-10 14:58:50 -08:00
Jordan Sissel 121989e0a0 Version bump 2021-11-09 22:30:01 -08:00
Jordan Sissel bba3114075 Regenerate in prep for release 2021-11-09 22:29:16 -08:00
Jordan Sissel 329b4758a6 Also regen per-package-type cli pages 2021-11-09 22:29:06 -08:00
Jordan Sissel 5b8e9fc334 Add release-prep target to regenerate certain files 2021-11-09 22:28:20 -08:00
Jordan Sissel 23c5790ec4 Update version in docs. Also fix link 2021-11-09 22:28:04 -08:00
Jordan Sissel d5985a5571 Fix sphinx error about empty block. 2021-11-09 22:27:50 -08:00
Jordan Sissel f722c4b3f5 Add introduction for the landing page. 2021-11-09 22:27:24 -08:00
Jordan Sissel 8437e50fe0 Update changelog from v1.13.1 to now 2021-11-09 22:27:14 -08:00
Jordan Sissel d43a017736 Have pip download packages to the build_path
Prior to this change, pip would download Python packages to $PWD which
leaves files hanging around.

The build_path is automatically removed when fpm exits.
2021-11-09 21:29:41 -08: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 7b57e92ec4 Cite reason for using 'python -m pip' aka "internal pip"
* https://bugs.python.org/issue22295

At time of writing, the python 3 installation docs mention:

https://docs.python.org/3/installing/index.html

> The following command will install the latest version of a module and its dependencies from the Python Package Index:
>
> python -m pip install SomePackage
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 309e6b3c18 Only show /etc "config files" warning when files are present in /etc.
This should silence a warning in cases when packages do not contain any
/etc files. Prior to this commit, most debian package creation would
have this warning emitted:

```
Debian packaging tools generally labels all files in /etc as config files, as mandated by policy, so fpm defaults to this behavior for deb packages. You can disable this default behavior with --deb-no-default-config-files flag {:level=>:warn}
```

Fixes #1851
2021-11-09 21:10:34 -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
seph 62f1418e4a Add documentation for running fpm from docker
Also add documentation for running the fpm test suite in docker.

From #1681
2021-11-09 16:47:02 -08:00
seph e1ef157dc3 fpm tests can now be run through docker.
This changes the Dockerfile to create docker images suitable for running tests (fpm rspec suite in docker) and also as a normal release (using fpm through docker).

Fixes #1682, #1453
2021-11-09 16:47:02 -08:00
Jordan Sissel db9db670c3 Remove rake development_dependency. I don't think Rake is used for fpm development ;) 2021-11-09 16:34:27 -08:00
Jordan Sissel 58ddeda91b Apply fix for readthedocs building errors.
https://blog.readthedocs.com/build-errors-docutils-0-18/

For #1848

Hoping this fixes it. Readthedocs emails me whenever doc build fails, and
for the past week or two, it has said the following:

```
Running Sphinx v1.8.5
loading translations [en]... done
making output directory...
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 37 source files that are out of date
updating environment: 37 added, 0 changed, 0 removed
reading sources... [  2%] changelog
reading sources... [  5%] changelog_links
reading sources... [  8%] cli-reference

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/fpm/envs/latest/lib/python2.7/site-packages/sphinx/cmd/build.py", line 304, in build_main
    app.build(args.force_all, filenames)
[ ... cut for brevity ... ]
  File "/home/docs/checkouts/readthedocs.org/user_builds/fpm/envs/latest/lib/python2.7/site-packages/sphinx/util/nodes.py", line 94, in apply_source_workaround
    for classifier in reversed(node.parent.traverse(nodes.classifier)):
TypeError: argument to reversed() must be a sequence
```
2021-11-09 15:52:31 -08:00
Jordan Sissel 11646b943f Add cpan docs per #1838 2021-11-09 15:44:37 -08:00
Jordan Sissel 13621c9722 Add special handling for converting CPAN to Deb.
I needed found this issue while trying to write documentation and
examples for fpm's cpan support. Fpm was generating invalid debian
packages as a result! This should fix things.
2021-11-09 15:44:37 -08:00
Jordan Sissel c6baaf9427 Fix formatting typo. Needed '::' to make the next paragraph pre-formatted code 2021-11-09 15:44:37 -08:00
Jordan Sissel 9efd56c54a Add npm/nodejs package documentation
This example uses the `ascii-art` npm package. I have realized that
using this package with its example ascii art is likely not accessible
for screen readers. I'll keep the example for now and revise it later.
2021-11-09 15:44:37 -08:00
Jordan Sissel 3540cfeb4b Add `dir` docs
For #1838
2021-11-09 15:44:37 -08:00
Jordan Sissel cb24061992 Fix formatting and rpm examples. 2021-11-09 15:44:37 -08:00
Jordan Sissel d6a77bff2a Add docs for 'empty' package type 2021-11-09 15:44:37 -08:00
Jordan Sissel e8fb21d725 Move generated cli docs to packages/cli/{type}.rst
I'm hoping this makes it easier to find files in the docs/packages
directory.
2021-11-09 15:44:37 -08:00
Jordan Sissel aecf23801d Add 'make view' in the docs/Makefile. Live-reloading sphinx html build.
Use sphinx-autobuild to run a server which autobuilds and reloads docs
in the browser.
2021-11-09 15:44:37 -08:00
Jordan Sissel c83461caf7 Add Debian package docs.
For #1838
2021-11-09 15:44:37 -08:00
Jordan Sissel 3e7ba8656b Fix Sphinx doc errors 2021-11-09 15:44:37 -08:00
Jordan Sissel 285c13554f Generate per-package-type command line docs
Add it to the rpm example.

Added make target in docs/ 'package-type-cli' to generate all the cli
docs pages.
2021-11-09 15:44:37 -08:00
Jordan Sissel 5bd26ad011 Add packaging types doc page 2021-11-09 15:44:37 -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
Clayton Wong 5995c7ac34 fix typo in readme 'installation guide' URL 2021-10-28 14:56:58 -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 1a980dd3e7 Remove travis-ci.
It's been hard to debug travis failures for a long time, and since the recent credentials-issue[1] being handled poorly, I think we can close this chapter.

> After 3 days of pressure from multiple projects, [Travis CI] silently patched the issue on the 10th. No analysis, no security report, no post mortem, not warning any of their users that their secrets might have been stolen

[1] https://arstechnica.com/information-technology/2021/09/travis-ci-flaw-exposed-secrets-for-thousands-of-open-source-projects/
2021-09-21 23:35:12 -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
Vlastimil Holer 63fdb94347 FreeBSD package: Fix missing leading `/` in archive
This is a simple workaround, which transforms the filenames inside the
tar archive so that they start with `/`. This happens only in case
the filename doesn't begin with `+`, which is expected (or at least is
very likely) to be a metadata file.

```
$ tar --list -f test-package-0.0.1.txz
+COMPACT_MANIFEST
+MANIFEST
/etc/config
/usr/bin/script

$ pkg install -y test-package-0.0.1.txz && echo OK
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	test-package: 0.0.1

Number of packages to be installed: 1
[1/1] Installing test-package-0.0.1...
Extracting test-package-0.0.1: 100%
OK
```

Fixes #1811

Signed-off-by: Vlastimil Holer <vholer@opennebula.io>
2021-08-15 23:11:38 -07:00
Joris Vandermeersch 0a8bccc511 Also use setuptools' extras_require which contains complex dependencies
ex. 'charset_normalizer~=2.0.0; python_version >= "3"' is now included if the marker matches the build environment.
2021-08-15 23:09:29 -07:00
Jordan Sissel 2ccf61c01f Generate reStructuredText documentation for command-line flags. 2021-08-15 23:05:34 -07:00
Vedant K 720e140d78 docs: fix case in command output 2021-08-15 21:57:40 -07:00
Vedant K cdf110d730 docs: remove fpm runtime deps (ruby, ffi, etc) from optional deps section 2021-08-15 21:57:40 -07:00
Vedant K 2834bb5816 docs: add link to issue #54 (rpm build dependency removal) 2021-08-15 21:57:40 -07:00
Vedant K 9fd97d747c docs: add -s flag to .fpm in getting started guide 2021-08-15 21:57:40 -07:00
Vedant K 37525ca4b0 docs: fix typo 2021-08-15 21:57:40 -07:00
Vedant K 3bb5e99f2a docs: add note about cli flags overriding .fpm file 2021-08-15 21:57:40 -07:00
Vedant K 99c5fcb485 rewrite some parts of documentation 2021-08-15 21:57:40 -07:00
Jordan Sissel 55f9613c0d Fix typo 2021-07-06 15:23:11 -07:00
Jordan Sissel 864e41c880 Update license copyright to year 2021 2021-07-06 14:32:08 -07:00
Jordan Sissel 01b67d747f Version bump 2021-07-06 14:31:42 -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
allen joslin dbd8bafb5d Update installing.rst
add 'brew install rpm' as a prerequisite in the OSX/macOS section
2021-06-24 16:51:13 -07:00
Jordan Sissel e96dc2729a Version bump 2021-06-19 00:50:47 -07:00
Jordan Sissel 4eed9d671b Move loading of 'git' library nearer to where it's used.
This is necessary because `require "git"` (at time of writing) will
error if the `git` program is not available.

Upstream (ruby git) issue:
https://github.com/ruby-git/ruby-git/issues/311

Related fpm issues: #1748, #1751
2021-06-19 00:44:23 -07:00
Jordan Sissel bf9bcc8e2a Changelog update for #1760 2021-06-19 00:43:13 -07:00
Jordan Sissel 82580bb8e7 Add --deb-compression test coverage for #1760 2021-06-19 00:39:19 -07:00
Philippe Poilbarbe 13dde8304e Replace hardcoded control.tar.gz by name depending on compression (#1759) 2021-06-19 00:38:04 -07:00
Jordan Sissel 057a60387f Add more changelog entries to prep for release 2021-06-19 00:22:52 -07:00
Jo Vandeginste 067f4ccfd0 Add back newlines after sections with macro expansion
The previous commit eats too much whitespace after the section headers
(`%pre`, `%post` etc.). There should remain a newline.

Correct versions (for `%pre`):

```
%pre
ugrade () {
```

and

```
%pre -e
upgrade() {
```

Without this patch, we get these (wrong):

```
%pre ugrade () {
```

and

```
%pre -e upgrade() {
```

(exact number of spaces can be different, but should not be relevant)

Fixes #1750

Signed-off-by: Jo Vandeginste <Jo.Vandeginste@kuleuven.be>
2021-06-19 00:16:58 -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
Jordan Sissel ab4eb18b5f FreeBSD package: Replace ruby-xz usage with alternative using `tar`
For #1795

This replaces another library which uses ffi with an implementation
that doesn't need ffi.

I am not certain this is an exact replacement, but for my casual tests,
comparing .txz files generated before/after this commit, things seem ok.
This would benefit from real freebsd testing, though.
2021-06-19 00:09:49 -07:00
Jordan Sissel 3965a0fd31 Remove childprocess library in the quest to remove ffi.
For #195.
2021-06-19 00:09:49 -07:00
Jordan Sissel 18c5adcd19 Remove the need to invoke mknod using FFI.
This removes fpm's direct use of FFI and removes `ffi` as a direct
dependency. For #1795

Cases:
* A unix socket.
* A named pipe
* A charDev should now fail (like /dev/tty)
* A blockDev should now fail (like /dev/sda1)

NOTE: In this change, chardev and blockdev support have been removed.
These "copies" previously were just calling `mknod` with identical
mode, basically copying the `mode` from stat(2) to mknod(2).
Exceptions are now thrown for chardev and blockdev.

Test cases:

    # Try to package a named pipe.
    % mkfifo /tmp/z.pipe
    % bundle exec bin/fpm -s dir -t rpm -n example /tmp/z.pipe
    Created package {:path=>"example-1.0-1.x86_64.rpm"}

    % rpm -qlvp example-1.0-1.x86_64.rpm
    prw-rw-r--    1 root     root                        0 Jun 17 22:40 /tmp/z.pipe

    # Create the unix socket
    % nc -lU /tmp/z.sock

    # Package it into an rpm
    % bin/fpm -s dir -t rpm -n example /tmp/z.sock |& less
    {:timestamp=>"2021-06-17T22:33:27.780347-0700", :message=>"Created package", :path=>"example-1.0-1.x86_64.rpm"}

    # Verify the file is of socket type ('s' at beginning of file mode
    % rpm -qlvp example-1.0-1.x86_64.rpm
    srwxrwxr-x    1 root     root                        0 Jun 17 22:33 /tmp/z.sock
2021-06-19 00:09:49 -07:00
Jordan Sissel e3b3f9d8e3 Begin replacing ChildProcess with Process.spawn()
The childprocess library uses `ffi`. Historically, installing ffi has
brought challenges for fpm users. This change is an attempt to use
ruby standard methods to replace ChildProcess.

For #1795
2021-06-19 00:09:49 -07:00
Jordan Sissel 3e42ff462c Update changelog for changes since v1.12.0. 2021-06-17 20:57:49 -07:00
Jordan Sissel 72a925b048 Ensure an if-then-else doesn't have an empty if block
Issue #1749
2021-06-17 08:30:31 -07:00
Jordan Sissel 2a6facbcce Escape single quotes in file names listed in `%files`
Fixes #1773
2021-06-17 08:21:41 -07:00
Steve Kamerman cc0a4e7369 Fixed Debian platform tag for aarch64/arm64 2021-06-17 07:58:02 -07:00
Zoe O'Connell d69ed14bd8 dir.rst: First example also requires trailing slash 2021-06-17 07:55:22 -07:00
Jordan Sissel d005508e18 Bump version of arr-pm to ensure 0.0.11 is used. That version fixes an issue on Ruby 3.0. #1786 2021-06-17 07:54:38 -07:00
Jordan Sissel 106d7b21e3 Add rexml as dependency
Previously, rexml was included standard in Ruby. However, in 3.0.0, ruby
moved this library to be a "bundled gem", per the release notes:

https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/

> The following default gems are now bundled gems.
> * rexml

Tested on Ruby 2.7.0 and 3.0.1 w/ bundler and it works.

```
% (rbenv shell 3.0.1; bundle install; bundle exec bin/fpm -s empty -t empty -n example)
% (rbenv shell 2.7.0; bundle install; bundle exec bin/fpm -s empty -t empty -n example)
```

Fixes #1793
2021-06-15 11:53:16 -07:00
Jordan Sissel d50f756d0e Bump version prepare to release. 2021-01-19 15:12:20 -08:00
Andreas Ulm c795ed7ef4 implemented --deb-maintainerscripts-force-errorchecks (#1696)
Switched from always enabling errexit to fpm parameter as result of
discussion in #1696.

Signed-off-by: Andreas Ulm <andreas.ulm@root360.de>
2021-01-19 14:33:01 -08:00
Andreas Ulm feb53faa14 added set -e to debian maintainer scripts #1696
Signed-off-by: Andreas Ulm <andreas.ulm@root360.de>
2021-01-19 14:33:01 -08:00
Vlastimil Holer 292073fc35 deb: Fixes gem pessimistic version constrains for single component versions.
If gem had a version constraint with just major version (e.g., ~>1),
the Debian packages were generated with wrong zero upper limit
(e.g., >= 1 and << 0). This results in unresolvable dependencies.

Signed-off-by: Vlastimil Holer <vholer@opennebula.io>
2021-01-19 14:31:27 -08:00
Matt Patterson 073e4e7b74 Pin ffi to 1.12.x, for compatibility with Ruby 2.0
ffi 1.13 requires Ruby 2.3, which is not supplied by many still-supported distros (e.g Centos/RHEL 7), 1.12.X works there, so restrict to that.

Addresses #1708
2021-01-19 14:22:56 -08:00
Arnar Gauti Ingason cd7e428d9f Prepending pyfpm to PYTHONPATH instead of replacing 2021-01-19 14:16:34 -08:00
Frank Siler 73804ded35 Remove older rubies and add some extra OS tests
This change is cherry-picked from #1717
2021-01-19 13:17:24 -08:00
Chris Hodges 50ca2bfd05 Update virtualenv documentation for Python3
Original `virtualenv-tools` causes issues when building Python3 virtual environments. Previously reported in #1491.
2021-01-19 13:08:17 -08:00
Jose 3db202a52f removed some pritnt statement I added 2021-01-19 13:06:50 -08:00
Jose 9a16e43e4e changed xz for zst 2021-01-19 13:06:50 -08:00
Jose 6735f9df69 intermediate error checking 2021-01-19 13:06:50 -08:00
Jose b2dd4dadb6 syntax error 2021-01-19 13:06:50 -08:00
Jose 922d4c5d4f Copy_entry error prevented pacman from working 2021-01-19 13:06:50 -08:00
Jose ca3477b67b added zstd as standard compressoin 2021-01-19 13:06:50 -08:00
Jose 66a4dea525 added zstd compression, standard for pacman 2021-01-19 13:06:50 -08:00
Jose 6b4b61a3f8 changed backports for backports/latest 2021-01-19 13:06:50 -08:00
Jordan Sissel 90d131b075 Call safesystem() with a list
instead of a space-separated argument string

Tested with this command:

    bundle exec bin/fpm --debug -s python -t deb --python-pip =pip django

And verified that safesystem() to invoke pip is given a list.

Mentioned this here:
https://github.com/jordansissel/fpm/pull/1737#discussion_r560474705
2021-01-19 13:03:27 -08:00
James Logsdon 204fb1b1ff Use head/tail over sed for metadata fetching in sh.erb template 2021-01-19 12:49:18 -08:00
vv-p c9487a30c0 Add trusted-host option for pip 2021-01-19 12:36:59 -08:00
Kenyon Ralph 7d7b184d63 virtualenv.rst: fix heading level
This makes the "Example uses" heading a subsection of the virtualenv section.
2021-01-19 12:21:30 -08:00
Federico Lancerin e05790fa92 Addresses DIR -> DEB error on big directories
Fixes https://github.com/jordansissel/fpm/issues/1739
2021-01-19 12:20:58 -08:00
Cameron Nemo 945ba5b4b0 Update Docker base image to Alpine 3.12
Closes #1534
2021-01-19 12:17:41 -08:00
Jeff Solomon b1e956e071 Add a new --rpm-compression-level option which addresses issue 1675:
https://github.com/jordansissel/fpm/issues/1675

The value can be a number from 0 to 9 inclusive. The default mirrors
the current behavior of 9. If the --rpm-compression value is set to
"none", this value is ignored.

Setting the value to 5 sped up RPM creation on my RPM from 9 to
3 minutes.
2020-03-07 19:54:46 -08:00
Julian Trzeciak 8a40cd1db7 rpm: add option to enable install-time macro expansion in scripts
- spec file sections affected: %pre %post %preun %postun
2020-03-07 19:46:46 -08:00
Jeff Solomon cc7610f434 Issue 1678
fix .deb creation
2020-01-30 12:02:34 -08:00
Avi Miller 304619416b This improves the Oracle Linux install docs by removing the additional
repo that was added and enabling the ol7_optional_latest repo instead.
This ensures that fully supported packages are installed, including
the ruby-devel package.

This also corrects the product name.

Signed-off-by: Avi Miller <avi.miller@oracle.com>
2019-11-19 15:53:29 -08:00
Will H d9ddb21de4 Update outdated "gem install" command
The --no-ri and --no-rdoc switches have now been superseded by --no-document per https://guides.rubygems.org/command-reference/#gem_install
2019-11-19 15:27:41 -08:00
Mike Perham 83b4ad9d65 Use variable instead of hardcoded filename
The code specifies .gz when using non-gzip compression which breaks on recent debian packaging tools. Fixes #1647
2019-11-19 15:27:18 -08:00
c-ameron d7b466787d default to false for deb-systemd starts 2019-03-25 22:15:44 -07:00
c-aamm e066e632ed remove multiple systemd services on uninstall 2019-03-25 22:15:44 -07:00
c-aamm 823b3947fc allow starting of multiple deb systemd services 2019-03-25 22:15:44 -07:00
c-aamm a7626cb99b Allow auto-enable and auto-start for deb-systemd services after install
Adds in two new options to enable/disable and autostart systemd services
--[no-]deb-systemd-enable to enable the systemd service after install
--[no-]deb-systemd-auto-start to auto start the service after install

Additionally, any service start/stop/restart will use deb-systemd-invoke
wrapper if installed on the system
2019-03-25 22:15:44 -07:00
Richard Grainger 1c1ff7dc19 [Fixes #1557] Allow git repo as gem source 2019-03-25 22:13:29 -07:00
Alexander Weidinger 6628f175ff Dir#input: don't overwrite license and vendor
Calling Dir#input overwrote #license and #vendor with default values.
2019-03-25 22:10:02 -07:00
Jordan Sissel 69cb62ddce Add virtualenv to path on OSX
This should fix this error on travis:

```
Installing collected packages: virtualenv
  The script virtualenv is installed in '/Users/travis/Library/Python/2.7/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
```
2019-02-23 22:00:15 -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 82ad8c6c2f Use python-3 2019-02-23 22:00:15 -08:00
Jordan Sissel b2c21dd285 Add perl 2019-02-23 22:00:15 -08:00
Jordan Sissel 4ff6fd7b91 Add ruby 2.6.0 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 57fb023ee2 Support rubygems >= 3.0.0
This rubygems release renamed --no-ri and --no-rdoc to --no-document
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
Ry Biesemeyer 29c9c13156 relax json dependency
rubies >= 2.5 ship with JSON 2.x, so allowing bundler to resolve to newer
implementations eliminates conflicts with dependency trees that include JSON
2.x.

Breaking changes for JSON 2.x include removed support for older rubies [1],
so specifying in this manner ensures that older rubies can find 1.x, while
newer ones can resolve to 2.x

[1]: https://github.com/flori/json/blob/master/CHANGES.md#2015-09-11-200

Resolves: https://github.com/jordansissel/fpm/issues/1599
2019-02-07 09:37:23 -08:00
Syed Ali 93e73c7ad5 Updated docs/installing.rst to reflect Oracle Enteprise Linux instructions 2019-02-07 09:31:00 -08:00
Colin Caine 591c0694d1 Deliberately omit a word 2019-02-03 15:00:35 -08:00
harbottle 625ad4bb1b Less strict pinning for childprocess #1592 2019-02-03 14:54:21 -08:00
Jordan Sissel 5e4e30ce0e version bump 2019-02-03 14:52:26 -08:00
João Ferreira 8d8428db04 Add Singularity definition file
This file is used to build a Singularity container with FPM installed
2019-02-03 14:50:37 -08:00
Jordan Sissel c1c82a45c4
Pin childprocess 0.9.0 to work around #1592 (#1593) 2019-01-30 10:29:29 -08:00
Jordan Sissel 40dc09925a
Testing workflows 2019-01-02 11:40:51 -08:00
Jordan Sissel 294f6180cf Upgrade Sphinx version to fix a crash in 'make build' (where newer sphinx_rtd_theme causes Sphinx 1.4.x to crash) 2018-12-23 14:29:46 -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
Alexander Aleksandrovič Klimov 900d7560f4 Update links to use https (#1562) 2018-10-18 14:12:48 -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
Dave L ca02692bcb Changed the mode of templates file for deb packages to 0644 (#1489)
If "--deb-templates" is used, fpm uses the wrong mode for this file. Since it is not an executable file, it should
not have the executable bits set. The lintian tool complains (with an error) that the mode is incorrect, and that
it should not be executable. Changing the mode to 0644 resolves this.
2018-10-16 15:57:03 -07:00
Mike Vastola 0d67ab9e3e Support different compression types for the deb control.tar file (#1542)
On input, the compression type is detected automatically. For output, the compression type is determined by the `--deb-compression` flag.

Fixes jordansissel/fpm#1540
2018-10-15 22:04:36 -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 bf54a505ed
Fix virtualenv failure on Python 3.6 (#1406) (#1556) 2018-10-15 20:46:13 -07:00
gcoxmoz 2b70a025f4 Preserve build-time timestamps when building rpms [#1538] (#1559) 2018-10-13 14:46:50 -07:00
Jordan Sissel 880e5512da Add missing change log entry 2018-10-13 14:22:24 -07:00
Fabian Mettler fa0d15d581 FIX: Proper indentation for changes (#1552)
Set the expected indentation format in changes according to the documentation: https://www.debian.org/doc/debian-policy/ch-source.html#s-dpkgchangelog
2018-09-10 17:37:30 -07:00
158 changed files with 5439 additions and 1974 deletions

30
.github/workflows/ruby.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Ruby
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-22.04
strategy:
matrix:
ruby-version: ['2.7', '3.0', '3.1', '3.4']
steps:
- run: |
sudo apt-get update
sudo apt install -y libarchive-tools lintian cpanminus
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: |
if [ ! -z "$RUNNER_DEBUG" ] ; then
DEBUG=1 bundle exec rspec -fd
else
bundle exec rspec
fi
env:
SHELL: /usr/bin/bash

3
.gitignore vendored
View File

@ -42,3 +42,6 @@ Gemfile.lock
docs/_build
docs/.work
.docker-test-everything
.docker-test-minimal

14
.readthedocs.yaml Normal file
View File

@ -0,0 +1,14 @@
# https://blog.readthedocs.com/build-errors-docutils-0-18/
version: 2
build:
os: ubuntu-24.04
tools:
python: "3.13"
sphinx:
configuration: docs/conf.py
python:
install:
- requirements: docs/requirements.txt

View File

@ -1,42 +0,0 @@
os:
- linux
- osx
language: ruby
sudo: false
rvm:
# We use language features of Ruby that are not supported in Ruby 1.9.x or
# older.
#- 1.8.7
#- 1.9.2
- 1.9.3
- 2.0.0
- 2.1.1
- 2.2.1
- 2.3.1
- 2.2.5
- 2.3.3
- 2.4.0
matrix:
exclude:
- os: osx
rvm: 1.9.3
- os: osx
rvm: 2.0.0
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update && brew bundle; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then which dpkg-deb || 'dpkg-deb not found'; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then which lintian || echo 'lintian not found'; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then which python || brew install python; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then which easy_install || echo 'easy_install not found'; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then which virtualenv || pip install --user virtualenv ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then which virtualenv-tools || pip install --user virtualenv virtualenv-tools ; fi
- virtualenv ${HOME}/.venv
script: source ${HOME}/.venv/bin/activate && PATH=${PATH}:${HOME}/.local/bin bundle exec rspec
addons:
apt:
packages:
- bsdtar
- rpm
- lintian
- python-setuptools
- python-pip

View File

@ -1,6 +1,134 @@
Release Notes and Change Log
============================
1.17.0 (October 2, 2025)
^^^^^^^^^^^^^^^^^^^^^^^^
* python: Support modern Python project features: pyproject.toml, wheels, etc. Now, any project that can be built or installed with ``pip`` can be packaged by fpm. Previously, fpm relied on a long-deprecated features in setup.py to see a python project's metadata such as name, version, and dependencies. Fpm now uses python's package tools to identify the project's name, version, dependencies, and other information. (`#2104`_, `#2105`_, `#2040`_, `#1982`_, `#2029`_; Jordan Sissel, cwegener, amdei, gmabey)
* dir: When copying files, only use hardlinks if the original files were also hardlinks. (`#2103`_, `#2102`_; Michael Telatynski, Matthew Rathbone, Jordan Sissel). :w
Related: https://github.com/electron-userland/electron-builder/issues/5721
* deb: bug fix: when a file given with ``--config-files <path>`` copied into the package, fpm was forgetting to mark the file as being a config file in the package, aka Debian "conffiles" (`#2027`_, `#1823`_; Alexandr Zarubkin, Kientz Arnaud)
* pacman: Now can build packages with aarch64 and arm7hf architecture (`#2017`_; Markson Hon)
* rpm: Paths with '{' and '}' characters can now be included in rpms (`#2088`_ `#2087`_; Jordan Sissel, Manish2481983)
* docs: Updated urls which pointed at rpm documentation (`#2092`_, `#2011`_, `#2054`_; André Kelpe, Natanael Arndt)
* Ruby 3.4.0 no longer gives warnings related to `ostruct` (`#2106`_, also `#2104`_ and `#2103`_; Jordan Sissel)
1.16.0 (December 8, 2024)
^^^^^^^^^^^^^^^^^^^^^^^^^
* deb: Add support for zstd compression (`#2009`_, `#2084`_; Ștefan Rusu)
* deb: Add compression level setting, ``--deb-compression-level`` (`#2036`_; Hugo Beauzée-Luyssen)
* rpm: Generate an empty rpm changelog if none is given. This should help cases where ``rpmlint`` would complain about missing a changelog entry in the rpm. (`#2041`_; Gordon Bleux)
* deb: When converting from an rpm, remove package information that is not valid on Debian systems. (`#2053`_, `#1627`; Jordan Stopford, Jamesits)
* python: Fix bug when PYTHONPATH has spaces in it (`#2062`_; Kristof Willaert)
* deb: You can now choose a different systemd directory with ``--deb-systemd-path`` (`#2063`_; Reinier Schoof)
* freebsd: OS version can now be specified with ``--freebsd-osversion``: (`#2064`_; David Newhall II)
* freebsd: Improve the 'architecture' value used by fpm to generate freebsd packages (`#2064`_, `#1880`_; David Newhall II, Matthew R Kasun)
* deb: Timer units can be given to ``--deb-systemd`` now (`#2065`_, `#1978`_; phillipp, Robert Schneider)
* rpm: When converting cpan packages, use newer ``perl-interpreter`` dependency name. To use the old dependency name ``perl``, use the flag ``--rpm-old-perl-dependency-name`` (`#2066`_, `#2085`_; Kevin Duret, Nicholas Hubbard, William N. Braswell, Jr., Jordan Sissel))
* Some errors now correctly print just an error message instead of dumping a ruby stack trace (`#2067`_; Jordan Sissel)
* python: Support modules which download as zip files (`#2068`_, `#2074`_, `#2072`_; Matt Ezell, hussainbani, hbani)
* rpm: Fix rpm build failures on Fedora 41 (`#2082`_, `#2076`_; Wayne Heaney, Antheas Kapenekakis, Romain Geissler)
1.15.1 (January 31, 2023)
^^^^^^^^^^^^^^^^^^^^^^^^^
* Ruby 3.2.0 now supported. This fixes error 'undefined method exists? for File' '(`#1981`_, `#1988`_; Nicholas Hubbard, romulasry)
1.15.0 (November 13, 2022)
^^^^^^^^^^^^^^^^^^^^^^^^^^
* New flag ``--fpm-options-file path/to/file`` which allows you to specify additional fpm flags in an external file of your choosing. (`#1905`_, `#1902`_, `#1827`_; Jordan Sissel, Will Furnell, hjpotter92)
* deb: Periods are now accepted in package names (`#1899`_; C. Cooke)
* Fix bug where fpm would crash if ``--workdir`` pointed at a path that didn't
exist. (`#1959`_; Jordan Sissel)
* osxpkg: this package format now supports the fpm ``--prefix`` flag(`#1909`_, `#1908`_; Jordan Sissel, mcataga)
* cpan: Fix bug where fpm would fail on certain Perl modules due to their source tarball structure (`#1940`_; Nicholas Hubbard, William N. Braswell, Jr.)
* cpan: Fix crash on certain CPAN modules where the author field was blank (`#1942`_, `#1937`_, `#1523`_, `#1528`_; Nicholas Hubbard, William N. Braswell, Jr.)
* deb: The distribution field of the debian changelog and changes files will now use the value set by ``--deb-dist`` (default is "unstable") (`#1934`_; Chabert Loïc)
* python: Fix errors in how fpm invoked ``pip``. Previously, fpm would use pip's ``--build`` flag, but this was removed a while ago, and fpm is now aware! (`#1896`_, `#1831`_, `#1893`_, `#1916`_; Jordan Sissel, Svyatogor Chuykov)
* pleaserun: Add ``--pleaserun-user`` flag. (`#1912`_; Evgeny Stambulchik)
* deb: The default ``--deb-priority`` is now "optional" instead of "extra" (`#1913`_; Chris Novakovic)
* Enable installation of fpm on older versions of ruby. This change removed ``git`` rubygem dependency. (`#1946`_, `#1923`_; Jordan Sissel, Andreas Wirooks, Ruslan Kuprieiev, jamshid, Lorenzo Castellino, Sam Hughes)
* Enable operation of fpm on very old versions of ruby (as old as Ruby 1.9.3). This changed removed ``json`` rubygem dependency. (`#1950`_, `#1949`_, `#1741`_, `#1264`_, `#1798`_, `#1800`_, `#1784`_; Jordan Sissel and many others)
* Fix bug where subprocesses could hang waiting for input (`#1955`_, `#1519`_, `#1522`_; Nicholas Hubbard, William N. Braswell, Jr.)
* Update Dockerfile to use ubuntu:20.04 (`#1935`_; Gnought)
* internal: Fix a code typo (`#1948`_; Nicholas Hubbard)
* internal tests: Support newer versions of lintian (`#1939`_, `#1907`_; Jordan Sissel)
* Improve support for Ruby 3.1.0 and newer that would previously crash with an error mentioning Psych::DisallowedClass (`#1898`_, `#1895`_; Jordan Sissel, Alexandre ZANNI)
* Improve support for Ruby 3.1.0 and newer that changed the API for ERB (`#1897`_; Jordan Sissel)
1.14.2 (March 30, 2022)
^^^^^^^^^^^^^^^^^^^^^^^
* deb: fix bug causing ``--deb-compression none`` to invoke ``tar`` incorrectly (`#1879`_; John Howard)
* rpm: Better support for paths that have spaces and mixed quotation marks in them. (`#1882`_, `#1886`_, `#1385`_; John Bollinger and Jordan Sissel)
* pacman: Fix typo preventing the use of ``--pacman-compression xz`` (`#1876`_; mszprejda)
* 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)
* docs: Small but lovely documentation fixes (`#1875`_ by Corey Quinn, `#1864`_ by Geoff Beier)
* Fixed mistake causing the test suite to fail when ``rake`` wasn't available. (`#1877`_; Jordan Sissel)
1.14.1 (November 10, 2021)
^^^^^^^^^^^^^^^^^^^^^^^^^^
* 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)
1.14.0 (November 9, 2021)
^^^^^^^^^^^^^^^^^^^^^^^^^
* 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)
* python: Support extras_require build markers in python packages (`#1307`_, `#1816`_; Joris Vandermeersch)
* 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)
* 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)
* deb: Only show a warning about /etc and config files if there are files in /etc (`#1852`_, `#1851`_; Jordan Sissel)
* rpm: replace dash with underscore in rpm's "Release" field aka what fpm calls ``--iteration``. (`#1834`_, `#1833`_; Jordan Sissel)
* empty: `fpm -s empty ...` now defaults to "all" architecture instead of "native". (`#1850`_, `#1846`_; Jordan Sissel)
* 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)
* Typo fixes in documentation are always appreciated! (`#1842`_; Clayton Wong)
* fpm can now (we hope!) now be tested more easily from docker (`#1818`_, `#1682`_, `#1453`_; @directionless, Jordan Sissel, Douglas Muth)
1.13.1 (July 6, 2021)
^^^^^^^^^^^^^^^^^^^^^
* deb: The `--provides` flag now allows for versions. Previously, fpm would
remove the version part of a provides field when generating deb packages.
(`#1788`_, `#1803`_; Jordan Sissel, Phil Schwartz, tympanix)
* osxpkg: Update documentation to include installing `rpm` tools on OSX
(`#1797`_; allen joslin)
1.13.0 (June 19, 2021)
^^^^^^^^^^^^^^^^^^^^^^
* Apple M1 users should now work (`#1772`_, `#1785`_, `#1786`_; Jordan Sissel)
* 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)
* 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)
* Docs: Fix a typo in an example (`#1785`_; Zoe O'Connell)
* rpm: File paths can now contain single-quote characters (`#1774`_; Jordan Sissel)
* rpm: Use correct SPEC syntax when using --after-upgrade or similar features (`#1761`_; Jo Vandeginste. Robert Fielding)
* 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)
* 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)
* deb: Fix syntax error in `postinst` (`--after-install`) script. (`#1752`_, `#1749`_, `#1764`_; rmanus, Adam Mohammed, Elliot Murphy, kimw, Jordan Sissel)
* deb: --deb-compression now uses the same compression and file suffix on the control.tar file (`#1760`_; Philippe Poilbarbe)
1.12.0 (January 19, 2021)
^^^^^^^^^^^^^^^^^^^^^^^^^
* 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)
* deb: New flag to add 'set -e' to all scripts. `--deb-maintainerscripts-force-errorchecks` which defaults to off. (`#1697`_; Andreas Ulm)
* 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)
* deb: Fix error 'uninitialized constant FPM::Package::Deb::Zlib' (`#1739`_, `#1740`_; Federico Lancerin)
* python: Prepend to PYTHONPATH instead of replacing it. This should help on platforms that rely heavily on PYTHONPATH, such as NixOSX (`#1711`_, `#1710`_; anarg)
* python: Add `--python-trusted-host` flag which passes `--trusted-host` flag to `pip` (`#1737`_; Vladimir Ponarevsky)
* Documentation improvements (`#1724`_, `#1738`_, `#1667`_, `#1636`_)
* Dockerfile updated to Alpine 3.12 (`#1745`_; Cameron Nemo)
* Remove the 'backports' deprecation warning (`#1727`_; Jose Galvez)
* sh: Performance improvement when printing package metadata (`#1729`_; James Logsdon, Ed Healy)
* rpm: Add support for `xzmt` compression (multithreaded xz compressor) to help when creating very large packages (several gigabytes). (`#1447`_, `#1419`_; amnobc)
* 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)
* deb: use correct control.tar filename (`#1668`_; Mike Perham)
1.11.0 (January 30, 2019)
^^^^^^^^^^^^^^^^^^^^^^^^^
* snap: Snap packages can now be created! (`#1490`_; kyrofa)
* Fix an installation problem where a dependency (childprocess) fails to install correctly. (#1592; Jordan Sissel)
1.10.2 (July 3, 2018)
^^^^^^^^^^^^^^^^^^^^^
@ -13,7 +141,7 @@ Release Notes and Change Log
* cpan: Adds `--[no-]cpan-verbose` flag which, when set, runs `cpanm` with the `--verbose` flag (`#1511`_; William N. Braswell, Jr)
1.10.0 (May 21, 2018)
^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^
* Pin `ruby-xz` dependency to one which allows Ruby versions older than 2.3.0 (`#1494`_; Marat Sharafutdinov)
* Documentation improvements: `#1488`_; Arthur Burkart. `#1384`_; Justin Kolberg. `#1452`_; Anatoli Babenia.
@ -25,6 +153,7 @@ Release Notes and Change Log
* rpm: fix shell function name `install` conflicting with `install` program. In
postinst (after-install), the function is now called `_install` to avoid
conflicting with `/usr/bin/install` (`#1434`_; Torsten Schmidt)
* rpm: Allow binary "arch dependent" files in noarch rpms (Jordan Sissel)
* - deb: --config-files ? (`#1440`_, `#1443`_; NoBodyCam)
* FPM source repo now contains a Brewfile for use with Homebrew.
* FPM source repo has a Dockerfile for invoking fpm with docker. (`#1484`_, ;Allan Lewis
@ -40,7 +169,7 @@ Release Notes and Change Log
* rpm: Fix `--config-files` handling (`#1390`_, `#1391`_; Jordan Sissel)
1.9.1 (July 28, 2017) happy sysadmin day!
^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* Documentation improvements: `#1291`_; Pablo Castellano. `#1321`_; ge-fa. `#1309`_; jesusbagpuss. `#1349`_; Perry Stole. `#1352`_, Jordan Sissel. `#1384`_; Justin Kolberg.
* Testing improvements: `#1320`_; Rob Young. `#1266`_; Ryan Parman. `#1374`_; Thiago Figueiró.
@ -69,9 +198,9 @@ Release Notes and Change Log
* Other: Remove unused archive-tar-minitar as a dependency of fpm (`#1355`_; Diego Martins)
* Other: Add stud as a runtime dependency (`#1354`_; Elan Ruusamäe)
.. _reproducible_builds:: https://reproducible-builds.org/
.. _path mapping:: http://fpm.readthedocs.io/en/latest/source/dir.html#path-mapping
.. _Deterministic output:: http://fpm.readthedocs.io/en/latest/source/gem.html
.. _reproducible_builds: https://reproducible-builds.org/
.. _path mapping: source/dir.html#path-mapping
.. _Deterministic output: source/gem.html
1.9.0 (July 28, 2017)
^^^^^^^^^^^^^^^^^^^^^

View File

@ -40,7 +40,7 @@ Project maintainers who do not follow or enforce the Code of Conduct in good fai
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [https://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
[homepage]: https://contributor-covenant.org
[version]: https://contributor-covenant.org/version/1/4/

View File

@ -21,6 +21,7 @@ sbuss
Brett Gailey (github: dnbert)
Daniel Haskin (github: djhaskin987)
Richard Grainger (github: liger1978)
seph (github: directionless)
If you have contributed (bug reports, feature requests, help in IRC, blog
posts, code, etc) and aren't listed here, please let me know if you wish to be

View File

@ -1,16 +1,107 @@
#
# To build this Docker image: docker build -t fpm .
#
# To run this Docker container interactively: docker run -it fpm
#
FROM alpine:3.7
# syntax=docker/dockerfile:1
RUN apk add --no-cache \
ruby \
ruby-dev \
gcc \
libffi-dev \
make \
libc-dev \
rpm \
&& gem install --no-ri --no-rdoc fpm
# Are we running against the minimal container, or the everything
# container? Minimal is mostly the compiled package tools. Everything
# pulls in scripting langauges.
ARG BASE_ENV=everything
# Are we running tests, or a release? Tests build and run against the
# CWD, where release will use the downloaded gem.
ARG TARGET=test
# Container to throw an error if called with a bare `docker build .`
FROM ubuntu:20.04 as error
RUN <<EOF
printf '\n\n\n%s\n\n\n' "Hey! Use buildkit. See the Makefile or docs"
false
EOF
# Base container is used for various release and test things
FROM ubuntu:20.04 as minimal-base
ARG DEBIAN_FRONTEND=noninteractive
ARG TZ=Etc/UTC
# Runtime deps. Build deps go in the build or test containers
# hadolint ignore=DL3009
RUN <<EOF
apt-get update
apt-get install --no-install-recommends --no-install-suggests -y \
'ruby=*' \
'ruby-dev=*' \
'libarchive-tools=*' \
'cpio=*' \
'debsigs=*' \
'pacman=*' \
'rpm=*' \
'squashfs-tools=*' \
'xz-utils=*' \
'zip=*' \
'gcc=*' \
'libc6-dev=*' \
'make=*' \
'lintian=*' \
'git=*'
useradd -ms /bin/bash fpm
EOF
# everything container includes all the scripting languages. These
# greatly embiggen the underlying docker container, so they're
# conditionalized.
FROM minimal-base as everything-base
RUN <<EOF
apt-get install --no-install-recommends --no-install-suggests -y \
'cpanminus=*' \
'npm=*' \
'perl=*' \
'python3-pip=*'
pip3 --no-cache-dir install 'setuptools>=45' 'wheel>=0.34' 'virtualenv>=20' 'virtualenv-tools3>=2'
update-alternatives --install /usr/bin/python python /usr/bin/python3 10
EOF
# hadolint ignore=DL3006
FROM ${BASE_ENV}-base as base
RUN <<EOF
rm -rf /var/lib/apt/lists/*
apt-get clean
EOF
# Run tests against the current working directory. This is a bit
# orthogonal to the container release process, but it has a lot of
# same dependancies, so we reuse it. This uses COPY to allow rspect to
# initall the gems, but runtime usage expects you to mount a volume
# into /src
FROM base AS test
# installing ffi here is a bit of an optimization for how COPY and layer reuse works
RUN gem install --no-document ffi:*
USER fpm
WORKDIR /origsrc
ENV HOME=/origsrc
ENV BUNDLE_PATH=/origsrc/.bundle
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN <<EOF
# Install a specific version of bundler
install -d -o fpm /origsrc
gem install -v "$(grep -A1 '^BUNDLED WITH' Gemfile.lock | tail -1)" bundler:*
bundle install
EOF
CMD ["bundle", "exec", "rspec"]
# build a container from a released gem. install build deps here, so
# we can omit them from the final release package
FROM base AS build
ENV GEM_PATH=/fpm
ENV PATH="/fpm/bin:${PATH}"
# hadolint ignore=DL3028
RUN gem install --no-document --install-dir=/fpm fpm
FROM base as release
COPY --from=build /fpm /fpm
ENV GEM_PATH=/fpm
ENV PATH="/fpm/bin:${PATH}"
USER fpm
WORKDIR /src
ENTRYPOINT ["/fpm/bin/fpm"]
# This target is to help docker buildkit in resolving things.
# hadolint ignore=DL3006
FROM ${TARGET}

View File

@ -1,6 +1,6 @@
(This is an MIT-style license)
Copyright (c) 2011-2017 Jordan Sissel and contributors.
Copyright (c) 2011-2021 Jordan Sissel and contributors.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -52,3 +52,22 @@ clean:
publish-docs:
$(MAKE) -C docs publish
release-prep: package
rm -f docs/changelog_links.rst docs/cli-reference.rst
make -C docs build package-type-cli
# Testing in docker.
# The dot file is a sentinal file that will built a docker image, and tag it.
# The normal make target runs said image, mounting CWD against it.
SECONDARY: .docker-test-minimal .docker-test-everything
.docker-test-%: Gemfile.lock fpm.gemspec Dockerfile
DOCKER_BUILDKIT=1 docker build -t fpm-test-$* --build-arg BASE_ENV=$* --build-arg TARGET=test .
touch "$@"
docker-test-%: .docker-test-%
docker run -v `pwd`:/src fpm-test-$*
docker-release-%:
DOCKER_BUILDKIT=1 docker build -t fpm --build-arg BASE_ENV=$* --build-arg TARGET=release --squash .

View File

@ -1,53 +0,0 @@
# Debian notes
## C libraries
Linux seems to require 'ldconfig' runs after shared libraries are installed. I
haven't bothered digging into why, but many debian C library packages run
ldconfig as a postinstall step.
I'd like to avoid postinstall actions, so this needs research to see if this is
possible.
## Ruby
rubygems on Debian/Ubuntu is not very recent in most cases, and some gems have
a requirement of rubygems >= a version you have available.
Further, debian blocks 'gem update --system' which you can get around by doing:
% gem install rubygems-update
% ruby /var/lib/gems/1.8/gems/rubygems-update-1.3.1/bin/update_rubygems
I recommend packaging 'rubygems-update' (fpm -s gem -t deb rubygems-update) and
possibly running the update_rubygems as a postinstall, even though I don't like
postinstalls. I haven't looked yet to see what is required to mimic (if
possible) the actions of that script simply in a tarball.
## Python
http://www.debian.org/doc/packaging-manuals/python-policy/ap-packaging_tools.html
Debian python packages all rely on some form of python-central or
python-support (different tools that do similar/same things? I don't know)
As I found, disabling postinst scripts in Debian causes Python to stop working.
The postinst scripts generally look like this:
if which update-python-modules >/dev/null 2>&1; then
update-python-modules SOMEPACKAGENAME.public
fi
I don't believe in postinst scripts, and I also feel like requiring a
postinstall step to make a python module work is quite silly - though I'm sure
(I hope) Debian had good reason.
So, I'm going to try working on a howto for recommended ways to build python
packages with fpm in debian. It will likely require a one-time addition to
site.py (/usr/lib/python2.6/site.py) or some other PYTHONPATH hackery, though
I don't know just yet.
It will also require special setup.py invocations as Debian has patched distutils to
install python packages, by default, to a place that requires again the
python-central/support tools to run to make them work.

View File

@ -1,7 +1,7 @@
fpm
===
|Build| |Chat| |Gem|
|Gem|
The goal of fpm is to make it easy and quick to build packages such as rpms,
debs, OSX packages, etc.
@ -23,7 +23,7 @@ You can find out how to use fpm in the `documentation`_.
You can learn how to install fpm on your platform in the `installation guide`_.
.. _installation guide: http://fpm.readthedocs.io/en/latest/installing.html
.. _installation guide: https://fpm.readthedocs.io/en/latest/installation.html
Project Principles
------------------
@ -41,10 +41,10 @@ situations), but small tweaks can fix it.
And sometimes, there isn't a package available for the tool you need.
And sometimes if you ask "How do I get python 3 on CentOS 5?" some unhelpful
And sometimes if you ask "How do I get python 3.9 on RHEL 8?" some unhelpful
trolls will tell you to "Use another distro"
Further, a job switches have me flipping between Ubuntu and CentOS. These use
Further, job switches have me flipping between Ubuntu and CentOS. These use
two totally different package systems with completely different packaging
policies and support tools. Learning both was painful and confusing. I want to
save myself (and you) that pain in the future.
@ -97,9 +97,5 @@ Targets:
.. include: docs/contributing
.. |Build| image:: https://img.shields.io/travis/jordansissel/fpm.svg
:target: https://travis-ci.org/jordansissel/fpm
.. |Chat| image:: https://img.shields.io/badge/irc-%23fpm%20on%20freenode-brightgreen.svg
:target: https://webchat.freenode.net/?channels=fpm
.. |Gem| image:: https://img.shields.io/gem/v/fpm.svg
:target: https://rubygems.org/gems/fpm

View File

@ -1,9 +1,9 @@
# This Dockerfile produces a docker image which is used to build the fpm docs.
FROM debian:latest
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-pip
RUN pip install Sphinx==1.4
RUN pip install sphinx_rtd_theme
RUN pip install alabaster
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python3-pip
RUN apt-get install -y python3-sphinx #pip3 install Sphinx
#==1.8
RUN apt-get install -y python3-sphinx python3-sphinx-rtd-theme python3-sphinx-autobuild
CMD ["/bin/bash"]

View File

@ -5,6 +5,8 @@ WORKDIR=./.work
GITROOT=$(shell git rev-parse --show-toplevel)
GITREMOTE=$(shell git remote -v | awk '/(push)/ {print $$2}')
GENERATED_FILES=cli-reference.rst changelog_links.rst
$(WORKDIR):
mkdir $(WORKDIR)
@ -15,11 +17,31 @@ changelog_links.rst: ../CHANGELOG.rst Makefile
| awk '{printf ".. _#%s: https://github.com/jordansissel/fpm/issues/%s\n", $$1, $$1 }' \
| sort -u > $@
# CLI reference is generated based on the the command line flags
cli-reference.rst: generate-cli-reference.rb Makefile
cli-reference.rst: ../lib/fpm/package/*.rb ../lib/fpm/package.rb
ruby -I ../lib generate-cli-reference.rb > $@
package-type-cli:
$(MAKE) $(addprefix packages/cli/,$(addsuffix .rst,$(notdir $(basename $(wildcard ../lib/fpm/package/*.rb)))))
packages/cli:
mkdir $@
packages/cli/%.rst: ../lib/fpm/package/%.rb packages/cli generate-cli-reference.rb Makefile
ruby -I ../lib generate-cli-reference.rb $* > $@
.PHONY: docker-prep
docker-prep: Dockerfile
@docker images fpm-sphinx | grep -q '^fpm-sphinx ' \
|| docker build -t $(IMAGE) .
.PHONY: build
build: changelog_links.rst | docker-prep
build: $(GENERATED_FILES) | docker-prep package-type-cli
docker run -it -v $$PWD/../:/project:z $(IMAGE) sh -xc 'make -C /project/docs html && chown -R 1000:1000 /project/docs'
.PHONY: build
view: $(GENERATED_FILES) | docker-prep
docker run -p 127.0.0.1:8000:8000 -it -v $$PWD/../:/project:z $(IMAGE) sh -xc 'make -C /project/docs livehtml'

View File

@ -215,3 +215,7 @@ pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
livehtml:
sphinx-autobuild --host 0.0.0.0 "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

View File

@ -37,10 +37,12 @@
.. _#1253: https://github.com/jordansissel/fpm/issues/1253
.. _#1259: https://github.com/jordansissel/fpm/issues/1259
.. _#1262: https://github.com/jordansissel/fpm/issues/1262
.. _#1264: https://github.com/jordansissel/fpm/issues/1264
.. _#1266: https://github.com/jordansissel/fpm/issues/1266
.. _#1287: https://github.com/jordansissel/fpm/issues/1287
.. _#1291: https://github.com/jordansissel/fpm/issues/1291
.. _#1293: https://github.com/jordansissel/fpm/issues/1293
.. _#1307: https://github.com/jordansissel/fpm/issues/1307
.. _#1309: https://github.com/jordansissel/fpm/issues/1309
.. _#1311: https://github.com/jordansissel/fpm/issues/1311
.. _#1313: https://github.com/jordansissel/fpm/issues/1313
@ -67,38 +69,187 @@
.. _#1376: https://github.com/jordansissel/fpm/issues/1376
.. _#1379: https://github.com/jordansissel/fpm/issues/1379
.. _#1384: https://github.com/jordansissel/fpm/issues/1384
.. _#1385: https://github.com/jordansissel/fpm/issues/1385
.. _#1390: https://github.com/jordansissel/fpm/issues/1390
.. _#1391: https://github.com/jordansissel/fpm/issues/1391
.. _#1395: https://github.com/jordansissel/fpm/issues/1395
.. _#1419: https://github.com/jordansissel/fpm/issues/1419
.. _#1422: https://github.com/jordansissel/fpm/issues/1422
.. _#1434: https://github.com/jordansissel/fpm/issues/1434
.. _#1440: https://github.com/jordansissel/fpm/issues/1440
.. _#1443: https://github.com/jordansissel/fpm/issues/1443
.. _#1447: https://github.com/jordansissel/fpm/issues/1447
.. _#1452: https://github.com/jordansissel/fpm/issues/1452
.. _#1453: https://github.com/jordansissel/fpm/issues/1453
.. _#1482: https://github.com/jordansissel/fpm/issues/1482
.. _#1484: https://github.com/jordansissel/fpm/issues/1484
.. _#1488: https://github.com/jordansissel/fpm/issues/1488
.. _#1490: https://github.com/jordansissel/fpm/issues/1490
.. _#1492: https://github.com/jordansissel/fpm/issues/1492
.. _#1494: https://github.com/jordansissel/fpm/issues/1494
.. _#1509: https://github.com/jordansissel/fpm/issues/1509
.. _#1511: https://github.com/jordansissel/fpm/issues/1511
.. _#1514: https://github.com/jordansissel/fpm/issues/1514
.. _#1515: https://github.com/jordansissel/fpm/issues/1515
.. _#1519: https://github.com/jordansissel/fpm/issues/1519
.. _#1522: https://github.com/jordansissel/fpm/issues/1522
.. _#1523: https://github.com/jordansissel/fpm/issues/1523
.. _#1528: https://github.com/jordansissel/fpm/issues/1528
.. _#1592: https://github.com/jordansissel/fpm/issues/1592
.. _#1627: https://github.com/jordansissel/fpm/issues/1627
.. _#1636: https://github.com/jordansissel/fpm/issues/1636
.. _#1642: https://github.com/jordansissel/fpm/issues/1642
.. _#1667: https://github.com/jordansissel/fpm/issues/1667
.. _#1668: https://github.com/jordansissel/fpm/issues/1668
.. _#1682: https://github.com/jordansissel/fpm/issues/1682
.. _#1697: https://github.com/jordansissel/fpm/issues/1697
.. _#1699: https://github.com/jordansissel/fpm/issues/1699
.. _#1709: https://github.com/jordansissel/fpm/issues/1709
.. _#1710: https://github.com/jordansissel/fpm/issues/1710
.. _#1711: https://github.com/jordansissel/fpm/issues/1711
.. _#171: https://github.com/jordansissel/fpm/issues/171
.. _#1724: https://github.com/jordansissel/fpm/issues/1724
.. _#1727: https://github.com/jordansissel/fpm/issues/1727
.. _#1729: https://github.com/jordansissel/fpm/issues/1729
.. _#1737: https://github.com/jordansissel/fpm/issues/1737
.. _#1738: https://github.com/jordansissel/fpm/issues/1738
.. _#1739: https://github.com/jordansissel/fpm/issues/1739
.. _#1740: https://github.com/jordansissel/fpm/issues/1740
.. _#1741: https://github.com/jordansissel/fpm/issues/1741
.. _#1745: https://github.com/jordansissel/fpm/issues/1745
.. _#1748: https://github.com/jordansissel/fpm/issues/1748
.. _#1749: https://github.com/jordansissel/fpm/issues/1749
.. _#1751: https://github.com/jordansissel/fpm/issues/1751
.. _#1752: https://github.com/jordansissel/fpm/issues/1752
.. _#1753: https://github.com/jordansissel/fpm/issues/1753
.. _#1760: https://github.com/jordansissel/fpm/issues/1760
.. _#1761: https://github.com/jordansissel/fpm/issues/1761
.. _#1764: https://github.com/jordansissel/fpm/issues/1764
.. _#1766: https://github.com/jordansissel/fpm/issues/1766
.. _#1772: https://github.com/jordansissel/fpm/issues/1772
.. _#1774: https://github.com/jordansissel/fpm/issues/1774
.. _#1775: https://github.com/jordansissel/fpm/issues/1775
.. _#1784: https://github.com/jordansissel/fpm/issues/1784
.. _#1785: https://github.com/jordansissel/fpm/issues/1785
.. _#1786: https://github.com/jordansissel/fpm/issues/1786
.. _#1788: https://github.com/jordansissel/fpm/issues/1788
.. _#1794: https://github.com/jordansissel/fpm/issues/1794
.. _#1797: https://github.com/jordansissel/fpm/issues/1797
.. _#1798: https://github.com/jordansissel/fpm/issues/1798
.. _#1800: https://github.com/jordansissel/fpm/issues/1800
.. _#1803: https://github.com/jordansissel/fpm/issues/1803
.. _#1811: https://github.com/jordansissel/fpm/issues/1811
.. _#1812: https://github.com/jordansissel/fpm/issues/1812
.. _#1815: https://github.com/jordansissel/fpm/issues/1815
.. _#1816: https://github.com/jordansissel/fpm/issues/1816
.. _#1817: https://github.com/jordansissel/fpm/issues/1817
.. _#1818: https://github.com/jordansissel/fpm/issues/1818
.. _#1820: https://github.com/jordansissel/fpm/issues/1820
.. _#1821: https://github.com/jordansissel/fpm/issues/1821
.. _#1823: https://github.com/jordansissel/fpm/issues/1823
.. _#1825: https://github.com/jordansissel/fpm/issues/1825
.. _#1827: https://github.com/jordansissel/fpm/issues/1827
.. _#1829: https://github.com/jordansissel/fpm/issues/1829
.. _#1831: https://github.com/jordansissel/fpm/issues/1831
.. _#1832: https://github.com/jordansissel/fpm/issues/1832
.. _#1833: https://github.com/jordansissel/fpm/issues/1833
.. _#1834: https://github.com/jordansissel/fpm/issues/1834
.. _#1838: https://github.com/jordansissel/fpm/issues/1838
.. _#1842: https://github.com/jordansissel/fpm/issues/1842
.. _#1844: https://github.com/jordansissel/fpm/issues/1844
.. _#1845: https://github.com/jordansissel/fpm/issues/1845
.. _#1846: https://github.com/jordansissel/fpm/issues/1846
.. _#1850: https://github.com/jordansissel/fpm/issues/1850
.. _#1851: https://github.com/jordansissel/fpm/issues/1851
.. _#1852: https://github.com/jordansissel/fpm/issues/1852
.. _#1854: https://github.com/jordansissel/fpm/issues/1854
.. _#1856: https://github.com/jordansissel/fpm/issues/1856
.. _#185: https://github.com/jordansissel/fpm/issues/185
.. _#1864: https://github.com/jordansissel/fpm/issues/1864
.. _#186: https://github.com/jordansissel/fpm/issues/186
.. _#1875: https://github.com/jordansissel/fpm/issues/1875
.. _#1876: https://github.com/jordansissel/fpm/issues/1876
.. _#1877: https://github.com/jordansissel/fpm/issues/1877
.. _#1879: https://github.com/jordansissel/fpm/issues/1879
.. _#187: https://github.com/jordansissel/fpm/issues/187
.. _#1880: https://github.com/jordansissel/fpm/issues/1880
.. _#1882: https://github.com/jordansissel/fpm/issues/1882
.. _#1884: https://github.com/jordansissel/fpm/issues/1884
.. _#1886: https://github.com/jordansissel/fpm/issues/1886
.. _#1893: https://github.com/jordansissel/fpm/issues/1893
.. _#1895: https://github.com/jordansissel/fpm/issues/1895
.. _#1896: https://github.com/jordansissel/fpm/issues/1896
.. _#1897: https://github.com/jordansissel/fpm/issues/1897
.. _#1898: https://github.com/jordansissel/fpm/issues/1898
.. _#1899: https://github.com/jordansissel/fpm/issues/1899
.. _#1902: https://github.com/jordansissel/fpm/issues/1902
.. _#1905: https://github.com/jordansissel/fpm/issues/1905
.. _#1907: https://github.com/jordansissel/fpm/issues/1907
.. _#1908: https://github.com/jordansissel/fpm/issues/1908
.. _#1909: https://github.com/jordansissel/fpm/issues/1909
.. _#190: https://github.com/jordansissel/fpm/issues/190
.. _#1912: https://github.com/jordansissel/fpm/issues/1912
.. _#1913: https://github.com/jordansissel/fpm/issues/1913
.. _#1916: https://github.com/jordansissel/fpm/issues/1916
.. _#191: https://github.com/jordansissel/fpm/issues/191
.. _#1923: https://github.com/jordansissel/fpm/issues/1923
.. _#1934: https://github.com/jordansissel/fpm/issues/1934
.. _#1935: https://github.com/jordansissel/fpm/issues/1935
.. _#1937: https://github.com/jordansissel/fpm/issues/1937
.. _#1939: https://github.com/jordansissel/fpm/issues/1939
.. _#193: https://github.com/jordansissel/fpm/issues/193
.. _#1940: https://github.com/jordansissel/fpm/issues/1940
.. _#1942: https://github.com/jordansissel/fpm/issues/1942
.. _#1946: https://github.com/jordansissel/fpm/issues/1946
.. _#1948: https://github.com/jordansissel/fpm/issues/1948
.. _#1949: https://github.com/jordansissel/fpm/issues/1949
.. _#194: https://github.com/jordansissel/fpm/issues/194
.. _#1950: https://github.com/jordansissel/fpm/issues/1950
.. _#1955: https://github.com/jordansissel/fpm/issues/1955
.. _#1959: https://github.com/jordansissel/fpm/issues/1959
.. _#196: https://github.com/jordansissel/fpm/issues/196
.. _#1978: https://github.com/jordansissel/fpm/issues/1978
.. _#1981: https://github.com/jordansissel/fpm/issues/1981
.. _#1982: https://github.com/jordansissel/fpm/issues/1982
.. _#1988: https://github.com/jordansissel/fpm/issues/1988
.. _#198: https://github.com/jordansissel/fpm/issues/198
.. _#2009: https://github.com/jordansissel/fpm/issues/2009
.. _#2011: https://github.com/jordansissel/fpm/issues/2011
.. _#2017: https://github.com/jordansissel/fpm/issues/2017
.. _#2027: https://github.com/jordansissel/fpm/issues/2027
.. _#2029: https://github.com/jordansissel/fpm/issues/2029
.. _#202: https://github.com/jordansissel/fpm/issues/202
.. _#2036: https://github.com/jordansissel/fpm/issues/2036
.. _#2040: https://github.com/jordansissel/fpm/issues/2040
.. _#2041: https://github.com/jordansissel/fpm/issues/2041
.. _#204: https://github.com/jordansissel/fpm/issues/204
.. _#2053: https://github.com/jordansissel/fpm/issues/2053
.. _#2054: https://github.com/jordansissel/fpm/issues/2054
.. _#205: https://github.com/jordansissel/fpm/issues/205
.. _#2062: https://github.com/jordansissel/fpm/issues/2062
.. _#2063: https://github.com/jordansissel/fpm/issues/2063
.. _#2064: https://github.com/jordansissel/fpm/issues/2064
.. _#2065: https://github.com/jordansissel/fpm/issues/2065
.. _#2066: https://github.com/jordansissel/fpm/issues/2066
.. _#2067: https://github.com/jordansissel/fpm/issues/2067
.. _#2068: https://github.com/jordansissel/fpm/issues/2068
.. _#206: https://github.com/jordansissel/fpm/issues/206
.. _#2072: https://github.com/jordansissel/fpm/issues/2072
.. _#2074: https://github.com/jordansissel/fpm/issues/2074
.. _#2076: https://github.com/jordansissel/fpm/issues/2076
.. _#207: https://github.com/jordansissel/fpm/issues/207
.. _#2082: https://github.com/jordansissel/fpm/issues/2082
.. _#2084: https://github.com/jordansissel/fpm/issues/2084
.. _#2085: https://github.com/jordansissel/fpm/issues/2085
.. _#2087: https://github.com/jordansissel/fpm/issues/2087
.. _#2088: https://github.com/jordansissel/fpm/issues/2088
.. _#208: https://github.com/jordansissel/fpm/issues/208
.. _#2092: https://github.com/jordansissel/fpm/issues/2092
.. _#2102: https://github.com/jordansissel/fpm/issues/2102
.. _#2103: https://github.com/jordansissel/fpm/issues/2103
.. _#2104: https://github.com/jordansissel/fpm/issues/2104
.. _#2105: https://github.com/jordansissel/fpm/issues/2105
.. _#2106: https://github.com/jordansissel/fpm/issues/2106
.. _#212: https://github.com/jordansissel/fpm/issues/212
.. _#213: https://github.com/jordansissel/fpm/issues/213
.. _#215: https://github.com/jordansissel/fpm/issues/215

596
docs/cli-reference.rst Normal file
View File

@ -0,0 +1,596 @@
Command-line Reference
==========================
This page documents the command-line flags available in FPM. You can also see this content in your terminal by running ``fpm --help``
General Options
---------------
* ``-C CHDIR``
- Alternate option spellings: ``--chdir``
- Change directory to here before searching for files
* ``-S PACKAGE_NAME_SUFFIX``
- Alternate option spellings: ``--package-name-suffix``
- a name suffix to append to package and dependencies.
* ``-a ARCHITECTURE``
- Alternate option spellings: ``--architecture``
- The architecture name. Usually matches 'uname -m'. For automatic values, you can use '-a all' or '-a native'. These two strings will be translated into the correct value for your platform and target package type.
* ``-d DEPENDENCY``
- Alternate option spellings: ``--depends``
- A dependency. This flag can be specified multiple times. Value is usually in the form of: -d 'name' or -d 'name > version'
* ``-e``
- Alternate option spellings: ``--edit``
- Edit the package spec before building.
* ``-f``
- Alternate option spellings: ``--force``
- Force output even if it will overwrite an existing file
* ``-m MAINTAINER``
- Alternate option spellings: ``--maintainer``
- The maintainer of this package.
* ``-n NAME``
- Alternate option spellings: ``--name``
- The name to give to the package
* ``-p OUTPUT``
- Alternate option spellings: ``--package``
- The package file path to output.
* ``-s INPUT_TYPE``
- Alternate option spellings: ``--input-type``
- the package type to use as input (gem, rpm, python, etc)
* ``-t OUTPUT_TYPE``
- Alternate option spellings: ``--output-type``
- the type of package you want to create (deb, rpm, solaris, etc)
* ``-v VERSION``
- Alternate option spellings: ``--version``
- The version to give to the package
* ``-x EXCLUDE_PATTERN``
- Alternate option spellings: ``--exclude``
- Exclude paths matching pattern (shell wildcard globs valid here). If you have multiple file patterns to exclude, specify this flag multiple times.
* ``--after-install FILE``
- A script to be run after package installation
* ``--after-remove FILE``
- A script to be run after package removal
* ``--after-upgrade FILE``
- A script to be run after package upgrade. If not specified, --before-install, --after-install, --before-remove, and --after-remove will behave in a backwards-compatible manner (they will not be upgrade-case aware). Currently only supports deb, rpm and pacman packages.
* ``--before-install FILE``
- A script to be run before package installation
* ``--before-remove FILE``
- A script to be run before package removal
* ``--before-upgrade FILE``
- A script to be run before package upgrade. If not specified, --before-install, --after-install, --before-remove, and --after-remove will behave in a backwards-compatible manner (they will not be upgrade-case aware). Currently only supports deb, rpm and pacman packages.
* ``--category CATEGORY``
- (optional) category this package belongs to
* ``--config-files CONFIG_FILES``
- Mark a file in the package as being a config file. This uses 'conffiles' in debs and %config in rpm. If you have multiple files to mark as configuration files, specify this flag multiple times. If argument is directory all files inside it will be recursively marked as config files.
* ``--conflicts CONFLICTS``
- Other packages/versions this package conflicts with. This flag can be specified multiple times.
* ``--debug``
- Enable debug output
* ``--debug-workspace``
- Keep any file workspaces around for debugging. This will disable automatic cleanup of package staging and build paths. It will also print which directories are available.
* ``--description DESCRIPTION``
- Add a description for this package. You can include '\n' sequences to indicate newline breaks.
* ``--directories DIRECTORIES``
- Recursively mark a directory as being owned by the package. Use this flag multiple times if you have multiple directories and they are not under the same parent directory
* ``--epoch EPOCH``
- The epoch value for this package. RPM and Debian calls this 'epoch'. FreeBSD calls this 'PORTEPOCH'
* ``--exclude-file EXCLUDE_PATH``
- The path to a file containing a newline-sparated list of patterns to exclude from input.
* ``--fpm-options-file FPM_OPTIONS_FILE``
- A file that contains additional fpm options. Any fpm flag format is valid in this file. This can be useful on build servers where you want to use a common configuration or inject other parameters from a file instead of from a command-line flag..
* ``--inputs INPUTS_PATH``
- The path to a file containing a newline-separated list of files and dirs to use as input.
* ``--iteration ITERATION``
- The iteration to give to the package. RPM calls this the 'release'. FreeBSD calls it 'PORTREVISION'. Debian calls this 'debian_revision'
* ``--license LICENSE``
- (optional) license name for this package
* ``--log LEVEL``
- Set the log level. Values: error, warn, info, debug.
* ``--no-auto-depends``
- Do not list any dependencies in this package automatically
* ``--no-depends``
- Do not list any dependencies in this package
* ``--post-install FILE``
- (DEPRECATED, use --after-install) A script to be run after package installation
* ``--post-uninstall FILE``
- (DEPRECATED, use --after-remove) A script to be run after package removal
* ``--pre-install FILE``
- (DEPRECATED, use --before-install) A script to be run before package installation
* ``--pre-uninstall FILE``
- (DEPRECATED, use --before-remove) A script to be run before package removal
* ``--prefix PREFIX``
- A path to prefix files with when building the target package. This may not be necessary for all input packages. For example, the 'gem' type will prefix with your gem directory automatically.
* ``--provides PROVIDES``
- What this package provides (usually a name). This flag can be specified multiple times.
* ``--replaces REPLACES``
- Other packages/versions this package replaces. Equivalent of rpm's 'Obsoletes'. This flag can be specified multiple times.
* ``--source-date-epoch-default SOURCE_DATE_EPOCH_DEFAULT``
- If no release date otherwise specified, use this value as timestamp on generated files to reduce nondeterminism. Reproducible build environments such as dpkg-dev and rpmbuild set this via envionment variable SOURCE_DATE_EPOCH variable to the integer unix timestamp to use in generated archives, and expect tools like fpm to use it as a hint to avoid nondeterministic output. This is a Unix timestamp, i.e. number of seconds since 1 Jan 1970 UTC. See https://reproducible-builds.org/specs/source-date-epoch
* ``--source-date-epoch-from-changelog``
- Use release date from changelog as timestamp on generated files to reduce nondeterminism. Experimental; only implemented for gem so far.
* ``--template-scripts``
- Allow scripts to be templated. This lets you use ERB to template your packaging scripts (for --after-install, etc). For example, you can do things like <%= name %> to get the package name. For more information, see the fpm wiki: https://github.com/jordansissel/fpm/wiki/Script-Templates
* ``--template-value KEY=VALUE``
- Make 'key' available in script templates, so <%= key %> given will be the provided value. Implies --template-scripts
* ``--url URI``
- Add a url for this package.
* ``--vendor VENDOR``
- (optional) vendor name for this package
* ``--verbose``
- Enable verbose output
* ``--workdir WORKDIR``
- The directory you want fpm to do its work in, where 'work' is any file copying, downloading, etc. Roughly any scratch space fpm needs to build your package.
apk
---
This package type has no additional options
cpan
----
* ``--cpan-cpanm-bin CPANM_EXECUTABLE``
- The path to the cpanm executable you wish to run.
* ``--[no-]cpan-cpanm-force``
- Pass the --force parameter to cpanm
* ``--cpan-mirror CPAN_MIRROR``
- The CPAN mirror to use instead of the default.
* ``--[no-]cpan-mirror-only``
- Only use the specified mirror for metadata.
* ``--cpan-package-name-prefix NAME_PREFIX``
- Name to prefix the package name with.
* ``--cpan-perl-bin PERL_EXECUTABLE``
- The path to the perl executable you wish to run.
* ``--cpan-perl-lib-path PERL_LIB_PATH``
- Path of target Perl Libraries
* ``--[no-]cpan-sandbox-non-core``
- Sandbox all non-core modules, even if they're already installed
* ``--[no-]cpan-test``
- Run the tests before packaging?
* ``--[no-]cpan-verbose``
- Produce verbose output from cpanm?
deb
---
* ``--deb-activate EVENT``
- Package activates EVENT trigger
* ``--deb-activate-noawait EVENT``
- Package activates EVENT trigger
* ``--deb-after-purge FILE``
- A script to be run after package removal to purge remaining (config) files (a.k.a. postrm purge within apt-get purge)
* ``--[no-]deb-auto-config-files``
- Init script and default configuration files will be labeled as configuration files for Debian packages.
* ``--deb-build-depends DEPENDENCY``
- Add DEPENDENCY as a Build-Depends
* ``--deb-changelog FILEPATH``
- Add FILEPATH as debian changelog
* ``--deb-compression COMPRESSION``
- The compression type to use, must be one of gz, bzip2, xz, zst, none.
* ``--deb-compression-level [0-9]``
- Select a compression level. 0 is none or minimal. 9 is max compression.
* ``--deb-config SCRIPTPATH``
- Add SCRIPTPATH as debconf config file.
* ``--deb-custom-control FILEPATH``
- Custom version of the Debian control file.
* ``--deb-default FILEPATH``
- Add FILEPATH as /etc/default configuration
* ``--deb-dist DIST-TAG``
- Set the deb distribution.
* ``--deb-field 'FIELD: VALUE'``
- Add custom field to the control file
* ``--[no-]deb-generate-changes``
- Generate PACKAGENAME.changes file.
* ``--deb-group GROUP``
- The group owner of files in this package
* ``--[no-]deb-ignore-iteration-in-dependencies``
- For '=' (equal) dependencies, allow iterations on the specified version. Default is to be specific. This option allows the same version of a package but any iteration is permitted
* ``--deb-init FILEPATH``
- Add FILEPATH as an init script
* ``--deb-installed-size KILOBYTES``
- The installed size, in kilobytes. If omitted, this will be calculated automatically
* ``--deb-interest EVENT``
- Package is interested in EVENT trigger
* ``--deb-interest-noawait EVENT``
- Package is interested in EVENT trigger without awaiting
* ``--[no-]deb-maintainerscripts-force-errorchecks``
- Activate errexit shell option according to lintian. https://lintian.debian.org/tags/maintainer-script-ignores-errors.html
* ``--deb-meta-file FILEPATH``
- Add FILEPATH to DEBIAN directory
* ``--[no-]deb-no-default-config-files``
- Do not add all files in /etc as configuration files by default for Debian packages.
* ``--deb-pre-depends DEPENDENCY``
- Add DEPENDENCY as a Pre-Depends
* ``--deb-priority PRIORITY``
- The debian package 'priority' value.
* ``--deb-recommends PACKAGE``
- Add PACKAGE to Recommends
* ``--deb-shlibs SHLIBS``
- Include control/shlibs content. This flag expects a string that is used as the contents of the shlibs file. See the following url for a description of this file and its format: http://www.debian.org/doc/debian-policy/ch-sharedlibs.html#s-shlibs
* ``--deb-suggests PACKAGE``
- Add PACKAGE to Suggests
* ``--deb-systemd FILEPATH``
- Add FILEPATH as a systemd script
* ``--[no-]deb-systemd-auto-start``
- Start service after install or upgrade
* ``--[no-]deb-systemd-enable``
- Enable service on install or upgrade
* ``--deb-systemd-path FILEPATH``
- Relative path to the systemd service directory
* ``--[no-]deb-systemd-restart-after-upgrade``
- Restart service after upgrade
* ``--deb-templates FILEPATH``
- Add FILEPATH as debconf templates file.
* ``--deb-upstart FILEPATH``
- Add FILEPATH as an upstart script
* ``--deb-upstream-changelog FILEPATH``
- Add FILEPATH as upstream changelog
* ``--[no-]deb-use-file-permissions``
- Use existing file permissions when defining ownership and modes
* ``--deb-user USER``
- The owner of files in this package
dir
---
This package type has no additional options
empty
-----
This package type has no additional options
freebsd
-------
* ``--freebsd-origin ABI``
- Sets the FreeBSD 'origin' pkg field
* ``--freebsd-osversion VERSION``
- Sets the FreeBSD 'version' pkg field, ie 12 or 13, use '*' for all.
gem
---
* ``--gem-bin-path DIRECTORY``
- The directory to install gem executables
* ``--gem-disable-dependency gem_name``
- The gem name to remove from dependency list
* ``--[no-]gem-embed-dependencies``
- Should the gem dependencies be installed?
* ``--[no-]gem-env-shebang``
- Should the target package have the shebang rewritten to use env?
* ``--[no-]gem-fix-dependencies``
- Should the package dependencies be prefixed?
* ``--[no-]gem-fix-name``
- Should the target package name be prefixed?
* ``--gem-gem PATH_TO_GEM``
- The path to the 'gem' tool (defaults to 'gem' and searches your $PATH)
* ``--gem-git-branch GIT_BRANCH``
- When using a git repo as the source of the gem instead of rubygems.org, use this git branch.
* ``--gem-git-repo GIT_REPO``
- Use this git repo address as the source of the gem instead of rubygems.org.
* ``--gem-package-name-prefix PREFIX``
- Name to prefix the package name with.
* ``--gem-package-prefix NAMEPREFIX``
- (DEPRECATED, use --package-name-prefix) Name to prefix the package name with.
* ``--[no-]gem-prerelease``
- Allow prerelease versions of a gem
* ``--gem-shebang SHEBANG``
- Replace the shebang in the executables in the bin path with a custom string
* ``--gem-stagingdir STAGINGDIR``
- The directory where fpm installs the gem temporarily before conversion. Normally a random subdirectory of workdir.
* ``--[no-]gem-version-bins``
- Append the version to the bins
npm
---
* ``--npm-bin NPM_EXECUTABLE``
- The path to the npm executable you wish to run.
* ``--npm-package-name-prefix PREFIX``
- Name to prefix the package name with.
* ``--npm-registry NPM_REGISTRY``
- The npm registry to use instead of the default.
osxpkg
------
* ``--osxpkg-dont-obsolete DONT_OBSOLETE_PATH``
- A file path for which to 'dont-obsolete' in the built PackageInfo. Can be specified multiple times.
* ``--osxpkg-identifier-prefix IDENTIFIER_PREFIX``
- Reverse domain prefix prepended to package identifier, ie. 'org.great.my'. If this is omitted, the identifer will be the package name.
* ``--osxpkg-ownership OWNERSHIP``
- --ownership option passed to pkgbuild. Defaults to 'recommended'. See pkgbuild(1).
* ``--[no-]osxpkg-payload-free``
- Define no payload, assumes use of script options.
* ``--osxpkg-postinstall-action POSTINSTALL_ACTION``
- Post-install action provided in package metadata. Optionally one of 'logout', 'restart', 'shutdown'.
p5p
---
* ``--p5p-group GROUP``
- Set the group to GROUP in the prototype file.
* ``--[no-]p5p-lint``
- Check manifest with pkglint
* ``--p5p-publisher PUBLISHER``
- Set the publisher name for the repository
* ``--p5p-user USER``
- Set the user to USER in the prototype files.
* ``--[no-]p5p-validate``
- Validate with pkg install
* ``--p5p-zonetype ZONETYPE``
- Set the allowed zone types (global, nonglobal, both)
pacman
------
* ``--pacman-compression COMPRESSION``
- The compression type to use, must be one of gz, bzip2, xz, zstd, none.
* ``--pacman-group GROUP``
- The group owner of files in this package
* ``--pacman-optional-depends PACKAGE``
- Add an optional dependency to the pacman package.
* ``--[no-]pacman-use-file-permissions``
- Use existing file permissions when defining ownership and modes
* ``--pacman-user USER``
- The owner of files in this package
pear
----
* ``--pear-bin-dir BIN_DIR``
- Directory to put binaries in
* ``--pear-channel CHANNEL_URL``
- The pear channel url to use instead of the default.
* ``--[no-]pear-channel-update``
- call 'pear channel-update' prior to installation
* ``--pear-data-dir DATA_DIR``
- Specify php dir relative to prefix if differs from pear default (pear/data)
* ``--pear-package-name-prefix PREFIX``
- Name prefix for pear package
* ``--pear-php-bin PHP_BIN``
- Specify php executable path if differs from the os used for packaging
* ``--pear-php-dir PHP_DIR``
- Specify php dir relative to prefix if differs from pear default (pear/php)
pkgin
-----
This package type has no additional options
pleaserun
---------
* ``--pleaserun-chdir CHDIR``
- The working directory used by the service
* ``--pleaserun-name SERVICE_NAME``
- The name of the service you are creating
* ``--pleaserun-user USER``
- The user to use for executing this program.
puppet
------
This package type has no additional options
python
------
* ``--python-bin PYTHON_EXECUTABLE``
- The path to the python executable you wish to run.
* ``--[no-]python-dependencies``
- Include requirements defined by the python package as dependencies.
* ``--python-disable-dependency python_package_name``
- The python package name to remove from dependency list
* ``--[no-]python-downcase-dependencies``
- Should the package dependencies be in lowercase?
* ``--[no-]python-downcase-name``
- Should the target package name be in lowercase?
* ``--python-easyinstall EASYINSTALL_EXECUTABLE``
- The path to the easy_install executable tool
* ``--[no-]python-fix-dependencies``
- Should the package dependencies be prefixed?
* ``--[no-]python-fix-name``
- Should the target package name be prefixed?
* ``--python-install-bin BIN_PATH``
- (DEPRECATED, does nothing) The path to where python scripts should be installed to.
* ``--python-install-data DATA_PATH``
- (DEPRECATED, does nothing) The path to where data should be installed to. This is equivalent to 'python setup.py --install-data DATA_PATH
* ``--python-install-lib LIB_PATH``
- (DEPRECATED, does nothing) The path to where python libs should be installed to (default depends on your python installation). Want to find out what your target platform is using? Run this: python -c 'from distutils.sysconfig import get_python_lib; print get_python_lib()'
* ``--[no-]python-internal-pip``
- 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
* ``--[no-]python-obey-requirements-txt``
- Use a requirements.txt file in the top-level directory of the python package for dependency detection.
* ``--python-package-name-prefix PREFIX``
- Name to prefix the package name with.
* ``--python-package-prefix NAMEPREFIX``
- (DEPRECATED, use --package-name-prefix) Name to prefix the package name with.
* ``--python-pip PIP_EXECUTABLE``
- The path to the pip executable tool. If not specified, easy_install is used instead
* ``--python-pypi PYPI_URL``
- PyPi Server uri for retrieving packages.
* ``--python-scripts-executable PYTHON_EXECUTABLE``
- (DEPRECATED) Set custom python interpreter in installing scripts. By default distutils will replace python interpreter in installing scripts (specified by shebang) with current python interpreter (sys.executable). This option is equivalent to appending 'build_scripts --executable PYTHON_EXECUTABLE' arguments to 'setup.py install' command.
* ``--python-setup-py-arguments setup_py_argument``
- (DEPRECATED) Arbitrary argument(s) to be passed to setup.py
* ``--python-trusted-host PYPI_TRUSTED``
- Mark this host or host:port pair as trusted for pip
rpm
---
* ``--rpm-attr ATTRFILE``
- Set the attribute for a file (%attr), e.g. --rpm-attr 750,user1,group1:/some/file
* ``--[no-]rpm-auto-add-directories``
- Auto add directories not part of filesystem
* ``--rpm-auto-add-exclude-directories DIRECTORIES``
- Additional directories ignored by '--rpm-auto-add-directories' flag
* ``--[no-]rpm-autoprov``
- Enable RPM's AutoProv option
* ``--[no-]rpm-autoreq``
- Enable RPM's AutoReq option
* ``--[no-]rpm-autoreqprov``
- Enable RPM's AutoReqProv option
* ``--rpm-changelog FILEPATH``
- Add changelog from FILEPATH contents
* ``--rpm-compression none|xz|xzmt|gzip|bzip2``
- Select a compression method. gzip works on the most platforms.
* ``--rpm-compression-level [0-9]``
- Select a compression level. 0 is store-only. 9 is max compression.
* ``--rpm-defattrdir ATTR``
- Set the default dir mode (%defattr).
* ``--rpm-defattrfile ATTR``
- Set the default file mode (%defattr).
* ``--rpm-digest md5|sha1|sha256|sha384|sha512``
- Select a digest algorithm. md5 works on the most platforms.
* ``--rpm-dist DIST-TAG``
- Set the rpm distribution.
* ``--rpm-filter-from-provides REGEX``
- Set %filter_from_provides to the supplied REGEX.
* ``--rpm-filter-from-requires REGEX``
- Set %filter_from_requires to the supplied REGEX.
* ``--rpm-group GROUP``
- Set the group to GROUP in the %files section. Overrides the group when used with use-file-permissions setting.
* ``--[no-]rpm-ignore-iteration-in-dependencies``
- For '=' (equal) dependencies, allow iterations on the specified version. Default is to be specific. This option allows the same version of a package but any iteration is permitted
* ``--rpm-init FILEPATH``
- Add FILEPATH as an init script
* ``--[no-]rpm-macro-expansion``
- install-time macro expansion in %pre %post %preun %postun scripts (see: https://rpm-software-management.github.io/rpm/manual/scriptlet_expansion.html)
* ``--[no-]rpm-old-perl-dependency-name``
- Use older 'perl' depdency name. Newer Red Hat (and derivatives) use a dependency named 'perl-interpreter'.
* ``--rpm-os OS``
- The operating system to target this rpm for. You want to set this to 'linux' if you are using fpm on OS X, for example
* ``--rpm-posttrans FILE``
- posttrans script
* ``--rpm-pretrans FILE``
- pretrans script
* ``--rpm-rpmbuild-define DEFINITION``
- Pass a --define argument to rpmbuild.
* ``--[no-]rpm-sign``
- Pass --sign to rpmbuild
* ``--rpm-summary SUMMARY``
- Set the RPM summary. Overrides the first line on the description if set
* ``--rpm-tag TAG``
- Adds a custom tag in the spec file as is. Example: --rpm-tag 'Requires(post): /usr/sbin/alternatives'
* ``--rpm-trigger-after-install '[OPT]PACKAGE: FILEPATH'``
- Adds a rpm trigger script located in FILEPATH, having 'OPT' options and linking to 'PACKAGE'. PACKAGE can be a comma seperated list of packages. See: https://rpm-software-management.github.io/rpm/manual/triggers.html
* ``--rpm-trigger-after-target-uninstall '[OPT]PACKAGE: FILEPATH'``
- Adds a rpm trigger script located in FILEPATH, having 'OPT' options and linking to 'PACKAGE'. PACKAGE can be a comma seperated list of packages. See: https://rpm-software-management.github.io/rpm/manual/triggers.html
* ``--rpm-trigger-before-install '[OPT]PACKAGE: FILEPATH'``
- Adds a rpm trigger script located in FILEPATH, having 'OPT' options and linking to 'PACKAGE'. PACKAGE can be a comma seperated list of packages. See: https://rpm-software-management.github.io/rpm/manual/triggers.html
* ``--rpm-trigger-before-uninstall '[OPT]PACKAGE: FILEPATH'``
- Adds a rpm trigger script located in FILEPATH, having 'OPT' options and linking to 'PACKAGE'. PACKAGE can be a comma seperated list of packages. See: https://rpm-software-management.github.io/rpm/manual/triggers.html
* ``--[no-]rpm-use-file-permissions``
- Use existing file permissions when defining ownership and modes.
* ``--rpm-user USER``
- Set the user to USER in the %files section. Overrides the user when used with use-file-permissions setting.
* ``--[no-]rpm-verbatim-gem-dependencies``
- When converting from a gem, leave the old (fpm 0.4.x) style dependency names. This flag will use the old 'rubygem-foo' names in rpm requires instead of the redhat style rubygem(foo).
* ``--rpm-verifyscript FILE``
- a script to be run on verification
sh
--
This package type has no additional options
snap
----
* ``--snap-confinement CONFINEMENT``
- Type of confinement to use for this snap.
* ``--snap-grade GRADE``
- Grade of this snap.
* ``--snap-yaml FILEPATH``
- Custom version of the snap.yaml file.
solaris
-------
* ``--solaris-group GROUP``
- Set the group to GROUP in the prototype file.
* ``--solaris-user USER``
- Set the user to USER in the prototype files.
tar
---
This package type has no additional options
virtualenv
----------
* ``--virtualenv-find-links PIP_FIND_LINKS``
- If a url or path to an html file, then parse for links to archives. If a local path or file:// url that's a directory, then look for archives in the directory listing.
* ``--[no-]virtualenv-fix-name``
- Should the target package name be prefixed?
* ``--virtualenv-install-location DIRECTORY``
- DEPRECATED: Use --prefix instead. Location to which to install the virtualenv by default.
* ``--virtualenv-other-files-dir DIRECTORY``
- Optionally, the contents of the specified directory may be added to the package. This is useful if the virtualenv needs configuration files, etc.
* ``--virtualenv-package-name-prefix PREFIX``
- Name to prefix the package name with.
* ``--virtualenv-pypi PYPI_URL``
- PyPi Server uri for retrieving packages.
* ``--virtualenv-pypi-extra-url PYPI_EXTRA_URL``
- PyPi extra-index-url for pointing to your priviate PyPi
* ``--[no-]virtualenv-setup-install``
- After building virtualenv run setup.py install useful when building a virtualenv for packages and including their requirements from requirements.txt
* ``--[no-]virtualenv-system-site-packages``
- Give the virtual environment access to the global site-packages
zip
---
This package type has no additional options

View File

@ -28,7 +28,9 @@ import os
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []
extensions = [
'sphinx_rtd_theme'
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@ -46,7 +48,7 @@ master_doc = 'index'
# General information about the project.
project = u'fpm - packaging made simple'
copyright = u'2016, Jordan Sissel'
copyright = u'2025, Jordan Sissel and contributors'
author = u'Jordan Sissel'
# The version info for the project you're documenting, acts as replacement for
@ -54,16 +56,16 @@ author = u'Jordan Sissel'
# built documents.
#
# The short X.Y version.
version = u'1.9'
version = u'1.17'
# The full version, including alpha/beta/rc tags.
release = u'1.9.0'
release = u'1.17.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:

View File

@ -1,33 +1,21 @@
Want to contribute? Or need help?
================================
Contributing/Issues
===================
Please note that this project is released with a Contributor Code of Conduct.
By participating in this project you agree to abide by its terms. See
the `Code of Conduct`_ for details.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See the `Code of Conduct`_ for details.
.. _Code of Conduct: https://github.com/jordansissel/fpm/blob/master/CODE_OF_CONDUCT.md
All contributions are welcome: ideas, patches, documentation, bug reports,
complaints, and even something you drew up on a napkin :)
All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin :)
It is more important that you are able to contribute and get help if you
need it than it is how you contribute or get help.
It is more important that you are able to contribute and get help if you need it than it is how you contribute or get help.
That said, some points to get started:
* Have a problem you want fpm to solve for you? You can email the
`mailing list`_, or join the IRC channel #fpm on irc.freenode.org, or email
me personally (jls@semicomplete.com)
* Have an idea or a feature request? File a ticket on `github`_, or email the
`mailing list`_, or email me personally (jls@semicomplete.com) if that is
more comfortable.
* If you think you found a bug, it probably is a bug. File it on
`github`_ or send details to the `mailing list`_.
* If you want to send patches, best way is to fork this repo and send me a pull
request. If you don't know git, I also accept diff(1) formatted patches -
whatever is most comfortable for you.
* Want to lurk about and see what others are doing? IRC (#fpm on
irc.freenode.org) is a good place for this as is the `mailing list`_.
* Have a problem you want FPM to solve for you? You can email the `mailing list`_, or join the IRC channel #fpm on irc.freenode.org, or email me personally (jls@semicomplete.com)
* Have an idea or a feature request? File a ticket on `github`_, or email the `mailing list`_, or email me personally (jls@semicomplete.com) if that is more comfortable.
* If you think you found a bug, it probably is a bug. File it on `github`_ or send details to the `mailing list`_.
* If you want to send patches, best way is to fork this repo and send me a pull request. If you don't know git, I also accept diff(1) formatted patches - whatever is most comfortable for you.
* Want to lurk about and see what others are doing? IRC (#fpm on irc.freenode.org) is a good place for this as is the `mailing list`_.
.. _mailing list: https://groups.google.com/group/fpm-users
.. _github: https://github.com/jordansissel/fpm
@ -35,12 +23,12 @@ That said, some points to get started:
Contributing changes by forking from GitHub
-------------------------------------------
First, create a GitHub account if you do not already have one. Log in to
GitHub and go to [the main fpm GitHub page](https://github.com/jordansissel/fpm).
First, create a GitHub account if you do not already have one. Log in to
GitHub and go to [the main FPM GitHub page](https://github.com/jordansissel/fpm).
At the top right, click on the button labeled "Fork". This will put a forked
copy of the main fpm repo into your account. Next, clone your account's GitHub
repo of fpm. For example:
copy of the main FPM repo into your account. Next, clone your account's GitHub
repo of FPM. For example:
$ git clone git@github.com:yourusername/fpm.git
@ -51,13 +39,13 @@ If you don't already have the bundler gem installed, install it now:
$ gem install bundler
Now change to the root of the fpm repo and run:
Now change to the root of the FPM repo and run:
$ bundle install
This will install all of the dependencies required for running fpm from source.
This will install all of the dependencies required for running FPM from source.
Most importantly, you should see the following output from the bundle command
when it lists the fpm gem:
when it lists the FPM gem:
...
Using json (1.8.1)
@ -68,18 +56,23 @@ when it lists the fpm gem:
If your system doesn't have `bsdtar` by default, make sure to install it or some
tests will fail:
apt-get install bsdtar
apt-get install bsdtar || apt install libarchive-tools
yum install bsdtar
Next, run make in root of the fpm repo. If there are any problems (such as
You also need these tools:
apt-get install lintian cpanminus
Next, run make in root of the FPM repo. If there are any problems (such as
missing dependencies) you should receive an error
At this point, the fpm command should run directly from the code in your cloned
At this point, the FPM command should run directly from the code in your cloned
repo. Now simply make whatever changes you want, commit the code, and push
your commit back to master.
If you think your changes are ready to be merged back to the main fpm repo, you
If you think your changes are ready to be merged back to the main FPM repo, you
can generate a pull request on the GitHub website for your repo and send it in
for review.
@ -93,4 +86,21 @@ you have the standalone command line tools separate from Xcode:
Finally, click the install button on the prompt that appears.
Editing Documentation
---------------------
If you want to edit the documentation, here's a quick guide to getting started:
* Install `docker`_.
* All documentation is located in the `docs` folder. ``cd`` into the docs folder and run the following command once::
make docker-prep
* Once that is done, run ``make build`` whenever you want to build the site. It will generate the html in the `_build/html` directory.
* You can use any tool like `serve _build/html` (npm package) or ``python -m http.server -d _build/html 5000`` to serve the static html on your machine (http://localhost:5000).
.. _docker: https://docs.docker.com/engine/install/
Now you can simply make whatever changes you want, commit the code, and push your commit back to master.
If you think your changes are ready to be merged back to the main FPM repo, you can generate a pull request on the GitHub website for your repo and send it in for review.

70
docs/docker.rst Normal file
View File

@ -0,0 +1,70 @@
FPM and Docker
==============
Because fpm depends on so many underlying system tools, docker can
alleviate the need to install them locally.
An end user may use a docker container in lieu of installing
locally. And a developer can use docker to run the test suite.
Running FPM inside docker
-------------------------
First, build a container will all the dependencies::
make docker-release-everything
Now, run it as you would the fpm command. Note that you will have to
mount your source directly into the docker volume::
docker run -v $(pwd):/src fpm --help
As a full example::
mkdir /tmp/fpm-test
mkdir /tmp/fpm-test/files
touch /tmp/fpm-test/files/one
touch /tmp/fpm-test/files/two
docker run -v /tmp/fpm-test/files:/src -v /tmp/fpm-test:/out fpm -s dir -t tar -n example -p /out/out.tar .
tar tf /tmp/fpm-test/out.tar
Depending on your needs, you will have to adjust the volume mounts and
relative paths to fit your particular situation.
Running rpsec inside docker
---------------------------
The Makefile provides some targets for testing. They will build a
docker container with the dependencies, and then invoked `rspec`
inside it. The makefile uses a sentinel file to indicate that the
docker image has been build, and can be reused.
make docker-test-everything
How does this work
------------------
The Dockerfile makes heavy use of multistage
builds. This allows the various output containers to build on the same
earlier stages.
There are two ``base`` images. A ``minimal`` image, which contains
compiled dependencies and ruby. And an ``everything`` image which brings
in scripting systems like ``python`` and ``perl``. These are split to
allow a smaller ``minimal`` image in cases where building scripting
language packages are not needed.
The Dockerfile the argument ``BASE_ENV`` to specify what base image to
use. This can be set to either ``minimal`` or ``everything``. If
unspecified, it defaults to ``everything``
We want to use the same set of base images for both the ``rspec``
testing, as well as the run time containerization. We do this by using
the ``TARGET`` argument to select which container to build.
The makefile encodes this logic with two pattern rules.

View File

@ -0,0 +1,67 @@
#!/usr/bin/env ruby
require_relative "../lib/fpm/command"
flagsort = lambda { |x| x.sub(/^--(?:\[no-\])?/, "") }
if ARGV.length == 0
puts "Command-line Reference"
puts "=========================="
puts
puts "This page documents the command-line flags available in FPM. You can also see this content in your terminal by running ``fpm --help``"
puts
puts "General Options"
puts "---------------"
#FPM::Command.instance_variable_get(:@declared_options).sort_by { |o| flagsort.call(o.switches.first) }.each do |option|
FPM::Command::GENERAL_OPTIONS.sort_by { |o| flagsort.call(o.switches.first) }.each do |option|
text = option.description.gsub("\n", " ")
if option.type == :flag
# it's a flag which means there are no parameters to the option
puts "* ``#{option.switches.first}``"
else
puts "* ``#{option.switches.first} #{option.type}``"
end
if option.switches.length > 1
puts " - Alternate option spellings: ``#{option.switches[1..-1].join(", ")}``"
end
puts " - #{text}"
puts
end
end
FPM::Package.types.sort_by { |k,v| k }.each do |name, type|
next if ARGV.length > 0 && ARGV[0].downcase != name.downcase
options = type.instance_variable_get(:@options)
# Only print the section header if no arguments are given
# -- aka, generate the list of all flags grouped by package type.
if ARGV.length == 0
puts "#{name}"
puts "-" * name.size
puts
end
if options.empty?
puts "This package type has no additional options"
end
options.sort_by { |flag, _| flagsort.call(flag.first) }.each do |flag, param, help, options, block|
if param == :flag
puts "* ``#{flag.first}``"
else
puts "* ``#{flag.first} #{param}``"
end
text = help.sub(/^\([^)]+\) /, "")
puts " - #{text}"
end
puts
end

244
docs/getting-started.rst Normal file
View File

@ -0,0 +1,244 @@
Getting Started
===============
FPM takes your program and builds packages that can be installed easily on various operating systems.
Understanding the basics of FPM
-------------------------------
The ``fpm`` command takes in three arguments:
* The type of sources to include in the package
* The type of package to output
* The sources themselves
The source could be a:
* file OR a directory with various files needed to run the program - ``dir``
* nodejs (npm) package - ``npm``
* ruby (gem) package - ``gem``
* python (using easy_install or a local setup.py) package - ``python``
* python virtualenv - ``virtualenv``
* pear package - ``pear``
* perl (cpan) module - ``cpan``
* .deb package - ``deb``
* .rpm package - ``rpm``
* pacman (.pkg.tar.zst) package - ``pacman``
* .pkgin package - ``pkgin``
* package without any files (useful for meta packages) - ``empty``
The target (output package format) could be:
* A .deb package (for Debian and Debian-based) - ``deb``
* A .rpm package (for RedHat based) - ``rpm``
* A .solaris package (for Solaris) - ``solaris``
* A .freebsd package (for FreeBSD) - ``freebsd``
* MacOS .pkg files - ``osxpkg``
* Pacman packages (.pkg.tar.zst) (for Arch Linux and Arch-based) - ``pacman``
* A puppet module - ``puppet``
* A p5p module - ``p5p``
* A self-extracting installer - ``sh``
* A tarfile that can be extracted into the root of any machine to install the program - ``tar``
* A zipfile that can be extracted into the root of any machine to install the program - ``zip``
* A directory that can be copied to the root of any machine to install the program - ``dir``
Given a source and a target, FPM can convert all the source files into a package of the target format.
Using it to package an executable
---------------------------------
To simplyify things a bit, let's take an example. Suppose you have a bash script that prints 'Hello, world!' in multiple colors when it is run::
--- File: hello-world
#!/usr/bin/env bash
#
# == hello-world 0.1.0 ==
#
echo "Hello, world!" | lolcat
Let's say you even wrote a manpage (manual page) for it::
--- File: hello-world.1
.TH HELLO WORLD "1" "July 2021" "hello-world 0.1.0" "User Commands"
.SH NAME
hello-world \- manual page for hello-world 0.1.0
.SH DESCRIPTION
.IP
USAGE: hello-world
.SH "SEE ALSO"
.IP
Website: https://example.com/hello-world
.SH "OTHER"
.IP
Made by You The Amazing Person <you are an amazing person at example dot com>
.IP
This program is distributed under the AGPL 3.0 license.
Now you want to package this script and its manual page and distribute to the world as a .deb file. To do that using FPM, here is the command we need to run::
fpm \
-s dir -t deb \
-p hello-world-0.1.0-1-any.deb \
--name hello-world \
--license agpl3 \
--version 0.1.0 \
--architecture all \
--depends bash --depends lolcat \
--description "Say hi!" \
--url "https://example.com/hello-world" \
--maintainer "You The Amazing Person <you are an amazing person at example dot com>" \
hello-world=/usr/bin/hello-world hello-world.1=/usr/share/man/man1/hello-world.1
If you have installed FPM, and have the hello-world script in your current directory, you should be able to see a ``hello-world-0.1.0-1-any.deb`` file in your current directory after you run this command.
Let's break the command down, option by option:
* ``-s dir`` [required]
- The ``-s`` option tells FPM what sources to use to build the package.
- In this case [``dir``], we are telling FPM that we want to build a package from source files that we have on our computer.
* ``-t deb`` [required]
- The ``-t`` option tells FPM what type of package to build (target package).
- In this case [``deb``], we are telling FPM that we want to build a .deb package, that can be installed on Debian and Debian-based operating systems, such as Ubuntu.
* ``-p hello-world-0.1.0-1-any.deb``
- The ``-p`` option tells FPM what to name the package once it has been created.
- In this case, we name it ``<package name>-<version>-<package rel/iteration>-<architecture>.<file extension>``, but you can call it whatever you want.
* ``--name hello-world``
- The name of the program that FPM is packaging.
- In this case, it is hello-world.
* ``--license agpl3``
- The license the program uses
- In this case, we use the AGPL 3.0 license (If you have a custom license, use ``custom`` instead of AGPL3)
* ``--version 0.1.0``
- The version of the program
- In this case, the version is 0.1.0
* ``--architecture all``
- The architecture required to run the program [valid values are: x86_64/amd64, aarch64, native (current architecture), all/noarch/any]
- In this case, the program is just a bash script, so we can run on all architectures
* ``--depends bash --depends lolcat``
- The dependencies the program needs to run
- In this case, we need bash and lolcat - bash to run the program itself, and lolcat to display the text in multiple colors
* ``--description "Say hi!"``
- The program description
- In this case, it is Say hi!
* ``--url "https://example.com/hello-world"``
- The URL to the program``s website or URL to program source
* ``--maintainer "You The Amazing Person <you are an amazing person at example dot com>"``
- The name and (optionally) email of the person creating the package
* ``hello-world=/usr/bin/hello-world hello-world.1=/usr/share/man/man1/hello-world.1`` [required]
- This is the most important part. It tells FPM which file (relative paths from the current directory) should be installed to which path in the machine.
- In this case, we want the user to be able to execute the command ``hello-world`` from terminal; so we put the hello-world script in the user's PATH, that is, in /usr/bin/. We also want the user to access the manual page using ``man hello-world``, so we put the manpage (hello-world.1) in the /usr/share/man/man1/ directory.
For more detailed documentation about each and every flag (there are some package-type-specific flags that exist as well), run ``fpm --help``.
Using it to package an existing package
---------------------------------------
We've seen how to package a program if you have an executable, but what if you already have a program that you have not written as an executable script, but in a language like nodejs instead? FPM can help here too. It can take any nodejs package, ruby gem or even a python package and turn it into a deb, rpm, pacman, etc. package. Here are a couple of examples.
Packaging a NodeJS application that's already on NPM
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. note::
This assumes you have nodejs and npm already installed on your machine.
Run the following command::
fpm -s npm -t <deb/rpm/pacman/solaris/freebsd/osxpkg/tar> <npm-package-name>
E.g.: To package yarn for Arch Linux::
fpm -s npm -t pacman yarn
This will download the latest ``yarn`` package from npm.com and convert it to a .pkg.tar.zst (pacman) package. It will create a package named node-yarn-VERSION_ARCH.deb with the appropriate version/arch in place. FPM will automatically pick the package name, version, maintainer, section, homepage, and description all from the npm package itself. Nothing for you to worry about :)
Packaging a ruby gem
~~~~~~~~~~~~~~~~~~~~
.. note::
This assumes you have ruby already installed on your machine.
Run the following command::
fpm -s gem -t <deb/rpm/pacman/solaris/freebsd/osxpkg/tar> <gem-name>
E.g.: To package FPM using FPM for Debian::
# FPM-ception :D
fpm -s gem -t deb fpm
This will download the latest ``fpm`` rubygem from rubygems.org and convert it to a .deb. It will create a package named rubygem-fpm-VERSION_ARCH.deb with the appropriate version/arch in place. FPM will automatically pick the package name, version, maintainer, section, homepage, and description all from the rubygem itself. Nothing for you to worry about :)
Packaging a CPAN module
~~~~~~~~~~~~~~~~~~~~~~~
.. note::
This assumes you have perl already installed on your machine.
Run the following command package the perl Fennec module for Debian::
fpm -s cpan -t deb Fennec
This will download Fennec from CPAN and build a Debian package of the Fennec Perl module locally.
By default, FPM believes the following to be true:
* That your local Perl lib path will be the target Perl lib path
* That you want the package name to be prefixed with the word perl
* That the dependencies from CPAN are valid and that the naming scheme for those dependencies are prefixed with perl
If you wish to change any of the above, use the following::
fpm -t deb -s cpan -cpan-perl-lib-path /usr/share/perl5 Fennec
fpm -t deb -s cpan --cpan-package-name-prefix fubar /usr/share/perl5 Fennec
The first command will change the target path to where perl will be. Your local perl install may be /opt/usr/share/perl5.10 but the package will be constructed so that the module will be installed to /usr/share/perl5
The second command will change the prefix of the package, i.e., from perl-Fennec to fubar-Fennec.
Configuration file
-------------------
If you are using FPM in to build packages for multiple targets and keep repeating several options (like version, description, name, license, maintainer, url, architecture, files to package, etc.), you can add a ``.fpm`` file in your working directory, with a list of options as well as arguments that you want to pass to the CLI. Extending the example of the hello-world program, say we want to package it as a .deb and a .rpm. We could create the following .fpm file::
--- File: .fpm
-s dir
--name hello-world
--license agpl3
--version 0.1.0
--architecture all
--depends bash --depends lolcat
--description "Say hi!"
--url "https://example.com/hello-world"
--maintainer "You The Amazing Person <you are an amazing person at example dot com>"
hello-world=/usr/bin/hello-world hello-world.1=/usr/share/man/man1/hello-world.1
.. note::
CLI flags will override those in the ``.fpm`` file.
Meanwhile, we could run the following commands in terminal to build the .deb and .rpm::
fpm -t deb -p hello-world-0.1.0-1-any.deb
fpm -t rpm -p hello-world-0.1.0-1-any.rpm
Tada! You will have a .deb (for Debian) and .rpm (for RedHat), with no unnecessary duplication of metadata. You can put any other valid CLI options in the ``.fpm`` file too.
For more detailed information regarding all CLI flags, see the :doc:`CLI reference. <cli-reference>`

View File

@ -2,23 +2,44 @@ fpm - packaging made simple
===========================
.. note::
The documentation here is a work-in-progress. If you want to contribute new
docs or report problems, I invite you to do so on `the project issue tracker`_.
The documentation here is a work-in-progress; it is by no means extensive. If you want to contribute new docs or report problems, you are invited to do so on `the project issue tracker`_.
.. _the project issue tracker: https://github.com/jordansissel/fpm/issues
Welcome to the fpm documentation!
.. include:: ../README.rst
fpm is a tool which lets you easily create packages for Debian, Ubuntu, Fedora, CentOS, RHEL, Arch Linux, FreeBSD, macOS, and more!
fpm isn't a new packaging system, it's a tool to help you make packages for existing systems with less effort. It does this by offering a command-line interface to allow you to create packages easily. Here are some examples using fpm:
* ``fpm -s npm -t deb express`` -- Make a Debian package for the nodejs `express` library
* ``fpm -s cpan -t rpm Fennec`` -- Make an rpm for the perl Fennec module
* ``fpm -s dir -t pacman -n fancy ~/.zshrc`` -- Put your ~/.zshrc into an Arch Linux pacman package named "fancy"
* ``fpm -s python -t freebsd Django`` -- Create a FreeBSD package containing the Python Django library
* ``fpm -s rpm -t deb mysql.rpm`` -- Convert an rpm to deb
This project has a few important principles which guide development:
* Community: If a newbie has a bad time, it's a bug.
* Engineering: Make it work, make it right, then make it fast.
* Capabilities: If it doesn't do a thing today, we can make it do it tomorrow.
`Install fpm <installation.html>`_ and you'll quickly begin making packages for whatever you need!
You can view the changelog `here`_.
Table of Contents
-----------------
.. toctree::
:maxdepth: 2
:includehidden:
:includehidden:
intro
installing
use-cases
packages
contributing
changelog
installation
getting-started
packaging-types
cli-reference
docker
contributing
changelog
.. _here: /changelog.html
.. _the project issue tracker: https://github.com/jordansissel/fpm/issues

70
docs/installation.rst Normal file
View File

@ -0,0 +1,70 @@
Installation
============
FPM is written in ruby and can be installed using `gem`. For some package formats (like rpm and snap), you will need certain packages installed to build them.
Installing FPM
--------------
.. note::
You must have ruby installed on your machine before installing fpm. `Here`_ are instructions to install Ruby on your machine.
.. _Here: https://www.ruby-lang.org/en/documentation/installation/
You can install FPM with the ``gem`` tool::
gem install fpm
To make sure fpm is installed correctly, try running the following command::
fpm --version
You should get some output like this, although the exact output will depend on which version of FPM you have installed.::
% fpm --version
1.17.0
Now you can go on to `using FPM! <getting-started.html>`_
Installing optional dependencies
--------------------------------
.. warning::
This section may be imperfect; please make sure you are installing the right package for your OS.
Some package formats require other tools to be installed on your machine to be built; especially if you are building a package for another operating system/distribution.
* RPM: rpm/rpm-tools/rpm-build [This dependency might be removed in the future, see `issue #54`_ on github]
* Snap: squashfs/squashfs-tools
.. _issue #54: https://github.com/jordansissel/fpm/issues/54
.. note::
You will not be able to build an osxpkg package (.pkg) for MacOS unless you are running MacOS.
Here are instructions to install these dependencies on your machine:
On OSX/macOS::
brew install rpm squashfs
On Arch Linux and Arch-based systems (Manjaro, EndeavourOS, etc)::
pacman -S rpm-tools squashfs-tools
On Debian and Debian-based systems (Ubuntu, Linux Mint, Pop!_OS, etc)::
apt-get install squashfs-tools
On Red Hat systems (Fedora 22 or older, CentOS, Rocky Linux, etc)::
yum install rpm-build squashfs-tools
On Fedora 23 or newer::
dnf install rpm-build squashfs-tools
On Oracle Linux 7.x systems::
yum-config-manager --enable ol7_optional_latest
yum install rpm-build squashfs-tools

View File

@ -1,91 +0,0 @@
Installation
============
FPM requires a few things before you can use it. This document will show you
how to install all the necessary things :)
Depending on what you want to do with FPM, you might need some extra things installed (like tooling to build rpms, or solaris packages, or something else), but for now, let's just get ruby so we can start using fpm!
Installing things FPM needs
--------------
.. warning::
This section may be imperfect due to the inconsistencies across OS vendors
fpm is written in Ruby, you'll need to provide Ruby. Some operating systems,
like OSX, come with Ruby already, but some do not. Depending on your operating system, you might need to run the following commands:
On OSX/macOS::
brew install gnu-tar
On Red Hat systems (Fedora 22 or older, CentOS, etc)::
yum install ruby-devel gcc make rpm-build rubygems
On Fedora 23 or newer::
dnf install ruby-devel gcc make rpm-build libffi-devel
On Debian-derived systems (Debian, Ubuntu, etc)::
apt-get install ruby ruby-dev rubygems build-essential
Installing FPM
--------------
You can install fpm with the `gem` tool::
gem install --no-ri --no-rdoc fpm
.. note::
`gem` is a command provided by a the Ruby packaging system called `rubygems`_. This allows you to install, and later upgrade, fpm.
.. _rubygems: https://en.wikipedia.org/wiki/RubyGems
You should see output that looks like this::
% gem install --no-ri --no-rdoc fpm
Fetching: cabin-0.9.0.gem (100%)
Successfully installed cabin-0.9.0
Fetching: backports-3.6.8.gem (100%)
Successfully installed backports-3.6.8
Fetching: arr-pm-0.0.10.gem (100%)
Successfully installed arr-pm-0.0.10
Fetching: clamp-1.0.1.gem (100%)
Successfully installed clamp-1.0.1
Fetching: ffi-1.9.14.gem (100%)
Building native extensions. This could take a while...
Successfully installed ffi-1.9.14
Fetching: childprocess-0.5.9.gem (100%)
Successfully installed childprocess-0.5.9
Fetching: archive-tar-minitar-0.5.2.gem (100%)
Successfully installed archive-tar-minitar-0.5.2
Fetching: io-like-0.3.0.gem (100%)
Successfully installed io-like-0.3.0
Fetching: ruby-xz-0.2.3.gem (100%)
Successfully installed ruby-xz-0.2.3
Fetching: dotenv-2.1.1.gem (100%)
Successfully installed dotenv-2.1.1
Fetching: insist-1.0.0.gem (100%)
Successfully installed insist-1.0.0
Fetching: mustache-0.99.8.gem (100%)
Successfully installed mustache-0.99.8
Fetching: stud-0.0.22.gem (100%)
Successfully installed stud-0.0.22
Fetching: pleaserun-0.0.27.gem (100%)
Successfully installed pleaserun-0.0.27
Fetching: fpm-1.6.3.gem (100%)
Successfully installed fpm-1.6.3
15 gems installed
Now you should be ready to use fpm!
To make sure fpm is installed correctly, try running the following command::
fpm --version
You should get some output like this, although the exact output will depend on which version of fpm you have installed.::
% fpm --version
1.6.3

View File

@ -1,61 +0,0 @@
What is FPM?
===================
fpm is a command-line program designed to help you build packages.
Building a package might look something like this:
fpm -s <source type> -t <target type> [list of sources]...
"Source type" is what your package is coming from; a directory (dir), a rubygem
(gem), an rpm (rpm), a python package (python), a php pear module (pear), see
the `full list`_.
.. _full list: https://fpm.readthedocs.io/en/latest/packages.html
"Target type" is what your output package form should be. Most common are "rpm"
and "deb" but others exist (solaris, etc)
You have a few options for learning to run FPM:
1. If you're impatient, just scan through `fpm --help`; you'll need various
options, and we try to make them well-documented. Quick learning is
totally welcome, and if you run into issues, you are welcome to ask
questions in #fpm on freenode irc or on fpm-users@googlegroups.com!
2. `The documentation`_ has explanations and examples. If you run into
problems, I welcome you to ask questions in #fpm on freenode irc or on
fpm-users@googlegroups.com!
.. _The documentation: http://fpm.readthedocs.io/en/latest/intro.html
To give you an idea of what fpm can do, here's a few use cases:
Take a directory and turn it into an RPM::
fpm -s dir -t rpm ...
Convert a .deb into an rpm::
fpm -s deb -t rpm ...
Convert a rubygem into a deb package::
fpm -s gem -t deb ...
Convert a .tar.gz into an OSX .pkg file::
fpm -s tar -t osxpkg
Convert a .zip into an rpm::
fpm -s zip -t rpm ...
Change properties of an existing rpm::
fpm -s rpm -t rpm
Create an deb that automatically installs a service::
fpm -s pleaserun -t deb
Below is a 10-minute video demonstrating fpm's simplicity of use:
.. raw:: html
<iframe width="560" height="315" src="https://www.youtube.com/embed/Jf89-2gWwiI" frameborder="0" allowfullscreen></iframe>
Now that you've seen a bit of what fpm can do, it's time to :doc:`install fpm <installing>`.

View File

@ -1,9 +0,0 @@
Packages
======
.. toctree::
:maxdepth: 2
sources
targets

12
docs/packages/apk.rst Normal file
View File

@ -0,0 +1,12 @@
apk - Alpine package format
===========================
Supported Uses in FPM
---------------------
fpm supports using ``apk`` only as an output type. This means you can create ``apk`` packages from input types like ``deb``, ``dir``, or ``npm``
apk-specific command line flags
-------------------------------
.. include:: cli/apk.rst

View File

@ -0,0 +1,2 @@
This package type has no additional options

View File

@ -0,0 +1,21 @@
* ``--cpan-cpanm-bin CPANM_EXECUTABLE``
- The path to the cpanm executable you wish to run.
* ``--[no-]cpan-cpanm-force``
- Pass the --force parameter to cpanm
* ``--cpan-mirror CPAN_MIRROR``
- The CPAN mirror to use instead of the default.
* ``--[no-]cpan-mirror-only``
- Only use the specified mirror for metadata.
* ``--cpan-package-name-prefix NAME_PREFIX``
- Name to prefix the package name with.
* ``--cpan-perl-bin PERL_EXECUTABLE``
- The path to the perl executable you wish to run.
* ``--cpan-perl-lib-path PERL_LIB_PATH``
- Path of target Perl Libraries
* ``--[no-]cpan-sandbox-non-core``
- Sandbox all non-core modules, even if they're already installed
* ``--[no-]cpan-test``
- Run the tests before packaging?
* ``--[no-]cpan-verbose``
- Produce verbose output from cpanm?

77
docs/packages/cli/deb.rst Normal file
View File

@ -0,0 +1,77 @@
* ``--deb-activate EVENT``
- Package activates EVENT trigger
* ``--deb-activate-noawait EVENT``
- Package activates EVENT trigger
* ``--deb-after-purge FILE``
- A script to be run after package removal to purge remaining (config) files (a.k.a. postrm purge within apt-get purge)
* ``--[no-]deb-auto-config-files``
- Init script and default configuration files will be labeled as configuration files for Debian packages.
* ``--deb-build-depends DEPENDENCY``
- Add DEPENDENCY as a Build-Depends
* ``--deb-changelog FILEPATH``
- Add FILEPATH as debian changelog
* ``--deb-compression COMPRESSION``
- The compression type to use, must be one of gz, bzip2, xz, zst, none.
* ``--deb-compression-level [0-9]``
- Select a compression level. 0 is none or minimal. 9 is max compression.
* ``--deb-config SCRIPTPATH``
- Add SCRIPTPATH as debconf config file.
* ``--deb-custom-control FILEPATH``
- Custom version of the Debian control file.
* ``--deb-default FILEPATH``
- Add FILEPATH as /etc/default configuration
* ``--deb-dist DIST-TAG``
- Set the deb distribution.
* ``--deb-field 'FIELD: VALUE'``
- Add custom field to the control file
* ``--[no-]deb-generate-changes``
- Generate PACKAGENAME.changes file.
* ``--deb-group GROUP``
- The group owner of files in this package
* ``--[no-]deb-ignore-iteration-in-dependencies``
- For '=' (equal) dependencies, allow iterations on the specified version. Default is to be specific. This option allows the same version of a package but any iteration is permitted
* ``--deb-init FILEPATH``
- Add FILEPATH as an init script
* ``--deb-installed-size KILOBYTES``
- The installed size, in kilobytes. If omitted, this will be calculated automatically
* ``--deb-interest EVENT``
- Package is interested in EVENT trigger
* ``--deb-interest-noawait EVENT``
- Package is interested in EVENT trigger without awaiting
* ``--[no-]deb-maintainerscripts-force-errorchecks``
- Activate errexit shell option according to lintian. https://lintian.debian.org/tags/maintainer-script-ignores-errors.html
* ``--deb-meta-file FILEPATH``
- Add FILEPATH to DEBIAN directory
* ``--[no-]deb-no-default-config-files``
- Do not add all files in /etc as configuration files by default for Debian packages.
* ``--deb-pre-depends DEPENDENCY``
- Add DEPENDENCY as a Pre-Depends
* ``--deb-priority PRIORITY``
- The debian package 'priority' value.
* ``--deb-recommends PACKAGE``
- Add PACKAGE to Recommends
* ``--deb-shlibs SHLIBS``
- Include control/shlibs content. This flag expects a string that is used as the contents of the shlibs file. See the following url for a description of this file and its format: http://www.debian.org/doc/debian-policy/ch-sharedlibs.html#s-shlibs
* ``--deb-suggests PACKAGE``
- Add PACKAGE to Suggests
* ``--deb-systemd FILEPATH``
- Add FILEPATH as a systemd script
* ``--[no-]deb-systemd-auto-start``
- Start service after install or upgrade
* ``--[no-]deb-systemd-enable``
- Enable service on install or upgrade
* ``--deb-systemd-path FILEPATH``
- Relative path to the systemd service directory
* ``--[no-]deb-systemd-restart-after-upgrade``
- Restart service after upgrade
* ``--deb-templates FILEPATH``
- Add FILEPATH as debconf templates file.
* ``--deb-upstart FILEPATH``
- Add FILEPATH as an upstart script
* ``--deb-upstream-changelog FILEPATH``
- Add FILEPATH as upstream changelog
* ``--[no-]deb-use-file-permissions``
- Use existing file permissions when defining ownership and modes
* ``--deb-user USER``
- The owner of files in this package

View File

@ -0,0 +1,2 @@
This package type has no additional options

View File

@ -0,0 +1,2 @@
This package type has no additional options

View File

@ -0,0 +1,5 @@
* ``--freebsd-origin ABI``
- Sets the FreeBSD 'origin' pkg field
* ``--freebsd-osversion VERSION``
- Sets the FreeBSD 'version' pkg field, ie 12 or 13, use '*' for all.

31
docs/packages/cli/gem.rst Normal file
View File

@ -0,0 +1,31 @@
* ``--gem-bin-path DIRECTORY``
- The directory to install gem executables
* ``--gem-disable-dependency gem_name``
- The gem name to remove from dependency list
* ``--[no-]gem-embed-dependencies``
- Should the gem dependencies be installed?
* ``--[no-]gem-env-shebang``
- Should the target package have the shebang rewritten to use env?
* ``--[no-]gem-fix-dependencies``
- Should the package dependencies be prefixed?
* ``--[no-]gem-fix-name``
- Should the target package name be prefixed?
* ``--gem-gem PATH_TO_GEM``
- The path to the 'gem' tool (defaults to 'gem' and searches your $PATH)
* ``--gem-git-branch GIT_BRANCH``
- When using a git repo as the source of the gem instead of rubygems.org, use this git branch.
* ``--gem-git-repo GIT_REPO``
- Use this git repo address as the source of the gem instead of rubygems.org.
* ``--gem-package-name-prefix PREFIX``
- Name to prefix the package name with.
* ``--gem-package-prefix NAMEPREFIX``
- (DEPRECATED, use --package-name-prefix) Name to prefix the package name with.
* ``--[no-]gem-prerelease``
- Allow prerelease versions of a gem
* ``--gem-shebang SHEBANG``
- Replace the shebang in the executables in the bin path with a custom string
* ``--gem-stagingdir STAGINGDIR``
- The directory where fpm installs the gem temporarily before conversion. Normally a random subdirectory of workdir.
* ``--[no-]gem-version-bins``
- Append the version to the bins

View File

@ -0,0 +1,7 @@
* ``--npm-bin NPM_EXECUTABLE``
- The path to the npm executable you wish to run.
* ``--npm-package-name-prefix PREFIX``
- Name to prefix the package name with.
* ``--npm-registry NPM_REGISTRY``
- The npm registry to use instead of the default.

View File

@ -0,0 +1,11 @@
* ``--osxpkg-dont-obsolete DONT_OBSOLETE_PATH``
- A file path for which to 'dont-obsolete' in the built PackageInfo. Can be specified multiple times.
* ``--osxpkg-identifier-prefix IDENTIFIER_PREFIX``
- Reverse domain prefix prepended to package identifier, ie. 'org.great.my'. If this is omitted, the identifer will be the package name.
* ``--osxpkg-ownership OWNERSHIP``
- --ownership option passed to pkgbuild. Defaults to 'recommended'. See pkgbuild(1).
* ``--[no-]osxpkg-payload-free``
- Define no payload, assumes use of script options.
* ``--osxpkg-postinstall-action POSTINSTALL_ACTION``
- Post-install action provided in package metadata. Optionally one of 'logout', 'restart', 'shutdown'.

13
docs/packages/cli/p5p.rst Normal file
View File

@ -0,0 +1,13 @@
* ``--p5p-group GROUP``
- Set the group to GROUP in the prototype file.
* ``--[no-]p5p-lint``
- Check manifest with pkglint
* ``--p5p-publisher PUBLISHER``
- Set the publisher name for the repository
* ``--p5p-user USER``
- Set the user to USER in the prototype files.
* ``--[no-]p5p-validate``
- Validate with pkg install
* ``--p5p-zonetype ZONETYPE``
- Set the allowed zone types (global, nonglobal, both)

View File

@ -0,0 +1,11 @@
* ``--pacman-compression COMPRESSION``
- The compression type to use, must be one of gz, bzip2, xz, zstd, none.
* ``--pacman-group GROUP``
- The group owner of files in this package
* ``--pacman-optional-depends PACKAGE``
- Add an optional dependency to the pacman package.
* ``--[no-]pacman-use-file-permissions``
- Use existing file permissions when defining ownership and modes
* ``--pacman-user USER``
- The owner of files in this package

View File

@ -0,0 +1,15 @@
* ``--pear-bin-dir BIN_DIR``
- Directory to put binaries in
* ``--pear-channel CHANNEL_URL``
- The pear channel url to use instead of the default.
* ``--[no-]pear-channel-update``
- call 'pear channel-update' prior to installation
* ``--pear-data-dir DATA_DIR``
- Specify php dir relative to prefix if differs from pear default (pear/data)
* ``--pear-package-name-prefix PREFIX``
- Name prefix for pear package
* ``--pear-php-bin PHP_BIN``
- Specify php executable path if differs from the os used for packaging
* ``--pear-php-dir PHP_DIR``
- Specify php dir relative to prefix if differs from pear default (pear/php)

View File

@ -0,0 +1,2 @@
This package type has no additional options

View File

@ -0,0 +1,7 @@
* ``--pleaserun-chdir CHDIR``
- The working directory used by the service
* ``--pleaserun-name SERVICE_NAME``
- The name of the service you are creating
* ``--pleaserun-user USER``
- The user to use for executing this program.

View File

@ -0,0 +1,2 @@
This package type has no additional options

View File

@ -0,0 +1,41 @@
* ``--python-bin PYTHON_EXECUTABLE``
- The path to the python executable you wish to run.
* ``--[no-]python-dependencies``
- Include requirements defined by the python package as dependencies.
* ``--python-disable-dependency python_package_name``
- The python package name to remove from dependency list
* ``--[no-]python-downcase-dependencies``
- Should the package dependencies be in lowercase?
* ``--[no-]python-downcase-name``
- Should the target package name be in lowercase?
* ``--python-easyinstall EASYINSTALL_EXECUTABLE``
- The path to the easy_install executable tool
* ``--[no-]python-fix-dependencies``
- Should the package dependencies be prefixed?
* ``--[no-]python-fix-name``
- Should the target package name be prefixed?
* ``--python-install-bin BIN_PATH``
- (DEPRECATED, does nothing) The path to where python scripts should be installed to.
* ``--python-install-data DATA_PATH``
- (DEPRECATED, does nothing) The path to where data should be installed to. This is equivalent to 'python setup.py --install-data DATA_PATH
* ``--python-install-lib LIB_PATH``
- (DEPRECATED, does nothing) The path to where python libs should be installed to (default depends on your python installation). Want to find out what your target platform is using? Run this: python -c 'from distutils.sysconfig import get_python_lib; print get_python_lib()'
* ``--[no-]python-internal-pip``
- 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
* ``--[no-]python-obey-requirements-txt``
- Use a requirements.txt file in the top-level directory of the python package for dependency detection.
* ``--python-package-name-prefix PREFIX``
- Name to prefix the package name with.
* ``--python-package-prefix NAMEPREFIX``
- (DEPRECATED, use --package-name-prefix) Name to prefix the package name with.
* ``--python-pip PIP_EXECUTABLE``
- The path to the pip executable tool. If not specified, easy_install is used instead
* ``--python-pypi PYPI_URL``
- PyPi Server uri for retrieving packages.
* ``--python-scripts-executable PYTHON_EXECUTABLE``
- (DEPRECATED) Set custom python interpreter in installing scripts. By default distutils will replace python interpreter in installing scripts (specified by shebang) with current python interpreter (sys.executable). This option is equivalent to appending 'build_scripts --executable PYTHON_EXECUTABLE' arguments to 'setup.py install' command.
* ``--python-setup-py-arguments setup_py_argument``
- (DEPRECATED) Arbitrary argument(s) to be passed to setup.py
* ``--python-trusted-host PYPI_TRUSTED``
- Mark this host or host:port pair as trusted for pip

71
docs/packages/cli/rpm.rst Normal file
View File

@ -0,0 +1,71 @@
* ``--rpm-attr ATTRFILE``
- Set the attribute for a file (%attr), e.g. --rpm-attr 750,user1,group1:/some/file
* ``--[no-]rpm-auto-add-directories``
- Auto add directories not part of filesystem
* ``--rpm-auto-add-exclude-directories DIRECTORIES``
- Additional directories ignored by '--rpm-auto-add-directories' flag
* ``--[no-]rpm-autoprov``
- Enable RPM's AutoProv option
* ``--[no-]rpm-autoreq``
- Enable RPM's AutoReq option
* ``--[no-]rpm-autoreqprov``
- Enable RPM's AutoReqProv option
* ``--rpm-changelog FILEPATH``
- Add changelog from FILEPATH contents
* ``--rpm-compression none|xz|xzmt|gzip|bzip2``
- Select a compression method. gzip works on the most platforms.
* ``--rpm-compression-level [0-9]``
- Select a compression level. 0 is store-only. 9 is max compression.
* ``--rpm-defattrdir ATTR``
- Set the default dir mode (%defattr).
* ``--rpm-defattrfile ATTR``
- Set the default file mode (%defattr).
* ``--rpm-digest md5|sha1|sha256|sha384|sha512``
- Select a digest algorithm. md5 works on the most platforms.
* ``--rpm-dist DIST-TAG``
- Set the rpm distribution.
* ``--rpm-filter-from-provides REGEX``
- Set %filter_from_provides to the supplied REGEX.
* ``--rpm-filter-from-requires REGEX``
- Set %filter_from_requires to the supplied REGEX.
* ``--rpm-group GROUP``
- Set the group to GROUP in the %files section. Overrides the group when used with use-file-permissions setting.
* ``--[no-]rpm-ignore-iteration-in-dependencies``
- For '=' (equal) dependencies, allow iterations on the specified version. Default is to be specific. This option allows the same version of a package but any iteration is permitted
* ``--rpm-init FILEPATH``
- Add FILEPATH as an init script
* ``--[no-]rpm-macro-expansion``
- install-time macro expansion in %pre %post %preun %postun scripts (see: https://rpm-software-management.github.io/rpm/manual/scriptlet_expansion.html)
* ``--[no-]rpm-old-perl-dependency-name``
- Use older 'perl' depdency name. Newer Red Hat (and derivatives) use a dependency named 'perl-interpreter'.
* ``--rpm-os OS``
- The operating system to target this rpm for. You want to set this to 'linux' if you are using fpm on OS X, for example
* ``--rpm-posttrans FILE``
- posttrans script
* ``--rpm-pretrans FILE``
- pretrans script
* ``--rpm-rpmbuild-define DEFINITION``
- Pass a --define argument to rpmbuild.
* ``--[no-]rpm-sign``
- Pass --sign to rpmbuild
* ``--rpm-summary SUMMARY``
- Set the RPM summary. Overrides the first line on the description if set
* ``--rpm-tag TAG``
- Adds a custom tag in the spec file as is. Example: --rpm-tag 'Requires(post): /usr/sbin/alternatives'
* ``--rpm-trigger-after-install '[OPT]PACKAGE: FILEPATH'``
- Adds a rpm trigger script located in FILEPATH, having 'OPT' options and linking to 'PACKAGE'. PACKAGE can be a comma seperated list of packages. See: https://rpm-software-management.github.io/rpm/manual/triggers.html
* ``--rpm-trigger-after-target-uninstall '[OPT]PACKAGE: FILEPATH'``
- Adds a rpm trigger script located in FILEPATH, having 'OPT' options and linking to 'PACKAGE'. PACKAGE can be a comma seperated list of packages. See: https://rpm-software-management.github.io/rpm/manual/triggers.html
* ``--rpm-trigger-before-install '[OPT]PACKAGE: FILEPATH'``
- Adds a rpm trigger script located in FILEPATH, having 'OPT' options and linking to 'PACKAGE'. PACKAGE can be a comma seperated list of packages. See: https://rpm-software-management.github.io/rpm/manual/triggers.html
* ``--rpm-trigger-before-uninstall '[OPT]PACKAGE: FILEPATH'``
- Adds a rpm trigger script located in FILEPATH, having 'OPT' options and linking to 'PACKAGE'. PACKAGE can be a comma seperated list of packages. See: https://rpm-software-management.github.io/rpm/manual/triggers.html
* ``--[no-]rpm-use-file-permissions``
- Use existing file permissions when defining ownership and modes.
* ``--rpm-user USER``
- Set the user to USER in the %files section. Overrides the user when used with use-file-permissions setting.
* ``--[no-]rpm-verbatim-gem-dependencies``
- When converting from a gem, leave the old (fpm 0.4.x) style dependency names. This flag will use the old 'rubygem-foo' names in rpm requires instead of the redhat style rubygem(foo).
* ``--rpm-verifyscript FILE``
- a script to be run on verification

2
docs/packages/cli/sh.rst Normal file
View File

@ -0,0 +1,2 @@
This package type has no additional options

View File

@ -0,0 +1,7 @@
* ``--snap-confinement CONFINEMENT``
- Type of confinement to use for this snap.
* ``--snap-grade GRADE``
- Grade of this snap.
* ``--snap-yaml FILEPATH``
- Custom version of the snap.yaml file.

View File

@ -0,0 +1,5 @@
* ``--solaris-group GROUP``
- Set the group to GROUP in the prototype file.
* ``--solaris-user USER``
- Set the user to USER in the prototype files.

View File

@ -0,0 +1,2 @@
This package type has no additional options

View File

@ -0,0 +1,19 @@
* ``--virtualenv-find-links PIP_FIND_LINKS``
- If a url or path to an html file, then parse for links to archives. If a local path or file:// url that's a directory, then look for archives in the directory listing.
* ``--[no-]virtualenv-fix-name``
- Should the target package name be prefixed?
* ``--virtualenv-install-location DIRECTORY``
- DEPRECATED: Use --prefix instead. Location to which to install the virtualenv by default.
* ``--virtualenv-other-files-dir DIRECTORY``
- Optionally, the contents of the specified directory may be added to the package. This is useful if the virtualenv needs configuration files, etc.
* ``--virtualenv-package-name-prefix PREFIX``
- Name to prefix the package name with.
* ``--virtualenv-pypi PYPI_URL``
- PyPi Server uri for retrieving packages.
* ``--virtualenv-pypi-extra-url PYPI_EXTRA_URL``
- PyPi extra-index-url for pointing to your priviate PyPi
* ``--[no-]virtualenv-setup-install``
- After building virtualenv run setup.py install useful when building a virtualenv for packages and including their requirements from requirements.txt
* ``--[no-]virtualenv-system-site-packages``
- Give the virtual environment access to the global site-packages

View File

@ -0,0 +1,2 @@
This package type has no additional options

65
docs/packages/cpan.rst Normal file
View File

@ -0,0 +1,65 @@
cpan - Perl packages from CPAN
===============================
Supported Uses in FPM
---------------------
fpm supports using ``cpan`` only as an input type. This means you can convert
``cpan`` input packages to output packages like ``deb``, ``rpm``, and more.
Arguments when used as input type
---------------------------------
Any number of arguments are supported and behave as follows:
* A name to search on MetaCPAN_. If a module is found on MetaCPAN_, it will be downloaded and used when building the package.
* or, a local directory containing a Perl module to build.
.. _MetaCPAN: https://metacpan.org/
Sample Usage
------------
Let's take the `Regexp::Common <https://metacpan.org/pod/Regexp::Common>`_ Perl module and package it as a deb. We can let fpm do the hard work here of finding the module on cpan and downloading it::
% fpm -s cpan -t deb Regexp::Common
Downcasing provides 'perl-Regexp-Common' because deb packages don't work so good with uppercase names {:level=>:warn}
Downcasing provides 'perl-Regexp-Common-Entry' because deb packages don't work so good with uppercase names {:level=>:warn}
Debian tools (dpkg/apt) don't do well with packages that use capital letters in the name. In some cases it will automatically downcase them, in others it will not. It is confusing. Best to not use any capital letters at all. I have downcased the package name for you just to be safe. {:oldname=>"perl-Regexp-Common", :fixedname=>"perl-regexp-common", :level=>:warn}
Debian packaging tools generally labels all files in /etc as config files, as mandated by policy, so fpm defaults to this behavior for deb packages. You can disable this default behavior with --deb-no-default-config-files flag {:level=>:warn}
Created package {:path=>"perl-regexp-common_2017060201_all.deb"}
Fpm did a bunch of nice work for you. First, it searched MetaCPAN_ for Regexp::Common. Then it downloaded the latest version. If you wanted to specify a version, you can use the ``-v`` flag, such as ``-v 2016060201``.
In the example above, a few warning messages appear. Fpm's job is to help you convert packages. In this case, we're converting a Perl module named "Regexp::Common" to a Debian package. In this situation, we need to make sure our Debian package is accepted by Debian's tools! This means fpm will do the following:
* Debian package names appear to all use lowercase names, so fpm does this for you.
* Debian package names also cannot have "::" in the names, so fpm replaces these with a dash "-"
Let's try to use our new package! First, installing it::
% sudo dpkg -i perl-regexp-common_2017060201_all.deb
Selecting previously unselected package perl-regexp-common.
(Reading database ... 81209 files and directories currently installed.)
Preparing to unpack perl-regexp-common_2017060201_all.deb ...
Unpacking perl-regexp-common (2017060201) ...
Setting up perl-regexp-common (2017060201) ...
Processing triggers for man-db (2.9.1-1) ...
And try to use it. Let's ask Regexp::Common for a regular expression that matches real numbers::
% perl -MRegexp::Common -e 'print $RE{num}{real}'
(?:(?i)(?:[-+]?)(?:(?=[.]?[0123456789])(?:[0123456789]*)(?:(?:[.])(?:[0123456789]{0,}))?)(?:(?:[E])(?:(?:[-+]?)(?:[0123456789]+))|))
Nice!
Fun Examples
------------
.. note::
Do you have any examples you want to share that use the ``cpan`` package type? Share your knowledge here: https://github.com/jordansissel/fpm/issues/new
cpan-specific command line flags
--------------------------------
.. include:: cli/cpan.rst

117
docs/packages/deb.rst Normal file
View File

@ -0,0 +1,117 @@
deb - Debian package format
===========================
Supported Uses in FPM
---------------------
fpm supports input and output for Debian package (deb). This means you can read a deb and convert it to a different output type (such as a `dir` or `rpm`). It also means you can create a deb package.
Arguments when used as input type
---------------------------------
For the sample command reading a deb file as input and outputting an rpm package::
fpm -s deb -t rpm file.deb
The argument is used as a file and read as a debian package file.
Sample Usage
------------
Let's create a Debian package of Hashicorp's Terraform. To do this, we'll need to download it and put the files into a Debian package::
# Download Terraform 1.0.10
% wget https://releases.hashicorp.com/terraform/1.0.10/terraform_1.0.10_linux_amd64.zip
The Terraform release .zip file contains a single file, `terraform` itself. You can see the files in this zip by using `unzip -l`::
% unzip -l ~/build/z/terraform_1.0.10_linux_amd64.zip
Archive: /home/jls/build/z/terraform_1.0.10_linux_amd64.zip
Length Date Time Name
--------- ---------- ----- ----
79348596 2021-10-28 07:15 terraform
--------- -------
79348596 1 file
We can use fpm to convert this zip file into a debian package with one step::
% fpm -s zip -t deb --prefix /usr/bin -n terraform -v 1.0.10 terraform_1.0.10_linux_amd64.zip
Created package {:path=>"terraform_1.0.10_amd64.deb"}
Nice! We just converted a zip file into a debian package. Let's talk through the command-line flags here:
* ``-s zip`` tells fpm to use "zip" as the input type. This allows fpm to read zip files.
* ``-t deb`` tells fpm to output a Debian package.
* ``--prefix /usr/bin`` tells fpm to move all files in the .zip file to the /usr/bin file path. In this case, it results in a single file in the path `/usr/bin/terraform`
* ``-n terraform`` names the package "terraform"
* ``-v 1.0.10`` sets the package version. This is useful to package systems when considering whether a given package is an upgrade, downgrade, or already installed.
* Finally, the last argument, `terraform_1.0.10_linux_amd64.zip`. This is given to the fpm to process as a zip file.
You can inspect the package contents with `dpkg --contents terraform_1.0.10_amd64.deb`::
% dpkg --contents terraform_1.0.10_amd64.deb
drwxr-xr-x 0/0 0 2021-11-02 23:33 ./
drwxr-xr-x 0/0 0 2021-11-02 23:33 ./usr/
drwxr-xr-x 0/0 0 2021-11-02 23:33 ./usr/share/
drwxr-xr-x 0/0 0 2021-11-02 23:33 ./usr/share/doc/
drwxr-xr-x 0/0 0 2021-11-02 23:33 ./usr/share/doc/terraform/
-rw-r--r-- 0/0 141 2021-11-02 23:33 ./usr/share/doc/terraform/changelog.gz
drwxr-xr-x 0/0 0 2021-11-02 23:33 ./usr/bin/
-rwxr-xr-x 0/0 79348596 2021-10-28 07:15 ./usr/bin/terraform
The ``changelog.gz`` file is a recommended Debian practice for packaging. FPM will provide a generated changelog for you, by default. You can provide your own with the ``--deb-changelog`` flag.
Lets install our terraform package and try it out::
% sudo apt install ./terraform_1.0.10_amd64.deb
...
% dpkg -l terraform
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-========================-=================-=================-=====================================================
ii terraform 1.0.10 amd64 no description given
% terraform -version
Terraform v1.0.10
on linux_amd64
You may remove the package at any time::
% sudo apt remove terraform
...
Removing terraform (1.0.10) ...
Fun Examples
------------
Hi! The fpm project would love to have any fun examples you have for using this package type. Please consider contributing your ideas by submitting them on the fpm issue tracker: https://github.com/jordansissel/fpm/issues/new
Changing an existing deb
~~~~~~~~~~~~~~~~~~~~~~~~
fpm supports deb as both an input and output type (``-s`` and ``-t`` flags), so you can use this to modify an existing deb.
For example, let's create an deb to use for our example::
% fpm -s empty -t deb -n example
Created package {:path=>"example_1.0_amd64.deb"}
Lets say we made a mistake and want to rename the package::
% fpm -s deb -t deb -n newname example_1.0_amd64.deb
Created package {:path=>"newname_1.0_amd64.deb"}
And maybe the architecture is wrong. fpm defaulted to amd64 (what fpm calls
"native"), and we really want what Debian calls "all"::
% fpm -s deb -t deb -a all newname_1.0_amd64.deb
Created package {:path=>"newname_1.0_all.deb"}
Deb-specific command line flags
-------------------------------
.. include:: cli/deb.rst

80
docs/packages/dir.rst Normal file
View File

@ -0,0 +1,80 @@
dir - Local Files
=================
Supported Uses in FPM
---------------------
fpm supports using ``dir`` as an input type and output type. This means you can use ``dir`` to put files into other package types (like Debian or Red Hat packages). You can also use this as an output type to extract files from packages.
Arguments when used as input type
---------------------------------
Any number of arguments are supported and behave as follows:
1) A path to a local file or directory will be put into the output package as-is with the same path, contents, and metadata (file owner, modification date, etc)
2) A syntax of "localpath=destinationpath" to copy local paths into the output package with the destination path.
The local file paths are modified by the ``--chdir`` flag. The destination file paths are modified by the ``--prefix`` flag.
Sample Usage
------------
For this example, let's look at packaging the Kubernetes tool, ``kubectl``. The installation for ``kubectl`` recommends downloading a pre-compiled binary. Let's do this and then package it into a Debian package.
First, we download the ``kubectl`` binary, according to the kubernetes documentation for kubectl installation on Linux::
# Query the latest version of kubectl and store the value in the 'version' variable
% version="$(curl -L -s https://dl.k8s.io/release/stable.txt)"
# Download the Linux amd64 binary
% curl -LO "https://dl.k8s.io/release/${version}/bin/linux/amd64/kubectl"
# Make it executable
% chmod 755 kubectl
The above shell will find the latest version of ``kubectl`` and download it. We'll use the file and the version number next to make our package::
# Create the package that installs kubectl as /usr/bin/kubectl
% fpm -s dir -t deb -n kubectl -a amd64 -v ${version#v*} kubectl=/usr/bin/kubectl
Created package {:path=>"kubectl_v1.22.3_amd64.deb"}
.. note::
We use ``${version#v*}`` in our shell to set the package version. This is
because Kuberenetes versions have a text that starts with "v" and this is not
valid in Debian packages. This will turn "v1.2.3" into "1.2.3" for our package.
Now we can check our package to make sure it looks the way we want::
% dpkg --contents kubectl_1.22.3_amd64.deb
[ ... output abbreviated for easier reading ... ]
-rw-r--r-- 0/0 46907392 2021-11-05 20:09 ./usr/bin/kubectl
% dpkg --field kubectl_1.22.3_amd64.deb Package Version Architecture
Package: kubectl
Version: 1.22.3
Architecture: amd64
And install it to test things and make sure it's what we wanted::
% sudo dpkg -i kubectl_1.22.3_amd64.deb
Selecting previously unselected package kubectl.
(Reading database ... 58110 files and directories currently installed.)
Preparing to unpack kubectl_1.22.3_amd64.deb ...
Unpacking kubectl (1.22.3) ...
Setting up kubectl (1.22.3) ...
And try to use it::
% which kubectl
/usr/bin/kubectl
% kubectl version
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.3", GitCommit:"c92036820499fedefec0f847e2054d824aea6cd1", GitTreeState:"clean", BuildDate:"2021-10-27T18:41:28Z", GoVersion:"go1.16.9", Compiler:"gc", Platform:"linux/amd64"}
Cool :)
Fun Examples
------------
.. note::
Do you have any examples you want to share that use the ``dir`` package type? Share your knowledge here: https://github.com/jordansissel/fpm/issues/new

50
docs/packages/empty.rst Normal file
View File

@ -0,0 +1,50 @@
empty - A package with no files
===============================
Supported Uses in FPM
---------------------
fpm supports using ``empty`` only as an input type.
Arguments when used as input type
---------------------------------
Extra arguments are ignored for this type. As an example, where with ``fpm -s dir ...`` the arguments are file paths, ``fpm -s empty`` takes no input arguments because there's no file contents to use.
Sample Usage
------------
The ``empty`` package type is great for creating "meta" packages which are used to group dependencies together.
For example, if you want to make it easier to install a collection of developer tools, you could create a single package that depends on all of your desired developer tools.
Let's create a Debian package named 'devtools' which installs the following:
* git
* curl
* nodejs
Here's the fpm command to do this::
% fpm -s empty -t rpm -n devtools -a all -d git -d curl -d nodejs
Created package {:path=>"devtools-1.0-1.noarch.rpm"}
We can check the dependencies on this package::
% rpm -qp devtools-1.0-1.noarch.rpm --requires
curl
git
nodejs
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
And see that there are no files::
% rpm -ql devtools-1.0-1.noarch.rpm
(contains no files)
Fun Examples
------------
Hi! The fpm project would love to have any fun examples you have for using this package type. Please consider contributing your ideas by submitting them on the fpm issue tracker: https://github.com/jordansissel/fpm/issues/new

12
docs/packages/freebsd.rst Normal file
View File

@ -0,0 +1,12 @@
freebsd - FreeBSD pkg
===============================
Supported Uses in FPM
---------------------
fpm supports using ``freebsd`` only as an output type. This means you can create ``freebsd`` packages from input types like ``deb``, ``dir``, or ``npm``
freebsd-specific command line flags
-----------------------------------
.. include:: cli/freebsd.rst

13
docs/packages/gem.rst Normal file
View File

@ -0,0 +1,13 @@
gem - Ruby's rubygem packages
=============================
Supported Uses in FPM
---------------------
fpm supports using ``gem`` only as an input type. This means you can convert
``gem`` input packages to output packages like ``deb``, ``rpm``, and more.
gem-specific command line flags
-------------------------------
.. include:: cli/gem.rst

78
docs/packages/npm.rst Normal file
View File

@ -0,0 +1,78 @@
npm - Packages for NodeJS
===============================
Supported Uses in FPM
---------------------
fpm supports using ``npm`` only as an input type.
Arguments when used as input type
---------------------------------
Any number of arguments are supported and behave as follows:
* ``name@version`` -- a specific named package at the given version.
* ``name`` -- the name of a node package. In this use, the ``--version`` flag is used to pick the version to download. If no version is given, the latest version of the package is downloaded.
Sample Usage
------------
You'll need ``npm`` installed for this example.
Let's turn the ``ascii-art`` npm package into a Debian package. For this example, we'll pick a specific version, 2.8.5::
% fpm --debug -s npm -t deb --depends nodejs ascii-art@2.8.5
Created package {:path=>"node-ascii-art_2.8.5_amd64.deb"}
Fpm uses ``npm`` to download the correct package. Additionally, the package name is given a ``node-`` prefix because this is common in distribution packages to prefix a library with the platform name, such as ``python-foo`` or ``node-foo``.
It also parses the package's ``package.json`` to collect any useful data such as the package name, author, homepage, description, etc::
% dpkg --field node-ascii-art_2.8.5_amd64.deb Package Version Vendor Homepage Description
Package: node-ascii-art
Version: 2.8.5
Vendor: Abbey Hawk Sparrow <@khrome>
Homepage: git://github.com/khrome/ascii-art.git
Description: Ansi codes, figlet fonts, and ascii art. 100% JS
Let's install the package and try to use it::
% sudo apt-get install ./node-ascii-art_2.8.5_amd64.deb
And now we can use this package::
% ascii-art text -F Doom "Hello World"
_ _ _ _ _ _ _ _
| | | | | || | | | | | | | | |
| |_| | ___ | || | ___ | | | | ___ _ __ | | __| |
| _ | / _ \| || | / _ \ | |/\| | / _ \ | '__|| | / _` |
| | | || __/| || || (_) | \ /\ /| (_) || | | || (_| |
\_| |_/ \___||_||_| \___/ \/ \/ \___/ |_| |_| \__,_|
Fpm asked ``npm`` where to install things using ``npm prefix -g``. On my system, this caused the package to install to ``/usr/local/lib/node_modules``. You can change the default prefix with the fpm ``--prefix`` flag or by changing the default global prefix in the ``npm`` tool.
Let's try to invoke ``ascii-art`` from node::
% export NODE_PATH=/usr/local/lib/node_modules
% node
> let art = require("ascii-art")
> art.font("Hello", "Doom", (err, rendered) => console.log(rendered))
_ _ _ _
| | | | | || |
| |_| | ___ | || | ___
| _ | / _ \| || | / _ \
| | | || __/| || || (_) |
\_| |_/ \___||_||_| \___/
Nice :)
Fun Examples
------------
.. note::
Do you have any examples you want to share that use the ``npm`` package type? Share your knowledge here: https://github.com/jordansissel/fpm/issues/new
npm-specific command line flags
-------------------------------
.. include:: cli/npm.rst

15
docs/packages/osxpkg.rst Normal file
View File

@ -0,0 +1,15 @@
osxpkg - Apple macOS and OSX packages
=====================================
Supported Uses in FPM
---------------------
fpm supports input and output for Apple's package files. These files typically
end in ".pkg". This means you can read a ``.pkg`` file and convert it to a different
output type (such as a `dir` or `rpm`). It also means you can create a ``.pkg``
package file.
osxpkg-specific command line flags
----------------------------------
.. include:: cli/osxpkg.rst

15
docs/packages/p5p.rst Normal file
View File

@ -0,0 +1,15 @@
p5p - Oracle Solaris 11 p5p packages
====================================
This package format for the Solaris Image Packaging System (IPS) and should be
useful for OpenSolaris, Solaris 11, and Illumos.
Supported Uses in FPM
---------------------
fpm supports using ``p5p`` only as an output type. This means you can create ``p5p`` packages from input types like ``deb``, ``dir``, or ``npm``
p5p-specific command line flags
-------------------------------
.. include:: cli/p5p.rst

12
docs/packages/pacman.rst Normal file
View File

@ -0,0 +1,12 @@
pacman - Arch Linux package format
==================================
Supported Uses in FPM
---------------------
fpm supports input and output for Arch Linux's package format, pacman. This means you can read a pacman and convert it to a different output type (such as a `dir` or `rpm`). It also means you can create a pacman package.
pacman-specific command line flags
----------------------------------
.. include:: cli/pacman.rst

13
docs/packages/pear.rst Normal file
View File

@ -0,0 +1,13 @@
pear - PHP PEAR Packages
========================
Supported Uses in FPM
---------------------
fpm supports using ``pear`` only as an input type. This means you can convert
``pear`` input packages to output packages like ``deb``, ``rpm``, and more.
pear-specific command line flags
--------------------------------
.. include:: cli/pear.rst

12
docs/packages/pkgin.rst Normal file
View File

@ -0,0 +1,12 @@
pkgin - NetBSD's pkgsrc binary packages
=======================================
Supported Uses in FPM
---------------------
fpm supports using ``pkgin`` only as an output type. This means you can create ``pkgin`` packages from input types like ``deb``, ``dir``, or ``npm``
pkgin-specific command line flags
---------------------------------
.. include:: cli/pkgin.rst

View File

@ -0,0 +1,23 @@
pleaserun - Pleaserun services
==============================
Pleaserun helps generate service definitions for a variety of service manangers
such as systemd and sysv.
When used as an input, fpm will generate a package that include multiple service
definitions, one for each type (systemd, sysv, etc). At package installation, the package
will attempt to detect the best service manager used on the system and will
install only that definition.
You can learn more on the project website: https://github.com/jordansissel/pleaserun#readme
Supported Uses in FPM
---------------------
fpm supports using ``pleaserun`` only as an input type. This means you can convert
``pleaserun`` input packages to output packages like ``deb``, ``rpm``, and more.
pleaserun-specific command line flags
-------------------------------------
.. include:: cli/pleaserun.rst

15
docs/packages/puppet.rst Normal file
View File

@ -0,0 +1,15 @@
puppet - Puppet Manifests (deprecated)
======================================
Note: This package type hasn't been maintained since 2012 and generates puppet
manifests that target Puppet 2.4 or 3.x.
Supported Uses in FPM
---------------------
fpm supports using ``puppet`` only as an output type. This means you can create ``puppet`` packages from input types like ``deb``, ``dir``, or ``npm``
puppet-specific command line flags
----------------------------------
.. include:: cli/puppet.rst

13
docs/packages/python.rst Normal file
View File

@ -0,0 +1,13 @@
python - Python packages, PyPI, etc
===================================
Supported Uses in FPM
---------------------
fpm supports using ``python`` only as an input type. This means you can convert
``python`` input packages to output packages like ``deb``, ``rpm``, and more.
python-specific command line flags
----------------------------------
.. include:: cli/python.rst

81
docs/packages/rpm.rst Normal file
View File

@ -0,0 +1,81 @@
rpm - RedHat Package Manager
============================
rpm is the package format used on RedHat Enterprise (RHEL), Fedora, CentOS, and
a number of other Linux distributions.
You may be familiar with tools such as `dnf` and `yum` for installing packages from repositories. The package files that these tools install are rpms.
Supported Uses in FPM
---------------------
fpm supports input and output for rpms. This means you can read an rpm and convert it to a different output type (such as a `dir` or `deb`). It also means you can write an rpm.
Arguments when used as input type
---------------------------------
For the sample command reading an rpm as input and outputting a debian package::
fpm -s rpm -t deb file.rpm
The the argument is used as a file and read as an rpm.
Sample Usage
------------
Create a package with no files but having dependencies::
% fpm -s empty -t rpm -n example --depends nginx
Created package {:path=>"example-1.0-1.x86_64.rpm"}
We can now inspect the package with rpm's tools if you wish::
% rpm -qp example-1.0-1.x86_64.rpm -i
Name : example
Version : 1.0
Release : 1
Architecture: x86_64
Install Date: (not installed)
Group : default
Size : 0
License : unknown
Signature : (none)
Source RPM : example-1.0-1.src.rpm
Build Date : Wed 20 Oct 2021 09:43:25 PM PDT
Build Host : snickerdoodle.localdomain
Relocations : /
Packager : <jls@snickerdoodle>
Vendor : none
URL : http://example.com/no-uri-given
Summary : no description given
Description :
no description given
Fun Examples
------------
Changing an existing RPM
~~~~~~~~~~~~~~~~~~~~~~~~
fpm supports rpm as both an input and output type (`-s` and `-t` flags), so you can use this to modify an existing rpm.
For example, let's create an rpm to use for our example::
% fpm -s empty -t rpm -n example
Created package {:path=>"example-1.0-1.x86_64.rpm"}
Lets say we made a mistake and want to rename the package::
% fpm -s rpm -t rpm -n newname example-1.0-1.x86_64.rpm
Created package {:path=>"newname-1.0-1.x86_64.rpm"}
And maybe the architecture is wrong. fpm defaulted to x86_64 (what fpm calls
"native"), and we really want what rpm calls "noarch"::
% fpm -s rpm -t rpm -a noarch newname-1.0-1.x86_64.rpm
Created package {:path=>"newname-1.0-1.noarch.rpm"}
RPM-specific command line flags
-------------------------------
.. include:: cli/rpm.rst

24
docs/packages/sh.rst Normal file
View File

@ -0,0 +1,24 @@
sh - Self-managing shell archive
================================
The 'sh' output in fpm will generate a shell script that is, itself, an archive.
The resulting shell script will install the files you provided. You can run the
resulting shell script to see more helpful information.
# Create an example.sh package
% fpm -s empty -t sh -n example
# Get help.
% ./example.sh -h
Supported Uses in FPM
---------------------
fpm supports using ``sh`` only as an output type. This means you can create ``sh`` packages from input types like ``deb``, ``dir``, or ``npm``
sh-specific command line flags
-------------------------------
.. include:: cli/sh.rst

15
docs/packages/snap.rst Normal file
View File

@ -0,0 +1,15 @@
snap - Application package files for Linux
==========================================
You can learn more about ``snap`` itself by visiting the website: https://snapcraft.io/about
Supported Uses in FPM
---------------------
fpm supports input and output for snap packages. This means you can read a snap and convert it to a different output type (such as a `dir` or `rpm`). It also means you can create a snap package.
snap-specific command line flags
--------------------------------
.. include:: cli/snap.rst

19
docs/packages/solaris.rst Normal file
View File

@ -0,0 +1,19 @@
solaris - Solaris SRV4 package format
=====================================
This package format is typically used in older Solaris versions (Solaris 7, 8,
9, and 10). You may also know them by files with a SUNW prefix and may have file names that end in ".pkg".
If you're using Solaris 11, OpenSolaris, or Illumos, you might want to use `the newer package format, p5p`_.
.. _the newer package format, p5p: /packages/p5p.html
Supported Uses in FPM
---------------------
fpm supports using ``solaris`` only as an output type. This means you can create ``solaris`` packages from input types like ``deb``, ``dir``, or ``npm``
solaris-specific command line flags
-----------------------------------
.. include:: cli/solaris.rst

12
docs/packages/tar.rst Normal file
View File

@ -0,0 +1,12 @@
tar - Tape archives aka "tar" files
===================================
Supported Uses in FPM
---------------------
fpm supports input and output for NAME (tar). This means you can read a tar and convert it to a different output type (such as a `dir` or `rpm`). It also means you can create a tar package.
tar-specific command line flags
-------------------------------
.. include:: cli/tar.rst

View File

@ -0,0 +1,13 @@
virtualenv - Python virtualenv
==============================
Supported Uses in FPM
---------------------
fpm supports using ``virtualenv`` only as an input type. This means you can convert
``virtualenv`` input packages to output packages like ``deb``, ``rpm``, and more.
virtualenv-specific command line flags
--------------------------------------
.. include:: cli/virtualenv.rst

12
docs/packages/zip.rst Normal file
View File

@ -0,0 +1,12 @@
zip - Zip files
===============
Supported Uses in FPM
---------------------
fpm supports input and output for zip files. This means you can read a zip and convert it to a different output type (such as a `dir` or `rpm`). It also means you can create a zip package.
zip-specific command line flags
-------------------------------
.. include:: cli/zip.rst

8
docs/packaging-types.rst Normal file
View File

@ -0,0 +1,8 @@
Packaging Types
===============
.. toctree::
:includehidden:
:glob:
packages/*

1
docs/requirements.txt Normal file
View File

@ -0,0 +1 @@
sphinx_rtd_theme

View File

@ -1,52 +0,0 @@
`dir` - Directories
===================
Synopsis::
fpm -s dir [other flags] path1 [path2 ...]
The 'dir' source will package up one or more directories for you.
Path mapping
------------
.. note::
Path mapping was added in fpm version 0.4.40
Some times you want to take a path and copy it into a package but under a different location. fpm can use the `=` directive to mark that::
fpm [...] -s dir ./example/foo=/usr/bin
This will put the file `foo` in the /usr/bin directory inside the package.
A simple example of this can be shown with redis. Redis has a config file
(redis.conf) and an executable (redis-server). Let's put the executable in
/usr/bin and the config file in /etc/redis::
% ls src/redis-server redis.conf
src/redis-server
redis.conf
# install src/redis-server into /usr/bin/
# install redis.conf into /etc/redis/
% fpm -s dir -t deb -n redis --config-files /etc/redis/redis.conf -v 2.6.10 \
src/redis-server=/usr/bin/ \
redis.conf=/etc/redis/
Created deb package {:path=>"redis_2.6.10_amd64.deb"}
% dpkg -c redis_2.6.10_amd64.deb
drwx------ jls/jls 0 2013-07-11 23:49 ./
drwxrwxr-x jls/jls 0 2013-07-11 23:49 ./etc/
drwxrwxr-x jls/jls 0 2013-07-11 23:49 ./etc/redis/
-rw-rw-r-- jls/jls 24475 2013-02-11 04:24 ./etc/redis/redis.conf
drwxrwxr-x jls/jls 0 2013-07-11 23:49 ./usr/
drwxrwxr-x jls/jls 0 2013-07-11 23:49 ./usr/bin/
-rwxrwxr-x jls/jls 3566152 2013-02-14 11:19 ./usr/bin/redis-server
# Did the conffiles setting work? Yep!
% dpkg-deb -e redis_2.6.10_amd64.deb .
% cat conffiles
/etc/redis/redis.conf
Voila!

View File

@ -1,236 +0,0 @@
`gem` - RubyGems
================
Simplest invocation
-------------------
Here's a command that will fetch the latest `json` gem and convert it to a .deb package::
% cd /tmp
% fpm -s gem -t deb json
...
Created /tmp/rubygem-json-1.4.6-1.amd64.deb
This will download the latest 'json' rubygem from rubygems.org and convert it
to a .deb. It will create a package named 'rubygem-json-VERSION_ARCH.deb' with
appropriate version/arch in place.
Check the package::
% dpkg --info rubygem-json-1.4.6-1.amd64.deb
new debian package, version 2.0.
size 1004040 bytes: control archive= 335 bytes.
275 bytes, 10 lines control
5 bytes, 1 lines md5sums
Package: rubygem-json
Version: 1.4.6-1
Architecture: amd64
Maintainer: Florian Frank
Standards-Version: 3.9.1
Section: Languages/Development/Ruby
Priority: extra
Homepage: http://flori.github.com/json
Description: JSON Implementation for Ruby
JSON Implementation for Ruby
From the above, you can see that fpm automatically picked the package name,
version, maintainer, section, homepage, and description all from the rubygem
itself. Nothing for you to worry about :)
Specifying a version
--------------------
You can ask for a specific version with '-v <VERSION>'. It will also handle
dependencies. How about an older gem like rails 2.2.2::
% fpm -s gem -t deb -v 2.2.2 rails
Trying to download rails (version=2.2.2)
...
Created .../rubygem-rails-2.2.2-1.amd64.deb
Now observe the package created:
% dpkg --info ./rubygem-rails-2.2.2-1.amd64.deb
new debian package, version 2.0.
size 2452008 bytes: control archive= 445 bytes.
575 bytes, 11 lines control
6 bytes, 1 lines md5sums
Package: rubygem-rails
Version: 2.2.2-1
Architecture: amd64
Maintainer: David Heinemeier Hansson
Depends: rubygem-rake (>= 0.8.3), rubygem-activesupport (= 2.2.2),
rubygem-activerecord (= 2.2.2), rubygem-actionpack (= 2.2.2),
rubygem-actionmailer (= 2.2.2), rubygem-activeresource (= 2.2.2)
Standards-Version: 3.9.1
Section: Languages/Development/Ruby
Priority: extra
Homepage: http://www.rubyonrails.org
Description: Web-application framework with template engine, control-flow layer, and ORM.
Web-application framework with template engine, control-flow layer, and ORM.
Noticei how the `Depends` entry for this debian package lists all the dependencies that `rails` has?
Let's see what the package installs::
% dpkg -c ./rubygem-rails-2.2.2-1.amd64.deb
...
drwxr-xr-x root/root 0 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/
drwxr-xr-x root/root 0 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/
-rw-r--r-- root/root 3639 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/source_annotation_extractor.rb
-rw-r--r-- root/root 198 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/performance_test_help.rb
drwxr-xr-x root/root 0 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/
-rw-r--r-- root/root 204 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/log.rake
-rw-r--r-- root/root 2695 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/gems.rake
-rw-r--r-- root/root 4858 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/testing.rake
-rw-r--r-- root/root 17727 2011-01-20 17:00 ./usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake
Packaging individual dependencies
---------------------------------
A frequently-asked question is how to get a rubygem and all its dependencies
converted. Let's take a look.
First we'll have to download the gem and its deps. The easiest way to do this
is to stage the installation in a temporary directory, like this::
% mkdir /tmp/gems
% gem install --no-ri --no-rdoc --install-dir /tmp/gems cucumber
<output trimmed>
Successfully installed json-1.4.6
Successfully installed gherkin-2.3.3
Successfully installed term-ansicolor-1.0.5
Successfully installed builder-3.0.0
Successfully installed diff-lcs-1.1.2
Successfully installed cucumber-0.10.0
6 gems installed
Now you've got everything cucumber requires to run (just as a normal 'gem
install' would.)
`gem` saves gems to the cache directory in the gem install dir, so check it out::
% ls /tmp/gems/cache
builder-3.0.0.gem diff-lcs-1.1.2.gem json-1.4.6.gem
cucumber-0.10.0.gem gherkin-2.3.3.gem term-ansicolor-1.0.5.gem
(by the way, under normal installation situations, gem would keep the cache in
a location like /usr/lib/ruby/gems/1.8/cache, see 'gem env | grep INSTALL')
Let's convert all these gems to debs (output trimmed for sanity)::
% find /tmp/gems/cache -name '*.gem' | xargs -rn1 fpm -d ruby -d rubygems --prefix $(gem environment gemdir) -s gem -t deb
...
Created /tmp/gems/rubygem-json-1.4.6-1.amd64.deb
...
Created /tmp/gems/rubygem-builder-3.0.0-1.amd64.deb
...
Created /tmp/gems/rubygem-gherkin-2.3.3-1.amd64.deb
...
Created /tmp/gems/rubygem-diff-lcs-1.1.2-1.amd64.deb
...
Created /tmp/gems/rubygem-term-ansicolor-1.0.5-1.amd64.deb
...
Created /tmp/gems/rubygem-cucumber-0.10.0-1.amd64.deb
% ls *.deb
rubygem-builder-3.0.0-1.amd64.deb rubygem-gherkin-2.3.3-1.amd64.deb
rubygem-cucumber-0.10.0-1.amd64.deb rubygem-json-1.4.6-1.amd64.deb
rubygem-diff-lcs-1.1.2-1.amd64.deb rubygem-term-ansicolor-1.0.5-1.amd64.deb
Nice, eh? Now, let's show what happens after these packages are installed::
# Show it's not install yet:
% gem list cucumber
*** LOCAL GEMS ***
# Now install the .deb packages:
% sudo dpkg -i rubygem-builder-3.0.0-1.amd64.deb \
rubygem-cucumber-0.10.0-1.amd64.deb rubygem-diff-lcs-1.1.2-1.amd64.deb \
rubygem-gherkin-2.3.3-1.amd64.deb rubygem-json-1.4.6-1.amd64.deb \
rubygem-term-ansicolor-1.0.5-1.amd64.deb
...
Setting up rubygem-builder (3.0.0-1) ...
Setting up rubygem-diff-lcs (1.1.2-1) ...
Setting up rubygem-json (1.4.6-1) ...
Setting up rubygem-term-ansicolor (1.0.5-1) ...
Setting up rubygem-gherkin (2.3.3-1) ...
Setting up rubygem-cucumber (0.10.0-1) ...
# Is it installed?
% gem list cucumber
*** LOCAL GEMS ***
cucumber (0.10.0)
# Does it work?
% dpkg -L rubygem-cucumber | grep bin
/usr/lib/ruby/gems/1.8/gems/cucumber-0.10.0/bin
/usr/lib/ruby/gems/1.8/gems/cucumber-0.10.0/bin/cucumber
/usr/lib/ruby/gems/1.8/bin
/usr/lib/ruby/gems/1.8/bin/cucumber
% /usr/lib/ruby/gems/1.8/bin/cucumber --help
Usage: cucumber [options] [ [FILE|DIR|URL][:LINE[:LINE]*] ]+
...
You can put these .deb files in your apt repo (assuming you have a local apt
repo, right?) and easily install them with 'apt-get' like: 'apt-get install
rubygem-cucumber' and expect dependencies to work nicely.
Deterministic output
--------------------
If convert a gem to a deb twice, you'll get different output even though the inputs didn't change:
% fpm -s gem -t deb json
% mkdir run1; mv *.deb run1
% sleep 1
% fpm -s gem -t deb json
% mkdir run2; mv *.deb run2
% cmp run1/*.deb run2/*.deb
run1/rubygem-json_2.1.0_amd64.deb run2/rubygem-json_2.1.0_amd64.deb differ: byte 124, line 4
This can be a pain if you're uploading packages to an apt repository
which refuses reuploads that differ in content, or if you're trying
to verify that packages have not been infected.
There are several sources of nondeterminism; use 'diffoscope run1/*.deb run2/*.deb' if you
want the gory details. See http://reproducible-builds.org for the whole story.
To remove nondeterminism due to differing timestamps,
use the option --source-date-epoch-from-changelog; that will use the timestamp from
the gem's changelog.
In case the gem doesn't have a standard changelog (and most don't, alas),
use --source-date-epoch-default to set a default integer Unix timestamp.
(This will also be read from the environment variable SOURCE_DATE_EPOCH if set.)
Gems that include native extensions may have nondeterministic output
because of how the extensions get built (at least until fpm and
compilers finish implementing the reproducible-builds.org
recommendations). If this happens, use the option --gem-stagingdir=/tmp/foo.
For instance, picking the timestamp 1234 seconds after the Unix epoch:
% fpm -s gem -t deb --source-date-epoch-default=1234 --gem-stagingdir=/tmp/foo json
% mkdir run1; mv *.deb run1
% sleep 1
% fpm -s gem -t deb --source-date-epoch-default=1234 --gem-stagingdir=/tmp/foo json
% mkdir run2; mv *.deb run2
% cmp run1/*.deb run2/*.deb
% dpkg-deb -c run1/*.deb
...
-rw-rw-r-- 0/0 17572 1969-12-31 16:20 ./var/lib/gems/2.3.0/gems/json-2.1.0/CHANGES.md
% date --date @1234
Wed Dec 31 16:20:34 PST 1969
If after using those three options, the files are still different,
you may have found a bug; we might not have plugged all the sources
of nondeterminism yet. As of this writing, these options are only
implemented for reading gems and writing debs, and only verified
to produce identical output when run twice on the same Linux system.

View File

@ -1,38 +0,0 @@
`cpan` - Perl packages
======================
A basic example:
`fpm -t deb -s cpan Fennec`
The above will download Fennec from CPAN and build a Debian package of the Fennec Perl module locally.
By default, fpm believes the following to be true:
1. That your local Perl lib path will be the target Perl lib path
2. That you want the package name to be prefixed with the word perl
3. That the dependencies from CPAN are valid and that the naming scheme for those dependencies are prefixed with perl
If you wish to avoid any of those issues you can try:
`fpm -t deb -s cpan --cpan-perl-lib-path /usr/share/perl5 Fennec`
This will change the target path to where perl will be. Your local perl install may be /opt/usr/share/perl5.10 but the package will be constructed so that the module will be installed to /usr/share/perl5
`fpm -t deb -s cpan --cpan-package-name-prefix fubar Fennec`
This will replace the perl default prefix with fubar. The resulting package will be named in the scheme of fubar-fennec-2.10.deb
`fpm -t -deb -s cpan --no-depends Fennec`
This will remove omit dependencies from being added to the package metadata.
A full list of available options for CPAN are listed here::
--cpan-perl-bin PERL_EXECUTABLE (cpan only) The path to the perl executable you wish to run. (default: "perl")
--cpan-cpanm-bin CPANM_EXECUTABLE (cpan only) The path to the cpanm executable you wish to run. (default: "cpanm")
--cpan-mirror CPAN_MIRROR (cpan only) The CPAN mirror to use instead of the default.
--[no-]cpan-mirror-only (cpan only) Only use the specified mirror for metadata. (default: false)
--cpan-package-name-prefix NAME_PREFIX (cpan only) Name to prefix the package name with. (default: "perl")
--[no-]cpan-test (cpan only) Run the tests before packaging? (default: true)
--cpan-perl-lib-path PERL_LIB_PATH (cpan only) Path of target Perl Libraries
--[no-]cpan-sandbox-non-core (cpan only) Sandbox all non-core modules, even if they're already installed (default: true)
--[no-]cpan-cpanm-force (cpan only) Pass the --force parameter to cpanm (default: false)

View File

@ -1,117 +0,0 @@
`pleaserun` - Please, run!
===================
Synopsis::
fpm -s pleaserun [other flags] program [args...]
The `pleaserun` source uses the pleaserun_ project to help you build a package
that installs a service.
.. _pleaserun: http://github.com/jordansissel/pleaserun
`pleaserun` supports the following service managers:
* sysv, /etc/init.d/whatever
* upstart
* systemd
* runit
* launchd (OS X)
Automatic Platform Detection
----------------------------
Targeting multiple platforms with a single package is hard. What init system is used? Can you predict?
fpm+pleaserun can detect this at installation-time!
One Package for All Platforms
-----------------------------
The following is an example which creates an rpm that makes `redis` service
available::
fpm -s pleaserun -t rpm -n redis-service /usr/bin/redis-server
The output looks like this::
Created package {:path=>"redis-service-1.0-1.x86_64.rpm"}
.. note::
Your package will detect the service platform (systemd, upstart, etc) automatically upon installation :)
Let's see what happens when I install this on Fedora 25 (which uses systemd)::
% sudo rpm -i redis-service-1.0-1.x86_64.rpm
Platform systemd (default) detected. Installing service.
To start this service, use: systemctl start redis-server
And checking on our service::
% systemctl status redis-server
● redis-server.service - redis-server
Loaded: loaded (/etc/systemd/system/redis-server.service; disabled; vendor pr
Active: inactive (dead)
(It is inactive and disabled because fpm does not start it by default)
As you can see in the above example, `fpm` added an after-install script which
detects the service manager during installation. In this case, `systemd` was
detected.
The above example shows installing on Fedora 25, which uses systemd. You can use this same rpm package on CentOS 6, which uses upstart, and it will still work::
% sudo rpm -i redis-service-1.0-1.x86_64.rpm
Platform upstart (0.6.5) detected. Installing service.
To start this service, use: initctl start redis-server
And checking on our service::
% initctl status redis-server
redis-server stop/waiting
Hurray! We now have a single rpm that installs this `redis-service` service on
most systems.
Questions You May Have
----------------------
How does the package know whether to use systemd, upstart, sysv, or something else?
fpm creates a package that `does a platform check`_ when the `package is installed`_
.. _does a platform check: https://github.com/jordansissel/fpm/blob/master/templates/pleaserun/install.sh#L101-L113
.. _package is installed: https://github.com/jordansissel/fpm/blob/master/templates/pleaserun/scripts/after-install.sh
Does this mean I need ruby and pleaserun installed on the target system?
Fortunately, no! fpm creates a package that consists only of the install scripts and the service files. The install scripts are written in bourne shell `/bin/sh`.
Here's an example::
% fpm -s pleaserun -t rpm -n example /usr/bin/example
% rpm -qlp example-1.0-1.x86_64.rpm
/usr/share/pleaserun/example/generate-cleanup.sh
/usr/share/pleaserun/example/install-path.sh
/usr/share/pleaserun/example/install.sh
/usr/share/pleaserun/example/launchd/10.9/files/Library/LaunchDaemons/example.plist
/usr/share/pleaserun/example/launchd/10.9/install_actions.sh
/usr/share/pleaserun/example/systemd/default/files/etc/default/example
/usr/share/pleaserun/example/systemd/default/files/etc/systemd/system/example.service
/usr/share/pleaserun/example/systemd/default/install_actions.sh
/usr/share/pleaserun/example/sysv/lsb-3.1/files/etc/default/example
/usr/share/pleaserun/example/sysv/lsb-3.1/files/etc/init.d/example
/usr/share/pleaserun/example/upstart/0.6.5/files/etc/default/example
/usr/share/pleaserun/example/upstart/0.6.5/files/etc/init/example.conf
/usr/share/pleaserun/example/upstart/1.5/files/etc/default/example
/usr/share/pleaserun/example/upstart/1.5/files/etc/init/example.conf
The package includes service definitions for your specific service that can
target systemd, a few versions of upstart, launchd, and sysv.
Upon install, the `install.sh` script is run which detects the correct service
definition to install.
Does the package clean up after itself when I remove it?
It should. When installing, the package generates a manifest of what service files were installed, and it uses that manifest to clean up when the package is uninstalled or removed.

View File

@ -1,105 +0,0 @@
`python` - Python packages
==========================
Minimal example
---------------
Here's a simple example to download the `pyramid` python package and convert it to an rpm::
% fpm -s python -t rpm pyramid
Trying to download pyramid (using easy_install)
Searching for pyramid
Reading http://pypi.python.org/simple/pyramid/
Reading http://docs.pylonshq.com
Reading http://docs.pylonsproject.org
Best match: pyramid 1.0
...
Created /home/jls/python-pyramid-1.0.noarch.rpm
This will download the latest 'pyramid' python module using easy_install and
convert it to an rpm. It will create a package named
'python-pyramid-VERSION_ARCH.rpm' with appropriate version/arch in place.
Check the package::
% rpm -qip python-pyramid-1.0.noarch.rpm
Name : python-pyramid Relocations: (not relocatable)
Version : 1.0 Vendor: (none)
Release : 1 Build Date: Mon 16 May 2011 06:41:16 PM PDT
Install Date: (not installed) Build Host: snack.home
Group : default Source RPM: python-pyramid-1.0-1.src.rpm
Size : 2766900 License: BSD-derived (http://www.repoze.org/LICENSE.txt)
Signature : (none)
URL : http://docs.pylonsproject.org
Summary : The Pyramid web application framework, a Pylons project
Description :
The Pyramid web application framework, a Pylons project
From the above, you can see that fpm automatically picked the package name,
version, maintainer, homepage, and description all from the python package
itself. Nothing for you to worry about :)
Looking at the dependencies::
% rpm -qRp python-pyramid-1.0.noarch.rpm
python-Chameleon >= 1.2.3
python-Mako >= 0.3.6
python-Paste > 1.7
python-PasteDeploy >= 0
python-PasteScript >= 0
python-WebOb >= 1.0
python-repoze.lru >= 0
python-setuptools >= 0
python-zope.component >= 3.6.0
python-zope.configuration >= 0
python-zope.deprecation >= 0
python-zope.interface >= 3.5.1
python-venusian >= 0.5
python-translationstring >= 0
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(CompressedFileNames) <= 3.0.4-1
Packaging for multiple pythons
-------------------------------
Some systems package python with packages named 'python24' and 'python26' etc.
You can build packages like this with fpm using the `--python-package-name-prefix` flag::
% ruby bin/fpm -s python -t rpm --python-package-name-prefix python26 pyramid
...
Created /home/jls/projects/fpm/python26-pyramid-1.0.noarch.rpm
% rpm -qRp python26-pyramid-1.0.noarch.rpm
python26-Chameleon >= 1.2.3
python26-Mako >= 0.3.6
python26-Paste > 1.7
python26-PasteDeploy >= 0
<remainder of output trimmed... you get the idea>
You can ask for a specific version with '-v <VERSION>'. It will also handle
dependencies. Here's an example converting an older package like pysqlite version 2.5.6::
% fpm -s python -t rpm --python-package-name-prefix python26 -v 2.5.6 'pysqlite'
Trying to download pysqlite (using easy_install)
Searching for pysqlite==2.5.6
Reading http://pypi.python.org/simple/pysqlite/
Reading http://pysqlite.googlecode.com/
< ... output cut ... >
Created /home/jls/projects/fpm/python26-pysqlite-2.5.6.x86_64.rpm
Local python sources
--------------------
If you are the developer of a python package, or you already have the local
package downloaded and unpacked.
In this scenario, you can tell fpm to use the `setup.py`::
% ls pyramid/setup.py
pyramid/setup.py
% fpm -s python -t rpm pyramid/setup.py
...
Created /tmp/python-pyramid-1.0.noarch.rpm

View File

@ -1,23 +0,0 @@
`rpm` - RPM Packages
====================
Synopsis::
fpm -s rpm [other options] path-to-rpm
Using 'rpm' as a source lets you treat an existing package as a source for
building a
new one. This can be useful for converting packages between formats or
for "editing" upstream packages.
Strip out docs under `/usr/share/doc`::
fpm -t rpm -s rpm --exclude /usr/share/doc ruby-2.0.0.x86_64.rpm`
Rename a package and assign different version::
fpm -t rpm -s rpm --name myruby --version $(date +%S) ruby-2.0.0.x86_64.rpm
Convert an rpm in to a deb::
fpm -t deb -s rpm fpm-1.63.x86_64.rpm

View File

@ -1,39 +0,0 @@
`virtualenv` - Python virtual environments
==========================================
Synopsis::
fpm -s virtualenv [other options] EGG_SPEC|requirements.txt
FPM has support for building packages that provide a python virtualenv from a
single egg or from a `requirements.txt` file. This lets you bundle up a set of
python dependencies separate from system python that you can then distribute.
.. note::
`virtualenv` support requires that you have `virtualenv` and the
`virtualenv-tools` binary on your path. This can usually be achieved with
`pip install virtualenv virtualenv-tools`.
Example uses:
=============
Build an rpm package for ansible::
fpm -s virtualenv -t rpm ansible
yum install virtualenv-ansible*.rpm
which ansible # /usr/share/python/ansible/bin/ansible
Create a debian package for your project's python dependencies under `/opt`::
echo 'glade' >> requirements.txt
echo 'paramiko' >> requirements.txt
echo 'SQLAlchemy' >> requirements.txt
fpm -s virtualenv -t deb --name myapp-python-libs \
--prefix /opt/myapp/virtualenv requirements.txt
Create a debian package from a version 0.9 of an egg kept in your internal
pypi repository, along with it's external dependencies::
fpm -s virtualenv -t deb \
--virtualenv-pypi-extra-url=https://office-pypi.lan/ \
proprietary-magic=0.9

View File

@ -1,10 +0,0 @@
Sources
=========
Sources are the things you input to fpm.
.. toctree::
:maxdepth: 1
:glob:
source/*

View File

@ -1,10 +0,0 @@
Targets
===============
Targets are the output of fpm.
.. toctree::
:maxdepth: 1
:glob:

View File

@ -1,9 +0,0 @@
Use Cases
=========
.. toctree::
:maxdepth: 1
:glob:
use-cases/*

View File

@ -1,51 +0,0 @@
Jenkins: Single-file package
===================
For this example, you'll learn how to package hudson/jenkins which is a
single-file download.
We'll use `make` to script the download, but `make` isn't required if you don't want it.
Makefile::
NAME=jenkins
VERSION=2.80
.PHONY: package
package:
rm -f jenkins.war
wget https://updates.jenkins-ci.org/download/war/$(VERSION)/jenkins.war
fpm -s dir -t deb -n $(NAME) -v $(VERSION) --prefix /opt/jenkins jenkins.war
.. note:: You'll need `wget` for this Makefile to work.
Running it::
% make
rm -f jenkins.war
wget https://updates.jenkins-ci.org/download/war/2.80/jenkins.war
--2017-09-27 14:29:55-- https://updates.jenkins-ci.org/download/war/2.80/jenkins.war
Resolving updates.jenkins-ci.org (updates.jenkins-ci.org)... 52.202.51.185
Connecting to updates.jenkins-ci.org (updates.jenkins-ci.org)|52.202.51.185|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://mirrors.jenkins-ci.org/war/2.80/jenkins.war [following]
--2017-09-27 14:29:56-- http://mirrors.jenkins-ci.org/war/2.80/jenkins.war
Resolving mirrors.jenkins-ci.org (mirrors.jenkins-ci.org)... 52.202.51.185
Connecting to mirrors.jenkins-ci.org (mirrors.jenkins-ci.org)|52.202.51.185|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://ftp-nyc.osuosl.org/pub/jenkins/war/2.80/jenkins.war [following]
--2017-09-27 14:29:56-- http://ftp-nyc.osuosl.org/pub/jenkins/war/2.80/jenkins.war
Resolving ftp-nyc.osuosl.org (ftp-nyc.osuosl.org)... 64.50.233.100, 2600:3404:200:237::2
Connecting to ftp-nyc.osuosl.org (ftp-nyc.osuosl.org)|64.50.233.100|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 73094442 (70M) [application/x-java-archive]
Saving to: jenkins.war
100%[=======================================================================================================>] 73,094,442 7.71MB/s in 11s
2017-09-27 14:30:07 (6.07 MB/s) - jenkins.war saved [73094442/73094442]
% fpm -s dir -t deb -n jenkins -v 1.396 --prefix /opt/jenkins -d "sun-java6-jre (> 0)" jenkins.war
Created .../jenkins-1.396-1.amd64.deb
Delicious.

View File

@ -1,75 +0,0 @@
nodejs and multiple packages
=====================================================
This example requires your `make install` support setting DESTDIR or otherwise
allow you to install to a specific target directory.
Consider building nodejs. Sometimes you want to produce multiple packages from
a single project. In this case, building three separate packages: nodejs, nodejs-dev, and nodejs-doc.
Package up the nodejs runtime
-----------------------------
Normal build steps::
# Normal build steps.
% wget http://nodejs.org/dist/v0.6.0/node-v0.6.0.tar.gz
% tar -zxf node-v0.6.0.tar.gz
% cd node-v0.6.0
% ./configure --prefix=/usr
% make
Now install it to a temporary directory::
# Install to a separate directory for capture.
% mkdir /tmp/installdir
% make install DESTDIR=/tmp/installdir
Now make the 'nodejs' package::
# Create a nodejs deb with only bin and lib directories:
# The 'VERSION' and 'ARCH' strings are automatically filled in for you
# based on the other arguments given.
% fpm -s dir -t deb -n nodejs -v 0.6.0 -C /tmp/installdir \
-p nodejs_VERSION_ARCH.deb \
-d "libssl0.9.8 > 0" \
-d "libstdc++6 >= 4.4.3" \
usr/bin usr/lib
Install the package, test it out::
# 'fpm' just produced us a nodejs deb:
% file nodejs_0.6.0-1_amd64.deb
nodejs_0.6.0-1_amd64.deb: Debian binary package (format 2.0)
% sudo dpkg -i nodejs_0.6.0-1_amd64.deb
% /usr/bin/node --version
v0.6.0
Package up the manpages (create nodejs-doc)
-------------------------------------------
Now, create a package for the node manpage::
# Create a package of the node manpage
% fpm -s dir -t deb -p nodejs-doc_VERSION_ARCH.deb -n nodejs-doc -v 0.6.0 -C /tmp/installdir usr/share/man
Look in the nodejs-doc package::
% dpkg -c nodejs-doc_0.6.0-1_amd64.deb| grep node.1
-rw-r--r-- root/root 945 2011-01-02 18:35 usr/share/man/man1/node.1
Package up the headers (create nodejs-dev)
------------------------------------------
Lastly, package the headers for development::
Package up the headers via::
% fpm -s dir -t deb -p nodejs-dev_VERSION_ARCH.deb -n nodejs-dev -v 0.6.0 -C /tmp/installdir usr/include
% dpkg -c nodejs-dev_0.6.0-1_amd64.deb | grep -F .h
-rw-r--r-- root/root 14359 2011-01-02 18:33 usr/include/node/eio.h
-rw-r--r-- root/root 1118 2011-01-02 18:33 usr/include/node/node_version.h
-rw-r--r-- root/root 25318 2011-01-02 18:33 usr/include/node/ev.h
...
Yay!

View File

@ -1,53 +0,0 @@
#!/usr/bin/env ruby
$: << File.join(File.dirname(__FILE__), "..", "..", "lib")
# This example uses the API to create a package from local files
# it also creates necessary init-scripts and systemd files so our executable can be used as a service
require "fpm"
require "tmpdir"
require "fpm/package/pleaserun"
# enable logging
FPM::Util.send :module_function, :logger
FPM::Util.logger.level = :info
FPM::Util.logger.subscribe STDERR
package = FPM::Package::Dir.new
# Set some attributes
package.name = "my-service"
package.version = "1.0"
# Add a script to run after install (should be in the current directory):
package.scripts[:after_install] = 'my_after_install_script.sh'
# Example for adding special attributes
package.attributes[:deb_group] = "super-useful"
package.attributes[:rpm_group] = "super-useful"
# Add our files (should be in the current directory):
package.input("my-executable=/usr/bin/")
package.input("my-library.so=/usr/lib/")
# Now, add our init-scripts, systemd services, and so on:
pleaserun = package.convert(FPM::Package::PleaseRun)
pleaserun.input ["/usr/bin/my-executable", "--foo-from", "bar"]
# Create two output packages!
output_packages = []
output_packages << pleaserun.convert(FPM::Package::RPM)
output_packages << pleaserun.convert(FPM::Package::Deb)
# and write them both.
begin
output_packages.each do |output_package|
output = output_package.to_s
output_package.output(output)
puts "successfully created #{output}"
end
ensure
# defer cleanup until the end
output_packages.each {|p| p.cleanup}
end

View File

@ -1,16 +0,0 @@
$: << File.join(File.dirname(__FILE__), "..", "..", "lib")
require "fpm"
package = FPM::Package::Gem.new
# the Gem package takes a string name of the package to download/install.
# Example, run this script with 'rails' as an argument and it will convert
# the latest 'rails' gem into rpm.
package.input(ARGV[0])
rpm = package.convert(FPM::Package::RPM)
begin
output = "NAME-VERSION.ARCH.rpm"
rpm.output(rpm.to_s(output))
ensure
rpm.cleanup
end

View File

@ -1,18 +0,0 @@
$: << File.join(File.dirname(__FILE__), "..", "..", "lib")
require "fpm"
package = FPM::Package::Gem.new
ARGV.each do |gem|
name, version = gem.split(/[=]/, 2)
package.version = version # Allow specifying a specific version
package.input(gem)
end
rpm = package.convert(FPM::Package::RPM)
rpm.name = "rubygem-manythings"
rpm.version = "1.0"
begin
output = "NAME-VERSION.ARCH.rpm"
rpm.output(rpm.to_s(output))
ensure
rpm.cleanup
end

View File

@ -1,61 +0,0 @@
#
# feel free to change these to whatever makes sense
#
# debian package we rely on
RUBY_PACKAGE=ruby
# and the executable that comes from it
RUBY_BIN=/usr/bin/ruby
# the version we name the deb
VERSION=1.1.0
# where to get the sauce
GIT_URL=https://github.com/jordansissel/fpm.git
# the tag we checkout to build from
TAG_SPEC=refs/tags/v$(VERSION)
CHECKOUT_DIR=fpm-checkout
BUILD_DIR=build
LIB_DIR=$(BUILD_DIR)/usr/lib/fpm
BIN_DIR=$(BUILD_DIR)/usr/bin
GEM_PATH:=$(shell readlink -f .)/build/gem
FPM_BIN=$(BIN_DIR)/fpm
BUNDLE_BIN=$(GEM_PATH)/bin/bundle
BUNDLE_CMD=$(RUBY_CMD) $(BUNDLE_BIN)
FPM_CMD=$(FPM_BIN)
GEM_CMD=$(RUBY_BIN) -S gem
.PHONY: clean
clean:
rm -rf $(CHECKOUT_DIR)
rm -rf $(BUILD_DIR)
rm -f fpm*.deb
$(CHECKOUT_DIR):
rm -rf $(CHECKOUT_DIR)
git clone $(GIT_URL) $(CHECKOUT_DIR) --depth 1
cd $(CHECKOUT_DIR) && git fetch && git checkout $(TAG_SPEC)
$(BUNDLE_BIN):
$(GEM_CMD) install bundler --install-dir=$(GEM_PATH) --no-ri --no-rdoc
$(FPM_BIN):
mkdir --parents $(BIN_DIR)
# Couldn't think of a nice way to do this, so here is this code turd
echo "#! $(RUBY_BIN)" > $(FPM_BIN)
echo 'load File.dirname($$0) + "/../lib/fpm/bundle/bundler/setup.rb"' >> $(FPM_BIN)
echo 'require "fpm"' >> $(FPM_BIN)
echo 'require "fpm/command"' >> $(FPM_BIN)
echo 'exit(FPM::Command.run || 0)' >> $(FPM_BIN)
chmod +x $(FPM_BIN)
.PHONY: install
install: $(CHECKOUT_DIR) $(BUNDLE_BIN) $(FPM_BIN)
mkdir --parents $(LIB_DIR)
cd $(CHECKOUT_DIR) && GEM_PATH=$(GEM_PATH) $(BUNDLE_CMD) install --without=development --standalone
cd $(CHECKOUT_DIR) && gem build fpm.gemspec
tar -xf $(CHECKOUT_DIR)/fpm*gem -C $(BUILD_DIR)
tar --touch -xf $(BUILD_DIR)/data.tar.gz -C $(LIB_DIR)
cp -r $(CHECKOUT_DIR)/bundle $(LIB_DIR)/bundle
.PHONY: package
package: install
$(FPM_BIN) -s dir -t deb -n fpm -d $(RUBY_PACKAGE) -v $(VERSION) -C $(BUILD_DIR) usr

View File

@ -1,18 +0,0 @@
# About
- build and install dependency on a ruby1.9 of some kind
- does not need root to package
- has its own GEM_DIR to keep its dependencies isolated
- installation does not install any gems in to your ruby environment
- installs in to standard locations /usr/{bin,lib}/fpm
- doesn't depend on having fpm installed for packaging to work
# Dependencies
- build-essential (perhaps more, but basically the standard packages you need
for deb packaging)
- ruby and ruby-dev
# Usage
- $ cd examples/fpm-with-system-ruby && make package

View File

@ -1,35 +0,0 @@
NAME=ruby
VERSION=1.9.2-p180
MAJOR_VERSION=1.9
ARCHITECTURE=x86
TARDIR=$(NAME)-$(VERSION)
TARBALL=$(TARDIR).tar.gz
DOWNLOAD=http://ftp.ruby-lang.org/pub/ruby/$(MAJOR_VERSION)/$(TARBALL)
PREFIX=/opt/fpm
PACKAGE_NAME=fpm
PACKAGE_VERSION=0.2.30
.PHONY: default
default: deb
package: deb
.PHONY: clean
clean:
rm -f $(NAME)-* $(NAME)_* |NAME| true
rm -fr $(TARDIR) || true
rm -fr $(PREFIX) || true
rm -f *.deb
$(TARBALL):
wget "$(DOWNLOAD)"
$(TARDIR): $(TARBALL)
tar -zxf $(TARBALL)
cd $(TARDIR); ./configure --enable-shared=false --prefix=$(PREFIX); make; make install
$(PREFIX)/bin/gem install fpm
.PHONY: deb
deb: $(TARDIR)
$(PREFIX)/bin/fpm -s dir -t deb -v $(PACKAGE_VERSION) -n $(PACKAGE_NAME) -a $(ARCHITECTURE) -C $(PREFIX) .

View File

@ -1,19 +0,0 @@
Notes:
You should have write permission on /opt directory
Dependencies:
$ sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libxml2-dev libxslt-dev autoconf libc6-dev
Usage:
$ make package
Should make the package. Try installing:
$ sudo dpkg -i fpm-0.2.30.x86.deb
Now try it:
$ /opt/fpm/bin/fpm --help

View File

@ -1,35 +0,0 @@
NAME=jruby
VERSION=1.6.1
DOWNLOAD=http://jruby.org.s3.amazonaws.com/downloads/$(VERSION)/$(TARBALL)
TARBALL=$(NAME)-bin-$(VERSION).tar.gz
TARDIR=$(NAME)-$(VERSION)
PREFIX=/opt/jruby
.PHONY: default
default: deb
package: deb
.PHONY: clean
clean:
rm -f $(NAME)-* $(NAME)_* || true
rm -fr $(TARDIR) || true
rm -f *.deb
rm -f *.rpm
$(TARBALL):
wget "$(DOWNLOAD)"
$(TARDIR): $(TARBALL)
tar -zxf $(TARBALL)
.PHONY: deb
deb: $(TARDIR)
fpm -s dir -t deb -v $(VERSION) -n $(NAME) -d "sun-java6-bin (>> 0)" \
-a all -d "sun-java6-jre (>> 0)" --prefix $(PREFIX) -C $(TARDIR) .
.PHONY: rpm
rpm: $(TARDIR)
fpm -s dir -t rpm -v $(VERSION) -n $(NAME) -d "jdk >= 1.6.0" \
-a all --prefix $(PREFIX) -C $(TARDIR) .

View File

@ -1,17 +0,0 @@
Usage:
make package
Should make the package. Try installing:
sudo dpkg -i jruby-1.6.0.RC2-1.all.deb
Now try it:
% /opt/jruby/bin/jirb
>> require "java"
=> true
>> java.lang.System.out.println("Hello")
Hello
=> nil

View File

@ -1,15 +0,0 @@
NAME=twisted
VERSION=10.2.0
twisted:
easy_install --editable --build-directory . "$(NAME)==$(VERSION)"
usr: twisted
cd twisted; python setup.py bdist
tar -zxf twisted/dist/Twisted-$(VERSION).linux-$(shell uname -m).tar.gz
package: usr
fpm -s dir -t deb -n $(NAME) -v $(VERSION) \
-p python-$(NAME)-VERSION_ARCH.deb -d "python" \
usr

View File

@ -22,45 +22,36 @@ Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 1.9.3'
# For parsing JSON (required for some Python support, etc)
# http://flori.github.com/json/doc/index.html
spec.add_dependency("json", ">= 1.7.7", "< 2.0") # license: Ruby License
# For logging
# https://github.com/jordansissel/ruby-cabin
spec.add_dependency("cabin", ">= 0.6.0") # license: Apache 2
spec.add_dependency("cabin", ">= 0.9.1") # license: Apache 2
# For backports to older rubies
# https://github.com/marcandre/backports
spec.add_dependency("backports", ">= 2.6.2") # license: MIT
# For reading and writing rpms
spec.add_dependency("arr-pm", "~> 0.0.10") # license: Apache 2
spec.add_dependency("arr-pm", "~> 0.0.11") # license: Apache 2
# For command-line flag support
# https://github.com/mdub/clamp/blob/master/README.markdown
spec.add_dependency("clamp", "~> 1.0.0") # license: MIT
# For starting external processes across various ruby interpreters
spec.add_dependency("childprocess") # license: ???
# For calling functions in dynamic libraries
spec.add_dependency("ffi") # license: GPL3/LGPL3
spec.add_development_dependency("rake", "~> 10") # license: MIT
# For creating FreeBSD package archives (xz-compressed tars)
spec.add_dependency("ruby-xz", "~> 0.2.3") # license: MIT
spec.add_dependency("clamp", ">= 1.0.0") # license: MIT
# For sourcing from pleaserun
spec.add_dependency("pleaserun", "~> 0.0.29") # license: Apache 2
spec.add_dependency("stud")
spec.add_development_dependency("rspec", "~> 3.0.0") # license: MIT (according to wikipedia)
# In Ruby 3.0, rexml was moved to a bundled gem instead of a default one,
# so I think this needs to be added explicitly?
spec.add_dependency("rexml")
spec.add_development_dependency("rspec", "~> 3.13.0") # license: MIT (according to wikipedia)
spec.add_development_dependency("insist", "~> 1.0.0") # license: Apache 2
spec.add_development_dependency("pry")
spec.add_development_dependency("rake") # For FPM::RakeTask, #1877, #756
spec.files = files
spec.require_paths << "lib"
spec.bindir = "bin"

View File

@ -18,3 +18,4 @@ require "fpm/package/p5p"
require "fpm/package/pkgin"
require "fpm/package/freebsd"
require "fpm/package/apk"
require "fpm/package/snap"

View File

@ -3,7 +3,6 @@ require "fpm/namespace"
require "fpm/version"
require "fpm/util"
require "clamp"
require "ostruct"
require "fpm"
require "tmpdir" # for Dir.tmpdir
@ -247,13 +246,24 @@ class FPM::Command < Clamp::Command
"See https://reproducible-builds.org/specs/source-date-epoch ",
:environment_variable => "SOURCE_DATE_EPOCH"
option "--fpm-options-file", "FPM_OPTIONS_FILE",
"A file that contains additional fpm options. Any fpm flag format is valid in this file. " \
"This can be useful on build servers where you want to use a common configuration or " \
"inject other parameters from a file instead of from a command-line flag.." do |path|
load_options(path)
end
parameter "[ARGS] ...",
"Inputs to the source package type. For the 'dir' type, this is the files" \
" and directories you want to include in the package. For others, like " \
"'gem', it specifies the packages to download and use as the gem input",
:attribute_name => :args
# Keep a copy of the original flags (ones declared above, not by package types)
# This helps when generating the documentation
GENERAL_OPTIONS = @declared_options.clone
FPM::Package.types.each do |name, klass|
# This adds each package's flags to the main command
klass.apply_options(self)
end
@ -291,6 +301,15 @@ class FPM::Command < Clamp::Command
args << "."
end
if !File.exist?(workdir)
logger.fatal("Given --workdir=#{workdir} is not a path that exists.")
raise FPM::Package::InvalidArgument, "The given workdir '#{workdir}' does not exist."
end
if !File.directory?(workdir)
logger.fatal("Given --workdir=#{workdir} must be a directory")
raise FPM::Package::InvalidArgument, "The given workdir '#{workdir}' must be a directory."
end
logger.info("Setting workdir", :workdir => workdir)
ENV["TMP"] = workdir
@ -355,7 +374,7 @@ class FPM::Command < Clamp::Command
# If --inputs was specified, read it as a file.
if !inputs.nil?
if !File.exists?(inputs)
if !File.exist?(inputs)
logger.fatal("File given for --inputs does not exist (#{inputs})")
return 1
end
@ -370,7 +389,7 @@ class FPM::Command < Clamp::Command
# If --exclude-file was specified, read it as a file and append to
# the exclude pattern list.
if !exclude_file.nil?
if !File.exists?(exclude_file)
if !File.exist?(exclude_file)
logger.fatal("File given for --exclude-file does not exist (#{exclude_file})")
return 1
end
@ -394,7 +413,12 @@ class FPM::Command < Clamp::Command
set = proc do |object, attribute|
# if the package's attribute is currently nil *or* the flag setting for this
# attribute is non-default, use the value.
if object.send(attribute).nil? || send(attribute) != send("default_#{attribute}")
# Not all options have a default value, so we assume `nil` if there's no default. (#1543)
# In clamp >= 1.3.0, options without `:default => ..` will not have any # `default_xyz`
# methods generated, so we need to check for the presence of this method first.
default = respond_to?("default_#{attribute}") ? send("default_#{attribute}") : nil
if object.send(attribute).nil? || send(attribute) != default
logger.info("Setting from flags: #{attribute}=#{send(attribute)}")
object.send("#{attribute}=", send(attribute))
end
@ -435,7 +459,7 @@ class FPM::Command < Clamp::Command
# Skip scripts not set
next if path.nil?
if !File.exists?(path)
if !File.exist?(path)
logger.error("No such file (for #{scriptname.to_s}): #{path.inspect}")
script_errors << path
end
@ -571,12 +595,86 @@ class FPM::Command < Clamp::Command
ARGV.unshift(*flags)
ARGV.push(*args)
super(run_args)
rescue FPM::Package::InvalidArgument => e
logger.error("Invalid package argument: #{e}")
return 1
end # def run
def load_options(path)
@loaded_files ||= []
if @loaded_files.include?(path)
#logger.error("Options file was already loaded once. Refusing to load a second time.", :path => path)
raise FPM::Package::InvalidArgument, "Options file already loaded once. Refusing to load a second time. Maybe a file tries to load itself? Path: #{path}"
end
if !File.exist?(path)
logger.fatal("Cannot load options from file because the file doesn't exist.", :path => path)
end
if !File.readable?(path)
logger.fatal("Cannot load options from file because the file isn't readable.", :path => path)
end
@loaded_files << path
logger.info("Loading flags from file", :path => path)
# Safety check, abort if the file is huge. Arbitrarily chosen limit is 100kb
stat = File.stat(path)
max = 100 * 1024
if stat.size > max
logger.fatal("Refusing to load options from file because the file seems pretty large.", :path => path, :size => stat.size)
raise FPM::Package::InvalidArgument, "Options file given to --fpm-options-file is seems too large. For safety, fpm is refusing to load this. Path: #{path} - Size: #{stat.size}, maximum allowed size #{max}."
end
File.read(path).split($/).each do |line|
logger.info("Processing flags from file", :path => path, :line => line)
# With apologies for this hack to mdub (Mike Williams, author of Clamp)...
# The following code will read a file and parse the file
# as flags as if they were in same argument position as the given --fpm-options-file option.
args = Shellwords.split(line)
while args.any?
arg = args.shift
# Lookup the Clamp option by its --flag-name or short name like -f
if arg =~ /^-/
# Single-letter options like -a or -z
if single_letter = arg.match(/^(-[A-Za-z0-9])(.*)$/)
option = self.class.find_option(single_letter.match(1))
arg, remainder = single_letter.match(1), single_letter.match(2)
if option.flag?
# Flags aka switches take no arguments, so we push the rest of the 'arg' entry back onto the args list
# For combined letter flags, like `-abc`, we want to consume the
# `-a` and then push `-bc` back to be processed.
# Only do this if there's more flags, like, not for `-a` but yes for `-abc`
args.unshift("-" + remainder) unless remainder.empty?
else
# Single letter options that take arguments, like `-ohello` same as `-o hello`
# For single letter flags with values, like `-ofilename` aka `-o filename`, push the remainder ("filename")
# back onto the args list so that it is consumed when we extract the flag value.
args.unshift(remainder) unless remainder.empty?
end
elsif arg.match(/^--/)
# Lookup the flag by its long --flag-name
option = self.class.find_option(arg)
end
end
# Extract the flag value, if any, from the remaining args list.
value = option.extract_value(arg, args)
# Process the flag into `self`
option.of(self).take(value)
end
end
end
# A simple flag validator
#
# The goal of this class is to ensure the flags and arguments given

Some files were not shown because too many files have changed in this diff Show More