Bug 1484485: Create state dir and install node / stylo stuff in bootstrap's non-interactive mode. r=ted
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 20 Aug 2018 23:41:10 +0200
changeset 490538 4b7383b27f89dcb1732b27f6d68f1684f36ff377
parent 490537 c0f5b64fe563a74d5d23f5aa5199a437cb8fd745
child 490539 53f23b446b29fd9dd32709be5c39b9eb3da9735e
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1484485
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1484485: Create state dir and install node / stylo stuff in bootstrap's non-interactive mode. r=ted The state directory is in $HOME by default, so should be fine to just create it if we get --no-interactive I think. Differential Revision: https://phabricator.services.mozilla.com/D3838
python/mozboot/mozboot/bootstrap.py
--- a/python/mozboot/mozboot/bootstrap.py
+++ b/python/mozboot/mozboot/bootstrap.py
@@ -292,53 +292,54 @@ class Bootstrapper(object):
     # We can't easily import mach_bootstrap.py because the bootstrapper may
     # run in self-contained mode and only the files in this directory will
     # be available. We /could/ refactor parts of mach_bootstrap.py to be
     # part of this directory to avoid the code duplication.
     def try_to_create_state_dir(self):
         state_dir, _ = get_state_dir()
 
         if not os.path.exists(state_dir):
+            should_create_state_dir = True
             if not self.instance.no_interactive:
                 choice = self.instance.prompt_int(
                     prompt=STATE_DIR_INFO.format(statedir=state_dir),
                     low=1,
                     high=2)
 
-                if choice == 1:
-                    print('Creating global state directory: %s' % state_dir)
-                    os.makedirs(state_dir, mode=0o770)
+                should_create_state_dir = choice == 1
+
+            # This directory is by default in $HOME, or overridden via an env
+            # var, so we probably shouldn't gate it on --no-system-changes.
+            if should_create_state_dir:
+                print('Creating global state directory: %s' % state_dir)
+                os.makedirs(state_dir, mode=0o770)
 
         state_dir_available = os.path.exists(state_dir)
         return state_dir_available, state_dir
 
     def maybe_install_private_packages_or_exit(self, state_dir,
                                                state_dir_available,
                                                have_clone,
                                                checkout_root):
-        # Install the clang packages needed for developing stylo, as well
-        # as the version of NodeJS that we currently support.
-        if not self.instance.no_interactive:
-            # The best place to install our packages is in the state directory
-            # we have.  If the user doesn't have one, we need them to re-run
-            # bootstrap and create the directory.
-            #
-            # XXX Android bootstrap just assumes the existence of the state
-            # directory and writes the NDK into it.  Should we do the same?
-            if not state_dir_available:
-                print(STYLO_NODEJS_DIRECTORY_MESSAGE.format(statedir=state_dir))
-                sys.exit(1)
+        # Install the clang packages needed for building the style system, as
+        # well as the version of NodeJS that we currently support.
 
-            if not have_clone:
-                print(STYLE_NODEJS_REQUIRES_CLONE)
-                sys.exit(1)
+        # The best place to install our packages is in the state directory
+        # we have.  We should have created one above in non-interactive mode.
+        if not state_dir_available:
+            print(STYLO_NODEJS_DIRECTORY_MESSAGE.format(statedir=state_dir))
+            sys.exit(1)
 
-            self.instance.state_dir = state_dir
-            self.instance.ensure_stylo_packages(state_dir, checkout_root)
-            self.instance.ensure_node_packages(state_dir, checkout_root)
+        if not have_clone:
+            print(STYLE_NODEJS_REQUIRES_CLONE)
+            sys.exit(1)
+
+        self.instance.state_dir = state_dir
+        self.instance.ensure_stylo_packages(state_dir, checkout_root)
+        self.instance.ensure_node_packages(state_dir, checkout_root)
 
     def bootstrap(self):
         if self.choice is None:
             # Like ['1. Firefox for Desktop', '2. Firefox for Android Artifact Mode', ...].
             labels = ['%s. %s' % (i + 1, name) for (i, (name, _)) in enumerate(APPLICATIONS_LIST)]
             prompt = APPLICATION_CHOICE % '\n'.join(labels)
             prompt_choice = self.instance.prompt_int(prompt=prompt, low=1, high=len(APPLICATIONS))
             name, application = APPLICATIONS_LIST[prompt_choice-1]