enter_chroot should only modify things within a lock.

enter_chroot is often called from multiple processes and we expect that
it doesn't modify anything unless it's within a lock. This CL moves
chroot modifications up to occur during the lock so that we don't have
multiple modifications to .gitconfig occurring at the same time.

This prevents the following warning:
  error: could not lock config file
/b/cbuild/chroot/home/chrome-bot/.gitconfig: File exists

See http://chromeos-botmaster.mtv.corp.google.com:8026/builders/TOT%20Pre-Flight%20Queue/builds/3771/steps/Test/logs/stdio

BUG=chromium-os:17661
TEST=Run enter_chroot.sh and verify gitconfig is still setup.

Change-Id: I73a7755d62cce895c76b8e0f35838b3874e5db33
Reviewed-on: http://gerrit.chromium.org/gerrit/4208
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: David James <davidjames@chromium.org>
1 file changed
tree: 88cb760327bca2ba21754a2c4d12beebcb257c64
  1. bin/
  2. chroot_version_hooks.d/
  3. lib/
  4. mod_for_factory_scripts/
  5. mod_for_test_scripts/
  6. .gitignore
  7. archive_build.sh
  8. archive_hwqual
  9. bash_completion
  10. build_gpt.sh
  11. build_image
  12. build_kernel_image.sh
  13. call_autoserv.py
  14. check_control_files.sh
  15. check_deps
  16. chromeos_blacklist
  17. clean_loopback_devices
  18. common.sh
  19. create_esp.sh
  20. create_legacy_bootloader_templates.sh
  21. cros_deps_diff
  22. cros_download_latest_image
  23. cros_generate_breakpad_symbols
  24. cros_generate_deps_graphs
  25. cros_show_stacks
  26. dot_helper.py
  27. emit_gpt_scripts.sh
  28. enable_localaccount.sh
  29. enter_chroot.sh
  30. file_copy.py
  31. fixup_image_for_qemu.py
  32. generate_au_zip.py
  33. get_latest_image.sh
  34. get_package_list
  35. image_to_usb.sh
  36. image_to_vm.sh
  37. inherit-review-settings-ok
  38. make_developer_script_runner.sh
  39. make_factory_package.sh
  40. make_netboot.sh
  41. make_universal_factory_shim.sh
  42. mk_memento_images.sh
  43. mod_image_for_recovery.sh
  44. mod_image_for_test.sh
  45. mount_gpt_image.sh
  46. remote_access.sh
  47. resize_stateful_partition.sh
  48. run_chroot_version_hooks
  49. serve_factory_packages.py
  50. set_shared_user_password.sh
  51. ssh_test.sh
  52. start_devserver
  53. test_build_root
  54. test_image
  55. update_bootloaders.sh
  56. update_chroot
  57. update_kernel.sh
  58. upload_symbols
  59. verify_rootfs_chksum.sh
  60. WATCHLISTS