Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | include conf/distro/include/upstream_tracking.inc |
| 2 | include conf/distro/include/distro_alias.inc |
| 3 | include conf/distro/include/maintainers.inc |
| 4 | |
| 5 | addhandler distro_eventhandler |
| 6 | distro_eventhandler[eventmask] = "bb.event.BuildStarted" |
| 7 | python distro_eventhandler() { |
| 8 | import oe.distro_check as dc |
| 9 | import csv |
| 10 | logfile = dc.create_log_file(e.data, "distrodata.csv") |
| 11 | |
| 12 | lf = bb.utils.lockfile("%s.lock" % logfile) |
| 13 | with open(logfile, "a") as f: |
| 14 | writer = csv.writer(f) |
| 15 | writer.writerow(['Package', 'Description', 'Owner', 'License', |
| 16 | 'VerMatch', 'Version', 'Upstream', 'Reason', 'Recipe Status', |
| 17 | 'Distro 1', 'Distro 2', 'Distro 3']) |
| 18 | f.close() |
| 19 | bb.utils.unlockfile(lf) |
| 20 | |
| 21 | return |
| 22 | } |
| 23 | |
| 24 | addtask distrodata_np |
| 25 | do_distrodata_np[nostamp] = "1" |
| 26 | python do_distrodata_np() { |
| 27 | localdata = bb.data.createCopy(d) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 28 | pn = d.getVar("PN") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 29 | bb.note("Package Name: %s" % pn) |
| 30 | |
| 31 | import oe.distro_check as dist_check |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 32 | tmpdir = d.getVar('TMPDIR') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 33 | distro_check_dir = os.path.join(tmpdir, "distro_check") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 34 | datetime = localdata.getVar('DATETIME') |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 35 | dist_check.update_distro_data(distro_check_dir, datetime, localdata) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 36 | |
| 37 | if pn.find("-native") != -1: |
| 38 | pnstripped = pn.split("-native") |
| 39 | bb.note("Native Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 40 | localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 41 | |
| 42 | if pn.find("-cross") != -1: |
| 43 | pnstripped = pn.split("-cross") |
| 44 | bb.note("cross Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 45 | localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 46 | |
| 47 | if pn.find("-crosssdk") != -1: |
| 48 | pnstripped = pn.split("-crosssdk") |
| 49 | bb.note("cross Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 50 | localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 51 | |
| 52 | if pn.startswith("nativesdk-"): |
| 53 | pnstripped = pn.replace("nativesdk-", "") |
| 54 | bb.note("NativeSDK Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 55 | localdata.setVar('OVERRIDES', "pn-" + pnstripped + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 56 | |
| 57 | |
| 58 | if pn.find("-initial") != -1: |
| 59 | pnstripped = pn.split("-initial") |
| 60 | bb.note("initial Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 61 | localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 62 | |
| 63 | """generate package information from .bb file""" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 64 | pname = localdata.getVar('PN') |
| 65 | pcurver = localdata.getVar('PV') |
| 66 | pdesc = localdata.getVar('DESCRIPTION') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 67 | if pdesc is not None: |
| 68 | pdesc = pdesc.replace(',','') |
| 69 | pdesc = pdesc.replace('\n','') |
| 70 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 71 | pgrp = localdata.getVar('SECTION') |
| 72 | plicense = localdata.getVar('LICENSE').replace(',','_') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 73 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 74 | rstatus = localdata.getVar('RECIPE_COLOR') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 75 | if rstatus is not None: |
| 76 | rstatus = rstatus.replace(',','') |
| 77 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 78 | pupver = localdata.getVar('RECIPE_UPSTREAM_VERSION') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 79 | if pcurver == pupver: |
| 80 | vermatch="1" |
| 81 | else: |
| 82 | vermatch="0" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 83 | noupdate_reason = localdata.getVar('RECIPE_NO_UPDATE_REASON') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 84 | if noupdate_reason is None: |
| 85 | noupdate="0" |
| 86 | else: |
| 87 | noupdate="1" |
| 88 | noupdate_reason = noupdate_reason.replace(',','') |
| 89 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 90 | maintainer = localdata.getVar('RECIPE_MAINTAINER') |
| 91 | rlrd = localdata.getVar('RECIPE_UPSTREAM_DATE') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 92 | result = dist_check.compare_in_distro_packages_list(distro_check_dir, localdata) |
| 93 | |
| 94 | bb.note("DISTRO: %s,%s,%s,%s,%s,%s,%s,%s,%s\n" % \ |
| 95 | (pname, pdesc, maintainer, plicense, vermatch, pcurver, pupver, noupdate_reason, rstatus)) |
| 96 | line = pn |
| 97 | for i in result: |
| 98 | line = line + "," + i |
| 99 | bb.note("%s\n" % line) |
| 100 | } |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 101 | do_distrodata_np[vardepsexclude] = "DATETIME" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 102 | |
| 103 | addtask distrodata |
| 104 | do_distrodata[nostamp] = "1" |
| 105 | python do_distrodata() { |
| 106 | import csv |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 107 | logpath = d.getVar('LOG_DIR') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 108 | bb.utils.mkdirhier(logpath) |
| 109 | logfile = os.path.join(logpath, "distrodata.csv") |
| 110 | |
| 111 | import oe.distro_check as dist_check |
| 112 | localdata = bb.data.createCopy(d) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 113 | tmpdir = d.getVar('TMPDIR') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 114 | distro_check_dir = os.path.join(tmpdir, "distro_check") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 115 | datetime = localdata.getVar('DATETIME') |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 116 | dist_check.update_distro_data(distro_check_dir, datetime, localdata) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 117 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 118 | pn = d.getVar("PN") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 119 | bb.note("Package Name: %s" % pn) |
| 120 | |
| 121 | if pn.find("-native") != -1: |
| 122 | pnstripped = pn.split("-native") |
| 123 | bb.note("Native Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 124 | localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 125 | |
| 126 | if pn.startswith("nativesdk-"): |
| 127 | pnstripped = pn.replace("nativesdk-", "") |
| 128 | bb.note("NativeSDK Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 129 | localdata.setVar('OVERRIDES', "pn-" + pnstripped + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 130 | |
| 131 | if pn.find("-cross") != -1: |
| 132 | pnstripped = pn.split("-cross") |
| 133 | bb.note("cross Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 134 | localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 135 | |
| 136 | if pn.find("-crosssdk") != -1: |
| 137 | pnstripped = pn.split("-crosssdk") |
| 138 | bb.note("cross Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 139 | localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 140 | |
| 141 | if pn.find("-initial") != -1: |
| 142 | pnstripped = pn.split("-initial") |
| 143 | bb.note("initial Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 144 | localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 145 | |
| 146 | """generate package information from .bb file""" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 147 | pname = localdata.getVar('PN') |
| 148 | pcurver = localdata.getVar('PV') |
| 149 | pdesc = localdata.getVar('DESCRIPTION') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 150 | if pdesc is not None: |
| 151 | pdesc = pdesc.replace(',','') |
| 152 | pdesc = pdesc.replace('\n','') |
| 153 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 154 | pgrp = localdata.getVar('SECTION') |
| 155 | plicense = localdata.getVar('LICENSE').replace(',','_') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 156 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 157 | rstatus = localdata.getVar('RECIPE_COLOR') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 158 | if rstatus is not None: |
| 159 | rstatus = rstatus.replace(',','') |
| 160 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 161 | pupver = localdata.getVar('RECIPE_UPSTREAM_VERSION') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 162 | if pcurver == pupver: |
| 163 | vermatch="1" |
| 164 | else: |
| 165 | vermatch="0" |
| 166 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 167 | noupdate_reason = localdata.getVar('RECIPE_NO_UPDATE_REASON') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 168 | if noupdate_reason is None: |
| 169 | noupdate="0" |
| 170 | else: |
| 171 | noupdate="1" |
| 172 | noupdate_reason = noupdate_reason.replace(',','') |
| 173 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 174 | maintainer = localdata.getVar('RECIPE_MAINTAINER') |
| 175 | rlrd = localdata.getVar('RECIPE_UPSTREAM_DATE') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 176 | # do the comparison |
| 177 | result = dist_check.compare_in_distro_packages_list(distro_check_dir, localdata) |
| 178 | |
| 179 | lf = bb.utils.lockfile("%s.lock" % logfile) |
| 180 | with open(logfile, "a") as f: |
| 181 | row = [pname, pdesc, maintainer, plicense, vermatch, pcurver, pupver, noupdate_reason, rstatus] |
| 182 | row.extend(result) |
| 183 | |
| 184 | writer = csv.writer(f) |
| 185 | writer.writerow(row) |
| 186 | f.close() |
| 187 | bb.utils.unlockfile(lf) |
| 188 | } |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 189 | do_distrodata[vardepsexclude] = "DATETIME" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 190 | |
| 191 | addtask distrodataall after do_distrodata |
| 192 | do_distrodataall[recrdeptask] = "do_distrodataall do_distrodata" |
| 193 | do_distrodataall[recideptask] = "do_${BB_DEFAULT_TASK}" |
| 194 | do_distrodataall[nostamp] = "1" |
| 195 | do_distrodataall() { |
| 196 | : |
| 197 | } |
| 198 | |
| 199 | addhandler checkpkg_eventhandler |
| 200 | checkpkg_eventhandler[eventmask] = "bb.event.BuildStarted bb.event.BuildCompleted" |
| 201 | python checkpkg_eventhandler() { |
| 202 | import csv |
| 203 | |
| 204 | def parse_csv_file(filename): |
| 205 | package_dict = {} |
| 206 | |
| 207 | with open(filename, "r") as f: |
| 208 | reader = csv.reader(f, delimiter='\t') |
| 209 | for row in reader: |
| 210 | pn = row[0] |
| 211 | |
| 212 | if reader.line_num == 1: |
| 213 | header = row |
| 214 | continue |
| 215 | |
| 216 | if not pn in package_dict.keys(): |
| 217 | package_dict[pn] = row |
| 218 | f.close() |
| 219 | |
| 220 | with open(filename, "w") as f: |
| 221 | writer = csv.writer(f, delimiter='\t') |
| 222 | writer.writerow(header) |
| 223 | for pn in package_dict.keys(): |
| 224 | writer.writerow(package_dict[pn]) |
| 225 | f.close() |
| 226 | |
| 227 | del package_dict |
| 228 | |
| 229 | if bb.event.getName(e) == "BuildStarted": |
| 230 | import oe.distro_check as dc |
| 231 | logfile = dc.create_log_file(e.data, "checkpkg.csv") |
| 232 | |
| 233 | lf = bb.utils.lockfile("%s.lock" % logfile) |
| 234 | with open(logfile, "a") as f: |
| 235 | writer = csv.writer(f, delimiter='\t') |
| 236 | headers = ['Package', 'Version', 'Upver', 'License', 'Section', |
| 237 | 'Home', 'Release', 'Depends', 'BugTracker', 'PE', 'Description', |
| 238 | 'Status', 'Tracking', 'URI', 'MAINTAINER', 'NoUpReason'] |
| 239 | writer.writerow(headers) |
| 240 | f.close() |
| 241 | bb.utils.unlockfile(lf) |
| 242 | elif bb.event.getName(e) == "BuildCompleted": |
| 243 | import os |
| 244 | filename = "tmp/log/checkpkg.csv" |
| 245 | if os.path.isfile(filename): |
| 246 | lf = bb.utils.lockfile("%s.lock"%filename) |
| 247 | parse_csv_file(filename) |
| 248 | bb.utils.unlockfile(lf) |
| 249 | return |
| 250 | } |
| 251 | |
| 252 | addtask checkpkg |
| 253 | do_checkpkg[nostamp] = "1" |
| 254 | python do_checkpkg() { |
| 255 | localdata = bb.data.createCopy(d) |
| 256 | import csv |
| 257 | import re |
| 258 | import tempfile |
| 259 | import subprocess |
| 260 | import oe.recipeutils |
| 261 | from bb.utils import vercmp_string |
| 262 | from bb.fetch2 import FetchError, NoMethodError, decodeurl |
| 263 | |
| 264 | """first check whether a uri is provided""" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 265 | src_uri = (d.getVar('SRC_URI') or '').split() |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 266 | if src_uri: |
| 267 | uri_type, _, _, _, _, _ = decodeurl(src_uri[0]) |
| 268 | else: |
| 269 | uri_type = "none" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 270 | |
| 271 | """initialize log files.""" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 272 | logpath = d.getVar('LOG_DIR') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 273 | bb.utils.mkdirhier(logpath) |
| 274 | logfile = os.path.join(logpath, "checkpkg.csv") |
| 275 | |
| 276 | """generate package information from .bb file""" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 277 | pname = d.getVar('PN') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 278 | |
| 279 | if pname.find("-native") != -1: |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 280 | if d.getVar('BBCLASSEXTEND'): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 281 | return |
| 282 | pnstripped = pname.split("-native") |
| 283 | bb.note("Native Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 284 | localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 285 | |
| 286 | if pname.startswith("nativesdk-"): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 287 | if d.getVar('BBCLASSEXTEND'): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 288 | return |
| 289 | pnstripped = pname.replace("nativesdk-", "") |
| 290 | bb.note("NativeSDK Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 291 | localdata.setVar('OVERRIDES', "pn-" + pnstripped + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 292 | |
| 293 | if pname.find("-cross") != -1: |
| 294 | pnstripped = pname.split("-cross") |
| 295 | bb.note("cross Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 296 | localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 297 | |
| 298 | if pname.find("-initial") != -1: |
| 299 | pnstripped = pname.split("-initial") |
| 300 | bb.note("initial Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 301 | localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 302 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 303 | pdesc = localdata.getVar('DESCRIPTION') |
| 304 | pgrp = localdata.getVar('SECTION') |
| 305 | pversion = localdata.getVar('PV') |
| 306 | plicense = localdata.getVar('LICENSE') |
| 307 | psection = localdata.getVar('SECTION') |
| 308 | phome = localdata.getVar('HOMEPAGE') |
| 309 | prelease = localdata.getVar('PR') |
| 310 | pdepends = localdata.getVar('DEPENDS') |
| 311 | pbugtracker = localdata.getVar('BUGTRACKER') |
| 312 | ppe = localdata.getVar('PE') |
| 313 | psrcuri = localdata.getVar('SRC_URI') |
| 314 | maintainer = localdata.getVar('RECIPE_MAINTAINER') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 315 | |
| 316 | """ Get upstream version version """ |
| 317 | pupver = "" |
| 318 | pstatus = "" |
| 319 | |
| 320 | try: |
| 321 | uv = oe.recipeutils.get_recipe_upstream_version(localdata) |
| 322 | |
| 323 | pupver = uv['version'] |
| 324 | except Exception as e: |
| 325 | if e is FetchError: |
| 326 | pstatus = "ErrAccess" |
| 327 | elif e is NoMethodError: |
| 328 | pstatus = "ErrUnsupportedProto" |
| 329 | else: |
| 330 | pstatus = "ErrUnknown" |
| 331 | |
| 332 | """Set upstream version status""" |
| 333 | if not pupver: |
| 334 | pupver = "N/A" |
| 335 | else: |
| 336 | pv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pversion, uri_type) |
| 337 | upv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pupver, uri_type) |
| 338 | |
| 339 | cmp = vercmp_string(pv, upv) |
| 340 | if cmp == -1: |
| 341 | pstatus = "UPDATE" |
| 342 | elif cmp == 0: |
| 343 | pstatus = "MATCH" |
| 344 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 345 | if psrcuri: |
| 346 | psrcuri = psrcuri.split()[0] |
| 347 | else: |
| 348 | psrcuri = "none" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 349 | pdepends = "".join(pdepends.split("\t")) |
| 350 | pdesc = "".join(pdesc.split("\t")) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 351 | no_upgr_reason = d.getVar('RECIPE_NO_UPDATE_REASON') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 352 | lf = bb.utils.lockfile("%s.lock" % logfile) |
| 353 | with open(logfile, "a") as f: |
| 354 | writer = csv.writer(f, delimiter='\t') |
| 355 | writer.writerow([pname, pversion, pupver, plicense, psection, phome, |
| 356 | prelease, pdepends, pbugtracker, ppe, pdesc, pstatus, pupver, |
| 357 | psrcuri, maintainer, no_upgr_reason]) |
| 358 | f.close() |
| 359 | bb.utils.unlockfile(lf) |
| 360 | } |
| 361 | |
| 362 | addtask checkpkgall after do_checkpkg |
| 363 | do_checkpkgall[recrdeptask] = "do_checkpkgall do_checkpkg" |
| 364 | do_checkpkgall[recideptask] = "do_${BB_DEFAULT_TASK}" |
| 365 | do_checkpkgall[nostamp] = "1" |
| 366 | do_checkpkgall() { |
| 367 | : |
| 368 | } |
| 369 | |
| 370 | addhandler distro_check_eventhandler |
| 371 | distro_check_eventhandler[eventmask] = "bb.event.BuildStarted" |
| 372 | python distro_check_eventhandler() { |
| 373 | """initialize log files.""" |
| 374 | import oe.distro_check as dc |
| 375 | result_file = dc.create_log_file(e.data, "distrocheck.csv") |
| 376 | return |
| 377 | } |
| 378 | |
| 379 | addtask distro_check |
| 380 | do_distro_check[nostamp] = "1" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 381 | do_distro_check[vardepsexclude] += "DATETIME" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 382 | python do_distro_check() { |
| 383 | """checks if the package is present in other public Linux distros""" |
| 384 | import oe.distro_check as dc |
| 385 | import shutil |
| 386 | if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('nativesdk',d): |
| 387 | return |
| 388 | |
| 389 | localdata = bb.data.createCopy(d) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 390 | tmpdir = d.getVar('TMPDIR') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 391 | distro_check_dir = os.path.join(tmpdir, "distro_check") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 392 | logpath = d.getVar('LOG_DIR') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 393 | bb.utils.mkdirhier(logpath) |
| 394 | result_file = os.path.join(logpath, "distrocheck.csv") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 395 | datetime = localdata.getVar('DATETIME') |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 396 | dc.update_distro_data(distro_check_dir, datetime, localdata) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 397 | |
| 398 | # do the comparison |
| 399 | result = dc.compare_in_distro_packages_list(distro_check_dir, d) |
| 400 | |
| 401 | # save the results |
| 402 | dc.save_distro_check_result(result, datetime, result_file, d) |
| 403 | } |
| 404 | |
| 405 | addtask distro_checkall after do_distro_check |
| 406 | do_distro_checkall[recrdeptask] = "do_distro_checkall do_distro_check" |
| 407 | do_distro_checkall[recideptask] = "do_${BB_DEFAULT_TASK}" |
| 408 | do_distro_checkall[nostamp] = "1" |
| 409 | do_distro_checkall() { |
| 410 | : |
| 411 | } |
| 412 | # |
| 413 | #Check Missing License Text. |
| 414 | #Use this task to generate the missing license text data for pkg-report system, |
| 415 | #then we can search those recipes which license text isn't exsit in common-licenses directory |
| 416 | # |
| 417 | addhandler checklicense_eventhandler |
| 418 | checklicense_eventhandler[eventmask] = "bb.event.BuildStarted" |
| 419 | python checklicense_eventhandler() { |
| 420 | """initialize log files.""" |
| 421 | import csv |
| 422 | import oe.distro_check as dc |
| 423 | logfile = dc.create_log_file(e.data, "missinglicense.csv") |
| 424 | lf = bb.utils.lockfile("%s.lock" % logfile) |
| 425 | with open(logfile, "a") as f: |
| 426 | writer = csv.writer(f, delimiter='\t') |
| 427 | writer.writerow(['Package', 'License', 'MissingLicense']) |
| 428 | f.close() |
| 429 | bb.utils.unlockfile(lf) |
| 430 | return |
| 431 | } |
| 432 | |
| 433 | addtask checklicense |
| 434 | do_checklicense[nostamp] = "1" |
| 435 | python do_checklicense() { |
| 436 | import csv |
| 437 | import shutil |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 438 | logpath = d.getVar('LOG_DIR') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 439 | bb.utils.mkdirhier(logpath) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 440 | pn = d.getVar('PN') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 441 | logfile = os.path.join(logpath, "missinglicense.csv") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 442 | generic_directory = d.getVar('COMMON_LICENSE_DIR') |
| 443 | license_types = d.getVar('LICENSE') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 444 | for license_type in ((license_types.replace('+', '').replace('|', '&') |
| 445 | .replace('(', '').replace(')', '').replace(';', '') |
| 446 | .replace(',', '').replace(" ", "").split("&"))): |
| 447 | if not os.path.isfile(os.path.join(generic_directory, license_type)): |
| 448 | lf = bb.utils.lockfile("%s.lock" % logfile) |
| 449 | with open(logfile, "a") as f: |
| 450 | writer = csv.writer(f, delimiter='\t') |
| 451 | writer.writerow([pn, license_types, license_type]) |
| 452 | f.close() |
| 453 | bb.utils.unlockfile(lf) |
| 454 | return |
| 455 | } |
| 456 | |
| 457 | addtask checklicenseall after do_checklicense |
| 458 | do_checklicenseall[recrdeptask] = "do_checklicenseall do_checklicense" |
| 459 | do_checklicenseall[recideptask] = "do_${BB_DEFAULT_TASK}" |
| 460 | do_checklicenseall[nostamp] = "1" |
| 461 | do_checklicenseall() { |
| 462 | : |
| 463 | } |