You are not logged in.

#1 2005-07-17 12:46:39

Riklaunim
Member
Registered: 2005-04-09
Posts: 106
Website

revdep-rebuild = find broken libs

this is a Ligth version of revdep-rebuild script used on gentoo systems (no portage finding packages for missing libs). It can find missing  libs like

 broken /opt/kde/lib/kde3/kio_smb.so (requires  libsmbclient.so.0)
  broken /opt/kde/lib/kde3/kio_svn.so (requires  libneon.so.24 libsvn_client-1.so.0 libsvn_delta-1.so.0 libsvn_diff-1.so.0 libsvn_fs-1.so.0 libsvn_fs_base-1.so.0 libsvn_fs_fs-1.so.0 libsvn_ra-1.so.0 libsvn_ra_dav-1.so.0 libsvn_ra_local-1.so.0 libsvn_ra_svn-1.so.0 libsvn_repos-1.so.0 libsvn_subr-1.so.0 libsvn_wc-1.so.0)
  broken /usr/lib/libdivxencore.so (requires  libstdc++-libc6.2-2.so.3)
  broken /usr/lib/libpq++.so.4.0 (requires  libpq.so.3)
  broken /usr/lib/php/odbc.so (requires  libodbc.so.1)
  broken /usr/lib/tuxcmd/libgnome_vfs.so (requires  libORBit-2.so.0 libbonobo-2.so.0 libbonobo-activation.so.4 libgconf-2.so.4 libgnomevfs-2.so.0)
  broken /usr/lib/xine/plugins/1.0.1/xineplug_inp_smb.so (requires  libsmbclient.so.0)

it found arch "optional" dependencies smile could be usefull when making packages with unknown dependencies etc.

save as, make it executable and then run it as root smile (get the code via "quote" - phpBB may damage the script tongue)

#! /bin/bash

# Copyright 1999-2005 Gentoo Foundation
# $Header$

# revdep-rebuild: Reverse dependency rebuilder.
# Original Author: Stanislav Brabec
# Current Maintainer: Paul Varner <fuzzyray@gentoo.org>

PRELIMINARY_SEARCH_DIRS="$PRELIMINARY_SEARCH_DIRS /bin /sbin /usr/bin /usr/sbin /lib* /usr/lib*"
PRELIMINARY_SEARCH_DIRS_MASK="$PRELIMINARY_SEARCH_DIRS_MASK /opt/OpenOffice"
PRELIMINARY_LD_LIBRARY_MASK="$PRELIMINARY_LD_LIBRARY_MASK libodbcinst.so libodbc.so libjava.so libjvm.so"


# Get the directories from /etc/ld.so.conf
if [ -e /etc/ld.so.conf ]
then
    PRELIMINARY_SEARCH_DIRS="$PRELIMINARY_SEARCH_DIRS $(grep -v "^#" /etc/ld.so.conf | tr 'n' ' ')"
fi    

# Set the final variables
# Note: Using $(echo $variable) removes extraneous spaces from variable assignment
unset SEARCH_DIRS
for i in $(echo $PRELIMINARY_SEARCH_DIRS)
do
    [ "$i" = "-*" ] && break
    SEARCH_DIRS="$(echo $SEARCH_DIRS $(readlink -f $i))"
done

unset SEARCH_DIRS_MASK
for i in $(echo $PRELIMINARY_SEARCH_DIRS_MASK)
do
    [ "$i" = "-*" ] && break
    SEARCH_DIRS_MASK="$(echo $SEARCH_DIRS_MASK $i)"
done

unset LD_LIBRARY_MASK
for i in $(echo $PRELIMINARY_LD_LIBRARY_MASK)
do
    [ "$i" = "-*" ] && break
    LD_LIBRARY_MASK="$(echo $LD_LIBRARY_MASK $i)"
done

# Use the color preference from portage
##NOCOLOR=$(portageq envvar NOCOLOR)

# Base of temporary files names.
LIST=~/.revdep-rebuild

shopt -s nullglob
shopt -s expand_aliases
unalias -a

# Color Definitions
NO="x1b[0m"
BR="x1b[0;01m"
CY="x1b[36;01m"
GR="x1b[32;01m"
RD="x1b[31;01m"
YL="x1b[33;01m"
BL="x1b[34;01m"

alias echo_v=echo

PACKAGE_NAMES=false
SONAME="not found"
SONAME_GREP=grep
SEARCH_BROKEN=true
EXTRA_VERBOSE=false
KEEP_TEMP=false

EMERGE_OPTIONS=""
PRELIMINARY_CALLED_OPTIONS=""
while [ ! -z "$1" ] ; do
    case "$1" in
    -X | --package-names )
        PACKAGE_NAMES=true
        PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --package_names"
        shift
        ;;
    -q | --quiet )
        alias echo_v=:
        EMERGE_OPTIONS="${EMERGE_OPTIONS} $1"
        shift
        ;;
    --library=* | --soname=* | --soname-regexp=* )
        SONAME="${1#*=}"
        SEARCH_BROKEN=false
        PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}"
        shift
        ;;
    --library | --soname | --soname-regexp )
        SONAME="$2"
        SEARCH_BROKEN=false
        PRELIMINARY_CALLED_OPTIONS="${PRELIMINARY_CALLED_OPTIONS} --library=${SONAME}"
        shift 2
        ;;
    -nc | --no-color )
        NOCOLOR=true
        shift
        ;;
    -i | --ignore )
        rm -f ${LIST}*
        shift
        ;;
    --keep-temp )
        KEEPTEMP=true
        shift
        ;;
    -vv | --extra-verbose )
        EXTRA_VERBOSE=true
        shift
        ;;
    -- )
        shift
        ;;
    * )
        EMERGE_OPTIONS="${EMERGE_OPTIONS} $1"
        shift
        ;;
    esac
done

EMERGE_OPTIONS=$(echo $EMERGE_OPTIONS | sed 's/^ //')

if [ -z "$PRELIMINARY_CALLED_OPTIONS" ]
then
    CALLED_OPTIONS=""
else
    for i in $(echo $PRELIMINARY_CALLED_OPTIONS | tr ' ' 'n'| sort)
    do
        CALLED_OPTIONS="$(echo $CALLED_OPTIONS $i)"
    done
fi

if [ "$NOCOLOR" = "yes" -o "$NOCOLOR" = "true" ]
then
    NOCOLOR=true
else
    NOCOLOR=false
fi

# Make the NOCOLOR variable visible to emerge
export NOCOLOR

if $NOCOLOR
then
    NO=""
    BR=""
    CY=""
    GR=""
    RD=""
    YL=""
    BL=""
fi

function set_trap () {
    trap "rm_temp $1" SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
}

function rm_temp () {
    echo " terminated."
    echo "Removing incomplete $1."
    rm $1
    echo
    exit 1
}

if $SEARCH_BROKEN ; then
    SONAME_SEARCH="$SONAME"
    LLIST=$LIST
    HEAD_TEXT="broken by a package update"
    OK_TEXT="Dynamic linking on your system is consistent"
    WORKING_TEXT=" consistency"
else
    # first case is needed to test against /path/to/foo.so
    if [ ${SONAME:0:1} == '/' ] ; then 
        # Set to "<space>$SONAME<space>"
        SONAME_SEARCH=" $SONAME "
    else
        # Set to "<tab>$SONAME<space>"
        SONAME_SEARCH="    $SONAME "
    fi
    LLIST=${LIST}_$(echo "$SONAME_SEARCH$SONAME" | md5sum | head -c 8)
    HEAD_TEXT="using $SONAME"
    OK_TEXT="There are no dynamic links to $SONAME"
    WORKING_TEXT=""
fi

# If our temporary files are older than 1 day, don't use them
TOO_OLD=$((`date +%s` - 86400))
for file in ${LIST}*
do
    if [ -f $file ]
    then
        FILE_AGE="$(stat -c %Y $file)"
        if [ $FILE_AGE -lt $TOO_OLD ]
        then
            rm -f ${LIST}*
            break
        fi
    fi
done

# Don't use our previous files if environment doesn't match
if [ -f $LIST.0_env ]
then
    PREVIOUS_SEARCH_DIRS=$(. ${LIST}.0_env; echo "$SEARCH_DIRS")
    PREVIOUS_SEARCH_DIRS_MASK=$(. ${LIST}.0_env; echo "$SEARCH_DIRS_MASK")
    PREVIOUS_LD_LIBRARY_MASK=$(. ${LIST}.0_env; echo "$LD_LIBRARY_MASK")
    PREVIOUS_OPTIONS=$(. ${LIST}.0_env; echo "$CALLED_OPTIONS")
    if [ "$PREVIOUS_SEARCH_DIRS" != "$SEARCH_DIRS" ] || 
       [ "$PREVIOUS_SEARCH_DIRS_MASK" != "$SEARCH_DIRS_MASK" ] || 
       [ "$PREVIOUS_LD_LIBRARY_MASK" != "$LD_LIBRARY_MASK" ] || 
       [ "$PREVIOUS_OPTIONS" != "$CALLED_OPTIONS" ] 
    then
        echo
        echo "Environment mismatch from previous run, deleting temporary files..."
        rm -f ${LIST}*
    fi
fi

# Log our environment
echo "SEARCH_DIRS="$SEARCH_DIRS"" > $LIST.0_env
echo "SEARCH_DIRS_MASK="$SEARCH_DIRS_MASK"" >> $LIST.0_env
echo "LD_LIBRARY_MASK="$LD_LIBRARY_MASK"" >> $LIST.0_env
echo "CALLED_OPTIONS="$CALLED_OPTIONS"" >> $LIST.0_env
echo "EMERGE_OPTIONS="$EMERGE_OPTIONS"" >> $LIST.0_env

if $EXTRA_VERBOSE
then
    echo
    echo "revdep-rebuild environment:"
    cat $LIST.0_env
fi

echo
echo "Checking reverse dependencies..."
echo

echo
echo -n -e "${GR}Collecting system binaries and libraries...${NO}"

if [ -f $LIST.1_files ]
then
    echo " using existing $LIST.1_files."
else
    # Be safe and remove any extraneous temporary files
    rm -f ${LIST}.[1-9]_*

    set_trap "$LIST.1_*"

    find $SEARCH_DIRS -type f ( -perm +u+x -o -name '*.so' -o -name '*.so.*' ) 2>/dev/null | sort | uniq >$LIST.0_files

    # Remove files that match SEARCH_DIR_MASK
    for dir in $SEARCH_DIRS_MASK
    do
        grep -v "^$dir" $LIST.0_files > $LIST.1_files
        mv $LIST.1_files $LIST.0_files
    done
    
    mv $LIST.0_files $LIST.1_files
    echo -e " done.n  ($LIST.1_files)"
fi

if $SEARCH_BROKEN ; then
    echo
    echo -n -e "${GR}Collecting complete LD_LIBRARY_PATH...${NO}"
    if [ -f $LIST.2_ldpath ] ; then
        echo " using existing $LIST.2_ldpath."
    else
        set_trap "$LIST.2_ldpath"
        # Ensure that the "trusted" lib directories are at the start of the path
        (
            echo /lib* /usr/lib* | sed 's/ /:/g'
            sed '/^#/d;s/#.*$//' </etc/ld.so.conf
            sed 's:/[^/]*$::' <$LIST.1_files | sort -ru
        ) | tr 'n' : | tr -d 'r' | sed 's/:$//' >$LIST.2_ldpath
        echo -e " done.n  ($LIST.2_ldpath)"
    fi
    export COMPLETE_LD_LIBRARY_PATH="$(cat $LIST.2_ldpath)"
fi

echo
echo -n -e "${GR}Checking dynamic linking$WORKING_TEXT...${NO}"
if [ -f $LLIST.3_rebuild ] ; then
    echo " using existing $LLIST.3_rebuild."
else
    echo_v
    set_trap "$LLIST.3_rebuild"
    LD_MASK="\(    $(echo "$LD_LIBRARY_MASK" | sed 's/./\./g;s/ / \|    /g') \)"
    echo -n >$LLIST.3_rebuild
    cat $LIST.1_files | while read FILE ; do
    # Note: double checking seems to be faster than single
    # with complete path (special add ons are rare).
    if ldd "$FILE" 2>/dev/null | grep -v "$LD_MASK" | $SONAME_GREP -q "$SONAME_SEARCH" ; then
        if $SEARCH_BROKEN ; then
            if LD_LIBRARY_PATH="$COMPLETE_LD_LIBRARY_PATH" ldd "$FILE" 2>/dev/null | grep -v "$LD_MASK" | $SONAME_GREP -q "$SONAME_SEARCH" ; then
                # FIX: I hate duplicating code
                # Only build missing direct dependencies
                ALL_MISSING_LIBS=$(ldd "$FILE" 2>/dev/null | sort -u | sed -n 's/    (.*) => not found$/1/p' | tr 'n' ' ' | sed 's/ $//' )
                REQUIRED_LIBS=$(objdump -x $FILE | grep NEEDED | awk '{print $2}' | tr 'n' ' ' | sed 's/ $//')
                MISSING_LIBS=""
                for lib in $ALL_MISSING_LIBS
                do
                    if echo $REQUIRED_LIBS | grep -q $lib
                    then
                        MISSING_LIBS="$MISSING_LIBS $lib"
                    fi
                done
                if [ "$MISSING_LIBS" != "" ]
                then
                    echo "$FILE" >>$LLIST.3_rebuild
                    echo_v "  broken $FILE (requires ${MISSING_LIBS})"
                fi
            fi
        else
            # FIX: I hate duplicating code
            # Only rebuild for direct dependencies
            ALL_MISSING_LIBS=$(ldd "$FILE" 2>/dev/null | sort -u | $SONAME_GREP "$SONAME_SEARCH" | awk '{print $1}' | tr 'n' ' ' | sed 's/ $//' )
            REQUIRED_LIBS=$(objdump -x $FILE | grep NEEDED | awk '{print $2}' | tr 'n' ' ' | sed 's/ $//')
            MISSING_LIBS=""
            for lib in $ALL_MISSING_LIBS
            do
                if echo $REQUIRED_LIBS | grep -q $lib
                then
                    MISSING_LIBS="$MISSING_LIBS $lib"
                fi
            done
            if [ "$MISSING_LIBS" != "" ]
            then
                echo "$FILE" >>$LLIST.3_rebuild
                echo_v "  found $FILE"
            fi
        fi
    fi
    done
    echo -e " done.n  ($LLIST.3_rebuild)"
fi

if $PACKAGE_NAMES ; then
    EXACT_EBUILDS=false

else
    EXACT_EBUILDS=true

fi

trap - SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM

if [ -z "$REBUILD_LIST" ] ; then
    echo -e "n${GR}$OK_TEXT... All done.${NO} "
    if [ ! $KEEPTEMP ]
    then
        rm $LIST.[0-2]_*
        rm $LLIST.[3-9]_*
    fi
    exit 0
fi
exit 0

Offline

#2 2008-03-27 02:39:39

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: revdep-rebuild = find broken libs

I've taken revdep-rebuild and converted it for Arch & Pacman, as findbrokenpkgs.

It highlights libgphoto2 2.4.0-5 as broken, because of this line in the libgphoto2 pkgbuild:

rm -f ${startdir}/pkg/usr/lib/*.la

I'm very tempted to raise that as a bug in the libgphoto2 pkgbuild - any feedback? smile

Offline

#3 2008-03-27 04:48:11

Sigi
Member
From: Thurgau, Switzerland
Registered: 2005-09-22
Posts: 1,131

Re: revdep-rebuild = find broken libs

<snip>
  /usr/lib/libgphoto2_port/0.8.0/disk.la -> 2.4.0-5
  /usr/lib/libgphoto2_port/0.8.0/ptpip.la -> 2.4.0-5
  /usr/lib/libgphoto2_port/0.8.0/serial.la -> 2.4.0-5
  /usr/lib/libgphoto2_port/0.8.0/usb.la -> 2.4.0-5
 done.
  (/home/sigi/.findbrokenpkgs.4_*)

Cleaning list of packages to rebuild... done.
  (/home/sigi/.findbrokenpkgs.5_packages)

To recompile:
0.5.5-1 1.1.10-1 1.4-1 2.22.0-1 2.4.0-5 2.4.4-3 26453-1 5.2.5-8

I tried it. Thanks so far for your effort.
Shouldn't this report the package names as well?

Cheers Sigi


Haven't been here in a while. Still rocking Arch. smile

Offline

#4 2008-03-27 04:57:07

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: revdep-rebuild = find broken libs

Looks like a language problem.

$ pacman -Qo /usr/bin/pacman | awk '{print $5 " " $6}'
pacman 3.1.3-1

Offline

#5 2008-03-27 05:07:11

Sigi
Member
From: Thurgau, Switzerland
Registered: 2005-09-22
Posts: 1,131

Re: revdep-rebuild = find broken libs

$ pacman -Qo /usr/bin/pacman | awk '{print $5 " " $6}'
3.1.3-1 enthalten

You're right. It works if I export LANG...


Haven't been here in a while. Still rocking Arch. smile

Offline

#6 2008-03-27 05:21:41

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: revdep-rebuild = find broken libs

Will this always show in English?

LANG=C pacman -Qo /usr/bin/pacman

From:  locale -a

Offline

#7 2008-03-27 05:29:40

Sigi
Member
From: Thurgau, Switzerland
Registered: 2005-09-22
Posts: 1,131

Re: revdep-rebuild = find broken libs

I think so.


Haven't been here in a while. Still rocking Arch. smile

Offline

#8 2008-03-27 05:47:01

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: revdep-rebuild = find broken libs

OK, I've updated findbrokenpkgs with LC_ALL=C - seems to work on my little test, after I set:

$ export | grep UTF
declare -x LANG="de_BE.UTF-8"
declare -x LC_ALL="de_BE.UTF-8"

Please grab version 0.2 from AUR wink

Last edited by brebs (2008-03-27 05:47:53)

Offline

#9 2008-03-27 07:56:41

el mariachi
Member
Registered: 2007-11-30
Posts: 595

Re: revdep-rebuild = find broken libs

To recompile:
avahi flac gimp libgphoto2 qt sox

what do i do now? what does this really mean?

Offline

#10 2008-03-27 10:01:01

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: revdep-rebuild = find broken libs

Take a look at /usr/bin/findbrokenpkgs - dynamic library files which are expected to exist because they are *needed* by an executable/library, are missing. This can usually be fixed simply by recompiling the affected packages, to point them at the library files which *do* exist.

Dunno how Arch Linux has existed without such a checker, because such breakage occurs often, when libraries increment their soname. revdep-rebuild is an essential program in Gentoo. Binary distro users are spoiled rotten by having the recompilations done for them wink

Example:

ldd /usr/lib/libalpm.so
objdump -p /usr/lib/libalpm.so

Last edited by brebs (2008-03-27 10:02:52)

Offline

#11 2008-03-27 10:33:47

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: revdep-rebuild = find broken libs

To recompile:
alsa-plugins amarok-base flac gimp gimp-ufraw gnumeric kdemod-kdepim-base kdemod-kdepim-kaddressbook kdemod-kdepim-kontact kofficemod-common kofficemod-kword libgphoto2 php qt sox tor trickle xine-lib

Jesus Christ, this is quite heavy! Damn!

Offline

#12 2008-03-27 10:37:17

el mariachi
Member
Registered: 2007-11-30
Posts: 595

Re: revdep-rebuild = find broken libs

so this is more oriented at the people that compile the packages for arch right?

Offline

#13 2008-03-27 11:30:38

aRcHaTe
Member
Registered: 2006-10-24
Posts: 646

Re: revdep-rebuild = find broken libs

el mariachi wrote:

so this is more oriented at the people that compile the packages for arch right?

not quite..its to have look at the consistincy of the system...for example i also had alsa-plugins from arch official repo..and it reported me as broken....


Its a sick world we live in....

Offline

#14 2008-03-27 11:32:21

el mariachi
Member
Registered: 2007-11-30
Posts: 595

Re: revdep-rebuild = find broken libs

so what have you done to fix? compiled it yourself?

Offline

#15 2008-03-27 11:35:43

AndyRTR
Developer
From: Magdeburg/Germany
Registered: 2005-10-07
Posts: 1,641

Re: revdep-rebuild = find broken libs

brebs wrote:

Dunno how Arch Linux has existed without such a checker, because such breakage occurs often, when libraries increment their soname.

ever checked our lddd.sh from the devtools? it has been in our cvs for a long time. but your script seems to run much faster.

Offline

#16 2008-03-27 11:41:41

aRcHaTe
Member
Registered: 2006-10-24
Posts: 646

Re: revdep-rebuild = find broken libs

el mariachi wrote:

so what have you done to fix? compiled it yourself?

take a good guess man tongue of cross if you can recompile great...if not ur screwd tongue just like this one beautiful pkgbuild tongue

-march=i686 -mtune=generic -O2 -pipe -shared -Wall -Werror -licuuc -lssl flashsupport.c -o libflashsupport.so
./PKGBUILD: line 18: -march=i686: command not found


Its a sick world we live in....

Offline

#17 2008-03-27 12:12:05

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: revdep-rebuild = find broken libs

AndyRTR wrote:

lddd.sh from the devtools

Interesting. lddd raises the following warning, which seems to be a false alarm:

$ ldd /usr/lib/xulrunner-1.8.1.12/libgtkembedmoz.so | grep xpcom
    libxpcom.so => not found

$ objdump -x /usr/lib/xulrunner-1.8.1.12/libgtkembedmoz.so | grep NEEDED | grep xp
  NEEDED      libxpcom.so
  
$ find /usr/lib -name libxpcom\*
/usr/lib/xulrunner-1.8.1.12/libxpcom.so

findbrokenpkgs treats this dependency as *found* rather than missing, because of its long colon-delimited $COMPLETE_LD_LIBRARY_PATH, which includes:

/usr/lib/xulrunner-1.8.1.12

Offline

#18 2008-03-27 13:22:16

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: revdep-rebuild = find broken libs

If it's both faster and more accurate than lddd, probably the developers will be interested by it smile


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#19 2008-03-27 13:53:12

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: revdep-rebuild = find broken libs

I've reported libgphoto2, to grab attention and hopefully fix the exception smile

Offline

#20 2008-03-27 14:21:59

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: revdep-rebuild = find broken libs

I think there should be some warning for people that don't quite understand what's going on, that it's OK for some packages to be reported as "broken", like amarok-base, flac, gnumeric, php, vlc, xine-lib, ... since they are compiled with optional support of some stuff *if* the correct libs are present. If they are not, then the programs still run fine, except they refer to libs which are not present.

Offline

#21 2008-03-27 15:05:59

aRcHaTe
Member
Registered: 2006-10-24
Posts: 646

Re: revdep-rebuild = find broken libs

it keeps teeling me audacious-plugins needs to be recompiled..and i already did it tongue
/usr/lib/audacious/Input/amidi-plug/ap-fluidsynth.so needs missing libfluidsynth.so.1
  /usr/lib/audacious/Visualization/projectm.so needs missing libprojectM.so.0


Its a sick world we live in....

Offline

#22 2008-03-27 15:21:24

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: revdep-rebuild = find broken libs

aRcHaTe wrote:

missing libfluidsynth.so.1

Use the ldd and objdump commands to see for yourself easily, as I mentioned above.

$ find /usr/lib -name libfluid\*
/usr/lib/libfluidsynth.so.1
/usr/lib/libfluidsynth.so.1.1.2
/usr/lib/libfluidsynth.so
/usr/lib/libfluidsynth.a

Here's my /usr/local/sbin/compilepkg so people can see what "recompile the package" means - run it from within /var/abs/local/pkgname/

#!/bin/bash

# Posted at http://bbs.archlinux.org/viewtopic.php?pid=347363#p347363

if [[ -n ${1} ]] ; then
    pkgname=${1}
else
    pkgname=$(basename ${PWD})
fi

# Fix for tedious permissions problems
cd /var/abs/local/ && chown root:root * && chmod -s *

cd /var/abs/local/${pkgname}/ || exit 1
# Sets gnome-terminal title
echo -n -e "\e]0;make ${pkgname}\a"
rm -rf src pkg && chown root:root * && chmod -s * && makepkg -fi --asroot
if [ $? -gt 0 ] ; then
    # Reset gnome-terminal title
    echo -n -e "\e]0;${pkgname} failed\a"
    exit 1
fi

# Find the correct pkg to check
f=$(ls -t *.pkg.tar.gz | head -n 1)
[[ -n ${f} ]] && namcap ${f}
namcap PKGBUILD

# Check .desktop files, if any
# http://freedesktop.org/wiki/Specifications/desktop-entry-spec
fl=$(ls -t *.desktop 2>/dev/null | head -n 1)
for f in $fl ; do
    desktop-file-validate --warn-kde ${f}
done

# Reset gnome-terminal title
echo -n -e "\e]0;Terminal\a"

Edit:  Added 2 echos, to set & reset the gnome-terminal title.

Last edited by brebs (2008-04-01 22:23:13)

Offline

#23 2008-03-27 15:56:29

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: revdep-rebuild = find broken libs

bender02 wrote:

I think there should be some warning for people that don't quite understand what's going on, that it's OK for some packages to be reported as "broken", like amarok-base, flac, gnumeric, php, vlc, xine-lib, ... since they are compiled with optional support of some stuff *if* the correct libs are present. If they are not, then the programs still run fine, except they refer to libs which are not present.

That's right, I got quite a few outputs but there were all normals. People have to figure that themselves, this is more a dev tool anyway (at least on a binary distrib)


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#24 2008-03-27 16:08:28

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: revdep-rebuild = find broken libs

shining wrote:

That's right, I got quite a few outputs but there were all normals. People have to figure that themselves, this is more a dev tool anyway (at least on a binary distrib)

Yea, but you know... once it's on the forum, there *will* be more people trying it and wasting watts on recompiling smile

Offline

#25 2008-03-27 16:17:42

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: revdep-rebuild = find broken libs

bender02 wrote:

I think there should be some warning for people that don't quite understand what's going on

I'll just add a link to this thread. The program cannot be expected to explain the subtleties of optional vs needed dynamic library linking. What would it say? "This could be right, or it could be wrong. Whaddyawannado?" wink

AFAICT, there's no way for the program to distinguish between "needed" and "optional" dependencies. If anyone knows a way, I'd love to hear it. So, it can only report the problems it sees.

The thing is, every distro screws up occasionally, and one of the ways they screw up is with the dependencies that this tool checks. Which makes this a useful tool. What's the usual response from the Arch devs? Use abs and compile yourself. And if you're using Testing/Unstable, or not doing a full update every time, you're on your own. They use that response, because it's the correct response. Individual users should be having some responsibility over their "linking". Users wouldn't last a month in Gentoo without such a responsibility.

Arch isn't a binary distro, it's a core of binary packages with lots of do-it-yourself packages in the AUR. I reckon that's the reality, for the sort of people who would be using/attracted to this distro. I mean, who on Earth wants crappy fonts when they can compile cairo-ubuntu? (shameless plug)

Last edited by brebs (2008-03-27 16:19:51)

Offline

Board footer

Powered by FluxBB