provision: Don’t rely on uid == gid assumption when invoking chown.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2019-08-14 14:58:26 -07:00
committed by Tim Abbott
parent fa913b7f5d
commit 349f22524e
3 changed files with 4 additions and 8 deletions

View File

@@ -247,8 +247,6 @@ REPO_STOPWORDS_PATH = os.path.join(
"zulip_english.stop",
)
user_id = os.getuid()
def install_system_deps():
# type: () -> None
@@ -393,7 +391,7 @@ def main(options):
if not os.access(NODE_MODULES_CACHE_PATH, os.W_OK):
run_as_root(["mkdir", "-p", NODE_MODULES_CACHE_PATH])
run_as_root(["chown", "%s:%s" % (user_id, user_id), NODE_MODULES_CACHE_PATH])
run_as_root(["chown", "%s:%s" % (os.getuid(), os.getgid()), NODE_MODULES_CACHE_PATH])
# This is a wrapper around `yarn`, which we run last since
# it can often fail due to network issues beyond our control.

View File

@@ -34,8 +34,6 @@ if is_travis:
UUID_VAR_PATH = get_dev_uuid_var_path()
user_id = os.getuid()
def setup_shell_profile(shell_profile):
# type: (str) -> None
shell_profile_path = os.path.expanduser(shell_profile)
@@ -82,7 +80,7 @@ def main(options: argparse.Namespace) -> int:
# packages.
if not os.access(EMOJI_CACHE_PATH, os.W_OK):
run_as_root(["mkdir", "-p", EMOJI_CACHE_PATH])
run_as_root(["chown", "%s:%s" % (user_id, user_id), EMOJI_CACHE_PATH])
run_as_root(["chown", "%s:%s" % (os.getuid(), os.getgid()), EMOJI_CACHE_PATH])
run(["tools/setup/emoji/build_emoji"])
# copy over static files from the zulip_bots package