Allow root to create cache directories as a non-root user

This change ensures that cache directories are owned by a non-root
user even if the process is running as root.

BUG=chromium:312420
TEST=unittests + tryjobs

Change-Id: I1336c547c7a8580e26fab7c24cf2382e9115d5a3
Reviewed-on: https://chromium-review.googlesource.com/174893
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: Yu-Ju Hong <yjhong@chromium.org>
Tested-by: Yu-Ju Hong <yjhong@chromium.org>
diff --git a/scripts/cros_sdk.py b/scripts/cros_sdk.py
index 09c41c8..97d0bbb 100644
--- a/scripts/cros_sdk.py
+++ b/scripts/cros_sdk.py
@@ -547,7 +547,7 @@
 
       sdk_cache = os.path.join(options.cache_dir, 'sdks')
       distfiles_cache = os.path.join(options.cache_dir, 'distfiles')
-      osutils.SafeMakedirs(options.cache_dir)
+      osutils.SafeMakedirsNonRoot(options.cache_dir)
 
       for target in (sdk_cache, distfiles_cache):
         src = os.path.join(constants.SOURCE_ROOT, os.path.basename(target))