Make git config optional to allow multiple calls to enter_chroot at the same time.

It's very rarely needed anyway but enter_chroot does everything under the sun.

Avoids:

error: could not lock config file ~/.gitconfig

Change-Id: Ide72b14fd434b182a88d2fc636559b3515905509

BUG=chromium-os:11523
TEST=Ran it ... 10x

Review URL: http://codereview.chromium.org/6312069
This commit is contained in:
Chris Sosa 2011-02-01 13:07:55 -08:00
parent 19ef17732c
commit 558940dddb
2 changed files with 14 additions and 9 deletions

View File

@ -840,7 +840,10 @@ def _PregenerateUpdates(parser, options):
if src:
src = ReinterpretPathForChroot(src)
return RunCommandCaptureOutput(['sudo',
return RunCommandCaptureOutput(['./enter_chroot.sh',
'--nogit_config',
'--',
'sudo',
'./start_devserver',
'--pregenerate_update',
'--exit',
@ -848,7 +851,6 @@ def _PregenerateUpdates(parser, options):
'--src_image=%s' % src,
'--for_vm',
], combine_stdout_stderr=True,
enter_chroot=True,
print_cmd=False)
# Get the list of deltas by mocking out update method in test class.
@ -911,9 +913,7 @@ def _RunTestsInParallel(parser, options, test_class):
threads.append(unittest.TextTestRunner().run)
args.append(test_case)
# TODO(sosa): Set back to options.jobs once parallel generation is
# no longer flaky.
results = _RunParallelJobs(1, threads, args, print_status=False)
results = _RunParallelJobs(options.jobs, threads, args, print_status=False)
for test_result in results:
if not test_result.wasSuccessful():
Die('Test harness was not successful')

View File

@ -27,6 +27,8 @@ DEFINE_string chrome_root "" \
DEFINE_string chrome_root_mount "/home/$USER/chrome_root" \
"The mount point of the chrome broswer source in the chroot."
DEFINE_boolean git_config $FLAGS_TRUE \
"Config git to work with your user/pass in the chroot."
DEFINE_boolean official_build $FLAGS_FALSE \
"Set CHROMEOS_OFFICIAL=1 for release builds."
DEFINE_boolean mount $FLAGS_FALSE "Only set up mounts."
@ -326,10 +328,13 @@ if [ -d "$HOME/.subversion" ]; then
fi
# Configure committer username and email in chroot .gitconfig
git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all user.name \
"$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/ *<.*//')"
git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all user.email \
"$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/.*<\([^>]*\)>.*/\1/')"
if [ $FLAGS_git_config -eq $FLAGS_TRUE ]; then
git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \
user.name "$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/ *<.*//')"
git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \
user.email "$(cd /tmp; git var GIT_COMMITTER_IDENT | \
sed -e 's/.*<\([^>]*\)>.*/\1/')"
fi
# Run command or interactive shell. Also include the non-chrooted path to
# the source trunk for scripts that may need to print it (e.g.