def doRunHooks(self, dummy): """Runs "gclient runhooks" after patching.""" dirname = os.path.join(self.builder.basedir, self.srcdir) command = [chromium_utils.GetGClientCommand(), 'runhooks'] c = runprocess.RunProcess( self.builder, command, dirname, sendRC=False, timeout=self.timeout, keepStdout=True, environ=self.env) self.command = c d = c.start() d.addCallback(self._abandonOnFailure) return d
def doGclientUpdate(self): """Sync the client """ dirname = os.path.join(self.builder.basedir, self.srcdir) command = [ chromium_utils.GetGClientCommand(), 'sync', '--verbose', '--reset', '--manually_grab_svn_rev', '--force', '--with_branch_heads' ] if self.delete_unversioned_trees_when_updating: command.append('--delete_unversioned_trees') if self.gclient_jobs: command.append('-j%d' % self.gclient_jobs) # Don't run hooks if it was patched or there is a patch since runhooks will # be run after. if self.gclient_nohooks or self.patch or self.was_patched: command.append('--nohooks') # GClient accepts --revision argument of two types 'module@rev' and 'rev'. if self.revision and not self.no_gclient_revision: command.append('--revision') # Ignore non-svn part of compound revisions. # Used for nacl.sdk.mono waterfall. if ':' in self.revision: command.append(self.revision.split(':')[0]) elif (not self.branch or self.no_gclient_branch or '@' in str(self.revision)): command.append(str(self.revision)) else: # Make the revision look like branch@revision. prefix = self.project if self.project else self.branch command.append('%s@%s' % (prefix, self.revision)) # We only add the transitive flag if we have a revision, otherwise it is # meaningless. if self.gclient_transitive: command.append('--transitive') if self.gclient_deps: command.append('--deps=' + self.gclient_deps) c = runprocess.RunProcess(self.builder, command, dirname, sendRC=False, timeout=self.timeout, keepStdout=True, environ=self.env) self.command = c return c.start()
def AddUpdateScriptStep(self, gclient_jobs=None): """Adds a step to the factory to update the script folder.""" # This will be run in the '..' directory to udpate the slave's own script # checkout. command = [ chromium_utils.GetGClientCommand(self._target_platform), 'sync', '--verbose' ] if gclient_jobs: command.append('-j%d' % gclient_jobs) self._factory.addStep(shell.ShellCommand, name='update_scripts', description='update_scripts', locks=[self.slave_exclusive_lock], timeout=60 * 5, workdir='..', command=command)
def doRevert(self, dummy): """Revert any modification done by a previous patch. This is done in 2 parts to trap potential errors at each step. Note that it is assumed that .orig and .rej files will be reverted, e.g. deleted by the 'gclient revert' command. If the try bot is configured with 'global-ignores=*.orig', patch failure will occur.""" dirname = os.path.join(self.builder.basedir, self.srcdir) command = [chromium_utils.GetGClientCommand(), 'revert', '--nohooks'] c = runprocess.RunProcess( self.builder, command, dirname, sendRC=False, timeout=self.timeout, keepStdout=True, environ=self.env) self.command = c d = c.start() d.addCallback(self._abandonOnFailure) # Remove patch residues. d.addCallback(lambda _: self._doRevertRemoveSignalFile()) return d
def getGclientConfigCommand(self): """Return the command to run the gclient config step. """ dirname = os.path.join(self.builder.basedir, self.srcdir) command = [chromium_utils.GetGClientCommand(), 'config'] if self.gclient_spec: command.append('--spec=%s' % self.gclient_spec) else: command.append(self.svnurl) c = runprocesscmd(self.builder, command, dirname, sendRC=False, timeout=self.timeout, keepStdout=True, environ=self.env) return c
def main(): parser = optparse.OptionParser(description=__doc__) parser.add_option('--use-goma', action='store_true') parser.add_option('--goma-dir', default=os.path.join(BUILD_DIR, 'goma'), help='goma directory, only used if --use-goma is passed') options, args = parser.parse_args() assert not args if options.use_goma: # Add goma-related GYP_DEFINES if requested. This is done in a slave script # because goma_dir is a slave-relative path and is not known to the master. gyp_defines = os.environ.get('GYP_DEFINES', '') # pipes.quote() is necessary on Windows: http://crbug.com/340918#c7 - 11. gyp_defines += ' use_goma=1 gomadir=' + pipes.quote(options.goma_dir) os.environ['GYP_DEFINES'] = gyp_defines print 'Changed GYP_DEFINES to', os.environ['GYP_DEFINES'] return chromium_utils.RunCommand( [chromium_utils.GetGClientCommand(), 'runhooks'])