diff options
author | Davide Depau | 2020-04-11 18:16:31 +0200 |
---|---|---|
committer | Davide Depau | 2020-04-11 18:16:31 +0200 |
commit | 6b3e2021c60ad85e41f44d1b22c62df6820d8ae6 (patch) | |
tree | 1001d2c181fab08560dccdd24bbaffe70e3a8b08 /update-depends.sh | |
parent | 361cc6c3947f7def5a94c52eda764ae2c2b41494 (diff) | |
download | aur-6b3e2021c60ad85e41f44d1b22c62df6820d8ae6.tar.gz |
Add script to update dependencies from CI config
Diffstat (limited to 'update-depends.sh')
-rwxr-xr-x | update-depends.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/update-depends.sh b/update-depends.sh new file mode 100755 index 000000000000..61fcef6dc0d2 --- /dev/null +++ b/update-depends.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# This script reads the CI config from xdg-desktop-portal-wlr's git repo +# and updates depends/makedepends accordingly in the PKGBUILD. +# It updates the PKGBUILD in place. + +# The script must be run from the PKGBUILD directory and it assumes that +# the sources are located in ./src/xdg-desktop-portal-wlr-git + +yml="$(cat src/xdg-desktop-portal-wlr-git/.build.yml | sed 's/ *- //g')" + +# Dumb-parse yaml file and get the "packages" section +pkgs="${yml##*packages:}" +pkgs="${pkgs%%sources*}" + +depends="wlroots" +makedepends="git" + +function move_to_makedepends() { + local pkg="$1" + pkgs="${pkgs//$pkg}" + makedepends="$makedepends $pkg" +} + +# Remove the compilers since they're in base-devel +pkgs="${pkgs//gcc}" +pkgs="${pkgs//clang}" + +# Try to filter out makedepends and treat them as such +echo "$pkgs" | grep -q meson && move_to_makedepends meson +echo "$pkgs" | grep -q wayland-protocols && move_to_makedepends wayland-protocols +echo "$pkgs" | grep -q wayland && move_to_makedepends wayland +echo "$pkgs" | grep -q systemd-libs && move_to_makedepends systemd-libs + +# Strip out empty lines +pkgs="$(echo "$pkgs" | sed '/^$/d')" + +# Add the rest to depends +depends="$depends $(echo "$pkgs" | tr '\n' ' ')" + +# Trim away extra spaces +depends="$(echo "$depends" | xargs)" +makedepends="$(echo "$makedepends" | xargs)" + +echo "=> Updated dependencies from CI config:" +echo "depends=($depends)" +echo "makedepends=($makedepends)" + +sed -i \ + -e s/'^depends=.*$'/"depends=($depends)"/ \ + -e s/'^makedepends=.*$'/"makedepends=($makedepends)"/ \ + PKGBUILD + + |