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 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 191 | addhandler checkpkg_eventhandler |
| 192 | checkpkg_eventhandler[eventmask] = "bb.event.BuildStarted bb.event.BuildCompleted" |
| 193 | python checkpkg_eventhandler() { |
| 194 | import csv |
| 195 | |
| 196 | def parse_csv_file(filename): |
| 197 | package_dict = {} |
| 198 | |
| 199 | with open(filename, "r") as f: |
| 200 | reader = csv.reader(f, delimiter='\t') |
| 201 | for row in reader: |
| 202 | pn = row[0] |
| 203 | |
| 204 | if reader.line_num == 1: |
| 205 | header = row |
| 206 | continue |
| 207 | |
| 208 | if not pn in package_dict.keys(): |
| 209 | package_dict[pn] = row |
| 210 | f.close() |
| 211 | |
| 212 | with open(filename, "w") as f: |
| 213 | writer = csv.writer(f, delimiter='\t') |
| 214 | writer.writerow(header) |
| 215 | for pn in package_dict.keys(): |
| 216 | writer.writerow(package_dict[pn]) |
| 217 | f.close() |
| 218 | |
| 219 | del package_dict |
| 220 | |
| 221 | if bb.event.getName(e) == "BuildStarted": |
| 222 | import oe.distro_check as dc |
| 223 | logfile = dc.create_log_file(e.data, "checkpkg.csv") |
| 224 | |
| 225 | lf = bb.utils.lockfile("%s.lock" % logfile) |
| 226 | with open(logfile, "a") as f: |
| 227 | writer = csv.writer(f, delimiter='\t') |
| 228 | headers = ['Package', 'Version', 'Upver', 'License', 'Section', |
| 229 | 'Home', 'Release', 'Depends', 'BugTracker', 'PE', 'Description', |
| 230 | 'Status', 'Tracking', 'URI', 'MAINTAINER', 'NoUpReason'] |
| 231 | writer.writerow(headers) |
| 232 | f.close() |
| 233 | bb.utils.unlockfile(lf) |
| 234 | elif bb.event.getName(e) == "BuildCompleted": |
| 235 | import os |
| 236 | filename = "tmp/log/checkpkg.csv" |
| 237 | if os.path.isfile(filename): |
| 238 | lf = bb.utils.lockfile("%s.lock"%filename) |
| 239 | parse_csv_file(filename) |
| 240 | bb.utils.unlockfile(lf) |
| 241 | return |
| 242 | } |
| 243 | |
| 244 | addtask checkpkg |
| 245 | do_checkpkg[nostamp] = "1" |
| 246 | python do_checkpkg() { |
| 247 | localdata = bb.data.createCopy(d) |
| 248 | import csv |
| 249 | import re |
| 250 | import tempfile |
| 251 | import subprocess |
| 252 | import oe.recipeutils |
| 253 | from bb.utils import vercmp_string |
| 254 | from bb.fetch2 import FetchError, NoMethodError, decodeurl |
| 255 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 256 | def get_upstream_version_and_status(): |
| 257 | |
| 258 | # set if the upstream check fails reliably, e.g. absent git tags, or weird version format used on our or on upstream side. |
| 259 | upstream_version_unknown = localdata.getVar('UPSTREAM_VERSION_UNKNOWN') |
| 260 | # set if the upstream check cannot be reliably performed due to transient network failures, or server behaving weirdly. |
| 261 | # This one should be used sparingly, as it completely excludes a recipe from upstream checking. |
| 262 | upstream_check_unreliable = localdata.getVar('UPSTREAM_CHECK_UNRELIABLE') |
| 263 | |
| 264 | if upstream_check_unreliable == "1": |
| 265 | return "N/A", "CHECK_IS_UNRELIABLE" |
| 266 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 267 | uv = oe.recipeutils.get_recipe_upstream_version(localdata) |
| 268 | pupver = uv['version'] if uv['version'] else "N/A" |
| 269 | pversion = uv['current_version'] |
| 270 | revision = uv['revision'] if uv['revision'] else "N/A" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 271 | |
| 272 | if pupver == "N/A": |
| 273 | pstatus = "UNKNOWN" if upstream_version_unknown else "UNKNOWN_BROKEN" |
| 274 | else: |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 275 | cmp = vercmp_string(pversion, pupver) |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 276 | if cmp == -1: |
| 277 | pstatus = "UPDATE" if not upstream_version_unknown else "KNOWN_BROKEN" |
| 278 | elif cmp == 0: |
| 279 | pstatus = "MATCH" if not upstream_version_unknown else "KNOWN_BROKEN" |
| 280 | else: |
| 281 | pstatus = "UNKNOWN" if upstream_version_unknown else "UNKNOWN_BROKEN" |
| 282 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 283 | return pversion, pupver, pstatus, revision |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 284 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 285 | |
| 286 | """initialize log files.""" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 287 | logpath = d.getVar('LOG_DIR') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 288 | bb.utils.mkdirhier(logpath) |
| 289 | logfile = os.path.join(logpath, "checkpkg.csv") |
| 290 | |
| 291 | """generate package information from .bb file""" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 292 | pname = d.getVar('PN') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 293 | |
| 294 | if pname.find("-native") != -1: |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 295 | if d.getVar('BBCLASSEXTEND'): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 296 | return |
| 297 | pnstripped = pname.split("-native") |
| 298 | bb.note("Native Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 299 | localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 300 | |
| 301 | if pname.startswith("nativesdk-"): |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 302 | if d.getVar('BBCLASSEXTEND'): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 303 | return |
| 304 | pnstripped = pname.replace("nativesdk-", "") |
| 305 | bb.note("NativeSDK Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 306 | localdata.setVar('OVERRIDES', "pn-" + pnstripped + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 307 | |
| 308 | if pname.find("-cross") != -1: |
| 309 | pnstripped = pname.split("-cross") |
| 310 | bb.note("cross Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 311 | localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 312 | |
| 313 | if pname.find("-initial") != -1: |
| 314 | pnstripped = pname.split("-initial") |
| 315 | bb.note("initial Split: %s" % pnstripped) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 316 | localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES')) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 317 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 318 | pdesc = localdata.getVar('DESCRIPTION') |
| 319 | pgrp = localdata.getVar('SECTION') |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 320 | plicense = localdata.getVar('LICENSE') |
| 321 | psection = localdata.getVar('SECTION') |
| 322 | phome = localdata.getVar('HOMEPAGE') |
| 323 | prelease = localdata.getVar('PR') |
| 324 | pdepends = localdata.getVar('DEPENDS') |
| 325 | pbugtracker = localdata.getVar('BUGTRACKER') |
| 326 | ppe = localdata.getVar('PE') |
| 327 | psrcuri = localdata.getVar('SRC_URI') |
| 328 | maintainer = localdata.getVar('RECIPE_MAINTAINER') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 329 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 330 | pversion, pupver, pstatus, prevision = get_upstream_version_and_status() |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 331 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 332 | if psrcuri: |
| 333 | psrcuri = psrcuri.split()[0] |
| 334 | else: |
| 335 | psrcuri = "none" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 336 | pdepends = "".join(pdepends.split("\t")) |
| 337 | pdesc = "".join(pdesc.split("\t")) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 338 | no_upgr_reason = d.getVar('RECIPE_NO_UPDATE_REASON') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 339 | lf = bb.utils.lockfile("%s.lock" % logfile) |
| 340 | with open(logfile, "a") as f: |
| 341 | writer = csv.writer(f, delimiter='\t') |
| 342 | writer.writerow([pname, pversion, pupver, plicense, psection, phome, |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 343 | prelease, pdepends, pbugtracker, ppe, pdesc, pstatus, prevision, |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 344 | psrcuri, maintainer, no_upgr_reason]) |
| 345 | f.close() |
| 346 | bb.utils.unlockfile(lf) |
| 347 | } |
| 348 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 349 | addhandler distro_check_eventhandler |
| 350 | distro_check_eventhandler[eventmask] = "bb.event.BuildStarted" |
| 351 | python distro_check_eventhandler() { |
| 352 | """initialize log files.""" |
| 353 | import oe.distro_check as dc |
| 354 | result_file = dc.create_log_file(e.data, "distrocheck.csv") |
| 355 | return |
| 356 | } |
| 357 | |
| 358 | addtask distro_check |
| 359 | do_distro_check[nostamp] = "1" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 360 | do_distro_check[vardepsexclude] += "DATETIME" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 361 | python do_distro_check() { |
| 362 | """checks if the package is present in other public Linux distros""" |
| 363 | import oe.distro_check as dc |
| 364 | import shutil |
| 365 | 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): |
| 366 | return |
| 367 | |
| 368 | localdata = bb.data.createCopy(d) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 369 | tmpdir = d.getVar('TMPDIR') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 370 | distro_check_dir = os.path.join(tmpdir, "distro_check") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 371 | logpath = d.getVar('LOG_DIR') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 372 | bb.utils.mkdirhier(logpath) |
| 373 | result_file = os.path.join(logpath, "distrocheck.csv") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 374 | datetime = localdata.getVar('DATETIME') |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 375 | dc.update_distro_data(distro_check_dir, datetime, localdata) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 376 | |
| 377 | # do the comparison |
| 378 | result = dc.compare_in_distro_packages_list(distro_check_dir, d) |
| 379 | |
| 380 | # save the results |
| 381 | dc.save_distro_check_result(result, datetime, result_file, d) |
| 382 | } |
| 383 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 384 | # |
| 385 | #Check Missing License Text. |
| 386 | #Use this task to generate the missing license text data for pkg-report system, |
| 387 | #then we can search those recipes which license text isn't exsit in common-licenses directory |
| 388 | # |
| 389 | addhandler checklicense_eventhandler |
| 390 | checklicense_eventhandler[eventmask] = "bb.event.BuildStarted" |
| 391 | python checklicense_eventhandler() { |
| 392 | """initialize log files.""" |
| 393 | import csv |
| 394 | import oe.distro_check as dc |
| 395 | logfile = dc.create_log_file(e.data, "missinglicense.csv") |
| 396 | lf = bb.utils.lockfile("%s.lock" % logfile) |
| 397 | with open(logfile, "a") as f: |
| 398 | writer = csv.writer(f, delimiter='\t') |
| 399 | writer.writerow(['Package', 'License', 'MissingLicense']) |
| 400 | f.close() |
| 401 | bb.utils.unlockfile(lf) |
| 402 | return |
| 403 | } |
| 404 | |
| 405 | addtask checklicense |
| 406 | do_checklicense[nostamp] = "1" |
| 407 | python do_checklicense() { |
| 408 | import csv |
| 409 | import shutil |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 410 | logpath = d.getVar('LOG_DIR') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 411 | bb.utils.mkdirhier(logpath) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 412 | pn = d.getVar('PN') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 413 | logfile = os.path.join(logpath, "missinglicense.csv") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 414 | generic_directory = d.getVar('COMMON_LICENSE_DIR') |
| 415 | license_types = d.getVar('LICENSE') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 416 | for license_type in ((license_types.replace('+', '').replace('|', '&') |
| 417 | .replace('(', '').replace(')', '').replace(';', '') |
| 418 | .replace(',', '').replace(" ", "").split("&"))): |
| 419 | if not os.path.isfile(os.path.join(generic_directory, license_type)): |
| 420 | lf = bb.utils.lockfile("%s.lock" % logfile) |
| 421 | with open(logfile, "a") as f: |
| 422 | writer = csv.writer(f, delimiter='\t') |
| 423 | writer.writerow([pn, license_types, license_type]) |
| 424 | f.close() |
| 425 | bb.utils.unlockfile(lf) |
| 426 | return |
| 427 | } |