Bruce Simpson
2009-Feb-24 06:06 UTC
Cleaning unused libraries and rebuilding dependent ones?
Hi all, I'm sure that these questions have been asked before, however, a quick search of forums on the Web didn't turn up any obvious answers. I currently use portupgrade on all my FreeBSD installations, however, I have noticed over time that a fair amount of detritus can build up in ${PREFIX}/lib/compat/pkg. So my questions are:- 1. Is there a tool like Gentoo's revdep-rebuild to force packages depending on packaged libraries to be rebuilt? 2. Is there a more complete tool to clean orphaned libraries like 'portsclean -L' used to do? Whilst I greatly appreciate the hard work and effort which the FreeBSD ports maintainers put in to ensure shared library versions get bumped when needed, this isn't always possible, as it requires keeping a sharp eye out for 3rd party software packages which do the wrong thing, and don't bump the major(s) when significant semantic changes happen inside their libraries, or when the ABI changes. [1] revdep-rebuild has very similar semantics to what I'm looking for, as it will navigate the dependency graph for all packages installed on the system, and rebuild packages where dependent libraries have changed. To do the same with portupgrade alone, I need to know which port(s) contain shared libraries, and tell it to go off and rebuild these *specific* packages if things change. [2] 'portsclean -L' used to do something :-) it does not appear to do anything now. I realize I could use libchk to discover which libraries are unreferenced at load-time, however, a fair number of the libraries which portupgrade moves into ${PREFIX}/lib/compat/pkg can potentially be loaded by dlopen() at run-time. Using libchk's output to remove unreferenced libraries isn't really an option without significant post-processing of its output. I would rather not rely on 'portupgrade -f -a -r', as this is going to cause a *lot* of work on the affected systems. Thanks for any help! BMS
Mike Edenfield
2009-Feb-24 09:05 UTC
Cleaning unused libraries and rebuilding dependent ones?
On 2/24/2009 9:06 AM, Bruce Simpson wrote:> Hi all,> [1] revdep-rebuild has very similar semantics to what I'm looking for, > as it will navigate the dependency graph for all packages installed on > the system, and rebuild packages where dependent libraries have changed. > To do the same with portupgrade alone, I need to know which port(s) > contain shared libraries, and tell it to go off and rebuild these > *specific* packages if things change.I don't think revdep-rebuild works as cleanly as you think. Technically, revdep-rebuild only locates packages that are *already broken* due to missing shared libraries, and rebuilds them. What revdep-rebuild does is literally run ldd on every executable file in the search path, grep for either "not found" or a specific library name, then assign each broken binary to a package name for portage to rebuild. This is exactly what libchk also does, so the effect would be the same. Specifically, revdep-rebuild also won't pick up missing dlopen() libs and such. The semantics you're talking about sounds like the new @preserved-libs set that's in the upcoming portage, but in order for that to work it has to be maintained at the time of library update: as a shared lib is moved into the compat folder, record any packages that depend on the previously installed package into a set for later rebuilding. --K