linux/update.sh: update linux-libre too

update-libre.sh doesn't commit by default so that it can be used as an
updateScript, where I don't think auto-committing is the norm.

The generated commit messages say "linux-libre_latest" rather than
"linux-libre", because even though linux-libre will also be rebuilt,
it's linux-libre_latest that is more likely to need it.
This commit is contained in:
Alyssa Ross 2019-12-16 04:25:42 +00:00
parent 821ff387da
commit 80a823eeca
3 changed files with 29 additions and 3 deletions

View file

@ -1,9 +1,6 @@
{ stdenv, lib, fetchsvn, linux
, scripts ? fetchsvn {
url = "https://www.fsfla.org/svn/fsfla/software/linux-libre/releases/branches/";
# Update this if linux_latest-libre fails to build.
# $ curl https://www.fsfla.org/svn/fsfla/software/linux-libre/releases/branches/ | grep -Eo 'Revision [0-9]+'
rev = "16794";
sha256 = "1lpaka4hs7yrpnrzfybd6radjylwvw2p4aly68pypykqs2srvm7j";
}

View file

@ -0,0 +1,26 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p nix-prefetch-svn git curl
set -euo pipefail
nixpkgs="$(git rev-parse --show-toplevel)"
path="$nixpkgs/pkgs/os-specific/linux/kernel/linux-libre.nix"
old_rev="$(grep -o 'rev = ".*"' "$path" | awk -F'"' '{print $2}')"
svn_url=https://www.fsfla.org/svn/fsfla/software/linux-libre/releases/branches/
rev="$(curl -s "$svn_url" | grep -Em 1 -o 'Revision [0-9]+' | awk '{print $2}')"
if [ "$old_rev" = "$rev" ]; then
echo "No updates for linux-libre"
exit 0
fi
sha256="$(QUIET=1 nix-prefetch-svn "$svn_url" "$rev" | tail -1)"
sed -i -e "s/rev = \".*\"/rev = \"$rev\"/" \
-e "s/sha256 = \".*\"/sha256 = \"$sha256\"/" "$path"
if [ -n "$COMMIT" ]; then
git commit -qm "linux-libre_latest: $old_rev -> $rev" "$path"
echo "Updated linux-libre_latest $old_rev -> $rev"
fi

View file

@ -57,3 +57,6 @@ ls $NIXPKGS/pkgs/os-specific/linux/kernel | while read FILE; do
echo "Updated $OLDVER -> $V"
done
# Update linux-libre
COMMIT=1 $NIXPKGS/pkgs/os-specific/linux/kernel/update-libre.sh