in reply to Re: How to get all shared libs of a path?
in thread How to get all shared libs of a path?

Hi, thanks for your suggestions. I think that my mistake is that I didn't explain the big picture. I have a file of paths that define my tool (all the needed paths to run my tool). I want to create a Dockerfile/Podman-file/Sing-file based on those dependencies so the container will be able to run the tool inside it. I want to find all the RPM packages of those paths. For that I use:
rpm -qf --queryformat "[%{NAME}]" [path]
But this command does not give me all the packages I need. I noticed that if I use ldd [path] to get all shared libs and then for each lib, run the above RPM command, then I'll get all the needed packages.

Now that I have explained the big picture, I'll talk about your suggestions. The locate is a good suggestion. I'll have to combine it with the objdump that was mentioned here. The ldd was working pretty well, but is objdump -p /path/to/program | grep NEEDED and then locate (and then rpm find) is a better approach?
Now that I have explained the big picture (sorry again that it was not in the main post), is it possible to suggest a better approach? Ideally I would want the rpm command to be able to get a path and return the packages of both the path and the shared libs of the path. This way I won't have to use the ldd command.