Trees | Indices | Help |
|
---|
|
1 # This file is part of Buildbot. Buildbot is free software: you can 2 # redistribute it and/or modify it under the terms of the GNU General Public 3 # License as published by the Free Software Foundation, version 2. 4 # 5 # This program is distributed in the hope that it will be useful, but WITHOUT 6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 7 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 8 # details. 9 # 10 # You should have received a copy of the GNU General Public License along with 11 # this program; if not, write to the Free Software Foundation, Inc., 51 12 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 13 # 14 # Copyright Buildbot Team Members 15 16 import stat 17 from buildbot.process import buildstep 18 from buildbot.status.results import SUCCESS, FAILURE 19 from buildbot.interfaces import BuildSlaveTooOldError 2022 """ 23 Sets properties from envirionment variables on the slave. 24 25 Note this is transfered when the slave first connects 26 """ 27 name='SetPropertiesFromEnv' 28 description='Setting' 29 descriptionDone='Set' 306132 buildstep.BuildStep.__init__(self, **kwargs) 33 self.variables = variables 34 self.source = source3537 # on Windows, environment variables are case-insensitive, but we have 38 # a case-sensitive dictionary in slave_environ. Fortunately, that 39 # dictionary is also folded to uppercase, so we can simply fold the 40 # variable names to uppercase to duplicate the case-insensitivity. 41 fold_to_uppercase = (self.buildslave.slave_system == 'win32') 42 43 properties = self.build.getProperties() 44 environ = self.buildslave.slave_environ 45 variables = self.variables 46 log = [] 47 if isinstance(variables, str): 48 variables = [self.variables] 49 for variable in variables: 50 key = variable 51 if fold_to_uppercase: 52 key = variable.upper() 53 value = environ.get(key, None) 54 if value: 55 # note that the property is not uppercased 56 properties.setProperty(variable, value, self.source, 57 runtime=True) 58 log.append("%s = %r" % (variable, value)) 59 self.addCompleteLog("properties", "\n".join(log)) 60 self.finished(SUCCESS)63 """ 64 Check for the existence of a file on the slave. 65 """ 66 name='FileExists' 67 description='Checking' 68 descriptionDone='Checked' 69 70 renderables = [ 'file' ] 71 72 haltOnFailure = True 73 flunkOnFailure = True 74 75 7910281 slavever = self.slaveVersion('stat') 82 if not slavever: 83 raise BuildSlaveTooOldError("slave is too old, does not know " 84 "about stat") 85 cmd = buildstep.RemoteCommand('stat', {'file': self.file }) 86 d = self.runCommand(cmd) 87 d.addCallback(lambda res: self.commandComplete(cmd)) 88 d.addErrback(self.failed)8991 if cmd.didFail(): 92 self.step_status.setText(["File not found."]) 93 self.finished(FAILURE) 94 return 95 s = cmd.updates["stat"][-1] 96 if stat.S_ISREG(s[stat.ST_MODE]): 97 self.step_status.setText(["File found."]) 98 self.finished(SUCCESS) 99 else: 100 self.step_status.setText(["Not a file."]) 101 self.finished(FAILURE)104 """ 105 Remove a directory tree on the slave. 106 """ 107 name='RemoveDirectory' 108 description='Deleting' 109 desciprtionDone='Deleted' 110 111 renderables = [ 'dir' ] 112 113 haltOnFailure = True 114 flunkOnFailure = True 115 119136121 slavever = self.slaveVersion('rmdir') 122 if not slavever: 123 raise BuildSlaveTooOldError("slave is too old, does not know " 124 "about rmdir") 125 cmd = buildstep.RemoteCommand('rmdir', {'dir': self.dir }) 126 d = self.runCommand(cmd) 127 d.addCallback(lambda res: self.commandComplete(cmd)) 128 d.addErrback(self.failed)129138 """ 139 Create a directory on the slave. 140 """ 141 name='MakeDirectory' 142 description='Creating' 143 desciprtionDone='Created' 144 145 renderables = [ 'dir' ] 146 147 haltOnFailure = True 148 flunkOnFailure = True 149 153170155 slavever = self.slaveVersion('mkdir') 156 if not slavever: 157 raise BuildSlaveTooOldError("slave is too old, does not know " 158 "about mkdir") 159 cmd = buildstep.RemoteCommand('mkdir', {'dir': self.dir }) 160 d = self.runCommand(cmd) 161 d.addCallback(lambda res: self.commandComplete(cmd)) 162 d.addErrback(self.failed)163
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Nov 21 16:22:50 2012 | http://epydoc.sourceforge.net |