summaryrefslogtreecommitdiff
path: root/dgit-repos-server
diff options
context:
space:
mode:
Diffstat (limited to 'dgit-repos-server')
-rw-r--r--dgit-repos-server42
1 files changed, 33 insertions, 9 deletions
diff --git a/dgit-repos-server b/dgit-repos-server
index 0cbcf35..51160be 100644
--- a/dgit-repos-server
+++ b/dgit-repos-server
@@ -2,8 +2,8 @@
# dgit-repos-push-receiver
#
# usages:
-# .../dgit-repos-push-receiver KEYRING-AUTH-SPEC DGIT-REPOS-DIR --ssh
-# .../dgit-repos-push-receiver KEYRING-AUTH-SPEC DGIT-REPOS-DIR PACKAGE
+# .../dgit-repos-push-receiver SUITES KEYRING-AUTH-SPEC DGIT-REPOS-DIR --ssh
+# .../dgit-repos-push-receiver SUITES KEYRING-AUTH-SPEC DGIT-REPOS-DIR PACKAGE
# internal usage:
# .../dgit-repos-push-receiver --pre-receive-hook PACKAGE
#
@@ -11,6 +11,9 @@
#
# Works like git-receive-pack
#
+# SUITES is the name of a file which lists the permissible suites
+# one per line (#-comments and blank lines ignored)
+#
# KEYRING-AUTH-SPEC is a :-separated list of
# KEYRING.GPG,AUTH-SPEC
# where AUTH-SPEC is one of
@@ -56,12 +59,29 @@ use strict;
# (because such a thing causes git-fetch-pack to barf). So then we
# do as above, except:
# - before starting, we take out our own lock for the destination repo
-# - we don't make a hardline clone of the destination repo; instead
-# we make a copy (not a hardlink clone) of _template
-# - we set up a post-receive hook as well, which does the following:
-# + check that exactly two refs were updated
-# + delete the two stunt hooks
-# + rename the working repo into place as the destination repo
+# - we create a prospective new destination repo by making a copy
+# of _template
+# - we use the prospective new destination repo instead of the
+# actual new destination repo (since the latter doesn't exist)
+# - we set up a post-receive hook as well, which
+# + checks that exactly two refs were updated
+# + touches a stamp file
+# - after git-receive-pack exits, we rename the prospective
+# destination repo into place
+#
+# Cleanup strategy:
+# - We are crash-only
+# - Temporary working trees and their locks are cleaned up
+# opportunistically by a program which tries to take each lock and
+# if successful deletes both the tree and the lockfile
+# - Prospective working trees and their locks are cleaned up by
+# a program which tries to take each lock and if successful
+# deletes any prospective working tree and the lock (but not
+# of course any actual tree)
+# - It is forbidden to _remove_ the lockfile without removing
+# the corresponding temporary tree, as the lockfile is also
+# a stampfile whose presence indicates that there may be
+# cleanup to do
use POSIX;
use Fcntl qw(:flock);
@@ -318,10 +338,14 @@ sub parseargs () {
exit 0;
}
- die unless @ARGV>=2;
+ die unless @ARGV>=3;
+
+ die if $ARGV[0] =~ m/^-/;
+ $suitesfile = shift @ARGV;
die if $ARGV[0] =~ m/^-/;
$ENV{'DGIT_RPR_KEYRINGS'} = shift @ARGV;
+
die if $ARGV[0] =~ m/^-/;
$dgitrepos = shift @ARGV;