Hello.
Mark Millard wrote on 2024/04/29 10:48:
> I've modified my local poudriere-devel to have Success and Failure lines also
> report the tmpfs size at that point. Using, say, script to log the output to
I am a bit curious because I am using tmpfs to reduce HDD IO from stage phase
to package phase to speed up the process.
So I will try to integrate that as well...
> "<" below is what is new, ">" is what was original, in
> /usr/local/share/poudriere/common.sh :
>
> 5928,5934d5927
> < tmpfs_at_end="$(env BLOCKSIZE=512 df -t tmpfs \
> < ${MASTERMNTROOT}/${MY_JOBID}/ \
> < ${MASTERMNTROOT}/${MY_JOBID}/.p/ \
> < ${MASTERMNTROOT}/${MY_JOBID}/usr/local/ \
> < 2>/dev/null | tail -3 \
> < | awk '{ tmpfs_use += $3; } END { printf "%s %.2f %s", "TMPFS:",
> tmpfs_use*512/(1024**3), "GiB" }')"
> <
> 5942c5935
> < "Success${COLOR_RESET} ending ${tmpfs_at_end}"
> ---
>> "Success"
> 5968c5961
> < "Failed: ${COLOR_PHASE}${failed_phase}${COLOR_RESET}
> ${tmpfs_at_end}"
> ---
>> "Failed: ${COLOR_PHASE}${failed_phase}"
>
If we wanted to integrate it here, we could have used a hook script.
Simply append the following script fragment to
/usr/local/etc/poudriere.d/hooks/pkgbuild.sh or install the file in
/usr/local/etc/poudriere.d/hooks/plugins/somedirectory/pkgbuild.sh.
Well, but hook scripts are a pain to create because of the quirks in the
variables and resources that can be used :)
The following is the script. You are free to modify and use the rest as you
wish :)
Regards.
#!/bin/sh
case "${0##*/}" in
pkgbuild.sh)
case "${1}" in # (
success|failed)
if [ ${MY_JOBID:+1} ] ; then
tmpfs_at_end="$(env BLOCKSIZE=512 df -t tmpfs \
${MASTERMNT}/../${MY_JOBID}/ \
${MASTERMNT}/../${MY_JOBID}/.p/ \
${MASTERMNT}/../${MY_JOBID}/usr/local/ \
2>/dev/null | tail -3 \
| awk '{ tmpfs_use += $3; } END { printf "%s
%.2f %s", "TMPFS:", tmpfs_use*512/(1024**3), "GiB" }')"
if true ; then
# output to stdout
echo "${2} | ${3}: ${tmpfs_at_end}"
>&${OUTPUT_REDIRECTED_STDOUT:-1}
fi
if false ; then
# output to stderr
echo "${2} | ${3}: ${tmpfs_at_end}"
>&${OUTPUT_REDIRECTED_STDERR:-2}
fi
if false && [ ${OUTPUT_REDIRECTED:-0} -eq 1 ] ; then
# output to ${LOG}/logs/${3}.log file
echo "${2} | ${3}: ${tmpfs_at_end}" >&2
fi
if false ; then
# append to file
echo "${2} | ${3}: ${tmpfs_at_end}"
>>/tmp/poudriere-tmpfs.log
fi
fi
;; # (
*)
esac
;; # (
*)
esac
# end of script