summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db-functions4
-rwxr-xr-xdb-move25
-rwxr-xr-xdb-update32
-rwxr-xr-xtesting2x15
4 files changed, 50 insertions, 26 deletions
diff --git a/db-functions b/db-functions
index 1f54dd9..015f254 100644
--- a/db-functions
+++ b/db-functions
@@ -151,8 +151,8 @@ repo_lock () {
while [ $_count -le $_trial ] || $_lockblock ; do
if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then
_owner="$(/usr/bin/stat -c %U $LOCKDIR)"
- warning "Repo [${1}] (${2}) is already locked by $_owner. " \
- "Retrying in $LOCK_DELAY seconds..."
+ warning "Repo [${1}] (${2}) is already locked by $_owner. "
+ msg2 "Retrying in $LOCK_DELAY seconds..."
else
LOCKS[${#LOCKS[*]}]="$1.$2"
set_umask
diff --git a/db-move b/db-move
index ae98958..a274cd3 100755
--- a/db-move
+++ b/db-move
@@ -18,24 +18,37 @@ if ! check_repo_permission $repo_to || ! check_repo_permission $repo_from; then
die "You don't have permission to move packages from ${repo_from} to ${repo_to}"
fi
+# TODO: this might lock too much (architectures)
+for pkgarch in ${ARCHES[@]}; do
+ repo_lock ${repo_to} ${pkgarch} || exit 1
+ repo_lock ${repo_from} ${pkgarch} || exit 1
+done
+
+# check if packages to be moved exist in svn and ftp dir
/usr/bin/svn checkout -q -N "${SVNREPO}" "${WORKDIR}/svn" >/dev/null
for pkgbase in ${args[@]:2}; do
/usr/bin/svn up -q "${WORKDIR}/svn/${pkgbase}" >/dev/null
for pkgarch in ${ARCHES[@]} 'any'; do
svnrepo_from="${WORKDIR}/svn/${pkgbase}/repos/${repo_from}-${pkgarch}"
if [ -r "${svnrepo_from}/PKGBUILD" ]; then
+ pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo ${pkgname[@]}))
+ pkgver=$(. "${svnrepo_from}/PKGBUILD"; echo "${pkgver}-${pkgrel}")
+ 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
+ done
+ done
continue 2
fi
done
die "${pkgbase} not found in ${repo_from}"
done
-# TODO: this might lock too much (architectures)
-for pkgarch in ${ARCHES[@]}; do
- repo_lock ${repo_to} ${pkgarch} || exit 1
- repo_lock ${repo_from} ${pkgarch} || exit 1
-done
-
msg "Moving packages from [${repo_from}] to [${repo_to}]..."
declare -A add_pkgs
diff --git a/db-update b/db-update
index 73897f3..b11face 100755
--- a/db-update
+++ b/db-update
@@ -11,43 +11,39 @@ fi
# Find repos with packages to release
repos=($(find "${STAGING}" -mindepth 1 -type d ! -empty -printf '%f ' 2>/dev/null))
if [ $? -ge 1 ]; then
- error "Could not read ${STAGING}"
- exit 1
+ die "Could not read ${STAGING}"
fi
+# TODO: this might lock too much (architectures)
+for repo in ${repos[@]}; do
+ for pkgarch in ${ARCHES[@]}; do
+ repo_lock ${repo} ${pkgarch} || exit 1
+ done
+done
+
+# check if packages are valid
for repo in ${repos[@]}; do
if ! check_repo_permission "${repo}"; then
- error "You don't have permission to update packages in ${repo}"
- exit 1
+ die "You don't have permission to update packages in ${repo}"
fi
pkgs=($(getpkgfiles "${STAGING}/${repo}/"*${PKGEXT}))
if [ $? -eq 0 ]; then
for pkg in ${pkgs[@]}; do
if ! check_pkgfile "${pkg}"; then
- error "Package ${repo}/$(basename ${pkg}) is not consistent with its meta data"
- exit 1
+ die "Package ${repo}/$(basename ${pkg}) is not consistent with its meta data"
fi
if ! check_pkgsvn "${pkg}" "${repo}"; then
- error "Package ${repo}/$(basename ${pkg}) is not consistent with svn repository"
- exit 1
+ die "Package ${repo}/$(basename ${pkg}) is not consistent with svn repository"
fi
if [ -f "${FTP_BASE}/$(get_pkgpool_for_host)/$(basename ${pkg})" ]; then
- error "Package ${repo}/$(basename pkg) already exists in ${FTP_BASE}/$(get_pkgpool_for_host)"
- exit 1
+ die "Package ${repo}/$(basename pkg) already exists in ${FTP_BASE}/$(get_pkgpool_for_host)"
fi
done
else
- exit 1
+ die "Could not read ${STAGING}"
fi
done
-# TODO: this might lock too much (architectures)
-for repo in ${repos[@]}; do
- for pkgarch in ${ARCHES[@]}; do
- repo_lock ${repo} ${pkgarch} || exit 1
- done
-done
-
for repo in ${repos[@]}; do
msg "Updating [${repo}]..."
any_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-any${PKGEXT} 2>/dev/null))
diff --git a/testing2x b/testing2x
index 83b12fa..54cae11 100755
--- a/testing2x
+++ b/testing2x
@@ -8,6 +8,13 @@ if [ $# -lt 1 ]; then
exit 1
fi
+# Lock everything to reduce possibility of interfering task between the different repo-updates
+script_lock
+for repo in 'core' 'extra' 'testing'; do
+ for pkgarch in ${ARCHES[@]}; do
+ repo_lock ${repo} ${pkgarch} || exit 1
+ done
+done
declare -A pkgs
@@ -39,8 +46,16 @@ for pkgbase in $*; do
fi
done
+for pkgarch in ${ARCHES[@]}; do
+ repo_unlock 'testing' ${pkgarch}
+done
for repo in 'core' 'extra'; do
+ for pkgarch in ${ARCHES[@]}; do
+ repo_unlock ${repo} ${pkgarch}
+ done
if [ -n "${pkgs[${repo}]}" ]; then
"$(dirname $0)/db-move" 'testing' "${repo}" ${pkgs[${repo}]}
fi
done
+
+script_unlock