diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2010-08-17 20:32:47 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2010-08-17 20:32:47 +0200 |
commit | 17c9dab4b420ca55fd4fb3f277805af148159a4d (patch) | |
tree | bf48b576e2d7886713d4e01cd7b2feccfc3aed2e | |
parent | a2b3b2bb2bde44289d41b956dde1f5bca61e581b (diff) | |
download | dbscripts-17c9dab4b420ca55fd4fb3f277805af148159a4d.tar.gz dbscripts-17c9dab4b420ca55fd4fb3f277805af148159a4d.tar.xz |
Add additional checks when reading PKGBUILDs
If reading from a PKGBUILD fails stop immediatly. Also put out more usefull error messages.
-rw-r--r-- | db-functions | 1 | ||||
-rwxr-xr-x | db-move | 13 | ||||
-rwxr-xr-x | db-update | 2 |
3 files changed, 13 insertions, 3 deletions
diff --git a/db-functions b/db-functions index a04dbf5..292e3ff 100644 --- a/db-functions +++ b/db-functions @@ -304,6 +304,7 @@ check_pkgsvn() { fi local pkgver="$(. "${WORKDIR}/pkgbuilds/${pkgbase}"; echo "${pkgver}-${pkgrel}")" + [ -z "${pkgver}" ] && return 1 if echo "$(basename ${pkgfile})" | grep -q "${pkgver}-${pkgarch}"; then return 0 else @@ -32,12 +32,21 @@ for pkgbase in ${args[@]:2}; do svnrepo_from="${WORKDIR}/svn/${pkgbase}/repos/${repo_from}-${pkgarch}" if [ -r "${svnrepo_from}/PKGBUILD" ]; then pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo ${pkgname[@]})) + if [ ${#pkgnames[@]} -lt 1 ]; then + die "Could not read pkgname" + fi + pkgver=$(. "${svnrepo_from}/PKGBUILD"; echo "${pkgver}-${pkgrel}") + if [ -z "${pkgver}" ]; then + die "Could not read pkgver" + fi + if [ "${pkgarch}" == 'any' ]; then tarches=(${ARCHES[@]}) else tarches=("${pkgarch}") fi + for pkgname in ${pkgnames[@]}; do for tarch in ${tarches[@]}; do getpkgfile "${ftppath_from}/${tarch}/"${pkgname}-${pkgver}-${pkgarch}${PKGEXT} >/dev/null @@ -98,9 +107,9 @@ done for tarch in ${ARCHES[@]}; do if [ -n "${add_pkgs[${tarch}]}" ]; then /usr/bin/repo-add -q "${ftppath_to}/${tarch}/${repo_to}${DBEXT}" ${add_pkgs[${tarch}]} >/dev/null \ - || die "Error in repo-add ${add_pkgs[${tarch}]}" + || error "repo-add ${tarch}/${repo_to}${DBEXT} ${add_pkgs[${tarch}]}" /usr/bin/repo-remove -q "${ftppath_from}/${tarch}/${repo_from}${DBEXT}" ${remove_pkgs[${tarch}]} >/dev/null \ - || die "Error in repo-remove ${remove_pkgs[${tarch}]}" + || error "repo-remove ${tarch}/${repo_from}${DBEXT} ${remove_pkgs[${tarch}]}" fi done @@ -63,7 +63,7 @@ for repo in ${repos[@]}; do if [ ${#add_pkgs[@]} -ge 1 ]; then pushd "$FTP_BASE/$repo/os/${pkgarch}" >/dev/null /usr/bin/repo-add -q "$repo$DBEXT" ${add_pkgs[@]} >/dev/null \ - || die "Could not add packages" + || die "repo-add $repo$DBEXT ${add_pkgs[@]}" popd >/dev/null fi done |