#!/bin/bash . "$(dirname $0)/common.sh" # Don't do releases in the wee hours :-) h=$(date '+%k') (( "$h" < 10 && "$h" > 4 )) && { echo "Go back to bed" 1>&2 exit 1 } read -r -p "Yubikey token: " tok ssh git@gitolite.kernel.org 2fa val-session $tok # This means I get the right tag if I finish after midnight d=$(date --date "5 hours ago" '+%Y%m%d') l=$(git tag -l --sort=taggerdate 'v*' | tail -n 1) n="next-$d" mkdir Next ( cat <<-'EOF' Trees included into this release: Name Type URL ---- ---- --- EOF IFS=' ' grep -v '^#' $CTRL_FILE | while read email type name url ref build; do [ "$type" = "branch" ] && continue tab="\t" [ ${#name} -lt 8 ] && tab="\t\t" [ "$type" = "git" ] && url="$url#${ref##*:}" printf "%s$tab%s\t%s\n" $name $type $url done ) >Next/Trees mv ../SHA1s Next/SHA1s grep -v '^Checking out files:' ../merge.log >Next/merge.log printf -- "-next-%s\n" $d >localversion-next git add Next localversion-next git commit -s -v -a -m "Add linux-next specific files for $d" git tag -u $gpg_key -m "$n" "$n" git branch -f stable refs/remotes/origin/master p="patch-$l-$n" git diff-tree -p "$l.." >"../$p" gpg -u $kup_gpg_key -a -b "../$p" oldest=$(date --date "3 months ago" '+%Y%m%d') echo "Removing old releases ... <= next-$oldest" old_tags=$(git tag -l 'next-*[0-9]' | awk -F - '$2 ~ /^[0-9]*$/ && $2 <= '$oldest' { printf("next-%s\n", $2); }') [ "$old_tags" ] && git tag -d $old_tags echo Pushing to korg ... git push --prune korg echo Pushing to korg-history ... git push korg-history echo Pushing to history git push history echo Pushing patch to kernel.org ... cd .. xz -v -9 "$p" kup put "$p.xz" "$p.asc" "/pub/linux/kernel/next/$p.gz" ssh -O exit git@gitolite.kernel.org exit 0