diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2010-12-02 18:06:45 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2010-12-02 18:06:45 +0100 |
commit | 6037b3e9aa414d94cd14b8c51b9b04be054c5e04 (patch) | |
tree | d13b294ee5cb4f2f755825d6af6e8e3b918c69cd /db-functions | |
parent | 69721f4e42fa296de2d5a568d07758888c354328 (diff) |
db-update: Fail if a set of split packages is incomplete
Diffstat (limited to 'db-functions')
-rw-r--r-- | db-functions | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/db-functions b/db-functions index 67a52aa..cb76e7a 100644 --- a/db-functions +++ b/db-functions @@ -198,9 +198,20 @@ getpkgbase() { _base="$(_grep_pkginfo "$1" "pkgbase")" if [ -z "$_base" ]; then getpkgname "$1" + else + echo "$_base" fi +} - echo "$_base" +issplitpkg() { + local _base + + _base="$(_grep_pkginfo "$1" "pkgbase")" + if [ -z "$_base" ]; then + return 1 + else + return 0 + fi } # Get the package name @@ -319,6 +330,51 @@ check_pkgsvn() { return 0 } +check_splitpkgs() { + local repo="${1}" + shift + local pkgfiles=(${@}) + local pkgfile + local pkgdir + local svnname + + mkdir -p "${WORKDIR}/check_splitpkgs/" + pushd "${WORKDIR}/check_splitpkgs" >/dev/null + + for pkgfile in ${pkgfiles[@]}; do + issplitpkg "${pkgfile}" || continue + local _pkgbase="$(getpkgbase ${pkgfile})" + local _pkgname="$(getpkgname ${pkgfile})" + local _pkgarch="$(getpkgarch ${pkgfile})" + mkdir -p "${repo}/${_pkgarch}/${_pkgbase}" + echo "${_pkgname}" >> "${repo}/${_pkgarch}/${_pkgbase}/staging" + + if [ ! -f "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" ]; then + mkdir -p "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}" + svn export -q "${SVNREPO}/${_pkgbase}/repos/${repo}-${_pkgarch}/PKGBUILD" \ + "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null + [ $? -ge 1 ] && return 1 + fi + + local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo ${pkgname[@]})) + for svnname in ${svnnames[@]}; do + echo "${svnname}" >> "${repo}/${_pkgarch}/${_pkgbase}/svn" + done + done + popd >/dev/null + + for pkgdir in "${WORKDIR}/check_splitpkgs/${repo}"/*/*; do + [ ! -d "${pkgdir}" ] && continue + sort -u "${pkgdir}/staging" -o "${pkgdir}/staging" + sort -u "${pkgdir}/svn" -o "${pkgdir}/svn" + if [ ! -z "$(comm -13 "${pkgdir}/staging" "${pkgdir}/svn")" ]; then + return 1 + fi + done + + return 0 +} + check_pkgrepos() { local pkgfile=$1 |