summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-08-17 20:32:47 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-08-17 20:32:47 +0200
commit17c9dab4b420ca55fd4fb3f277805af148159a4d (patch)
treebf48b576e2d7886713d4e01cd7b2feccfc3aed2e
parenta2b3b2bb2bde44289d41b956dde1f5bca61e581b (diff)
downloaddbscripts-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-functions1
-rwxr-xr-xdb-move13
-rwxr-xr-xdb-update2
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
diff --git a/db-move b/db-move
index a274cd3..5ffb8bc 100755
--- a/db-move
+++ b/db-move
@@ -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
diff --git a/db-update b/db-update
index dd8d1c0..68450b4 100755
--- a/db-update
+++ b/db-update
@@ -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