SIGN IN SIGN UP

Only unset HOME when running cmake as root (#3507)

Summary:
This hack is required to work around pytorch/test-infra#5091, which runs some CI jobs as root, which buck2 doesn't like.

But we saw in https://github.com/pytorch/executorch/issues/3502 that this can break things for some normal users.

Reduce the blast radius of this hack, only modifying HOME when actually running as root.

Mitigates https://github.com/pytorch/executorch/issues/3502

Pull Request resolved: https://github.com/pytorch/executorch/pull/3507

Test Plan:
`./install_requirements.sh` succeeded locally.

The build-wheels jobs for this PR do not break during the buck2 phase, and show that they're unsetting HOME.

https://github.com/pytorch/executorch/actions/runs/8946028682/job/24575999986?pr=3507#step:14:118
```
2024-05-03T23:32:08.9616508Z temporarily unsetting HOME while running as root
```

https://github.com/pytorch/executorch/actions/runs/8946028682/job/24575999986?pr=3507#step:14:465
```
2024-05-03T23:32:08.9914557Z restored HOME
```

Reviewed By: larryliu0820

Differential Revision: D56958571

Pulled By: dbort

fbshipit-source-id: c7c6abdd52361af8253ce068002e3c23dee16f6b
D
Dave Bort committed
d34f9f2ed13b9442cc339d4d8a44b97b1c9d2c5f
Parent: 0909c5a
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 5/4/2024, 12:28:33 AM