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
|
'''
Created on June 17th, 2015
__author__ = "Elizabeth 'pidge' Flanagan"
__copyright__ = "Copyright 2012-2015, Intel Corp."
__credits__ = ["Elizabeth Flanagan"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "Elizabeth Flanagan"
__email__ = "pidge@toganlabs.com"
'''
from buildbot.steps.shell import ShellCommand
from buildbot.process.buildstep import LogLineObserver
from buildbot.status.results import SUCCESS, FAILURE, WARNINGS
class CheckForGPLv3(ShellCommand):
haltOnFailure = False
flunkOnFailure = True
name = "CheckForGPLv3"
def __init__(self, factory, argdict=None, **kwargs):
self.factory = factory
for k, v in argdict.iteritems():
setattr(self, k, v)
# Timeout needs to be passed to LoggingBuildStep as a kwarg
self.timeout = 100000
kwargs['timeout']=self.timeout
ShellCommand.__init__(self, **kwargs)
def start(self):
self.command = 'for x in `find ./build/tmp/deploy/licenses -name "license.manifest"`; do cat $x|grep -E "GPLv3|GPL-3"; done'
self.description = ["Checking to ensure no GPLv3 packages"]
ShellCommand.start(self)
def commandComplete(self, cmd):
result = cmd.logs['stdio'].getText()
hasGPLv3 = ""
try:
hasGPLv3 = result.split()[-1]
except:
self.setProperty('hasGPLv3', "False", "No GPLv3, we're ok.")
self.finished(SUCCESS)
if "|" in result:
self.setProperty('hasGPLv3', "True", "A license may be dual licensed as GPLv3")
self.description = ["A license may be dual licensed as GPLv3"]
self.finished(SUCCESS)
else:
self.setProperty('hasGPLv3', "True", "GPLv3, Fail out.")
self.finished(FAILURE)
|