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