From 926a4b901c3aeed0f66e96b5e6b04cfa2aff48f8 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 27 Jun 2012 15:22:28 -0400 Subject: [PATCH] enter_chroot: make sure ccache dir perms are correct For fresh sdk builds, gcc won't update and automatically see the ccache tree for us. So make sure the perms are sane when people enter the chroot. This will also automatically fix perms if/when people manually delete the ccache dir (which sometimes happens on the buildbots when people try to free up space). BUG=None TEST=`rm -rf distfiles/ccache/; cros_sdk` and see ccache dir get setup nicely Change-Id: I5bcc86ebf696549b142a7ceb312eb8ec4be5e2bf Reviewed-on: https://gerrit.chromium.org/gerrit/26257 Reviewed-by: David James Tested-by: Mike Frysinger Commit-Ready: Mike Frysinger --- sdk_lib/enter_chroot.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh index b75dce1262..d6ef7c4a2c 100755 --- a/sdk_lib/enter_chroot.sh +++ b/sdk_lib/enter_chroot.sh @@ -393,6 +393,17 @@ setup_env() { # See https://bugzilla.gnome.org/show_bug.cgi?id=677648 sudo killall -STOP gvfs-gdu-volume-monitor gvfsd-trash 2>/dev/null || true + # Fix permissions on ccache tree. If this is a fresh chroot, then they + # might not be set up yet. Or if the user manually `rm -rf`-ed things, + # we need to reset it. Otherwise, gcc itself takes care of fixing things + # on demand, but only when it updates. + ccache_dir="${FLAGS_chroot}/var/cache/distfiles/ccache" + if [[ ! -d ${ccache_dir} ]]; then + sudo mkdir -p -m 2775 "${ccache_dir}" + fi + sudo find -H "${ccache_dir}" -type d -exec chmod 2775 {} + & + sudo find -H "${ccache_dir}" -gid 0 -exec chgrp 250 {} + & + # Configure committer username and email in chroot .gitconfig. Change # to the root directory first so that random $PWD/.git/config settings # do not get picked up. We want to stick to ~/.gitconfig only.