chiark / gitweb /
Infra: Add dgit-repos-policy-trusting
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 May 2015 14:36:04 +0000 (15:36 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 May 2015 15:05:10 +0000 (16:05 +0100)
Also add the --deliberately-fresh-repo deliberately, both to the
manpage and to dgit's idea of non-fast-forward-ness.

Rename the dgit test only deliberatelies to start with TEST-dgit-only-
rather than having the -dgit-only at the end.

dgit
dgit.1
infra/dgit-repos-policy-trusting [new file with mode: 0755]
tests/tests/debpolicy-newreject

diff --git a/dgit b/dgit
index c315c7f..65bc10f 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -165,8 +165,9 @@ sub deliberately ($) {
 }
 
 sub deliberately_not_fast_forward () {
 }
 
 sub deliberately_not_fast_forward () {
-    deliberately('not-fast-forward') ||
-       deliberately('TEST-not-fast-forward-dgit-only');
+    foreach (qw(not-fast-forward fresh-repo)) {
+       return 1 if deliberately($_) || deliberately("TEST-dgit-only-$_");
+    }
 }
 
 #---------- remote protocol support, common ----------
 }
 
 #---------- remote protocol support, common ----------
diff --git a/dgit.1 b/dgit.1
index 35a0922..ed4c6b1 100644 (file)
--- a/dgit.1
+++ b/dgit.1
@@ -278,6 +278,11 @@ option after verifying that: none of the rejected-from-NEW (or
 never-accepted) versions in the git history of your current push, were
 rejected by ftpmaster for copyright or redistributability reasons.
 .TP
 never-accepted) versions in the git history of your current push, were
 rejected by ftpmaster for copyright or redistributability reasons.
 .TP
+.BR --deliberately-fresh-repo
+Declare that you are deliberately rewinding history and want to
+throw away the existing repo.  Not relevant when pushing to Debian,
+as the Debian server will do this automatically when necessary.
+.TP
 .BR --quilt=linear
 When fixing up source format `3.0 (quilt)' metadata, insist on
 generating a linear patch stack.  If such a stack cannot be generated,
 .BR --quilt=linear
 When fixing up source format `3.0 (quilt)' metadata, insist on
 generating a linear patch stack.  If such a stack cannot be generated,
diff --git a/infra/dgit-repos-policy-trusting b/infra/dgit-repos-policy-trusting
new file mode 100755 (executable)
index 0000000..b550d01
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/bash
+set -e
+
+case "$DGIT_DRS_DEBUG" in
+''|0)  exec 3>/dev/null        ;;
+1)     exec 3>&2               ;;
+*)     exec 3>&2;      set -x  ;;
+esac
+
+distro=$1      ; shift
+reposdir=$1    ; shift
+livedir=$1     ; shift
+distrodir=$1   ; shift
+action=$1      ; shift
+
+echo >&3 "dgit-repos-policy-trusting: action=$action"
+
+case "$action" in
+push|push-confirm)     ;;
+*) exit 0              ;;
+esac
+
+package=$1     ; shift
+version=$1     ; shift
+suite=$1       ; shift
+tagname=$1     ; shift
+delibs=$1      ; shift
+
+bitmask=0
+
+policyflags () {
+       perl -e 'use Debian::Dgit qw(:policyflags); print '$1',"\n"'
+}
+
+set -e
+
+case "$action//,$delibs," in
+push//*,--deliberately-fresh-repo,*)
+       bitmask=$(( bitmask | `policyflags 'NOFFCHECK|FRESHREPO'` ))
+       ;;
+push//*,--deliberately-not-fast-forward,*)
+       bitmask=$(( bitmask | `policyflags 'NOFFCHECK'` ))
+       ;;
+esac
+
+exit $bitmask
index c1192d1..b2bf6be 100755 (executable)
@@ -70,7 +70,7 @@ t-expect-fail "HEAD is not a descendant of the archive's version" \
 t-dgit push
 
 t-expect-fail "Package is in NEW and has not been accepted or rejected yet" \
 t-dgit push
 
 t-expect-fail "Package is in NEW and has not been accepted or rejected yet" \
-t-dgit --deliberately-TEST-not-fast-forward-dgit-only push
+t-dgit --deliberately-TEST-dgit-only-not-fast-forward push
 
 t-dgit --deliberately-not-fast-forward push
 
 
 t-dgit --deliberately-not-fast-forward push