diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2010-08-14 20:15:50 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2010-08-14 20:15:50 +0200 |
commit | cdf17a4c4c83c1363a59fa688654276c3d807eae (patch) | |
tree | d46f88d11558362bc6e3ea90b5998a89eef541e9 /db-functions | |
parent | 27abfce26dc4f667fb4702db40acf27317ecfd9f (diff) |
Rewrite of db-update
* db-update now updates all repos with packages in its staging dirs
* sanity checks are performed before any repo is touched
* improved performance
* less code; easier to maintain
Diffstat (limited to 'db-functions')
-rw-r--r-- | db-functions | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/db-functions b/db-functions index 0c96913..16b5ad3 100644 --- a/db-functions +++ b/db-functions @@ -211,6 +211,18 @@ getpkgver() { echo "$_ver" } +getpkgarch() { + local _ver + + _ver="$(_grep_pkginfo "$1" "^arch")" + if [ -z "$_ver" ]; then + error "Package '$1' has no arch in the PKGINFO. Fail!" + exit 1 + fi + + echo "$_ver" +} + getpkgfile() { if [[ ${#} -ne 1 ]]; then error 'No canonical package found!' @@ -240,16 +252,40 @@ getpkgfiles() { echo ${@} } -#check_pkg_arch pkgfile arch -check_pkg_arch () { - local _arch - _arch="$(_grep_pkginfo "$1" "^arch")" +check_pkgfile() { + local pkgfile=$1 - if [ -z "$_arch" ]; then - error "Package '$1' has no arch in the PKGINFO. Fail!" + local pkgname="$(getpkgname ${pkgfile})" + [ $? -ge 1 ] && return 1 + local pkgver="$(getpkgver ${pkgfile})" + [ $? -ge 1 ] && return 1 + local pkgarch="$(getpkgarch ${pkgfile})" + [ $? -ge 1 ] && return 1 + + if echo "$(basename ${pkgfile})" | grep -q "${pkgname}-${pkgver}-${pkgarch}"; then + return 0 + else return 1 fi - if [ "$_arch" = "$2" ]; then +} + +check_pkgsvn() { + local pkgfile="${1}" + local pkgbase="$(getpkgbase $pkg)" + [ $? -ge 1 ] && return 1 + local pkgarch="$(getpkgarch ${pkgfile})" + [ $? -ge 1 ] && return 1 + local repo="${2}" + + if [ ! -f "${WORKDIR}/pkgbuilds/${pkgbase}" ]; then + mkdir -p "${WORKDIR}/pkgbuilds" + svn export -q "${SVNREPO}/${pkgbase}/repos/${repo}-${pkgarch}/PKGBUILD" \ + "${WORKDIR}/pkgbuilds/${pkgbase}" >/dev/null + [ $? -ge 1 ] && return 1 + fi + + local pkgver="$(. "${WORKDIR}/pkgbuilds/${pkgbase}"; echo "${pkgver}-${pkgrel}")" + if echo "$(basename ${pkgfile})" | grep -q "${pkgver}-${pkgarch}"; then return 0 else return 1 |