diff --git a/common/hooks/post-pkg/00-register-pkg.sh b/common/hooks/post-pkg/00-register-pkg.sh index 5d5c9980fc6..98e1a2f5c69 100644 --- a/common/hooks/post-pkg/00-register-pkg.sh +++ b/common/hooks/post-pkg/00-register-pkg.sh @@ -7,16 +7,7 @@ registerpkg() { msg_error "Unexistent binary package ${repo}/${pkg}!\n" fi - msg_normal "Registering ${pkg} into ${repo} ...\n" - if [ -n "${arch}" ]; then - XBPS_TARGET_ARCH=${arch} $XBPS_RINDEX_CMD ${XBPS_BUILD_FORCEMODE:+-f} -a ${repo}/${pkg} - else - if [ -n "$XBPS_CROSS_BUILD" ]; then - $XBPS_RINDEX_XCMD ${XBPS_BUILD_FORCEMODE:+-f} -a ${repo}/${pkg} - else - $XBPS_RINDEX_CMD ${XBPS_BUILD_FORCEMODE:+-f} -a ${repo}/${pkg} - fi - fi + printf "%s:%s:%s\n" "${arch}" "${repo}" "${pkg}" >> "${XBPS_STATEDIR}/.${sourcepkg}_register_pkg" } hook() { diff --git a/common/xbps-src/libexec/build.sh b/common/xbps-src/libexec/build.sh index c7489accb73..fd2a1174029 100755 --- a/common/xbps-src/libexec/build.sh +++ b/common/xbps-src/libexec/build.sh @@ -84,11 +84,32 @@ for subpkg in ${subpackages} ${sourcepkg}; do fi done +# Clean list of preregistered packages +printf "" > ${XBPS_STATEDIR}/.${sourcepkg}_register_pkg # If install went ok generate the binpkgs. for subpkg in ${subpackages} ${sourcepkg}; do $XBPS_LIBEXECDIR/xbps-src-dopkg.sh $subpkg "$XBPS_REPOSITORY" "$XBPS_CROSS_BUILD" || exit 1 done +# Registering packages at once per repository. This makes sure that staging is +# triggered for all new packages if any of them introduces inconsistencies. +cut -d: -f 1,2 ${XBPS_STATEDIR}/.${sourcepkg}_register_pkg | sort -u | \ + while IFS=: read -r arch repo; do + paths=$(grep "^$arch:$repo:" "${XBPS_STATEDIR}/.${sourcepkg}_register_pkg" | \ + cut -f 2,3 | tr ':' '/') + if [ -n "${arch}" ]; then + msg_normal "Registering new packages to $repo ($arch)\n" + XBPS_TARGET_ARCH=${arch} $XBPS_RINDEX_CMD ${XBPS_BUILD_FORCEMODE:+-f} -a ${paths} + else + msg_normal "Registering new packages to $repo\n" + if [ -n "$XBPS_CROSS_BUILD" ]; then + $XBPS_RINDEX_XCMD ${XBPS_BUILD_FORCEMODE:+-f} -a ${paths} + else + $XBPS_RINDEX_CMD ${XBPS_BUILD_FORCEMODE:+-f} -a ${paths} + fi + fi + done + # pkg cleanup if declare -f do_clean >/dev/null; then run_func do_clean