2023-05-16 19:50:18 +02:00
|
|
|
#!/usr/bin/env -S nix shell nixpkgs#gawk nixpkgs#git nixpkgs#gnused nixpkgs#moreutils nixpkgs#jq nixpkgs#ripgrep -c bash
|
2022-12-24 01:20:02 +01:00
|
|
|
|
|
|
|
set -ex
|
2022-06-01 00:52:34 +02:00
|
|
|
|
2022-06-01 23:08:03 +02:00
|
|
|
# get wlroots revision from submodule
|
2022-12-24 01:20:02 +01:00
|
|
|
SUB_REV=$(git submodule status | rg wlroots | awk '{ print substr($1,2)}')
|
2022-06-01 23:08:03 +02:00
|
|
|
# and from lockfile
|
2023-04-10 13:53:50 +02:00
|
|
|
CRT_REV=$(jq <flake.lock '.nodes.wlroots.locked.rev' -r)
|
2022-06-01 23:08:03 +02:00
|
|
|
|
2023-04-10 13:53:50 +02:00
|
|
|
if [ "$SUB_REV" != "$CRT_REV" ]; then
|
|
|
|
# update inputs to latest versions
|
|
|
|
nix flake update
|
2022-06-01 23:42:05 +02:00
|
|
|
|
2022-06-01 23:08:03 +02:00
|
|
|
# update wlroots to submodule revision
|
2022-06-22 22:23:46 +02:00
|
|
|
nix flake lock --override-input wlroots "gitlab:wlroots/wlroots/$SUB_REV?host=gitlab.freedesktop.org"
|
2022-06-01 00:52:34 +02:00
|
|
|
|
2022-06-01 23:08:03 +02:00
|
|
|
# remove "dirty" mark from lockfile
|
2023-04-10 13:53:50 +02:00
|
|
|
jq <flake.lock 'del(.nodes.wlroots.original.rev)' | sponge flake.lock
|
2023-05-16 19:50:18 +02:00
|
|
|
|
|
|
|
# fix revision in wlroots.wrap
|
2023-06-15 16:19:28 +02:00
|
|
|
sed -Ei "s/[a-z0-9]{40}/$SUB_REV/g" subprojects/wlroots.wrap
|
2022-06-01 23:08:03 +02:00
|
|
|
else
|
|
|
|
echo "wlroots is up to date!"
|
|
|
|
fi
|