yum leaving multiple versions installed

Steve Grubb sgrubb at redhat.com
Sun Feb 5 18:29:22 UTC 2006


On Sunday 05 February 2006 12:54, Jim Cornette wrote:
> This addition would probably help prevent duplicates showing up on i386
> and 64-bit architectures. I get the below output but only have an i686.
> I guess those with 64 bit would need to try out the command to see what
> shows up.

Ok, I think I have something that works for everyone.
-Steve


#!/bin/sh

# Add any package here that is OK to have duplicates
dups="gpg-pubkey|kernel|kernel-devel"

# Test 1. Look for multiple versions of the same package
# We use # as a separator so that we can remove it later. # is not in any
# package name that I know of and that's the basis of using it.
list=`rpm -qa --queryformat "%{NAME}#%{ARCH}\n" | sort | uniq -c |  tr '#' ' ' 
| egrep -vw "$dups" | awk '$1 > 1 { print $2 } '`

if [ x"$list" != "x" ] ; then
        echo "Duplicates were found:"
        echo $list | xargs rpm -q
        exit 1
fi

# Test 2. Check for mismatched versions
list=`rpm -qa --queryformat "%{NAME}\n" | sort | uniq -c | egrep -vw $dups | 
awk '$1 == 2 { print $2 } '| xargs rpm -q --queryformat 
"%{NAME}-%{VERSION}-%{RELEASE}\n" | sort | uniq -c | awk '$1 == 1 { print 
$2 }' | xargs rpm -q --queryformat "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n"`

if [ x"$list" != "x" ] ; then
        echo "Version mismatches were found:"
        echo $list | tr ' ' '\n'
        exit 1
fi

exit 0




More information about the fedora-test-list mailing list