maandag 26 september 2011

Gentoo la files breakage

I'm  a Gentoo user for years now and I've had my share of bumps in the road. I recently had some problems with packages trying to find non existing .la files. I'll take VLC for example. VLC was missing an audio .la file belonging to the nas package. Nas was previously installed on my system and since I removed it, VLC no longer built.
Trying to find the missing .la file didn't help as it was a .la file that was removed. I've also read that Gentoo wants to get rid of the .la files in total. Anyhow, Gentoo has a tool called "lafilefixer", this tries, as the name implies, to fix .la file linkage. Unfortunately this didn't help. There is also a tool called "revdep-rebuild", this tries to fix missing dependencies or better said, broken linkage to dependencies. Paludis has a similar tool called "cave fix-linkage".
Unfortunately fixing the linkage to dependencies didn't work either. So I've searched on the Internet for alternative solutions and I recently found one: removing the .la files that don't belong to any package installed and then fixing broken linkage to dependencies.
This is the script I used to remove the .la files:
#!/bin/bash
for f in `find -O3 /  -type f -name "*.la"  -print0 | xargs -0`
do
        if [ -z `cave print-owners $f` ]
        then
                echo file is orphaned $f
                rm $f
        fi
done
After this I fixed the breakage by running "cave  fix-linkage -x" and all was solved.
To prevent this from happening again I placed a hook in the paludis hooks directory to 'fix' linkage before merging to /.
I installed the hook in /etc/paludis/hooks/auto/

#!/usr/bin/env bash

hook_auto_names()
{
        echo "merger_install_pre"
}

hook_run_merger_install_pre()
{
        source ${PALUDIS_EBUILD_DIR}/echo_functions.bash

        einfo_unhooked "Running lafilefixer"

        lafilefixer ${IMAGE}
}

Geen opmerkingen:

Een reactie posten