~kota/nilsu-pkg-void

bca08a6f53e59ddb2b59d6e274424e3391bb9a88 — Dakota Walsh 1 year, 3 months ago e6a03d0
Re-add accidentally removed build script
1 files changed, 27 insertions(+), 0 deletions(-)

A common/builds-sr-ht/changed_templates_latest_commit.sh
A common/builds-sr-ht/changed_templates_latest_commit.sh => common/builds-sr-ht/changed_templates_latest_commit.sh +27 -0
@@ 0,0 1,27 @@
#!/bin/sh
#
# changed_templates_latest_commit.sh
# similar to the changed_templates.sh script in common/travis, but it gets the
# changed packages since the latest commit instead of only ones that are from
# other branches or whatever exactly the other script does.

if command -v chroot-git >/dev/null 2>&1; then
	GIT_CMD=$(command -v chroot-git)
elif command -v git >/dev/null 2>&1; then
	GIT_CMD=$(command -v git)
fi

changed_packages=$($GIT_CMD diff-tree -r --no-renames --name-only --diff-filter=AM "HEAD^" "HEAD" 'srcpkgs/*/template' | cut -d/ -f 2)
changed_count=$(printf '%s\n' "$changed_packages" | wc -l)

# only accept 1 changed package per build
if [ -z "$changed_packages" ]; then
	printf 'No changed packages\n'
	exit 1
elif [ "$changed_count" -ne 1 ]; then
	printf 'More than 1 package was changed\n'
	exit 1
fi

printf '%s\n' "$changed_packages"
exit 0