yum leaving multiple versions installed
Steve Grubb
sgrubb at redhat.com
Mon Feb 6 15:34:59 UTC 2006
On Monday 06 February 2006 07:15, Jim Cornette wrote:
> I tried out your latest script with the -vw option and it matched
> anything with kernel within it.
Sorry, all my machines' rpm databases are screwed up in some way and never got
it to run without complaining. New version below should be fine.
> For test 2, what are you searching for?
When you type "yum update rpm" on an x86_64 machine for example, it does not
pull in neon for i386, it only grabs the x86_64 package. So, I have
neon-0.24.7-10.1.i386 and neon-0.25.5-1.x86_64 on my system. This is not the
way I want my system to be. Both versions should match.
-Steve
#!/bin/sh
# Add any package here that is OK to have duplicates
dups="gpg-pubkey kernel kernel-devel kernel-smp kernel-smp-devel"
# This function removes any word that matches the dups above
filter() {
while [ $# -ge 1 ]
do
skip=0
for d in $dups
do
if [ "$1" = "$d" ] ; then
skip=1
break
fi
done
if [ $skip -eq 0 ] ; then
echo $1
fi
shift
done
}
# Test 1. Look for multiple versions of the same package. This can occur
# when something prevents yum/rpm from completing an upgrade.
# 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 '#' ' ' | awk '$1 > 1 { print $2 } '`
list2=`filter $list`
if [ x"$list2" != "x" ] ; then
echo "Duplicates were found:"
echo $list2 | xargs rpm -q
exit 1
fi
# Test 2. Check for mismatched versions. This can occur on a multilib system
# when yum does not upgrade both x86_64 and i386 packages at the same time.
# Get all packages with 2 entries
list=`rpm -qa --queryformat "%{NAME}\n" | sort | uniq -c | \
awk '$1 == 2 { print $2 }'`
list2=`filter $list`
if [ x"$list2" = "x" ] ; then
exit 0
fi
# Of those, see which ones only have 1 version of the package
list=`echo $list2 | tr ' ' '\n' | xargs rpm -q --queryformat \
"%{NAME}-%{VERSION}-%{RELEASE}\n" | sort | uniq -c | \
awk '$1 == 1 { print $2 }'`
if [ x"$list" = "x" ] ; then
exit 0
fi
echo "Version mismatches were found:"
for l in $list
do
rpm -q --queryformat "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" $l
done
exit 1
More information about the fedora-test-list
mailing list