chiark
/
gitweb
/
~ianmdlvl
/
dgit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dgit: Introduce archive_query_prepend_mirror
[dgit.git]
/
infra
/
dgit-mirror-rsync
diff --git
a/infra/dgit-mirror-rsync
b/infra/dgit-mirror-rsync
index e73d9a5bcf982fd109902973a4f310f843bf7c67..0d29ffb3e65621b3fec1f468bd0d64c5d90f3772 100755
(executable)
--- a/
infra/dgit-mirror-rsync
+++ b/
infra/dgit-mirror-rsync
@@
-26,11
+26,24
@@
set -o pipefail
shopt -s nullglob
case "$DGIT_DRS_DEBUG" in
shopt -s nullglob
case "$DGIT_DRS_DEBUG" in
-''|0
!
1) ;;
+''|0
|
1) ;;
*) set -x ;;
esac
*) set -x ;;
esac
+fail () {
+ echo >&2 "dgit-mirror-rsync: $*"; exit 127
+}
+
+if [ $# -lt 2 ]; then fail "too few arguments"; fi
+
self=$0
self=$0
+
+case "$self" in
+/*) ;;
+*/*) self="$PWD/$self" ;;
+*) ;;
+esac
+
distrodir=$1; shift
action=$1; shift
package=$1
distrodir=$1; shift
action=$1; shift
package=$1
@@
-54,10
+67,6
@@
rsyncssh='ssh -o batchmode=yes'
cd $repos
queue=_mirror-queue
cd $repos
queue=_mirror-queue
-fail () {
- echo >&2 "dgit-mirror-rsync: $*"; exit 127
-}
-
case "$remoterepos" in
*:/*|/*) ;;
'') fail "remoterepos config not set" ;;
case "$remoterepos" in
*:/*|/*) ;;
'') fail "remoterepos config not set" ;;
@@
-77,7
+86,7
@@
reinvoke () {
exec \
"$@" \
exec \
"$@" \
- "$
0"
"$distrodir" "reinvoke$newaction" "$package"
+ "$
self"
"$distrodir" "reinvoke$newaction" "$package"
}
check-package-mirrorable () {
}
check-package-mirrorable () {
@@
-96,13
+105,17
@@
lock-and-process () {
}
attempt () {
}
attempt () {
- exec >"$queue/$package.err" 2>&1
+ exec
3>&2
>"$queue/$package.err" 2>&1
if actually; then
if actually; then
- rm "$queue/$package.a"
+ rm -f "$queue/$package.a"
+ exec 2>&3 2>&1
mv -f "$queue/$package.err" "$queue/$package.log"
mv -f "$queue/$package.err" "$queue/$package.log"
+ if ! [ -s "$queue/$package.log" ]; then
+ rm "$queue/$package.log"
+ fi
rm "$queue/$package.lock"
else
rm "$queue/$package.lock"
else
- cat >&
2
"$queue/$package.err"
+ cat >&
3
"$queue/$package.err"
exit 127
fi
}
exit 127
fi
}
@@
-137,13
+150,13
@@
reinvoke-locked)
backlog)
for f in $queue/*.[na]; do
backlog)
for f in $queue/*.[na]; do
- lock-and-process-baseof-f
+ (lock-and-process-baseof-f ||:)
done
;;
all)
for f in [a-z0-9]*.git; do
done
;;
all)
for f in [a-z0-9]*.git; do
- lock-and-process-baseof-f
+ (lock-and-process-baseof-f)
done
;;
done
;;