build-setup: Make ssc_dir as optional environment

ssc_dir was set to ${HOME} and could not be set by environment.

There is a need to split the ${ssc_dir} and ${HOME} to resolve an issue
related to git-proxy (see below TL;DR), so make it an optional
environment of this script.

TL;DR

When building behind a proxy or using proxy to speedup the downloads, it
is necessary to use git-proxy globally.
The git-proxy script itself is in the ${WORKSPACE}, and the .gitconfig
is in ${HOME}.

When building matrix jobs, say job-a and job-b
1. job-a will set .gitconfig to use git-proxy in it's own ${WORKSPACE}.
2. When job-b starts, it will set .gitconfig to use git-proxy in b's
   ${WORKSPACE}, which typically is a different dir.
   So far it's OK, because the git-proxy's content is the same and both
   files exists.
3. Say job-b finishes, and job-a is still building.
4. The queued job2 starts, and job2-b starts.
5. Now b's ${WORKSPACE} will be cleaned up, while job-a is still
   using the git-proxy in b's ${WORKSPACE}, and job-a will fail with below
   log:
      fatal: cannot run
      /path/to/job-b-workspace/.../bin/git-proxy: No such file or directory

The fix is to use separated ${HOME} for each job, so that the proxy will
not conflict anymore.
But the jobs could still share the downloads and sstate directories by
${ssc_dir}.

The the job setup will be:
* Set a shared directory between jobs for ${ssc_dir};
* Set different directories between jobs for ${HOME}.

Tested: Verify there is no above build error anymore.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: If07086a862c2a7854cc2571139895013951ad616
1 file changed