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
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
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 db9db670c39a84dccc92123eed4413bf09d89bc5.
Fixes #1877
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.
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
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
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
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
Long term, we'll probably have a "smart" post-install that will choose
the correct service (systemd, etc) to install based on the platform
doing the installation, not the platform creating the package :)
Adds dependencies on pleaserun and upgrades clamp to suit.
Example using the defaults in pleaserun:
# Create a package called 'example-service' that installs a service named 'example'
% bin/fpm -s pleaserun -t rpm -n example-service --pleaserun-name example =logger hello world
No platform selected. Autodetecting... {:platform=>"systemd", :version=>"default", :level=>:warn}
Writing file {:destination=>"/tmp/package-pleaserun-staging20160513-12576-1ozurnf/lib/systemd/system/example.service"}
Writing install actions. You will want to run this script to properly activate your service on the target host {:path=>"/tmp/package-pleaserun-staging20160513-12576-1ozurnf/install_actions.sh"}
Created package {:path=>"example-service-1.0-1.x86_64.rpm"}
# ^^ The above service will execute "logger hello world"
# What's in our rpm?
% rpm -qlp example-service-1.0-1.x86_64.rpm
/lib/systemd/system/example.service
# What about any post-install steps?
% rpm -qp example-service-1.0-1.x86_64.rpm --scripts
postinstall scriptlet (using /bin/sh):
systemctl --system daemon-reload
# Install it.
% sudo rpm -ivh example-service-1.0-1.x86_64.rpm
# Start it.
% sudo systemctl start example
# Check the logs!
% sudo tail -n1 /var/log/messages
May 13 03:32:55 localhost root: hello world
Example choosing 'sysv' as the platform:
% bin/fpm -s pleaserun -t rpm -n example-service --pleaserun-platform sysv --pleaserun-name example =logger hello world
Writing file
{:destination=>"/tmp/package-pleaserun-staging20160513-13675-xae6xd/etc/init.d/example"}
Writing file
{:destination=>"/tmp/package-pleaserun-staging20160513-13675-xae6xd/etc/default/example"}
Created package {:path=>"example-service-1.0-1.x86_64.rpm"}
% rpm -qlp example-service-1.0-1.x86_64.rpm
/etc/default/example
/etc/init.d/example