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
|
'''
Created on Dec 26, 2012
__author__ = "Elizabeth 'pidge' Flanagan"
__copyright__ = "Copyright 2013, Intel Corp."
__credits__ = ["Elizabeth Flanagan"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "Elizabeth Flanagan"
__email__ = "pidge@toganlabs.com"
'''
from buildbot.steps.shell import ShellCommand
from twisted.python import log
class CreateBBLayersConf(ShellCommand):
haltOnFailure = False
flunkOnFailure = True
name = "Create BBLayers Configuration"
def __init__(self, factory, layers, argdict=None, **kwargs):
self.factory = factory
self.layers=layers
self.buildprovider="yocto"
self.bsplayer=False
self.bspprovider=""
self.x32abi=False
self.bbtext=""
self.bbtextprepend=""
self.bbtextappend=""
self.layerdirs=""
for k, v in argdict.iteritems():
setattr(self, k, v)
self.description = "Create BBLayers Configuration"
ShellCommand.__init__(self, **kwargs)
def start(self):
import os
fout = ""
buildername=self.getProperty("buildername")
branch=self.getProperty("branch")
workdir=self.getProperty("workdir")
layerversioncore = int(self.getProperty("layerversion_core", "0"))
layerversionyocto = int(self.getProperty("layerversion_yocto", "0"))
if self.bbtextprepend != "":
fout = fout +"\n"+self.bbtextprepend
if self.bbtext:
if self.bbtext == "#TOASTER":
fout = fout+"\n"+self.getProperty("custom_bbtext")
else:
fout = fout+"\n"+self.bbtext #check to see if we have a prepend
#check to see if we have text override
self.command = "rm -rf ./build/conf/bblayers.conf; echo '" + fout + "'>> ./build/conf/bblayers.conf"
self.setProperty("BBLAYERS", fout)
ShellCommand.start(self)
else:
if self.buildprovider == "yocto" and layerversionyocto > 2:
fout = fout + 'POKY_BBLAYERS_CONF_VERSION = <PCONF> \n'
self.command = "PCONF=`cat ./build/conf/bblayers.conf| grep \"POKY_BBLAYERS_CONF_VERSION =\"|cut -d'=' -f2|tr -d '[:space:]'`;"
else:
fout = fout + 'LCONF_VERSION = <LCONF> \n'
self.command = "LCONF=`cat ./build/conf/bblayers.conf| grep \"LCONF_VERSION =\"|cut -d'=' -f2|tr -d '[:space:]'`;"
fout = fout + 'BBPATH = "${TOPDIR}" \n'
fout = fout + 'BBFILES ?="" \n'
fout = fout + 'BBLAYERS += " \ \n'
ldirs = ['poky', 'oecore', 'bitbake']
if self.buildprovider == "yocto":
if layerversionyocto > 2:
fout = fout + workdir + "/build/meta \ \n"
fout = fout + workdir + "/build/meta-poky \ \n"
fout = fout + workdir + "/build/meta-yocto-bsp \ \n"
ldirs.append("meta")
ldirs.append("meta-poky")
ldirs.append("meta-yocto-bsp")
else:
fout = fout + workdir + "/build/meta \ \n"
fout = fout + workdir + "/build/meta-yocto \ \n"
fout = fout + workdir + "/build/meta-yocto-bsp \ \n"
ldirs.append("meta")
ldirs.append("meta-yocto")
ldirs.append("meta-yocto-bsp")
if self.x32abi == True:
fout = fout + workdir + '/build/meta-x32 \ \n'
ldirs.append("meta-x32")
elif self.buildprovider == "oe":
fout = fout + workdir + "/build/meta \ \n"
ldirs.append("meta")
for layer in self.layers:
if layer.iterkeys().next() not in ldirs:
if (layer[layer.iterkeys().next()].has_key('checkout') and layer[layer.iterkeys().next()]['checkout'] is not False) \
or layer[layer.iterkeys().next()].has_key('checkout') is False:
if layer.iterkeys().next()=="meta-qt3":
if layerversioncore < 9:
fout = fout + workdir + '/build/' + layer.iterkeys().next() + ' \ \n'
elif layer.iterkeys().next()=="meta-qt4":
if layerversioncore > 6 and layerversioncore < 11:
fout = fout + workdir + '/build/' + layer.iterkeys().next() + ' \ \n'
elif layer.iterkeys().next()=="meta-gplv2":
# We only want meta-gplv2 for pyro or newer
if layerversioncore > 9:
fout = fout + workdir + '/build/' + layer.iterkeys().next() + ' \ \n'
elif (layer[layer.iterkeys().next()].has_key('autoinclude') and layer[layer.iterkeys().next()]['autoinclude'] is not False) or \
layer[layer.iterkeys().next()].has_key('autoinclude') is False:
fout = fout + workdir + '/build/' + layer.iterkeys().next() + ' \ \n'
ldirs.append(layer.iterkeys().next())
if list(self.layerdirs):
for layer in self.layerdirs:
if layer not in ldirs:
fout = fout + workdir + '/build/' + layer + ' \ \n'
ldirs.append(layer)
fout = fout + '" \n'
if self.bbtextappend != "":
fout = fout + self.bbtextappend
self.command += "rm -rf ./build/conf/bblayers.conf; echo '" + fout + "'>> ./build/conf/bblayers.conf;"
if self.buildprovider == "yocto" and layerversionyocto > 2:
self.command += "sed -i \"s/<PCONF>/$PCONF/\" ./build/conf/bblayers.conf"
else:
self.command += "sed -i \"s/<LCONF>/$LCONF/\" ./build/conf/bblayers.conf"
self.setProperty("BBLAYERS", fout)
ShellCommand.start(self)
def describe(self, done=False):
description = ShellCommand.describe(self,done)
return description
|