diff options
-rw-r--r-- | db-functions | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/db-functions b/db-functions index d9b38e2..f7699ff 100644 --- a/db-functions +++ b/db-functions @@ -288,28 +288,32 @@ check_pkgfile() { check_pkgsvn() { local pkgfile="${1}" - local pkgbase="$(getpkgbase $pkg)" + local _pkgbase="$(getpkgbase ${pkgfile})" [ $? -ge 1 ] && return 1 - local pkgarch="$(getpkgarch ${pkgfile})" + local _pkgname="$(getpkgname ${pkgfile})" + [ $? -ge 1 ] && return 1 + local _pkgver="$(getpkgver ${pkgfile})" + [ $? -ge 1 ] && return 1 + local _pkgarch="$(getpkgarch ${pkgfile})" [ $? -ge 1 ] && return 1 local repo="${2}" in_array "${repo}" ${PKGREPOS[@]} || return 1 - if [ ! -f "${WORKDIR}/pkgbuilds/${repo}/${pkgbase}" ]; then + if [ ! -f "${WORKDIR}/pkgbuilds/${repo}/${_pkgbase}" ]; then mkdir -p "${WORKDIR}/pkgbuilds/${repo}" - svn export -q "${SVNREPO}/${pkgbase}/repos/${repo}-${pkgarch}/PKGBUILD" \ - "${WORKDIR}/pkgbuilds/${repo}/${pkgbase}" >/dev/null + svn export -q "${SVNREPO}/${_pkgbase}/repos/${repo}-${_pkgarch}/PKGBUILD" \ + "${WORKDIR}/pkgbuilds/${repo}/${_pkgbase}" >/dev/null [ $? -ge 1 ] && return 1 fi - local pkgver="$(. "${WORKDIR}/pkgbuilds/${repo}/${pkgbase}"; echo "${pkgver}-${pkgrel}")" - [ -z "${pkgver}" ] && return 1 - if echo "$(basename ${pkgfile})" | grep -q "${pkgver}-${pkgarch}"; then - return 0 - else - return 1 - fi + local svnver="$(. "${WORKDIR}/pkgbuilds/${repo}/${_pkgbase}"; echo "${pkgver}-${pkgrel}")" + [ "${svnver}" == "${_pkgver}" ] || return 1 + + local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}/${_pkgbase}"; echo ${pkgname[@]})) + in_array "${_pkgname}" ${svnnames[@]} || return 1 + + return 0 } check_pkgrepos() { |