]> git.ozlabs.org Git - next-scripts/blob - make_tree_file
make_tree_file: add 2fa for gitolite.kernel.org
[next-scripts] / make_tree_file
1 #!/bin/bash
2
3 . "$(dirname $0)/common.sh"
4
5 # Don't do releases in the wee hours :-)
6 h=$(date '+%k')
7 (( "$h" < 10 && "$h" > 4 )) && {
8         echo "Go back to bed" 1>&2
9         exit 1
10 }
11
12 eval $(gpg-agent --daemon --enable-ssh-support)
13 ssh-add ~/.ssh/ra.kernel.org
14
15 if ! ssh git@gitolite.kernel.org 2fa isval; then
16         read -r -p "Yubikey token: " tok
17         ssh git@gitolite.kernel.org 2fa val $tok
18 fi
19
20 # This means I get the right tag if I finish after midnight
21 d=$(date --date "5 hours ago" '+%Y%m%d')
22 l="$(git describe --match "v*" --abbrev=0)"
23 n="next-$d"
24
25 mkdir Next
26
27 echo 'Trees included into this release:
28
29 Name            Type    URL
30 ----            ----    ---' > Next/Trees
31
32 (
33 IFS='   '
34 while read email type name url ref build; do
35         [[ "$email" =~ '^#.*$' ]] && continue
36         tab="\t"
37         [ $(echo "$name" | wc -c) -le 8 ] && tab="\t\t"
38         [ "${ref%:*}" = "${ref}" ] || ref=${ref##*:}
39         [ "$type" = "git" ] && url="$url#$ref"
40         printf "%s$tab%s\t%s\n" $name $type $url >>Next/Trees
41 done <$CTRL_FILE
42 )
43
44 mv ../SHA1s Next/SHA1s
45
46 for i in quilt-import.log merge.log; do
47         grep -v '^Checking out files:' ../$i >Next/$i
48 done
49
50 printf -- "-next-%s\n" $d >localversion-next
51
52 git add Next localversion-next
53 git commit -s -v -a -m "Add linux-next specific files for $d"
54 git tag -u 41D5C07A -m "$n" "$n"
55
56 git branch -f stable refs/remotes/origin/master
57
58 p="patch-$l-$n"
59 git diff-tree -p "$l.." >"../$p"
60 gpg2 -u 41D5C07A -a -b "../$p"
61 #echo "$l" > "../LATEST-IS-$n"
62
63 "$bin_dir/make_abat_scripts" "$d" "$l"
64
65 oldest=$(date --date "3 months ago" '+%Y%m%d')
66 echo "Removing old releases ... <= next-$oldest"
67
68 old_tags=$(git ls-remote --tags korg next-\* |
69         awk -F - '$2 ~ /^[0-9]*$/ && $2 <= '$oldest' { printf("next-%s\n", $2); }')
70
71 [ "$old_tags" ] && git push korg --delete $old_tags
72
73 echo Pushing to korg ...
74 git push korg
75
76 echo Pushing to korg-history ...
77 git push korg-history
78
79 echo Pushing to history
80 git push history
81
82 echo Pushing patch to kernel.org ...
83 cd ..
84 xz -v -9 "$p"
85 kup --host=kup.kernel.org put "$p.xz" "$p.asc" "/pub/linux/kernel/next/$p.gz"
86
87 ssh-agent -k
88
89 exit 0