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

Enable searching of local RPMs #28

Closed
svenstaro opened this issue Sep 22, 2019 · 4 comments
Closed

Enable searching of local RPMs #28

svenstaro opened this issue Sep 22, 2019 · 4 comments

Comments

@svenstaro
Copy link
Contributor

I sometimes have to locate files in a big pool of local RPMs. It would be really neat if this tool supported searching through that.

@phiresky
Copy link
Owner

phiresky commented Sep 22, 2019

Good idea. Researching a bit, looks like there's three steps to achieve this:

  1. Get the actual data from the rpm, which is a cpio archive. rpm2cpio is a 30 line shell script (could be bundled) or maybe https://crates.io/crates/rpm-rs which is a rust library that would also allow getting the package metadata which would be useful.
  2. Decompress the cpio. Apparently it can use pretty much any compression, with the most common being gz, xz and zstd. This should be handled by just passing it to the existing decompress adapter with mime type detection
  3. Extract the cpio and recursively handle all contained files. There's the cpio-rs library which looks like it should work (it provides an iterator of Reads for the contained files), assuming rpm always uses the SVR4 cpio format.

lesspipe does it similarily, though testing it it seems to be broken for me.

Since I don't have a personal need for rpm archives in particular I'm probably not going to spend time implementing this soon, unless I get bored. Of course I'd be happy to merge a PR though!

@saidsay-so
Copy link

I could try to make it with only Rust.

@svenstaro
Copy link
Contributor Author

@musikid did you ever get anywhere with your approach?

@phiresky
Copy link
Owner

Starting with 1.0.0, it's possible to add custom adapters via the config file. If someone has a good suggestion for a file type please post it in show-your-adapter

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

No branches or pull requests

3 participants