feat: Autobuild changed build files from git commit
parent
3f23633dcc
commit
64e09d296d
20
aptpkg
20
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"
|
||||
|
|
Loading…
Reference in New Issue