Consolidate bash version checks

There were two checks for bash version, the 2nd was superfluous; this
patch removes the duplicate checks, and shifts the bash version check to
being back after the "are we in bash" check.

Change-Id: I57ff8c1fedce80f739c06643d2976d2c1465db1b
envsetup: export ANDROID_BUILD_TOP earlier

Change-Id: Ia3497f61f4e9aaeeb793cecd3b4f488f0a48181a
build: fix bash completion sourcing

Sourcing functions in files from a function within a file being
sourced was giving bash a hard time. This fixes 'repo' command tab
completions.

Change-Id: Iac1b3078e20749fb474ed1270e0886cf435e24d9