mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
provision: Skip some rm, mkdir, chown commands if possible.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Tim Abbott
parent
2a1305de9f
commit
88793e80ea
@@ -391,15 +391,13 @@ def main(options):
|
||||
]
|
||||
run_as_root(proxy_env + ["scripts/lib/install-node"], sudo_args = ['-H'])
|
||||
|
||||
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])
|
||||
|
||||
# This is a wrapper around `yarn`, which we run last since
|
||||
# it can often fail due to network issues beyond our control.
|
||||
try:
|
||||
# Hack: We remove `node_modules` as root to work around an
|
||||
# issue with the symlinks being improperly owned by root.
|
||||
if os.path.islink("node_modules"):
|
||||
run_as_root(["rm", "-f", "node_modules"])
|
||||
run_as_root(["mkdir", "-p", NODE_MODULES_CACHE_PATH])
|
||||
run_as_root(["chown", "%s:%s" % (user_id, user_id), NODE_MODULES_CACHE_PATH])
|
||||
setup_node_modules(prefer_offline=True)
|
||||
except subprocess.CalledProcessError:
|
||||
print(WARNING + "`yarn install` failed; retrying..." + ENDC)
|
||||
|
||||
@@ -80,9 +80,9 @@ def main(options: argparse.Namespace) -> int:
|
||||
# The `build_emoji` script requires `emoji-datasource` package
|
||||
# which we install via npm; thus this step is after installing npm
|
||||
# packages.
|
||||
if not os.path.isdir(EMOJI_CACHE_PATH):
|
||||
run_as_root(["mkdir", EMOJI_CACHE_PATH])
|
||||
run_as_root(["chown", "%s:%s" % (user_id, user_id), EMOJI_CACHE_PATH])
|
||||
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(["tools/setup/emoji/build_emoji"])
|
||||
|
||||
# copy over static files from the zulip_bots package
|
||||
|
||||
Reference in New Issue
Block a user