LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Reverse/backward dependency checking in Slackware (https://www.linuxquestions.org/questions/slackware-14/reverse-backward-dependency-checking-in-slackware-4175692958/)

xj25vm 04-01-2021 09:25 AM

Reverse/backward dependency checking in Slackware
 
I think I might have asked this question here many years ago - but looking through all my previous posts, I just can't find it. I'm perfectly happy to sort out dependencies when I install a new package in Slackware - the current system works fine: either read the info at SBo, or try to run the software on the command line and it will complain with some relevant error message.

However, I am faced with kind of the opposite problem. I need to start with a package, and find out what depends on it. For example, I have 'twolame' installed - and I was trying to figure out which software installed on the laptop needs it - if any - so that I know if it is safe to remove it. I can't figure out a way to do this. I think someone suggested grep'ing some directory. Going through /var/log/packages/ doesn't seem to help - as the README or package.info files with dependencies info are not stored there. Is there another way to obtain this information? I looked through the Slackware docs and wiki - but all the info seems to be about forward dependency checking - not backwards.

As a small side note, I suppose it would be helpful if SBo would have the option to search through package descriptions on the website - if that is possible at all. This way it would be possible to search for packages which depend on the particular package you are looking at - and then check if any of them are installed on the local machine.

Alien Bob 04-01-2021 09:33 AM

SlackBuilds.org offers a reverse dependency check actually. Using twolame as an example: https://slackbuilds.org/advsearch.ph...e&stype=revdep.

EdGr 04-01-2021 10:42 AM

Run ldd on all executable programs and libraries. Grep for the library you are interested in.

Code:

for n in /usr/bin/*; do if (ldd $n | grep -q lame); then echo $n; fi; done
Ed

SpacePlod 04-01-2021 11:28 AM

If I understand your question correctly, you might give hoorex a try (on SBo: https://slackbuilds.org/repository/14.2/misc/hoorex/)

Code:

$ hoorex --help
...

This program shows which other packages require a given SBo package

...

$ hoorex twolame
twolame bombono-dvd vlc soundconverter


drumz 04-01-2021 12:13 PM

Be aware that SBo's reverse dependency search only lists hard dependencies, not optional dependencies. If you are compiling SBo packages with optional dependencies, then you should be maintaining your own queue files as self-documentation (and for easier compiling!). For example, if I search for speex on my local queue list it matches several more packages than just vlc (the only package I have installed which appears on https://slackbuilds.org/advsearch.ph...&stype=revdep1)

Code:

# grep speex /var/lib/sbopkg/queues/*
/var/lib/sbopkg/queues/FlightGear.sqf:@speex
/var/lib/sbopkg/queues/TiMidity++.sqf:@speex
/var/lib/sbopkg/queues/ffmpeg.sqf:@speex
/var/lib/sbopkg/queues/libshout.sqf:@speex
/var/lib/sbopkg/queues/speex.sqf:speex
/var/lib/sbopkg/queues/vlc.sqf:@speex

This example is of course for sbopkg. I believe most SBo automated tools have some way of specifying dependencies (required, optional, and/or both).

(My queue files generally only list first-level dependencies, so I'd have to do further searching to find all dependent packages on speex).

drumz 04-01-2021 12:17 PM

As optional dependencies should be documented in the README, you should be able to grep for the program. Continuing with my speex example:

Code:

# grep speex /var/lib/sbopkg/SBo/14.2/*/*/README
/var/lib/sbopkg/SBo/14.2/audio/TiMidity++/README:Optional dependencies are jack, speex, and portaudio.
/var/lib/sbopkg/SBo/14.2/audio/icecast/README:Optional dependencies: speex
/var/lib/sbopkg/SBo/14.2/development/squeak-vm/README:Optional dependency: speex
/var/lib/sbopkg/SBo/14.2/games/FlightGear/README:speex and flite are optional dependencies for voice communication
/var/lib/sbopkg/SBo/14.2/libraries/audiere/README:Optional dependencies are speex, libcdaudio and dumb (this one
/var/lib/sbopkg/SBo/14.2/libraries/libfishsound/README:Optional dependency: speex. Autodetected at build time.
/var/lib/sbopkg/SBo/14.2/libraries/libshout/README:speex is an optional dependency.
/var/lib/sbopkg/SBo/14.2/multimedia/ffmpeg/README:SPEEX=yes|no (default: no), requires speex
/var/lib/sbopkg/SBo/14.2/multimedia/ffmpeg4/README:  LIBSPEEX=yes      # requires speex
/var/lib/sbopkg/SBo/14.2/multimedia/gnash/README:Optional but recommended dependencies are speex, gst0-ffmpeg,
/var/lib/sbopkg/SBo/14.2/network/yate/README:Optional dependencies: postgresql, speex, amrnb


volkerdi 04-01-2021 01:21 PM

1 Attachment(s)
Here's a little something I use around here.

bassmadrigal 04-01-2021 03:41 PM

Quote:

Originally Posted by volkerdi (Post 6236237)
Here's a little something I use around here.

Knowing the scripts I've created to help my processes, it'd be really interesting to see your collection of scripts you've created over the years.

I'm not actually asking for them, just more of a showerthought.

xj25vm 04-04-2021 12:32 PM

Thank you everyone for the suggestions - most helpful!

Quote:

Originally Posted by Alien Bob (Post 6236178)
SlackBuilds.org offers a reverse dependency check actually. Using twolame as an example: https://slackbuilds.org/advsearch.ph...e&stype=revdep.

Thank you - I didn't realise that.

Quote:

Originally Posted by EdGr (Post 6236194)
Run ldd on all executable programs and libraries. Grep for the library you are interested in.

Code:

for n in /usr/bin/*; do if (ldd $n | grep -q lame); then echo $n; fi; done
Ed

I guess if some binaries are under /opt or elsewhere, the above wouldn't catch them?

Quote:

Originally Posted by SpacePlod (Post 6236204)
If I understand your question correctly, you might give hoorex a try (on SBo: https://slackbuilds.org/repository/14.2/misc/hoorex/)

Does hoorex return packages from the entire SBo list, or only SBo packages already installed locally?

Quote:

Originally Posted by drumz (Post 6236217)
Be aware that SBo's reverse dependency search only lists hard dependencies, not optional dependencies. If you are compiling SBo packages with optional dependencies, then you should be maintaining your own queue files as self-documentation

Hmm - as far as I can tell sbotools (which is what I'm using now) don't have the option to save queue files - I think I'll have to take a look at sbopkg instead.

Quote:

Originally Posted by drumz (Post 6236219)
As optional dependencies should be documented in the README, you should be able to grep for the program. Continuing with my speex example:

Code:

# grep speex /var/lib/sbopkg/SBo/14.2/*/*/README
...


This is sort of what I ended up doing. It does return results from the entire SBo tree, not only installed packages - but it is just about enough to work out the answer to the question.

Quote:

Originally Posted by volkerdi (Post 6236237)
Here's a little something I use around here.

Thank you - I will give the script a try

EdGr 04-04-2021 12:45 PM

Quote:

Originally Posted by xj25vm (Post 6237179)
I guess if some binaries are under /opt or elsewhere, the above wouldn't catch them?

Yes, you need to search all executables and libraries. I was showing you how to do that. My point was that one line of Bash can do what you want.
Ed

chris.willing 04-04-2021 05:10 PM

Quote:

Originally Posted by xj25vm (Post 6237179)
Does hoorex return packages from the entire SBo list, or only SBo packages already installed locally?

That is optional. By default packages from the entire SBo repo are considered, but can be restricted to those packages already installed. From the man page:
Code:

    -i, --installed
        Restrict output to those packages already installed, with the exception of the target package(s) which are included.

chris

gus3 04-04-2021 06:10 PM

Quote:

Originally Posted by volkerdi (Post 6236237)
Here's a little something I use around here.

In 119 lines of Bash code, 2 pages of x86 RAM...

You, Sir, have yet again made some magic. :thumbsup:

Now, let us lesser magicians study his methods. :study:

drgibbon 04-05-2021 02:45 AM

Quote:

Originally Posted by xj25vm (Post 6236175)
I need to start with a package, and find out what depends on it. For example, I have 'twolame' installed - and I was trying to figure out which software installed on the laptop needs it - if any - so that I know if it is safe to remove it. I can't figure out a way to do this.

sbotools has a version of this built-in:
Code:

sboremove twolame
From the manpage:
Quote:

sboremove is used to remove packages installed from slackbuilds. It pulls the list of requirements from the .info file for any specified slackbuild. If such a list exists, sboremove will look to see whether or not those requirements are installed. Those that are will then be checked to see whether they are requirements of other packages also installed. If a package is no longer required, or the -a flag is specified sboremove will ask whether or not it should also remove it from the system.
The drawback is that it will only pick up explicitly listed dependencies in .info files (so not "soft" deps). Some of the other library checking approaches given in this thread might be useful in conjunction with `sboremove`.

chrisretusn 04-05-2021 05:50 AM

I don't think sbbdep has been mentioned yet. I find it quite useful.

"sbbdep --whoneeds [query]"


All times are GMT -5. The time now is 06:31 PM.