in reply to Re^4: Capture::Tiny getting stuck on ldd /proc/self/fd/1
in thread Capture::Tiny getting stuck on ldd /proc/self/fd/1

But this command does not give me all the packages I need.

That's because you are not querying their dependencies. Run rpm -q --requires $pkg on the packages found. This will give you the packages they depend on. Add those packages, query their dependencies, repeat and you should end up with the complete set. No need for ldd.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^6: Capture::Tiny getting stuck on ldd /proc/self/fd/1
by ovedpo15 (Pilgrim) on Jun 22, 2021 at 15:40 UTC
    Thanks again for your reply.
    So lets take an example /usr/bin/grep. In that case I get:
    rpm -qf --queryformat "[%{NAME}]" /usr/bin/grep grep
    After that, you suggested to run:
    rpm -q --requires grep info /bin/sh /bin/sh rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1 libc.so.6()(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.4)(64bit) rpmlib(PayloadIsLzma) <= 4.4.6-1
    How to handle this output? Which lines interest me? I guess to run rpm -q --requires info and get:
    bash zlib libzio /bin/sh /bin/sh rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1 libbz2.so.1()(64bit) libc.so.6()(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.4)(64bit) libncurses.so.5()(64bit) libz.so.1()(64bit) libzio.so.0()(64bit) rpmlib(PayloadIsLzma) <= 4.4.2-1
    What should I do with other lines?
      After that, you suggested to run:
      rpm -q --requires grep info /bin/sh /bin/sh rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1 libc.so.6()(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.4)(64bit) rpmlib(PayloadIsLzma) <= 4.4.6-1

      You can skip info, since this is a program to display manual pages. It provides no libraries. You can skip those rpmlib lines, too. The libc.so.6 package contains the standard C library, which is needed by all programs written in C. Include that. If in doubt, run rpm -ql $pkg | grep '\.so' to check whether a package provides shared libraries. If so, add that package. If not, you can skip it.

      perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
        I see. Under info I find bash,zlib,libzio which should not be ignored. Now that I'm using this command, I don't need the libraries right (because you mentioned ". It provides no libraries")? I just need to find all the packages.
        Also, I want to make it run automatically. So I need some logic on how to parse the output of rpm -q --requires $pkg. I gave grep as an example so it will be easier to talk about the strategy on how to parse this output. I guess I can exclude the rpmlib lines. For the libc.so.6, do I need to run locate to find the location and then run the rpm -qf --queryformat "[%{NAME}]" $lib command? What about /bin/sh?

        To sum up - What is the strategy in general case, on parsing the output of rpm -q --requires?