diff options
author | Laura Abbott <labbott@fedoraproject.org> | 2016-10-07 13:59:14 -0700 |
---|---|---|
committer | Laura Abbott <labbott@fedoraproject.org> | 2016-10-10 16:50:38 -0700 |
commit | 2f50aa19db3b3de4c7fc03a6299fe54d3aa35552 (patch) | |
tree | 65d866eebaf71b8f80094790d1a2bdeeafefb992 /scripts/stable-update.sh | |
parent | da8efd59dbeb7d3912641d1543af457d14cdf5e3 (diff) | |
download | kernel-2f50aa19db3b3de4c7fc03a6299fe54d3aa35552.tar.gz kernel-2f50aa19db3b3de4c7fc03a6299fe54d3aa35552.tar.xz kernel-2f50aa19db3b3de4c7fc03a6299fe54d3aa35552.zip |
Add scripts for automatically generating builds
Many of the steps for day-to-day updates still require a lot of
manual steps which can lead to typos. Add a series of scripts to
make automate the manual steps and hopefully reduce errors. These
are a work in progress because having them in tree makes it easier
to work out issues.
Diffstat (limited to 'scripts/stable-update.sh')
-rwxr-xr-x | scripts/stable-update.sh | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/scripts/stable-update.sh b/scripts/stable-update.sh new file mode 100755 index 000000000..25f7f5ad6 --- /dev/null +++ b/scripts/stable-update.sh @@ -0,0 +1,74 @@ +#!/bin/sh +# +# Author: Laura Abbott <labbott@fedoraproject.org> +# +# Apply a stable patch update to the Fedora tree. This takes care of +# - Downloading the patch from kernel.org +# - Uploading the source file +# - Removing old patch files +# - Updating the spec file stable version +# - Adding a proper changelog entry +# +# Based on steps from https://fedoraproject.org/wiki/Kernel/DayToDay#Stable_kernel_update +# +# Args: Stable version to update (e.g. 4.7.7, 4.8.1) + +if [ $# -lt 1 ]; then + echo "Need a version" + exit 1 +fi + +VERSION=`echo $1 | cut -d . -f 1` +if [ -z $VERSION ]; then + echo "Malformed version $1" + exit 1 +fi +PATCHLEVEL=`echo $1 | cut -d . -f 2` +if [ -z $VERSION ]; then + echo "Malformed version $1" + exit 1 +fi +SUBLEVEL=`echo $1 | cut -d . -f 3` +if [ -z $VERSION ]; then + echo "Malformed version $1" + exit 1 +fi + +if [ ! -f patch-$1.xz ]; then + wget https://cdn.kernel.org/pub/linux/kernel/v4.x/patch-$1.xz + if [ ! $? -eq 0 ]; then + echo "Download fail" + exit 1 + fi +fi + +grep $1 sources &> /dev/null +if [ ! $? -eq 0 ]; then + fedpkg upload patch-$1.xz + + # Cryptic awk: search for the previous patch level (if one exists) and + # remove it from the source file + awk -v VER=$VERSION.$PATCHLEVEL.$((SUBLEVEL-1)) '$0 !~ VER { print $0; }' < sources > sources.tmp + mv sources.tmp sources +fi + +# Update the stable level +awk -v STABLE=$SUBLEVEL '/%define stable_update/ \ + { print "%define stable_update " STABLE } \ + !/%define stable_update/ { print $0 }' \ + < kernel.spec > kernel.spec.tmp +mv kernel.spec.tmp kernel.spec + +# Add the changelog entry. Ideally we would get rpmdev-bumpspec to do so +# but that also bumps the release which we don't want so do this manually +# for now + +BASERELEASE=`cat kernel.spec | grep "%global baserelease" | cut -d ' ' -f 3` +CURDATE=`date +"%a %b %d %Y"` +PACKAGER=`rpmdev-packager` +CHANGELOG="%changelog\n* $CURDATE $PACKAGER - $1\n- Linux v$1\n" + +awk -v CHANGE="$CHANGELOG" '/%changelog/ {print CHANGE } \ + !/%changelog/ { print $0 }' \ + < kernel.spec > kernel.spec.tmp +mv kernel.spec.tmp kernel.spec |