summaryrefslogtreecommitdiff
path: root/infra/dgit-repos-policy-trusting
blob: b550d012118e59f3c7633efb528c7a00bfafb79b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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