]> git.ozlabs.org Git - next-scripts/blob - make_tree_file
do_build: stop a failing "kill" from killing the whole here-script
[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                         [ "$type" = "branch" ] && continue
34                         tab="\t"
35                         [ ${#name} -le 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 for i in quilt-import.log merge.log; do
44         grep -v '^Checking out files:' ../$i >Next/$i
45 done
46
47 printf -- "-next-%s\n" $d >localversion-next
48
49 git add Next localversion-next
50 git commit -s -v -a -m "Add linux-next specific files for $d"
51 git tag -u $gpg_key -m "$n" "$n"
52
53 git branch -f stable refs/remotes/origin/master
54
55 p="patch-$l-$n"
56 git diff-tree -p "$l.." >"../$p"
57 gpg -u $kup_gpg_key -a -b "../$p"
58
59 oldest=$(date --date "3 months ago" '+%Y%m%d')
60 echo "Removing old releases ... <= next-$oldest"
61
62 old_tags=$(git tag -l 'next-*[0-9]' |
63         awk -F - '$2 ~ /^[0-9]*$/ && $2 <= '$oldest' { printf("next-%s\n", $2); }')
64
65 [ "$old_tags" ] && git tag -d $old_tags
66
67 echo Pushing to korg ...
68 git push --prune korg
69
70 echo Pushing to korg-history ...
71 git push korg-history
72
73 echo Pushing to history
74 git push history
75
76 echo Pushing patch to kernel.org ...
77 cd ..
78 xz -v -9 "$p"
79 kup put "$p.xz" "$p.asc" "/pub/linux/kernel/next/$p.gz"
80
81 ssh -O exit git@gitolite.kernel.org
82
83 exit 0