From 6f29ee2f02c2a8e2991599ce1d76a59b58a7ee67 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 5 Sep 2010 13:32:27 +0200 Subject: Check if package exists in any other repository on update This also checks if the sam package exists within the old package layout (without package pool) --- db-functions | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'db-functions') diff --git a/db-functions b/db-functions index 4ac282a..4081d54 100644 --- a/db-functions +++ b/db-functions @@ -312,6 +312,31 @@ check_pkgsvn() { fi } +check_pkgrepos() { + local pkgfile=$1 + + local pkgname="$(getpkgname ${pkgfile})" + [ $? -ge 1 ] && return 1 + local pkgver="$(getpkgver ${pkgfile})" + [ $? -ge 1 ] && return 1 + + if [ -f "${FTP_BASE}/$(get_pkgpool_for_host)/${pkgname}-${pkgver}-"*${PKGEXT} ]; then + return 1 + fi + + local repo + local arch + for repo in $(get_repos_for_host); do + for arch in ${ARCHES[@]}; do + if [ -f "${FTP_BASE}/${repo}/os/${arch}/${pkgname}-${pkgver}"*${PKGEXT} ]; then + return 1 + fi + done + done + + return 0 +} + get_repos_for_host() { if [ -n "${PKGREPO[$(hostname -s)]}" ]; then echo "${PKGREPO[$(hostname -s)]}" -- cgit v1.2.3-24-g4f1b