yum leaving multiple versions installed

Jim Cornette fct-cornette at insight.rr.com
Sun Feb 5 20:36:55 UTC 2006


Steve Grubb wrote:
> 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
> 
> 

Steve,
This version works great for me but has the effect that Ville mentioned. 
I was having troubles with lines wrapping so I added the \ to prevent 
the breaking up when the script was pasted.
Thanks! This works fine and is valuable to fine dupes and also the 
feature to show version information for multiple version packages is 
very valuable. I did have the below output for no duplicates found.

No duplicate entries outputs:
~/find-dupes-sgmv.sh
rpmq: no arguments given for query
rpmq: no arguments given for query

Removing kernel from exclusions outputs:
[jim at cornette-lt ~]$ ~/find-dupes-sgmv.sh
Duplicates were found:
kernel-2.6.15-1.1895_FC5
kernel-2.6.15-1.1907_FC5

Adding an x to the end of gpg-pubkey shows:
[jim at cornette-lt ~]$ ~/find-dupes-sgmv.sh
Duplicates were found:
gpg-pubkey-1ac70ce6-41bebeef
gpg-pubkey-a109b1ec-3f6e28d5

Thanks!
Jim

----
#!/bin/sh

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

# 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

-- 
The person who can smile when something goes wrong has thought of
someone to blame it on.




More information about the fedora-test-list mailing list