Skip to content
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

Extract CPIO as a reusable module #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexeymorozov
Copy link
Contributor

@jordansissel

Would allow to use the CPIO parser outside of the project. For example, we need it in fontist.

What do you think? What can I do?

@jordansissel
Copy link
Owner

I'm open to having the CPIO parser available to other libraries. +1

@jordansissel
Copy link
Owner

That said, I don't think arr-pm uses the CPIO code anywhere. There's a few different CPIO formats (ascii, binary, etc) and I think I only implemented the ASCII one (used by RPM?). The arr-pm code extracting CPIO uses IO#popen to call the cpio program ;)

extractor = IO.popen("#{tags[:payloadcompressor]} -d | (cd #{target}; cpio -i --quiet --make-directories)", "w")

I'm thinking about a few different ideas here:

  1. You copy the cpio parser code into your repo?
  2. Instead, maybe use libarchive which supports different CPIO encodings? (https://github.com/chef/ffi-libarchive has ruby bindings)
  3. Merge this PR and push a new arr-pm

@alexeymorozov
Copy link
Contributor Author

Agree, my research shown the same: arr-pm doesn't currently use this implementation of CPIO extraction.

Considering of the ideas:

  1. Made exactly this way, copied to https://github.com/fontist/excavate/tree/main/lib/excavate/extractors/cpio as a new format (the ASCII one)
  2. Our library strives to be cross-platform, butlibarchive requires to have compiled binary in system, and there is no such library on Windows by default. So it's a hard option, currently we skipped it.
  3. If there is anyone else who needs the feature, it can be helpful.
  4. Also we may extract the CPIO implementation as a new gem? 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants