summaryrefslogtreecommitdiff
path: root/cron-jobs
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-11-20 21:29:47 +0100
committerPierre Schmitz <pierre@archlinux.de>2010-11-20 21:29:47 +0100
commita2cdd819ed32cd4ccfefab2c2ce0ead118f9772d (patch)
tree70733eaa05cb29e7c3be64f11243e7d881c27c63 /cron-jobs
parent7edb6b55cbacbc32c0234026df38401a60561dc7 (diff)
sourceballs: Lock the repo while reading the db file
Diffstat (limited to 'cron-jobs')
-rwxr-xr-xcron-jobs/sourceballs13
1 files changed, 10 insertions, 3 deletions
diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs
index 1add36e..351b06d 100755
--- a/cron-jobs/sourceballs
+++ b/cron-jobs/sourceballs
@@ -21,9 +21,16 @@ for repo in ${PKGREPOS[@]}; do
warning "DB file does not exist: ${dbfile}"
continue
fi
- for pkg in $(bsdtar -xOf "${dbfile}" \
- | awk '/^%NAME%/{getline b};/^%BASE%/{getline b};/^%VERSION%/{getline v};/^%ARCH%/{printf "%s/%s\n", b, v}' \
- | sort -u); do
+
+ repo_lock ${repo} ${arch} || exit 1
+ # Read packages from db file
+ # Format is: <pkgbase|pkgname>/<pkgver>-<pkgrel>
+ pkgs=($(bsdtar -xOf "${dbfile}" \
+ | awk '/^%NAME%/{getline b};/^%BASE%/{getline b};/^%VERSION%/{getline v};/^%ARCH%/{printf "%s/%s ", b, v}' \
+ | sort -u))
+ repo_unlock ${repo} ${arch}
+
+ for pkg in ${pkgs[@]}; do
pkgbase=${pkg%/*}
pkgver=${pkg#*/}
srcpkg="${pkgbase}-${pkgver}${SRCEXT}"