]> git.ozlabs.org Git - next-scripts/blob - make_tree_file
make_tree_file: cope with the changes in gpg2
[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 # allow kisskb to use more of ka2
13 ssh $build_host /usr/local/bin/set-kisskb-jfactor 48
14
15 ssh-add -t 600 $ssh_key_file || exit 1
16
17 if ! ssh git@gitolite.kernel.org 2fa isval; then
18         read -r -p "Yubikey token: " tok
19         ssh git@gitolite.kernel.org 2fa val $tok
20 fi
21
22 # This means I get the right tag if I finish after midnight
23 d=$(date --date "5 hours ago" '+%Y%m%d')
24 l="$(git describe --match "v*" --abbrev=0)"
25 n="next-$d"
26
27 mkdir Next
28
29 (
30         cat <<-'EOF'
31         Trees included into this release:
32
33         Name            Type    URL
34         ----            ----    ---
35         EOF
36
37         IFS='   '
38         grep -v '^#' $CTRL_FILE |
39                 while read email type name url ref build; do
40                         tab="\t"
41                         [ ${#name} -le 8 ] && tab="\t\t"
42                         [ "$type" = "git" ] && url="$url#${ref##*:}"
43                         printf "%s$tab%s\t%s\n" $name $type $url
44                 done
45 ) >Next/Trees
46
47 mv ../SHA1s Next/SHA1s
48
49 for i in quilt-import.log merge.log; do
50         grep -v '^Checking out files:' ../$i >Next/$i
51 done
52
53 printf -- "-next-%s\n" $d >localversion-next
54
55 git add Next localversion-next
56 git commit -s -v -a -m "Add linux-next specific files for $d"
57 git tag -u $gpg_key -m "$n" "$n"
58
59 git branch -f stable refs/remotes/origin/master
60
61 p="patch-$l-$n"
62 git diff-tree -p "$l.." >"../$p"
63 gpg -u $gpg_key -a -b "../$p"
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-*[0-9]' |
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 exit 0