summaryrefslogtreecommitdiff
path: root/archbuild.in
diff options
context:
space:
mode:
authorJan Alexander Steffens (heftig) <jan.steffens@gmail.com>2013-05-02 07:03:12 +0200
committerJan Alexander Steffens (heftig) <jan.steffens@gmail.com>2013-05-03 04:34:29 +0200
commita7a05deb37b3db6aa3606f488467f621c40ce32d (patch)
tree3091e3cdfc4abb0c73c9199d5c54b6fdfbe5f1d4 /archbuild.in
parent0e98bd8c485b2c55c3971823f99a13c41b1ed696 (diff)
downloaddevtools-a7a05deb37b3db6aa3606f488467f621c40ce32d.tar.xz
lib/common.sh: Introduce locking helper functions
Reduces code duplication. With makechrootpkg not calling mkarchroot anymore, the lock handover protocol is unneeded. arch-nspawn does not do any locking, so add protection to archbuild.
Diffstat (limited to 'archbuild.in')
-rw-r--r--archbuild.in8
1 files changed, 2 insertions, 6 deletions
diff --git a/archbuild.in b/archbuild.in
index 7872cd4..9f1b98a 100644
--- a/archbuild.in
+++ b/archbuild.in
@@ -51,12 +51,7 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
[[ -d $copy ]] || continue
msg2 "Deleting chroot copy '$(basename "${copy}")'..."
- exec 9>"$copydir.lock"
- if ! flock -n 9; then
- stat_busy "Locking chroot copy '$copy'"
- flock 9
- stat_done
- fi
+ lock 9 "$copydir.lock" "Locking chroot copy '$copy'"
if [[ "$(stat -f -c %T "${copy}")" == btrfs ]]; then
{ type -P btrfs && btrfs subvolume delete "${copy}"; } &>/dev/null
@@ -73,6 +68,7 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
"${chroots}/${repo}-${arch}/root" \
"${base_packages[@]}" || abort
else
+ lock 9 "${chroots}/${repo}-${arch}/root.lock" "Locking clean chroot"
setarch ${arch} arch-nspawn \
-C "@pkgdatadir@/pacman-${repo}.conf" \
-M "@pkgdatadir@/makepkg-${arch}.conf" \