Use our own TMPDIR

Some people have run into issues where /tmp is on a smaller partition
than their main source tree, and if it fills up (or only has a few GB
free), their builds can start failing.

There may also be a subset of people whose /tmp may be slower than their
out directory -- if they put their src and out trees on a SSD, but keep
/tmp on a spinning HDD.

Bug: 71755844
Test: check out/soong.log for TMPDIR
Test: do a build, watch out/soong/.temp
Change-Id: Ib749ec736ad0f6c8ce7453861a91b3e99ddbd92d
This commit is contained in:
Dan Willemsen
2018-03-08 19:42:00 -08:00
parent 0343d020b3
commit 32a669b01b

View File

@@ -115,6 +115,8 @@ func NewConfig(ctx Context, args ...string) Config {
// Tell python not to spam the source tree with .pyc files.
ret.environ.Set("PYTHONDONTWRITEBYTECODE", "1")
ret.environ.Set("TMPDIR", absPath(ctx, ret.TempDir()))
// Precondition: the current directory is the top of the source tree
if _, err := os.Stat(srcDirFileCheck); err != nil {
if os.IsNotExist(err) {