Skip to content

Commit

Permalink
Backed out changeset dc7924e3ea6b (bug 1483941) for causing bug 15044…
Browse files Browse the repository at this point in the history
…49. a=backout
  • Loading branch information
raulgurzau committed Nov 3, 2018
1 parent 7c0a5e2 commit 26c6e57
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 182 deletions.
1 change: 0 additions & 1 deletion python/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ with Files('mach/docs/**'):

PYTHON_UNITTEST_MANIFESTS += [
'mach/mach/test/python.ini',
'mozboot/mozboot/test/python.ini',
'mozbuild/dumbmake/test/python.ini',
'mozlint/test/python.ini',
'mozrelease/test/python.ini',
Expand Down
14 changes: 0 additions & 14 deletions python/mozboot/mozboot/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,20 +408,6 @@ def prompt_int(self, prompt, low, high, limit=5):
else:
raise Exception("Error! Reached max attempts of entering option.")

def prompt_yesno(self, prompt):
''' Prompts the user with prompt and requires a yes/no answer.'''
valid = False
while not valid:
choice = raw_input(prompt + ' [Y/n]: ').strip().lower()[:1]
if choice == '':
choice = 'y'
if choice not in ('y', 'n'):
print('ERROR! Please enter y or n!')
else:
valid = True

return choice == 'y'

def _ensure_package_manager_updated(self):
if self.package_manager_updated:
return
Expand Down
61 changes: 1 addition & 60 deletions python/mozboot/mozboot/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
import sys
import os
import subprocess
from six.moves.configparser import (
Error as ConfigParserError,
RawConfigParser,
)

# Don't forgot to add new mozboot modules to the bootstrap download
# list in bin/bootstrap.py!
Expand Down Expand Up @@ -189,54 +185,17 @@
Then restart your shell.
'''

TELEMETRY_OPT_IN_PROMPT = '''
Would you like to enable build system telemetry?
Mozilla collects data about local builds in order to make builds faster and
improve developer tooling. To learn more about the data we intend to collect
read here:
https://firefox-source-docs.mozilla.org/build/buildsystem/telemetry.html.
If you have questions, please ask in #build in irc.mozilla.org. If you would
like to opt out of data collection, select (N) at the prompt.
Your choice'''


def update_or_create_build_telemetry_config(path):
"""Write a mach config file enabling build telemetry to `path`. If the file does not exist,
create it. If it exists, add the new setting to the existing data.
This is standalone from mach's `ConfigSettings` so we can use it during bootstrap
without a source checkout.
"""
config = RawConfigParser()
if os.path.exists(path):
try:
config.read([path])
except ConfigParserError as e:
print('Your mach configuration file at `{path}` is not parseable:\n{error}'.format(
path=path, error=e))
return False
if not config.has_section('build'):
config.add_section('build')
config.set('build', 'telemetry', 'true')
with open(path, 'wb') as f:
config.write(f)
return True


class Bootstrapper(object):
"""Main class that performs system bootstrap."""

def __init__(self, finished=FINISHED, choice=None, no_interactive=False,
hg_configure=False, no_system_changes=False, mach_context=None):
hg_configure=False, no_system_changes=False):
self.instance = None
self.finished = finished
self.choice = choice
self.hg_configure = hg_configure
self.no_system_changes = no_system_changes
self.mach_context = mach_context
cls = None
args = {'no_interactive': no_interactive,
'no_system_changes': no_system_changes}
Expand Down Expand Up @@ -377,20 +336,6 @@ def maybe_install_private_packages_or_exit(self, state_dir,
self.instance.ensure_stylo_packages(state_dir, checkout_root)
self.instance.ensure_node_packages(state_dir, checkout_root)

def check_telemetry_opt_in(self, state_dir):
# We can't prompt the user.
if self.instance.no_interactive:
return
# Don't prompt if the user already has a setting for this value.
if self.mach_context is not None and 'telemetry' in self.mach_context.settings.build:
return
choice = self.instance.prompt_yesno(prompt=TELEMETRY_OPT_IN_PROMPT)
if choice:
cfg_file = os.path.join(state_dir, 'machrc')
if update_or_create_build_telemetry_config(cfg_file):
print('\nThanks for enabling build telemetry! You can change this setting at ' +
'any time by editing the config file `{}`\n'.format(cfg_file))

def bootstrap(self):
if self.choice is None:
# Like ['1. Firefox for Desktop', '2. Firefox for Android Artifact Mode', ...].
Expand All @@ -415,8 +360,6 @@ def bootstrap(self):
(checkout_type, checkout_root) = r
have_clone = bool(checkout_type)

if state_dir_available:
self.check_telemetry_opt_in(state_dir)
self.maybe_install_private_packages_or_exit(state_dir,
state_dir_available,
have_clone,
Expand Down Expand Up @@ -492,8 +435,6 @@ def bootstrap(self):
if not have_clone:
print(SOURCE_ADVERTISE)

if state_dir_available:
self.check_telemetry_opt_in(state_dir)
self.maybe_install_private_packages_or_exit(state_dir,
state_dir_available,
have_clone,
Expand Down
11 changes: 3 additions & 8 deletions python/mozboot/mozboot/mach_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
@CommandProvider
class Bootstrap(object):
"""Bootstrap system and mach for optimal development experience."""
def __init__(self, context):
self._context = context

@Command('bootstrap', category='devenv',
description='Install required system packages for building.')
Expand All @@ -34,12 +32,9 @@ def __init__(self, context):
def bootstrap(self, application_choice=None, no_interactive=False, no_system_changes=False):
from mozboot.bootstrap import Bootstrapper

bootstrapper = Bootstrapper(
choice=application_choice,
no_interactive=no_interactive,
no_system_changes=no_system_changes,
mach_context=self._context,
)
bootstrapper = Bootstrapper(choice=application_choice,
no_interactive=no_interactive,
no_system_changes=no_system_changes)
bootstrapper.bootstrap()


Expand Down
4 changes: 0 additions & 4 deletions python/mozboot/mozboot/test/python.ini

This file was deleted.

95 changes: 0 additions & 95 deletions python/mozboot/mozboot/test/test_write_config.py

This file was deleted.

0 comments on commit 26c6e57

Please sign in to comment.