Improve the naming capabilities for temp files.

Review Request #10667 — Created Aug. 28, 2019 and submitted — Latest diff uploaded

chipx86
RBTools
release-1.0.x
10668
3796443...
rbtools

RBTools has wrappers for creating temp files without worrying about
cleanup, handling that automatically during the shutdown of the process.
The existing support, however, did not allow callers to control the
naming of any temp files, and our defaults made it hard to distinguish
RBTools temp files from those of other processes.

This change adds new arguments to make_tempfile(), allowing a custom
suffix and prefix to be specified. By default, a prefix of rbtools. is
used.

It also allows an explicit filename to be specified. This will be useful
for some upcoming work on the commit message editing capabilities. When
providing an explicit filename, a temp directory will be created with
the temp file living inside of it. This avoids conflicts when multiple
callers are trying to create temp files of the same explicit name.

Unit tests have been updated for the new additional functionality, and
some existing tests have been fixed to better meet our standards.

Unit tests pass.

Made use of the new capabilities in a couple upcoming changes.

Loading...