]> git.ozlabs.org Git - next-scripts/blob - make_tree_file
make_tree_file: use session 2fa
[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 read -r -p "Yubikey token: " tok
13 ssh git@gitolite.kernel.org 2fa val-session $tok
14
15 # This means I get the right tag if I finish after midnight
16 d=$(date --date "5 hours ago" '+%Y%m%d')
17 l="$(git describe --match "v*" --abbrev=0)"
18 n="next-$d"
19
20 mkdir Next
21
22 (
23         cat <<-'EOF'
24         Trees included into this release:
25
26         Name            Type    URL
27         ----            ----    ---
28         EOF
29
30         IFS='   '
31         grep -v '^#' $CTRL_FILE |
32                 while read email type name url ref build; do
33                         tab="\t"
34                         [ ${#name} -le 8 ] && tab="\t\t"
35                         [ "$type" = "git" ] && url="$url#${ref##*:}"
36                         printf "%s$tab%s\t%s\n" $name $type $url
37                 done
38 ) >Next/Trees
39
40 mv ../SHA1s Next/SHA1s
41
42 for i in quilt-import.log merge.log; do
43         grep -v '^Checking out files:' ../$i >Next/$i
44 done
45
46 printf -- "-next-%s\n" $d >localversion-next
47
48 git add Next localversion-next
49 git commit -s -v -a -m "Add linux-next specific files for $d"
50 git tag -u $gpg_key -m "$n" "$n"
51
52 git branch -f stable refs/remotes/origin/master
53
54 p="patch-$l-$n"
55 git diff-tree -p "$l.." >"../$p"
56 gpg -u $gpg_key -a -b "../$p"
57
58 oldest=$(date --date "3 months ago" '+%Y%m%d')
59 echo "Removing old releases ... <= next-$oldest"
60
61 old_tags=$(git tag -l 'next-*[0-9]' |
62         awk -F - '$2 ~ /^[0-9]*$/ && $2 <= '$oldest' { printf("next-%s\n", $2); }')
63
64 [ "$old_tags" ] && git tag -d $old_tags
65
66 echo Pushing to korg ...
67 git push --prune korg
68
69 echo Pushing to korg-history ...
70 git push korg-history
71
72 echo Pushing to history
73 git push history
74
75 echo Pushing patch to kernel.org ...
76 cd ..
77 xz -v -9 "$p"
78 kup put "$p.xz" "$p.asc" "/pub/linux/kernel/next/$p.gz"
79
80 exit 0