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' 306032 buildstep.BuildStep.__init__(self, **kwargs) 33 self.addFactoryArguments(variables = variables, 34 source = source) 35 self.variables = variables 36 self.source = source3739 # on Windows, environment variables are case-insensitive, but we have 40 # a case-sensitive dictionary in slave_environ. Fortunately, that 41 # dictionary is also folded to uppercase, so we can simply fold the 42 # variable names to uppercase to duplicate the case-insensitivity. 43 fold_to_uppercase = (self.buildslave.slave_system == 'win32') 44 45 properties = self.build.getProperties() 46 environ = self.build.slaveEnvironment 47 variables = self.variables 48 if isinstance(variables, str): 49 variables = [self.variables] 50 for variable in variables: 51 key = variable 52 if fold_to_uppercase: 53 key = variable.upper() 54 value = environ.get(key, None) 55 if value: 56 # note that the property is not uppercased 57 properties.setProperty(variable, value, self.source, 58 runtime=True) 59 self.finished(SUCCESS)62 """ 63 Check for the existence of a file on the slave. 64 """ 65 name='FileExists' 66 description='Checking' 67 descriptionDone='Checked' 68 69 renderables = [ 'file' ] 70 71 haltOnFailure = True 72 flunkOnFailure = True 73 7410276 buildstep.BuildStep.__init__(self, **kwargs) 77 self.addFactoryArguments(file = file) 78 self.file = file7981 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.rc != 0: 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 115137117 buildstep.BuildStep.__init__(self, **kwargs) 118 self.addFactoryArguments(dir = dir) 119 self.dir = dir120122 slavever = self.slaveVersion('rmdir') 123 if not slavever: 124 raise BuildSlaveTooOldError("slave is too old, does not know " 125 "about rmdir") 126 cmd = buildstep.RemoteCommand('rmdir', {'dir': self.dir }) 127 d = self.runCommand(cmd) 128 d.addCallback(lambda res: self.commandComplete(cmd)) 129 d.addErrback(self.failed)130139 """ 140 Create a directory on the slave. 141 """ 142 name='MakeDirectory' 143 description='Creating' 144 desciprtionDone='Created' 145 146 renderables = [ 'dir' ] 147 148 haltOnFailure = True 149 flunkOnFailure = True 150172152 buildstep.BuildStep.__init__(self, **kwargs) 153 self.addFactoryArguments(dir = dir) 154 self.dir = dir155157 slavever = self.slaveVersion('mkdir') 158 if not slavever: 159 raise BuildSlaveTooOldError("slave is too old, does not know " 160 "about mkdir") 161 cmd = buildstep.RemoteCommand('mkdir', {'dir': self.dir }) 162 d = self.runCommand(cmd) 163 d.addCallback(lambda res: self.commandComplete(cmd)) 164 d.addErrback(self.failed)165
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Mar 25 19:40:43 2012 | http://epydoc.sourceforge.net |