[arch-general] Pacman Error: upgrading to same package version?again & again

clemens fischer ino-news at spotteswoode.dnsalias.org
Wed Feb 17 16:46:55 EST 2010


Gaurish Sharma wrote:

> On Tuesday 16 Feb 2010 6:31:52 pm Nagy Gabor wrote:
>
>> Check /var/lib/pacman/local/, you will probably find many duplicated
>> entries there. Then you should manually remove the older entries.
>>
>> (This is probably caused by backup or buggy third party scripts. Next
>> major pacman release will catch duplicated database entries and warn
>> the user.)
>
> Hi, you are right, there were duplicated entries(which I removed). I
> think which were caused while taking backups via rsync. I wonder, how
> could I advoid such problems in future.

I've got this little script:

#################################
#! /bin/bash
# /root/bin/arch-linux-local-dup-packages.sh _date: 20100217-2244_

iam="${0##*/}"
match="${1}"
ex=0
declare -A pkg_local
pkg_local_dir="/var/lib/pacman/local"
pkg=""
_pkg=""
pkg_name=""
pkg_entry=""

for pkg in "${pkg_local_dir}"/*
do
    _pkg="${pkg##*/}"
    pkg_name="${_pkg%-*-*}"
    pkg_entry=${pkg_local["${pkg_name}"]}
    [ -z "${pkg_entry}" ] && {
        pkg_local["${pkg_name}"]="${_pkg}"
        :
    } || {
        pkg_local["${pkg_name}"]="${pkg_entry} ${_pkg}"
        echo "${iam}: duplicate: ${pkg_local[${pkg_name}]}"
        ((ex++))
        :
    }
done

shopt -s extglob

[ -n "${match}" ] &&
for pkg in "${!pkg_local[@]}"
do
    pkg_entry=${pkg_local["${pkg}"]}
    [ -z "${pkg}" ] && {
        echo "${iam}: zero entry: ${pkg} -> ${pkg_entry}"
        ((ex++))
        continue
    }
    case "${pkg}" in
        ${match})
            echo "${iam}: match: ${pkg} -> ${pkg_entry}"
            ;;
    esac
    case "${pkg_entry}" in
        ${match})
            echo "${iam}: match: ${pkg} <- ${pkg_entry}"
            ;;
    esac
done

exit ${ex}
#################################



clemens



More information about the arch-general mailing list