tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pbulk change to tee output



In the #pkgsrc channel on freenode, it was suggested that having a way
to examine the normal output from making each package in real-time
would be a nice feature. Looking at the pkg-build script, it uses this
idiom to capture the normal output to individual log files for each
phase of a pkgsrc build:

    make target > $bulklog/$pkg/target.log 2>&1 || cleanup

I would like to duplicate that output to another file (realtime.log)
in real-time, but the only way I can keep the same output semantics
seems to be by doing:

    ((((( exec 5>&- 6>&-; make target ); echo $? 1>&5 ) | tee
$bulklog/realtime.log 1>&6 ) 5>&1 ) | ( read xs; exit $xs )) >
$bulklog/$pkg/target.log 6>&1 || cleanup

Is that excessive?  I couldn't see another way to use the exit code
from the make process as the exit code for the pipeline, have all of
the output be sent to the target.log file, but leave any output from
the cleanup function out of the log file.

Or perhaps we don't actually need to avoid capturing the output from
cleanup?  In that case, we can simplify to:

    { make target || cleanup; } 2>&1 | tee $bulklog/realtime.log >
$bulklog/$pkg/target.log

Any thoughts?

Johnny C. Lam


Home | Main Index | Thread Index | Old Index