envsetup.sh checks, but does not set ENVSETUP_SH_INCLUDED=1

envsetup.sh has a guard that prevents the file to be sourced multiple
times. This is useful if a script wants to:
  1) source envsetup.sh to get the default environment;
  2) change some variables
  3) call another script that calls envsetup.sh again, overwriting the
     modifications.
This is what happens with build_abi.sh which, after sourcing
envsetup.sh, changes the environment variables and builds the kernel
with build.sh. The ladder script sources again envsetup.sh, overwriting
the canges made by build_abi.sh. This unexpected behavior is solved by
envsetup.sh, which can either immediately return if ENVSETUP_SH_INCLUDED
is set or set ENVSETUP_SH_INCLUDED=1 and continue the execution. This
avoids envsetup.sh to be sourced multiple times, thus overriding the
environment variables.  This solution causes the issue of making the
build script unusable if the user manually sources build.sh.

This patch solves the issue by removing the ENVSETUP_SH_INCLUDED=1
operation from envsetup.sh, which is instead moved to build_abi.sh.

Test: manual inspection
Bug: 138854687
Change-Id: If52b0546809d77304ed8d11c9da062e13a3c7ec5
Signed-off-by: Alessio Balsini <balsini@google.com>
2 files changed