Bug 1066680 - mach run should provide an option to start without a profile. r=gps
authorPanos Astithas <past@mozilla.com>
Fri, 12 Sep 2014 18:45:53 +0300
changeset 207920 a6ffb6748edda09bc4242d5011209e51aa5befb2
parent 207919 de63b8929fa4ddde5fb4751f4e861f5ec101d591
child 207921 2ae57957e4bb916f6596f3d1c1c19a1b6399900b
child 208019 1f8b260d82da599eb1cbd3dc75a1ad778f55f6d0
push id27569
push usercbook@mozilla.com
push dateTue, 30 Sep 2014 13:14:19 +0000
treeherderautoland@2ae57957e4bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1066680
milestone35.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 1066680 - mach run should provide an option to start without a profile. r=gps
python/mozbuild/mozbuild/mach_commands.py
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -770,17 +770,17 @@ class Install(MachCommandBase):
     """Install a package."""
 
     @Command('install', category='post-build',
         description='Install the package on the machine, or on a device.')
     def install(self):
         return self._run_make(directory=".", target='install', ensure_exit_code=False)
 
 
-def get_run_args(mach_command, params, remote, background):
+def get_run_args(mach_command, params, remote, background, noprofile):
     """
     Parses the given options to create an args array for running firefox.
     Creates a scratch profile and uses that if one is not specified.
     """
     try:
         args = [mach_command.get_binary_path('app')]
     except Exception as e:
         print("It looks like your program isn't built.",
@@ -789,17 +789,17 @@ def get_run_args(mach_command, params, r
         return None
 
     if not remote:
         args.append('-no-remote')
 
     if not background and sys.platform == 'darwin':
         args.append('-foreground')
 
-    if '-profile' not in params and '-P' not in params:
+    if '-profile' not in params and '-P' not in params and not noprofile:
         path = os.path.join(mach_command.topobjdir, 'tmp', 'scratch_user')
         if not os.path.isdir(path):
             os.makedirs(path)
         args.append('-profile')
         args.append(path)
 
     if params:
         args.extend(params)
@@ -816,18 +816,20 @@ class RunProgram(MachCommandBase):
     @Command('run', category='post-build', allow_all_args=True,
         description='Run the compiled program.')
     @CommandArgument('params', default=None, nargs='...',
         help='Command-line arguments to be passed through to the program. Not specifying a -profile or -P option will result in a temporary profile being used.')
     @CommandArgument('+remote', '+r', action='store_true',
         help='Do not pass the -no-remote argument by default.')
     @CommandArgument('+background', '+b', action='store_true',
         help='Do not pass the -foreground argument by default on Mac')
-    def run(self, params, remote, background):
-        args = get_run_args(self, params, remote, background)
+    @CommandArgument('+noprofile', '+n', action='store_true',
+        help='Do not pass the -profile argument by default.')
+    def run(self, params, remote, background, noprofile):
+        args = get_run_args(self, params, remote, background, noprofile)
         if not args:
             return 1
 
         return self.run_process(args=args, ensure_exit_code=False,
             pass_thru=True)
 
 @CommandProvider
 class DebugProgram(MachCommandBase):
@@ -847,17 +849,19 @@ class DebugProgram(MachCommandBase):
         help='Command-line arguments to pass to the debugger itself; split as the Bourne shell would.')
     # Bug 933807 introduced JS_DISABLE_SLOW_SCRIPT_SIGNALS to avoid clever
     # segfaults induced by the slow-script-detecting logic for Ion/Odin JITted
     # code.  If we don't pass this, the user will need to periodically type
     # "continue" to (safely) resume execution.  There are ways to implement
     # automatic resuming; see the bug.
     @CommandArgument('+slowscript', action='store_true',
         help='Do not set the JS_DISABLE_SLOW_SCRIPT_SIGNALS env variable; when not set, recoverable but misleading SIGSEGV instances may occur in Ion/Odin JIT code')
-    def debug(self, params, remote, background, debugger, debugparams, slowscript):
+    @CommandArgument('+noprofile', '+n', action='store_true',
+        help='Do not pass the -profile argument by default.')
+    def debug(self, params, remote, background, debugger, debugparams, slowscript, noprofile):
         # Parameters come from the CLI. We need to convert them before their use.
         if debugparams:
             import pymake.process
             argv, badchar = pymake.process.clinetoargv(debugparams, os.getcwd())
             if badchar:
                 print("The +debugparams you passed require a real shell to parse them.")
                 print("(We can't handle the %r character.)" % (badchar,))
                 return 1
@@ -893,17 +897,17 @@ class DebugProgram(MachCommandBase):
         args.append(binpath)
 
         if not remote:
             args.append('-no-remote')
         if not background and sys.platform == 'darwin':
             args.append('-foreground')
         if params:
             args.extend(params)
-        if '-profile' not in params and '-P' not in params:
+        if '-profile' not in params and '-P' not in params and not noprofile:
             path = os.path.join(self.topobjdir, 'tmp', 'scratch_user')
             if not os.path.isdir(path):
                 os.makedirs(path)
             args.append('-profile')
             args.append(path)
         if not slowscript:
             extra_env['JS_DISABLE_SLOW_SCRIPT_SIGNALS'] = '1'
         return self.run_process(args=args, append_env=extra_env,