chiark / gitweb /
exit status: Document in changelog.
[dgit.git] / infra / dgit-repos-policy-trusting
1 #!/bin/bash
2 #
3 # This is a genuine policy, not just one for testing.
4 #
5 # It allows anyone authorised to push to also, on demand:
6 #   - wipe the repo and replace it with a new one
7 #     (with --deliberately-fresh-repo)
8 #   - do non-fast-forward pushes
9 #     (with --deliberately-not-fast-forward)
10
11 set -e
12
13 case "$DGIT_DRS_DEBUG" in
14 ''|0)   exec 3>/dev/null        ;;
15 1)      exec 3>&2               ;;
16 *)      exec 3>&2;      set -x  ;;
17 esac
18
19 distro=$1       ; shift
20 reposdir=$1     ; shift
21 livedir=$1      ; shift
22 distrodir=$1    ; shift
23 action=$1       ; shift
24
25 echo >&3 "dgit-repos-policy-trusting: action=$action"
26
27 case "$action" in
28 push|push-confirm)      ;;
29 *) exit 0               ;;
30 esac
31
32 package=$1      ; shift
33 version=$1      ; shift
34 suite=$1        ; shift
35 tagname=$1      ; shift
36 delibs=$1       ; shift
37
38 bitmask=0
39
40 policyflags () {
41         perl -e '
42                 use Debian::Dgit::Infra;
43                 use Debian::Dgit qw(:policyflags); print '$1',"\n"
44         '
45 }
46
47 set -e
48
49 case "$action//,$delibs," in
50 push//*,--deliberately-fresh-repo,*)
51         bitmask=$(( bitmask | `policyflags 'NOFFCHECK|FRESHREPO'` ))
52         ;;
53 push//*,--deliberately-not-fast-forward,*)
54         bitmask=$(( bitmask | `policyflags 'NOFFCHECK'` ))
55         ;;
56 esac
57
58 exit $bitmask