-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove FFI as a dependency #1796
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
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
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.
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.
jordansissel
force-pushed
the
issue/1795-remove-ffi
branch
from
June 19, 2021 07:05
933be8d
to
dfb23f1
Compare
Test 1: FFI is not installed, confirmed below:
I spot-checked a few manual tests (
|
jordansissel
changed the title
Work in progress: Remove FFI as a dependency
Remove FFI as a dependency
Jun 29, 2021
This was referenced Nov 3, 2022
This was referenced Nov 10, 2022
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this PR, the following changes shall occur:
Process.spawn
mknod
syscall with Ruby standard methods, where possible.xz
library with externalxz
program.Acceptance criteria: fpm can be installed without any
ffi
gem dependency.Expected outcomes, all of the following:
This PR aims to address issues listed in #1795