git-2.eclass: Add exclusive file locking on EGIT_DIR

Packages that try to check out the same git directory sometimes race and
generate build errors due to git lock contention. This CL adds a file
lock around all of the git operations once EGIT_DIR has been set up so
that packages will block on contended git access rather than potentially
error. Additionally, clean up the logic around whether or not a git
checkout is in a valid state and needs to be cleaned up.

BUG=chromium:988143, chromium:991580
TEST=`build_packages --board=grunt` succeeds at building everything from source

Change-Id: Ia1850060297da7da2b0ca74b75ec2b2c0dc4e961
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/eclass-overlay/+/1726273
Tested-by: Chris McDonald <cjmcdonald@chromium.org>
Commit-Queue: Chris McDonald <cjmcdonald@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
1 file changed
tree: 810656addc8d9b5f2582b6749a02302ba2e8e6f9
  1. eclass/
  2. metadata/
  3. profiles/
  4. OWNERS
  5. PRESUBMIT.cfg