summaryrefslogtreecommitdiffstats
path: root/meta/classes/distrodata.bbclass
diff options
context:
space:
mode:
authorSaul Wold <Saul.Wold@intel.com>2010-08-16 14:22:09 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-17 23:12:33 +0100
commitd7bc9b8ecec524294cc9143fd0b349249b329891 (patch)
tree43bfd78584c40b8614e6434d01230cde230a7046 /meta/classes/distrodata.bbclass
parent26350bbd22bb91d20a9c31ee37d5fd76d9de4f3c (diff)
downloadpoky-d7bc9b8ecec524294cc9143fd0b349249b329891.tar.gz
DistroData: Cleanup Version numbers and add DistroData Parser
Signed-off-by: Saul Wold <Saul.Wold@intel.com>
Diffstat (limited to 'meta/classes/distrodata.bbclass')
-rw-r--r--meta/classes/distrodata.bbclass158
1 files changed, 158 insertions, 0 deletions
diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass
new file mode 100644
index 0000000000..86a614a01e
--- /dev/null
+++ b/meta/classes/distrodata.bbclass
@@ -0,0 +1,158 @@
1
2require conf/distro/include/distro_tracking_fields.inc
3
4addtask distrodata_np
5do_distrodata_np[nostamp] = "1"
6python do_distrodata_np() {
7
8 localdata = bb.data.createCopy(d)
9 pn = bb.data.getVar("PN", d, True)
10 bb.note("Package Name: %s" % pn)
11
12 if pn.find("-native") != -1:
13 pnstripped = pn.split("-native")
14 bb.note("Native Split: %s" % pnstripped)
15 bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + bb.data.getVar('OVERRIDES', d, True), localdata)
16 bb.data.update_data(localdata)
17
18 if pn.find("-cross") != -1:
19 pnstripped = pn.split("-cross")
20 bb.note("cross Split: %s" % pnstripped)
21 bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + bb.data.getVar('OVERRIDES', d, True), localdata)
22 bb.data.update_data(localdata)
23
24 if pn.find("-initial") != -1:
25 pnstripped = pn.split("-initial")
26 bb.note("initial Split: %s" % pnstripped)
27 bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + bb.data.getVar('OVERRIDES', d, True), localdata)
28 bb.data.update_data(localdata)
29
30 """generate package information from .bb file"""
31 pname = bb.data.getVar('PN', localdata, True)
32 pcurver = bb.data.getVar('PV', localdata, True)
33 pdesc = bb.data.getVar('DESCRIPTION', localdata, True)
34 pgrp = bb.data.getVar('SECTION', localdata, True)
35 plicense = bb.data.getVar('LICENSE', localdata, True).replace(',','_')
36 if bb.data.getVar('LIC_FILES_CHKSUM', localdata, True):
37 pchksum="1"
38 else:
39 pchksum="0"
40
41 if bb.data.getVar('RECIPE_STATUS', localdata, True):
42 hasrstatus="1"
43 else:
44 hasrstatus="0"
45
46 rstatus = bb.data.getVar('RECIPE_STATUS', localdata, True)
47
48 pupver = bb.data.getVar('RECIPE_LATEST_VERSION', localdata, True)
49 if pcurver == pupver:
50 vermatch="1"
51 else:
52 vermatch="0"
53
54 noupdate_reason = bb.data.getVar('RECIPE_NO_UPDATE_REASON', localdata, True)
55 if noupdate_reason is None:
56 noupdate="0"
57 else:
58 noupdate="1"
59
60 ris = bb.data.getVar('RECIPE_INTEL_SECTION', localdata, True)
61 maintainer = bb.data.getVar('RECIPE_MAINTAINER', localdata, True)
62 rttr = bb.data.getVar('RECIPE_TIME_BETWEEN_LAST_TWO_RELEASES', localdata, True)
63 rlrd = bb.data.getVar('RECIPE_LATEST_RELEASE_DATE', localdata, True)
64 dc = bb.data.getVar('DEPENDENCY_CHECK', localdata, True)
65 rc = bb.data.getVar('RECIPE_COMMENTS', localdata, True)
66
67 bb.note("DISTRO: %s,%s,%s,%s,%s,%s,%s,%s, %s, %s, %s\n" % \
68 (pname, maintainer, plicense, pchksum, hasrstatus, vermatch, pcurver, pupver, noupdate, noupdate_reason, rstatus))
69}
70
71addtask distrodata
72do_distrodata[nostamp] = "1"
73python do_distrodata() {
74 """initialize log files."""
75 logpath = bb.data.getVar('LOG_DIR', d, 1)
76 bb.utils.mkdirhier(logpath)
77 logfile = os.path.join(logpath, "distrodata.%s.csv" % bb.data.getVar('DATETIME', d, 1))
78 if not os.path.exists(logfile):
79 slogfile = os.path.join(logpath, "distrodata.csv")
80 if os.path.exists(slogfile):
81 os.remove(slogfile)
82 os.system("touch %s" % logfile)
83 os.symlink(logfile, slogfile)
84
85 localdata = bb.data.createCopy(d)
86 pn = bb.data.getVar("PN", d, True)
87 bb.note("Package Name: %s" % pn)
88
89 if pn.find("-native") != -1:
90 pnstripped = pn.split("-native")
91 bb.note("Native Split: %s" % pnstripped)
92 bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + bb.data.getVar('OVERRIDES', d, True), localdata)
93 bb.data.update_data(localdata)
94
95 if pn.find("-cross") != -1:
96 pnstripped = pn.split("-cross")
97 bb.note("cross Split: %s" % pnstripped)
98 bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + bb.data.getVar('OVERRIDES', d, True), localdata)
99 bb.data.update_data(localdata)
100
101 if pn.find("-initial") != -1:
102 pnstripped = pn.split("-initial")
103 bb.note("initial Split: %s" % pnstripped)
104 bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + bb.data.getVar('OVERRIDES', d, True), localdata)
105 bb.data.update_data(localdata)
106
107 """generate package information from .bb file"""
108 pname = bb.data.getVar('PN', localdata, True)
109 pcurver = bb.data.getVar('PV', localdata, True)
110 pdesc = bb.data.getVar('DESCRIPTION', localdata, True)
111 pgrp = bb.data.getVar('SECTION', localdata, True)
112 plicense = bb.data.getVar('LICENSE', localdata, True).replace(',','_')
113 if bb.data.getVar('LIC_FILES_CHKSUM', localdata, True):
114 pchksum="1"
115 else:
116 pchksum="0"
117
118 if bb.data.getVar('RECIPE_STATUS', localdata, True):
119 hasrstatus="1"
120 else:
121 hasrstatus="0"
122
123 rstatus = bb.data.getVar('RECIPE_STATUS', localdata, True)
124
125 pupver = bb.data.getVar('RECIPE_LATEST_VERSION', localdata, True)
126 if pcurver == pupver:
127 vermatch="1"
128 else:
129 vermatch="0"
130
131 noupdate_reason = bb.data.getVar('RECIPE_NO_UPDATE_REASON', localdata, True)
132 if noupdate_reason is None:
133 noupdate="0"
134 else:
135 noupdate="1"
136
137 ris = bb.data.getVar('RECIPE_INTEL_SECTION', localdata, True)
138 maintainer = bb.data.getVar('RECIPE_MAINTAINER', localdata, True)
139 rttr = bb.data.getVar('RECIPE_TIME_BETWEEN_LAST_TWO_RELEASES', localdata, True)
140 rlrd = bb.data.getVar('RECIPE_LATEST_RELEASE_DATE', localdata, True)
141 dc = bb.data.getVar('DEPENDENCY_CHECK', localdata, True)
142 rc = bb.data.getVar('RECIPE_COMMENTS', localdata, True)
143
144 lf = bb.utils.lockfile(logfile + ".lock")
145 f = open(logfile, "a")
146 f.write("%s,%s,%s,%s,%s,%s,%s,%s, %s, %s, %s\n" % \
147 (pname, maintainer, plicense, pchksum, hasrstatus, vermatch, pcurver, pupver, noupdate, noupdate_reason, rstatus))
148 f.close()
149 bb.utils.unlockfile(lf)
150}
151
152addtask distrodataall after do_distrodata
153do_distrodataall[recrdeptask] = "do_distrodata"
154do_distrodataall[nostamp] = "1"
155do_distrodataall() {
156 :
157}
158