diff options
Diffstat (limited to '.extras/hooks/post-commit')
| -rwxr-xr-x | .extras/hooks/post-commit | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/.extras/hooks/post-commit b/.extras/hooks/post-commit index 6ed63f7..6f55d61 100755 --- a/.extras/hooks/post-commit +++ b/.extras/hooks/post-commit @@ -7,14 +7,14 @@ SBO_DIR="$REPO_ROOT/SBo" # Find packages whose .SlackBuild was added (A) or modified (M) in this commit. # git diff-tree output format: <status>\t<file> -# We only want files exactly one directory deep, e.g. hugo/hugo.SlackBuild. +# Paths are <category>/<package>/<package>.SlackBuild, matching SBo's own +# layout. Depth isn't asserted: any dir holding a .SlackBuild is a build. PACKAGES=() while IFS=$'\t' read -r status file; do [[ "$status" != "A" && "$status" != "M" ]] && continue dir=$(dirname "$file") base=$(basename "$file") [[ "$dir" == "." ]] && continue # skip root-level files - [[ "$dir" == *"/"* ]] && continue # skip files deeper than one level [[ "$base" == *.SlackBuild ]] || continue PACKAGES+=("$dir") done < <(git diff-tree --no-commit-id -r --name-status HEAD) @@ -51,8 +51,12 @@ for pkg in "${PACKAGES[@]}"; do case "$answer" in [yY]|[yY][eE][sS]) mkdir -p "$SBO_DIR" - if tar -czf "$SBO_DIR/$pkg.tar.gz" -C "$REPO_ROOT" "$pkg"; then - echo " -> Archive created: SBo/$pkg.tar.gz" + # $pkg is <category>/<package>. SBo expects a tarball named after + # the package, with the package dir (not the category) at its + # root, so name it by basename and tar from inside the category. + name=$(basename "$pkg") + if tar -czf "$SBO_DIR/$name.tar.gz" -C "$REPO_ROOT/$(dirname "$pkg")" "$name"; then + echo " -> Archive created: SBo/$name.tar.gz" else echo " -> Archive FAILED." >&2 fi |
