1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464
|
#!/usr/bin/python
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2014 Task Coach developers <developers@taskcoach.org>
Task Coach is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Task Coach is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
# pylint: disable=F0401,E1101
from buildbot.steps.shell import Compile, ShellCommand, WithProperties
from buildbot.steps.master import MasterShellCommand
from buildbot.steps.transfer import FileUpload, DirectoryUpload
from buildbot import interfaces
from buildbot.process.buildstep import SUCCESS, FAILURE
from twisted.python import log
from zope.interface import implements
import re, os
class TaskCoachEmailLookup(object):
implements(interfaces.IEmailLookup)
def getAddress(self, name):
try:
return { 'fraca7': 'fraca7@free.fr',
'fniessink': 'frank@niessink.com' }[name]
except KeyError:
return None
class Revert(Compile):
name = 'Revert'
description = ['Reverting', 'locally', 'modified', 'files']
descriptionDone = ['Local', 'changes', 'reverted']
command = ['svn', 'revert', '-R', '.']
class Cleanup(Compile):
name = 'Cleanup'
description = ['Deleting', 'unversioned', 'files']
descriptionDone = ['Unversioned', 'files', 'deleted']
command = ['make', 'nuke']
def start(self):
try:
self.getProperty('release')
except KeyError:
self.setProperty('release', False)
Compile.start(self)
class Revision(Compile):
name = 'Revision'
description = ['Generating', 'revision', 'file']
descriptionDone = ['Revision', 'file', 'generated']
command = ['make', 'revision', WithProperties('TCREV=%s', 'got_revision')]
#==============================================================================
# Tests and documentation
class UnitTests(Compile):
name = 'unit tests'
description = ['Running', 'unit', 'tests']
descriptionDone = ['Unit', 'tests']
haltOnFailure = False
command = ['make', 'unittests']
class IntegrationTests(Compile):
name = 'integration tests'
description = ['Running', 'integration', 'tests']
descriptionDone = ['Integration', 'tests']
command = ['make', 'integrationtests']
class LanguageTests(Compile):
name = 'language tests'
description = ['Running', 'language', 'tests']
descriptionDone = ['Language', 'tests']
haltOnFailure = False
command = ['make', 'languagetests']
class ReleaseTests(Compile):
name = 'release tests'
description = ['Running', 'release', 'tests']
descriptionDone = ['Release', 'tests']
haltOnFailure = False
command = ['make', 'releasetests']
class DistributionTests(Compile):
name = 'distribution tests'
description = ['Running', 'distribution', 'tests']
descriptionDone = ['Distribution', 'tests']
haltOnFailure = False
command = ['make', 'disttests']
class KillEXE(ShellCommand):
haltOnFailure = False
flunkOnFailure = False
name = 'Cleanup'
command = ['taskkill', '/F', '/IM', 'taskcoach.exe']
description = ['Killing', 'exe']
descriptionDone = ['Exe', 'killed']
def evaluateCommand(self, cmd):
return SUCCESS
class Coverage(Compile):
name = 'coverage'
description = ['Running', 'coverage']
descriptionDone = ['Coverage']
haltOnFailure = False
command = ['make', 'coverage']
def createSummary(self, log):
Compile.createSummary(self, log)
self.addURL('coverage',
'http://www.fraca7.net/TaskCoach-coverage/%s/index.html' % (self.getProperty('buildername')))
class UploadCoverage(DirectoryUpload):
def __init__(self, **kwargs):
kwargs['slavesrc'] = 'tests/coverage.out'
kwargs['masterdest'] = WithProperties('/var/www/TaskCoach-coverage/%s', 'buildername')
DirectoryUpload.__init__(self, **kwargs)
class Epydoc(Compile):
name = 'epydoc'
description = ['Generating', 'documentation']
descriptionDone = ['Documentation']
warningPattern = '.*Warning:.*'
command = ['make', 'epydoc']
class UploadDoc(DirectoryUpload):
def __init__(self, **kwargs):
kwargs['slavesrc'] = 'epydoc.out'
kwargs['masterdest'] = WithProperties('/var/www/TaskCoach-doc/%s', 'buildername')
DirectoryUpload.__init__(self, **kwargs)
def start(self):
DirectoryUpload.start(self)
self.addURL('Documentation',
'http://www.fraca7.net/TaskCoach-doc/%s/index.html' % (self.getProperty('buildername')))
#==============================================================================
# Platform-specific packages
class DistCompile(Compile):
sep = '/'
ignoreWarnings = False
filesuffix = None
fileprefix = None
target = None
def start(self):
if self.getProperty('release'):
self.command = ['make', self.target or self.name]
else:
self.command = ['make', self.target or self.name, 'TCREV=%s' % self.getProperty('got_revision')]
Compile.start(self)
def commandComplete(self, cmd):
log = cmd.logs['stdio']
for line in log.readlines():
mt = self.filename_rx.search(line)
if mt:
filename = mt.group(1).strip()
if self.filesuffix is not None:
filename += self.filesuffix
if self.fileprefix is not None:
filename = self.fileprefix + filename
self.setProperty('filename', filename)
self.setProperty('basefilename', filename[filename.rfind(self.sep) + 1:])
break
Compile.commandComplete(self, cmd)
def createSummary(self, log):
if not self.ignoreWarnings:
Compile.createSummary(self, log)
class UploadBase(FileUpload):
def __init__(self, **kwargs):
kwargs['slavesrc'] = WithProperties('%s', 'filename')
kwargs['masterdest'] = WithProperties('/var/www/TaskCoach-packages/%s/%s', 'branch', 'basefilename')
kwargs['mode'] = 0644
FileUpload.__init__(self, **kwargs)
def start(self):
if self.getProperty('release'):
self.masterdest = '/var/www/TaskCoach-packages/release/%s' % self.getProperty('basefilename')
FileUpload.start(self)
if not self.getProperty('release'):
url = 'http://www.fraca7.net/TaskCoach-packages/%s/%s' % (self.getProperty('branch') or '',
self.getProperty('basefilename'))
self.addURL('Download', url)
class UploadChangelog(FileUpload):
def __init__(self, **kwargs):
kwargs['slavesrc'] = 'changelog_content'
kwargs['masterdest'] = WithProperties('/var/www/TaskCoach-packages/%s/changelog_content', 'branch')
kwargs['mode'] = 0644
FileUpload.__init__(self, **kwargs)
# Mac OS X
class BuildDMG(DistCompile):
filename_rx = re.compile(r'^created: (.*)')
name = 'dmg-signed'
description = ['Generating', 'MacOS', 'binary']
descriptionDone = ['MacOS', 'binary']
class UploadDMG(UploadBase):
pass
# Windows
class BuildEXE(DistCompile):
filename_rx = re.compile(r'(dist\\.*-win32\.exe)')
sep = '\\'
ignoreWarnings = True
name = 'windist'
description = ['Generating', 'Windows', 'binary']
descriptionDone = ['Windows', 'binary']
class UploadEXE(UploadBase):
pass
class BuildWinPenPack(DistCompile):
filename_rx = re.compile(r'^Generated (dist\\.*\.zip)')
sep = '\\'
name = 'winpenpack'
description = ['Generating', 'WinPenPack', 'binary']
descriptionDone = ['WinPenPack', 'binary']
class UploadWinPenPack(UploadBase):
pass
class BuildPortableApps(DistCompile):
filename_rx = re.compile(r'^mv build/(.*\.paf\.exe) dist')
fileprefix = 'dist\\'
sep = '\\'
name = 'portableapps'
description = ['Generating', 'PortableApps', 'binary']
descriptionDone = ['PortableApps', 'binary']
class UploadPortableApps(UploadBase):
pass
# Source
class BuildSourceTar(DistCompile):
filename_rx = re.compile('^Created (.*)$')
name = 'sdist_linux'
description = ['Generating', 'source', 'distribution']
descriptionDone = ['Source', 'distribution']
class BuildSourceZip(DistCompile):
filename_rx = re.compile(r"creating '(.*\.zip)'")
sep = '\\'
ignoreWarnings = True
name = 'sdist_windows'
description = ['Generating', 'source', 'distribution']
descriptionDone = ['Source', 'distribution']
class BuildSourceRaw(DistCompile):
filename_rx = re.compile(r'tar czf (TaskCoach-.*-raw.tgz)')
fileprefix = 'dist/'
name = 'sdist_raw'
description = ['Generating', 'raw', 'source', 'distribution']
descriptionDone = ['Raw', 'source', 'distribution']
class UploadSourceTar(UploadBase):
pass
class UploadSourceZip(UploadBase):
pass
class UploadSourceRaw(UploadBase):
pass
# Debian
class BuildDEB(DistCompile):
filename_rx = re.compile(r'^mv (dist/taskcoach.*)_all\.deb')
filesuffix = '.deb'
name = 'deb'
description = ['Generating', 'Debian', 'package']
descriptionDone = ['Debian', 'package']
class BuildUbuntu(BuildDEB):
filename_rx = re.compile(r'^moving build/(taskcoach_.*_all)\.deb')
fileprefix = 'dist/'
name = 'ubuntu'
class UploadDEB(UploadBase):
pass
class PPA(Compile):
name = 'ppa'
description = ['Uploading', 'PPA']
description_done = ['PPA', 'uploaded']
def __init__(self, **kwargs):
name = kwargs.pop('name')
kwargs['command'] = ['./uploadppa.sh', name]
Compile.__init__(self, **kwargs)
self.addFactoryArguments(name=name)
# Generic RPM
class BuildRPM(DistCompile):
filename_rx = re.compile(r'([^/]*.noarch.rpm) -> dist')
fileprefix = 'dist/'
name = 'rpm'
target = 'rpm'
description = ['Generating', 'RPM', 'package']
descriptiondone = ['RPM', 'package']
class BuildSRPM(DistCompile):
filename_rx = re.compile(r'([^/]*.src.rpm) -> dist')
fileprefix = 'dist/'
name = 'rpm'
target = 'rpm'
description = ['Generating', 'SRPM', 'package']
descriptiondone = ['SRPM', 'package']
class UploadRPM(UploadBase):
pass
class UploadSRPM(UploadBase):
pass
# Fedora
class BuildFedora14(DistCompile):
filename_rx = re.compile(r'([^/]*.noarch.rpm) -> dist')
fileprefix = 'dist/'
name = 'fedora'
description = ['Generating', 'Fedora', 'package']
descriptionDone = ['Fedora', 'package']
class UploadFedora14(UploadBase):
pass
# OpenSuse
class BuildOpenSuse(DistCompile):
filename_rx = re.compile(r'([^/]*).noarch.rpm -> dist')
fileprefix = 'dist/'
filesuffix = '.opensuse.i386.rpm'
name = 'opensuse'
description = ['Generating', 'OpenSuse', 'package']
descriptionDone = ['OpenSuse', 'package']
class UploadOpenSuse(UploadBase):
pass
# Release
class CleanupReleaseStep(MasterShellCommand):
name = 'Cleanup'
description = ['Cleanup']
def __init__(self, **kwargs):
kwargs['command'] = 'rm -rf /var/www/TaskCoach-packages/release/*'
MasterShellCommand.__init__(self, **kwargs)
class ZipReleaseStep(MasterShellCommand):
name = 'Zipping'
description = ['Zip']
def __init__(self, **kwargs):
kwargs['command'] = 'cd /var/www/TaskCoach-packages/release\nzip release.zip *'
MasterShellCommand.__init__(self, **kwargs)
def start(self):
MasterShellCommand.start(self)
self.addURL('Download release', 'http://www.fraca7.net/TaskCoach-packages/release/release.zip')
# Pylint
class PylintStep(Compile):
name = 'pylint'
description = ['Running', 'pylint']
descriptionDone = ['pylint']
command = ['make', 'pylint']
class PylintUploadStep(FileUpload):
def __init__(self, **kwargs):
kwargs['slavesrc'] = 'pylint.html'
kwargs['masterdest'] = WithProperties('/var/www/pylint-%s.html', 'buildername')
kwargs['mode'] = 0644
FileUpload.__init__(self, **kwargs)
def start(self):
FileUpload.start(self)
self.addURL('See', 'http://www.fraca7.net/pylint-%s.html' % self.getProperty('buildername'))
|