summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/chroot-tools/libremakepkg27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg
index 99c448f..9b3ec9a 100755
--- a/src/chroot-tools/libremakepkg
+++ b/src/chroot-tools/libremakepkg
@@ -24,6 +24,7 @@
. $(librelib messages)
. $(librelib chroot/makechrootpkg.sh)
+set -o pipefail
shopt -s nullglob
umask 0022
@@ -47,6 +48,10 @@ hook_check_pkg=(:)
# Boring/mundane functions #####################################################
+indent() {
+ sed 's/^/ | /'
+}
+
# Usage: exit_copy $copydir $src_owner
# End immediately, but copy log files out
exit_copy() {
@@ -65,14 +70,15 @@ run_hook() {
local fails=()
for hook in "${!hookvar}"; do
- "$hook" "$@" || { error "result: %s" $?; fails+=("$hook"); }
- done
+ "$hook" "$@" || fails+=("$hook")
+ done |& indent
if [[ ${#fails[@]} -gt 0 ]]; then
error "Failure(s) in %s: %s" "$hookname" "${fails[*]}"
return 1
+ else
+ return 0
fi
- return 0
}
# Usage: add_to_local_repo $copydir $pkgfiles...
@@ -109,10 +115,10 @@ build() (
fi
prepare_chroot "$copydir" "$LIBREHOME" "$repack" false
- "${run[@]}" /chrootprepare "$@"
+ "${run[@]}" /chrootprepare "$@" |& indent
run_hook pre_build "$copydir"
trap "run_hook post_build '$copydir'" EXIT
- "${run[@]}" /chrootbuild "$@"
+ "${run[@]}" /chrootbuild "$@" |& indent
)
# The main program #############################################################
@@ -235,7 +241,8 @@ main() {
lock 9 "$copydir.lock" \
"Waiting for existing lock on chroot copy to be released: [%s]" "$copy"
# Create the chroot if it does not exist
- librechroot "${librechroot_flags[@]}" make
+ msg 'Initializing the chroot...'
+ librechroot "${librechroot_flags[@]}" make |& indent
fi
# Set target CARCH
@@ -243,16 +250,20 @@ main() {
export CARCH="$(MAKEPKG_CONF=$copydir/etc/makepkg.conf get_conf_makepkg CARCH)"
# Pre-build
+ msg 'Starting pre-build activities...'
run_hook check_pkgbuild
- download_sources "$copydir" "$LIBREUSER"
+ msg 'Downloading sources...'
+ download_sources "$copydir" "$LIBREUSER" |& indent
# Build
+ msg 'Starting to build the package...'
trap "exit_copy '$copydir' '$LIBREUSER'" EXIT
build "$copydir" "$repack" "${makepkg_args[@]}"
# Post-build
+ msg 'Starting post-build activities...'
run_hook check_pkg
- add_to_local_repo "$copydir" "$copydir"/pkgdest/*.pkg.tar*
+ add_to_local_repo "$copydir" "$copydir"/pkgdest/*.pkg.tar* |& indent
}
main "$@"