xbps-src: introduce XBPS_STATEDIR to store state files, logs and others.
XBPS_STATEDIR is created in XBPS_BUILDDIR/.xbps-${sourcepkg}-${version} and contains logs and state files for all phases, as well as wrappers. We can now inspect the output from all hooks.
This commit is contained in:
parent
8ad235c69d
commit
6e13dcbaff
11 changed files with 33 additions and 33 deletions
|
@ -29,9 +29,9 @@ if [ -z $pkgname -o -z $version ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
XBPS_BUILD_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_build_done"
|
||||
XBPS_PRE_BUILD_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_pre_build_done"
|
||||
XBPS_POST_BUILD_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_post_build_done"
|
||||
XBPS_BUILD_DONE="${XBPS_STATEDIR}/${sourcepkg}_${XBPS_CROSS_BUILD}_build_done"
|
||||
XBPS_PRE_BUILD_DONE="${XBPS_STATEDIR}/${sourcepkg}_${XBPS_CROSS_BUILD}_pre_build_done"
|
||||
XBPS_POST_BUILD_DONE="${XBPS_STATEDIR}/${sourcepkg}_${XBPS_CROSS_BUILD}_post_build_done"
|
||||
|
||||
if [ -f "$XBPS_BUILD_DONE" ]; then
|
||||
exit 0
|
||||
|
|
|
@ -24,9 +24,9 @@ for f in $XBPS_COMMONDIR/environment/configure/*.sh; do
|
|||
source_file "$f"
|
||||
done
|
||||
|
||||
XBPS_CONFIGURE_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_configure_done"
|
||||
XBPS_PRECONFIGURE_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_pre_configure_done"
|
||||
XBPS_POSTCONFIGURE_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_post_configure_done"
|
||||
XBPS_CONFIGURE_DONE="${XBPS_STATEDIR}/${sourcepkg}_${XBPS_CROSS_BUILD}_configure_done"
|
||||
XBPS_PRECONFIGURE_DONE="${XBPS_STATEDIR}/${sourcepkg}_${XBPS_CROSS_BUILD}_pre_configure_done"
|
||||
XBPS_POSTCONFIGURE_DONE="${XBPS_STATEDIR}/${sourcepkg}_${XBPS_CROSS_BUILD}_post_configure_done"
|
||||
|
||||
if [ -f "$XBPS_CONFIGURE_DONE" ]; then
|
||||
exit 0
|
||||
|
|
|
@ -24,7 +24,7 @@ for f in $XBPS_COMMONDIR/environment/extract/*.sh; do
|
|||
source_file "$f"
|
||||
done
|
||||
|
||||
XBPS_EXTRACT_DONE="$wrksrc/.xbps_extract_done"
|
||||
XBPS_EXTRACT_DONE="${XBPS_STATEDIR}/${sourcepkg}_${XBPS_CROSS_BUILD}_extract_done"
|
||||
|
||||
if [ -f $XBPS_EXTRACT_DONE ]; then
|
||||
exit 0
|
||||
|
|
|
@ -24,7 +24,7 @@ for f in $XBPS_COMMONDIR/environment/fetch/*.sh; do
|
|||
source_file "$f"
|
||||
done
|
||||
|
||||
XBPS_FETCH_DONE="$wrksrc/.xbps_fetch_done"
|
||||
XBPS_FETCH_DONE="${XBPS_STATEDIR}/${sourcepkg}_${XBPS_CROSS_BUILD}_fetch_done"
|
||||
|
||||
if [ -f "$XBPS_FETCH_DONE" ]; then
|
||||
exit 0
|
||||
|
|
|
@ -24,9 +24,9 @@ for f in $XBPS_COMMONDIR/environment/install/*.sh; do
|
|||
source_file "$f"
|
||||
done
|
||||
|
||||
XBPS_INSTALL_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_install_done"
|
||||
XBPS_PRE_INSTALL_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_pre_install_done"
|
||||
XBPS_POST_INSTALL_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_post_install_done"
|
||||
XBPS_INSTALL_DONE="${XBPS_STATEDIR}/${sourcepkg}_${XBPS_CROSS_BUILD}_install_done"
|
||||
XBPS_PRE_INSTALL_DONE="${XBPS_STATEDIR}/${sourcepkg}_${XBPS_CROSS_BUILD}_pre_install_done"
|
||||
XBPS_POST_INSTALL_DONE="${XBPS_STATEDIR}/${sourcepkg}_${XBPS_CROSS_BUILD}_post_install_done"
|
||||
|
||||
cd $wrksrc || msg_error "$pkgver: cannot access to wrksrc [$wrksrc]\n"
|
||||
if [ -n "$build_wrksrc" ]; then
|
||||
|
@ -74,7 +74,7 @@ if [ ! -f $XBPS_INSTALL_DONE ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
XBPS_SUBPKG_INSTALL_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_${PKGNAME}_install_done"
|
||||
XBPS_SUBPKG_INSTALL_DONE="${XBPS_STATEDIR}/${PKGNAME}_${XBPS_CROSS_BUILD}_subpkg_install_done"
|
||||
|
||||
# If it's a subpkg execute the pkg_install() function.
|
||||
if [ ! -f $XBPS_SUBPKG_INSTALL_DONE ]; then
|
||||
|
|
|
@ -25,7 +25,7 @@ for f in $XBPS_COMMONDIR/environment/install/*.sh; do
|
|||
done
|
||||
|
||||
|
||||
XBPS_PREPKG_DONE="$wrksrc/.xbps_${XBPS_CROSS_BUILD}_${PKGNAME}_prepkg_done"
|
||||
XBPS_PREPKG_DONE="${XBPS_STATEDIR}/${PKGNAME}_${XBPS_CROSS_BUILD}_prepkg_done"
|
||||
|
||||
if [ -f $XBPS_PREPKG_DONE ]; then
|
||||
exit 0
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
# vim: set ts=4 sw=4 et:
|
||||
|
||||
run_func() {
|
||||
local func="$1" desc="$2" restoretrap= logpipe= logfile= teepid=
|
||||
local func="$1" desc="$2" funcname="$3" restoretrap= logpipe= logfile= teepid=
|
||||
|
||||
if [ -d "${wrksrc}" ]; then
|
||||
logpipe=$(mktemp -u --tmpdir=${wrksrc} .xbps_${XBPS_CROSS_BUILD}_XXXXXXXX.logpipe)
|
||||
logfile=${wrksrc}/.xbps_${XBPS_CROSS_BUILD}_${func}.log
|
||||
else
|
||||
logpipe=$(mktemp -t -u .xbps_${XBPS_CROSS_BUILD}_${func}_${pkgname}_logpipe.XXXXXXX)
|
||||
logfile=$(mktemp -t .xbps_${XBPS_CROSS_BUILD}_${func}_${pkgname}.log.XXXXXXXX)
|
||||
fi
|
||||
: ${funcname:=$func}
|
||||
|
||||
logpipe=$(mktemp -u --tmpdir=${XBPS_STATEDIR} ${pkgname}_${XBPS_CROSS_BUILD}_XXXXXXXX.logpipe)
|
||||
logfile=${XBPS_STATEDIR}/${pkgname}_${XBPS_CROSS_BUILD}_${funcname}.log
|
||||
|
||||
msg_normal "${pkgver:-xbps-src}: running ${desc:-${func}} ...\n"
|
||||
|
||||
set -E
|
||||
restoretrap=$(trap -p ERR)
|
||||
trap 'error_func $func $LINENO' ERR
|
||||
trap 'error_func $funcname $LINENO' ERR
|
||||
|
||||
mkfifo "$logpipe"
|
||||
tee "$logfile" < "$logpipe" &
|
||||
|
@ -176,7 +173,7 @@ run_pkg_hooks() {
|
|||
hookn=$(basename $f)
|
||||
hookn=${hookn%.sh}
|
||||
. $f
|
||||
run_func hook "$phase hook: $hookn"
|
||||
run_func hook "$phase hook: $hookn" ${phase}_${hookn}
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -400,5 +397,7 @@ setup_pkg() {
|
|||
exit 0
|
||||
fi
|
||||
|
||||
export XBPS_WRAPPERDIR="${wrksrc}/.xbps/bin"
|
||||
export XBPS_STATEDIR="${XBPS_BUILDDIR}/.xbps-${sourcepkg}-${version}"
|
||||
export XBPS_WRAPPERDIR="${XBPS_STATEDIR}/wrappers"
|
||||
mkdir -p $XBPS_WRAPPERDIR
|
||||
}
|
||||
|
|
|
@ -177,10 +177,10 @@ remove_pkg() {
|
|||
msg_normal "$f: removing 32bit files from destdir...\n"
|
||||
rm -rf ${_destdir}/${f}-32bit-${version}
|
||||
fi
|
||||
rm -f $wrksrc/.xbps_${XBPS_CROSS_BUILD}_${f}_install_done
|
||||
rm -f $wrksrc/.xbps_${XBPS_CROSS_BUILD}_${f}_prepkg_done
|
||||
rm -f ${XBPS_STATEDIR}/${f}_${cross}_subpkg_install_done
|
||||
rm -f ${XBPS_STATEDIR}/${f}_${cross}_prepkg_done
|
||||
done
|
||||
rm -f $wrksrc/.xbps_${cross}_install_done
|
||||
rm -f $wrksrc/.xbps_${cross}_pre_install_done
|
||||
rm -f $wrksrc/.xbps_${cross}_post_install_done
|
||||
rm -f ${XBPS_STATEDIR}/${sourcepkg}_${cross}_install_done
|
||||
rm -f ${XBPS_STATEDIR}/${sourcepkg}_${cross}_pre_install_done
|
||||
rm -f ${XBPS_STATEDIR}/${sourcepkg}_${cross}_post_install_done
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue