feat: "aptpkg-auto-run" trailer for HEAD commit

To build files changed from provided commit hash before HEAD
main
earnest ma 2021-10-06 22:06:53 -04:00
parent 64e09d296d
commit c209761d1e
Signed by: earnest ma
GPG Key ID: A343F43342EB6E2A
1 changed files with 15 additions and 0 deletions

15
aptpkg
View File

@ -123,6 +123,21 @@ change_autobuild_pkgs(){
commitid=$1 commitid=$1
[ -n "$commitid" ] || commitid=HEAD [ -n "$commitid" ] || commitid=HEAD
if [[ "$commitid" = HEAD ]]; then
before_run=$(git log HEAD^..HEAD | grep aptpkg-auto-run | sed 's#aptpkg-auto-run: ##' | sed 's# ##')
if [ -n "$before_run" ]; then
for m in $before_run; do
build_chg_pre=$(git diff-tree --no-commit-id --name-only -r "$m" | grep "build" | sed 's#/build##')
echo "Using $m with files $build_chg_pre"
for a in $build_chg_pre; do
aptpkg "$a"
done
done
fi
fi
build_chg=$(git diff-tree --no-commit-id --name-only -r $commitid | grep "build" | sed 's#/build##') build_chg=$(git diff-tree --no-commit-id --name-only -r $commitid | grep "build" | sed 's#/build##')
echo "Using $commitid with files $build_chg" echo "Using $commitid with files $build_chg"