chiark / gitweb /
Infra: Add dgit-repos-policy-trusting
[dgit.git] / infra / dgit-repos-policy-trusting
1 #!/bin/bash
2 set -e
3
4 case "$DGIT_DRS_DEBUG" in
5 ''|0)   exec 3>/dev/null        ;;
6 1)      exec 3>&2               ;;
7 *)      exec 3>&2;      set -x  ;;
8 esac
9
10 distro=$1       ; shift
11 reposdir=$1     ; shift
12 livedir=$1      ; shift
13 distrodir=$1    ; shift
14 action=$1       ; shift
15
16 echo >&3 "dgit-repos-policy-trusting: action=$action"
17
18 case "$action" in
19 push|push-confirm)      ;;
20 *) exit 0               ;;
21 esac
22
23 package=$1      ; shift
24 version=$1      ; shift
25 suite=$1        ; shift
26 tagname=$1      ; shift
27 delibs=$1       ; shift
28
29 bitmask=0
30
31 policyflags () {
32         perl -e 'use Debian::Dgit qw(:policyflags); print '$1',"\n"'
33 }
34
35 set -e
36
37 case "$action//,$delibs," in
38 push//*,--deliberately-fresh-repo,*)
39         bitmask=$(( bitmask | `policyflags 'NOFFCHECK|FRESHREPO'` ))
40         ;;
41 push//*,--deliberately-not-fast-forward,*)
42         bitmask=$(( bitmask | `policyflags 'NOFFCHECK'` ))
43         ;;
44 esac
45
46 exit $bitmask