8 t-select-package pari-extra
14 local mpat="$1"; shift
15 t-expect-push-fail "$mpat" \
23 if diff $tmp/show-refs.{pre,post}-push >$tmp/show-refs.diff; then
24 fail "no refs updated"
31 cp $tmp/masters/* $tmp/.
32 tag_signer='-u Senatus'
33 tag_message="$p release $version for $suite ($csuite) [dgit]"
37 tag_name=$tagpfx/$version
38 push_spec1="HEAD:refs/dgit/$csuite"
39 push_spec2="refs/tags/$tag_name"
40 push_spec="$push_spec1 $push_spec2"
44 git tag -f $tag_signer -m "$tag_message" $tag_name "$@"
48 cp $tmp/d[dm].* $tmp/masters
55 mustfail 'missing signature' $push_spec
57 git cat-file tag $tag_name >goodtag
59 for h in object type tag; do
60 for how in missing dupe; do
63 missing) perl -pe 's/^tag /wombat$&/ if 1..m/^$/' <goodtag >badtag ;;
64 dupe) perl -pe 'print if 1..m/^$/ and m/^'$h' /' <goodtag >badtag ;;
68 gpg --detach-sign --armor -u Senatus badtag
69 cat badtag.asc >>badtag
72 LC_MESSAGES=C git hash-object -w -t tag badtag >badtag.hash 2>badtag.err
76 if [ $rc = 128 ] && grep 'fatal: corrupt tag' badtag.err; then
78 elif [ $rc != 0 ]; then
80 fail "could not make tag"
83 read <badtag.hash badtag
84 git update-ref refs/tags/$tag_name $badtag
86 mustfail 'multiple headers '$h' in signed tag object' $push_spec
91 tag_message='something'
93 mustfail 'tag message not in expected format' $push_spec
97 mustfail 'sid != sponge' HEAD:refs/dgit/sponge $push_spec2
99 # fixme test --sig-policy-url string
100 # fixme cannot test reject "signature is not of type 00!";
104 mustfail 'push is missing tag ref update' $push_spec1
105 mustfail 'push is missing head ref update' +$push_spec2
106 mustfail 'pushing unexpected ref' $push_spec HEAD:refs/wombat
107 mustfail 'pushing multiple heads' $push_spec HEAD:refs/dgit/wombat
108 mustfail E:'pushing multiple tags|pushing too many similar tags' \
109 $push_spec HEAD:refs/tags/$tagpfx/wombat
113 echo woody >$tmp/suites
114 mustfail 'unknown suite' $push_spec
115 cp $root/tests/suites $tmp/.
118 # or reject "command string not understood";
119 # reject "unknown method" unless $mainfunc;
124 cp $tmp/dm.gpg $tmp/dd.gpg
125 mustfail 'key not found in keyrings' $push_spec
129 mustfail 'tag refers to wrong commit' $push_spec
133 mustfail 'tag refers to wrong kind of object' $push_spec
136 tag_name=$tagpfx/wombat
138 #git update-ref $tagpfx/$version $tagpfx/wombat
139 mustfail 'tag name in tag is wrong' \
140 refs/tags/$tagpfx/wombat:refs/tags/$tagpfx/$version $push_spec1
144 mustsucceed $push_spec # succeeds
147 mustfail 'push is missing head ref update' $push_spec1 +$push_spec2
149 git commit --allow-empty -m 'Dummy update'
151 mustfail 'not replacing previously-pushed version' +$push_spec1 +$push_spec2
156 mustfail 'not replacing previously-pushed version' +$push_spec1 +$push_spec2
158 git reset --hard HEAD~
163 next unless m/^fingerprint: 3A82860837A0CD32/i../^$/;
164 ' -e "$1" $tmp/dm.txt
165 tag_signer='-u Populus'
169 git commit --amend --message 'Make it not a fast forward'
173 mustfail 'not fast forward on dgit branch' +$push_spec1 +$push_spec2
179 perl -i.bak -ne 'print if 1..s/(pari-extra).*\n/$1/' $tmp/dm.txt
180 mustfail '' $push_spec # malformed (truncated) dm.txt; don't care about msg
182 prep_dm_mangle 's/allow:/asponge:/i'
183 mustfail 'missing Allow section in permission' $push_spec
185 prep_dm_mangle 's/\bpari-extra\b/sponge/i'
186 mustfail "package $p not allowed for key" $push_spec
188 prep_dm_mangle 'y/0-9/5-90-4/ if m/^fingerprint:/i'
189 mustfail "not in permissions list although in keyring" $push_spec
192 mustsucceed $push_spec # succeeds