---
aptpkg | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/aptpkg b/aptpkg
index dc04f7b..0d5b335 100755
--- a/aptpkg
+++ b/aptpkg
@@ -15,6 +15,7 @@ Documentation: https://man.sr.ht/~earnestma/aptpkg
Usage:
aptpkg [directory]
+ aptpkg --auto (commit id) Autobuild modified packages from commit
aptpkg -h, --help Show help
EOF
}
@@ -114,10 +115,29 @@ load_build(){
esac
}
+# Autobuild packages based on git list files changed in commit
+# latest (HEAD) assumed if commit hash not provided
+change_autobuild_pkgs(){
+ [ -d .git ] || error_usage_die "Current directory is not a git repository!"
+
+ commitid=$1
+ [ -n "$commitid" ] || commitid=HEAD
+
+ build_chg=$(git diff-tree --no-commit-id --name-only -r $commitid | grep "build" | sed 's#/build##')
+ echo "Using $commitid with files $build_chg"
+
+ for f in $build_chg; do
+ aptpkg "$f"
+ done
+}
+
# Run!
case $1 in
-h|--help)
show_help ;;
+ --auto)
+ shift
+ change_autobuild_pkgs $1 ;;
*)
if [ $# -ne 1 ]; then
error_usage_die "You must provide one directory"
--
2.30.2