Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'commit')[0].attributes['revision'].value
except (KeyError, IndexError):
msg = ("SVN.parseGotRevision unable to detect Last Changed Rev in"
" output of svn info")
log.msg(msg)
# fall through and try to get 'Revision' instead
if revision is None:
try:
revision = stdout_xml.getElementsByTagName(
'entry')[0].attributes['revision'].value
except (KeyError, IndexError):
msg = ("SVN.parseGotRevision unable to detect revision in"
" output of svn info")
log.msg(msg)
raise buildstep.BuildStepFailed()
msg = "Got SVN revision %s" % (revision, )
self.stdio_log.addHeader(msg)
self.updateSourceProperty('got_revision', revision)
return cmd.rc
def _fetchOrFallback(self, _=None):
"""
Handles fallbacks for failure of fetch,
wrapper for self._fetch
"""
res = yield self._fetch(None)
if res == RC_SUCCESS:
defer.returnValue(res)
return
elif self.retryFetch:
yield self._fetch(None)
elif self.clobberOnFailure:
yield self.clobber()
else:
raise buildstep.BuildStepFailed()
def evaluateCommand(cmd):
if abandonOnFailure and cmd.didFail():
log.msg("Source step failed while running command %s" % cmd)
raise buildstep.BuildStepFailed()
if collectStdout:
return cmd.stdout
else:
return cmd.rc
d.addCallback(lambda _: evaluateCommand(cmd))
def evaluate(cmd):
if cmd.didFail():
raise buildstep.BuildStepFailed()
return cmd.rc
return d
def getUnversionedFiles(xmlStr, keep_on_purge):
try:
result_xml = xml.dom.minidom.parseString(xmlStr)
except xml.parsers.expat.ExpatError:
log.err("Corrupted xml, aborting step")
raise buildstep.BuildStepFailed()
for entry in result_xml.getElementsByTagName('entry'):
(wc_status,) = entry.getElementsByTagName('wc-status')
if wc_status.getAttribute('item') == 'external':
continue
if wc_status.getAttribute('item') == 'missing':
continue
filename = entry.getAttribute('path')
if filename in keep_on_purge or filename == '':
continue
yield filename
"Please put a file named .travis.yml at the root of your repository:\n{0}".format(e))
self.addHelpLog()
raise
self.addCompleteLog(filename, travis_yml)
config = TravisYml()
try:
config.parse(travis_yml)
except TravisYmlInvalid as e:
self.descriptionDone = u"bad .travis.yml"
self.addCompleteLog(
"error",
".travis.yml is invalid:\n{0}".format(e))
self.addHelpLog()
raise buildstep.BuildStepFailed("Bad travis file")
defer.returnValue(config)
def checkInstall(svnInstalled):
if not svnInstalled:
raise buildstep.BuildStepFailed(
"SVN is not installed on worker")
return 0
def evaluateCommand(_):
if abandonOnFailure and cmd.didFail():
self.descriptionDone = "repo failed at: %s" % (
" ".join(command[:2]))
self.stdio_log.addStderr(
"Source step failed while running command %s\n" % cmd)
raise buildstep.BuildStepFailed()
return cmd.rc
return d
yield self._dovccmd(['mtn', 'db', 'migrate', '--db',
self.database],
workdir='.')
elif stdout.find("too new, cannot use") >= 0 or \
stdout.find("database has no tables") >= 0:
# The database is of a newer format which the worker's
# mtn version can not handle. Drop it and pull again
# with that monotone version installed on the
# worker. Do the same if it's an empty file.
yield self.runRmdir(self.database)
db_needs_init = True
elif stdout.find("not a monotone database") >= 0:
# There exists a database file, but it's not a valid
# monotone database. Do not delete it, but fail with
# an error.
raise buildstep.BuildStepFailed()
else:
log.msg("Database exists and compatible")
else:
db_needs_init = True
log.msg("Database does not exist")
if db_needs_init:
command = ['mtn', 'db', 'init', '--db', self.database]
yield self._dovccmd(command, workdir='.')