]> git.ozlabs.org Git - next-scripts/blob - make_tree_file
update to_build_host a bit
[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 tag -l --sort=taggerdate 'v*' | tail -n 1)
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                         [ "$type" = "branch" ] && continue
34                         tab="\t"
35                         [ ${#name} -lt 8 ] && tab="\t\t"
36                         [ "$type" = "git" ] && url="$url#${ref##*:}"
37                         printf "%s$tab%s\t%s\n" $name $type $url
38                 done
39 ) >Next/Trees
40
41 mv ../SHA1s Next/SHA1s
42
43 grep -v '^Checking out files:' ../merge.log >Next/merge.log
44
45 printf -- "-next-%s\n" $d >localversion-next
46
47 git add Next localversion-next
48 git commit -s -v -a -m "Add linux-next specific files for $d"
49 git tag -u $gpg_key -m "$n" "$n"
50
51 git branch -f stable refs/remotes/origin/master
52
53 p="patch-$l-$n"
54 git diff-tree -p "$l.." >"../$p"
55 gpg -u $kup_gpg_key -a -b "../$p"
56
57 oldest=$(date --date "3 months ago" '+%Y%m%d')
58 echo "Removing old releases ... <= next-$oldest"
59
60 old_tags=$(git tag -l 'next-*[0-9]' |
61         awk -F - '$2 ~ /^[0-9]*$/ && $2 <= '$oldest' { printf("next-%s\n", $2); }')
62
63 [ "$old_tags" ] && git tag -d $old_tags
64
65 echo Pushing to korg ...
66 git push --prune korg
67
68 echo Pushing to korg-history ...
69 git push korg-history
70
71 echo Pushing to history
72 git push history
73
74 echo Pushing patch to kernel.org ...
75 cd ..
76 xz -v -9 "$p"
77 kup put "$p.xz" "$p.asc" "/pub/linux/kernel/next/$p.gz"
78
79 ssh -O exit git@gitolite.kernel.org
80
81 exit 0