2015-08-11 16:41:41 +00:00
include conf/distro/include/upstream_tracking.inc
include conf/distro/include/distro_alias.inc
include conf/distro/include/maintainers.inc
2010-08-27 02:48:26 +00:00
addhandler distro_eventhandler
2013-06-12 16:31:57 +00:00
distro_eventhandler[eventmask] = "bb.event.BuildStarted"
2010-08-27 02:48:26 +00:00
python distro_eventhandler() {
2013-06-12 16:31:57 +00:00
import oe.distro_check as dc
2015-06-04 20:43:51 +00:00
import csv
2013-06-12 16:31:57 +00:00
logfile = dc.create_log_file(e.data, "distrodata.csv")
2015-06-04 20:43:51 +00:00
2013-06-12 16:31:57 +00:00
lf = bb.utils.lockfile("%s.lock" % logfile)
2015-06-04 20:43:51 +00:00
with open(logfile, "a") as f:
writer = csv.writer(f)
writer.writerow(['Package', 'Description', 'Owner', 'License',
2015-07-06 20:49:58 +00:00
'VerMatch', 'Version', 'Upstream', 'Reason', 'Recipe Status',
2015-06-04 20:43:51 +00:00
'Distro 1', 'Distro 2', 'Distro 3'])
f.close()
2013-06-12 16:31:57 +00:00
bb.utils.unlockfile(lf)
2010-10-15 20:51:33 +00:00
2010-12-30 18:40:32 +00:00
return
2010-08-27 02:48:26 +00:00
}
2010-08-16 21:22:09 +00:00
addtask distrodata_np
do_distrodata_np[nostamp] = "1"
python do_distrodata_np() {
2012-09-10 06:53:46 +00:00
localdata = bb.data.createCopy(d)
2016-12-14 21:13:04 +00:00
pn = d.getVar("PN")
2010-08-16 21:22:09 +00:00
bb.note("Package Name: %s" % pn)
2010-10-15 20:51:33 +00:00
import oe.distro_check as dist_check
2016-12-14 21:13:04 +00:00
tmpdir = d.getVar('TMPDIR')
2010-10-15 20:51:33 +00:00
distro_check_dir = os.path.join(tmpdir, "distro_check")
2016-12-14 21:13:04 +00:00
datetime = localdata.getVar('DATETIME')
2015-09-02 08:59:43 +00:00
dist_check.update_distro_data(distro_check_dir, datetime, localdata)
2010-10-15 20:51:33 +00:00
2012-09-10 06:53:46 +00:00
if pn.find("-native") != -1:
pnstripped = pn.split("-native")
bb.note("Native Split: %s" % pnstripped)
2016-12-14 21:13:04 +00:00
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES'))
2012-09-10 06:53:46 +00:00
if pn.find("-cross") != -1:
pnstripped = pn.split("-cross")
bb.note("cross Split: %s" % pnstripped)
2016-12-14 21:13:04 +00:00
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES'))
2012-09-10 06:53:46 +00:00
if pn.find("-crosssdk") != -1:
pnstripped = pn.split("-crosssdk")
bb.note("cross Split: %s" % pnstripped)
2016-12-14 21:13:04 +00:00
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES'))
2012-09-10 06:53:46 +00:00
2012-10-03 16:33:16 +00:00
if pn.startswith("nativesdk-"):
pnstripped = pn.replace("nativesdk-", "")
bb.note("NativeSDK Split: %s" % pnstripped)
2016-12-14 21:13:04 +00:00
localdata.setVar('OVERRIDES', "pn-" + pnstripped + ":" + d.getVar('OVERRIDES'))
2012-10-03 16:33:16 +00:00
2012-09-10 06:53:46 +00:00
if pn.find("-initial") != -1:
pnstripped = pn.split("-initial")
bb.note("initial Split: %s" % pnstripped)
2016-12-14 21:13:04 +00:00
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES'))
2012-09-10 06:53:46 +00:00
"""generate package information from .bb file"""
2016-12-14 21:13:04 +00:00
pname = localdata.getVar('PN')
pcurver = localdata.getVar('PV')
pdesc = localdata.getVar('DESCRIPTION')
2010-10-15 20:51:33 +00:00
if pdesc is not None:
pdesc = pdesc.replace(',','')
pdesc = pdesc.replace('\n','')
2016-12-14 21:13:04 +00:00
pgrp = localdata.getVar('SECTION')
plicense = localdata.getVar('LICENSE').replace(',','_')
2010-08-16 21:22:09 +00:00
2016-12-14 21:13:04 +00:00
rstatus = localdata.getVar('RECIPE_COLOR')
2010-10-15 20:51:33 +00:00
if rstatus is not None:
rstatus = rstatus.replace(',','')
2013-07-26 15:58:18 +00:00
2016-12-14 21:13:04 +00:00
pupver = localdata.getVar('RECIPE_UPSTREAM_VERSION')
2012-09-10 06:53:46 +00:00
if pcurver == pupver:
vermatch="1"
else:
vermatch="0"
2016-12-14 21:13:04 +00:00
noupdate_reason = localdata.getVar('RECIPE_NO_UPDATE_REASON')
2012-09-10 06:53:46 +00:00
if noupdate_reason is None:
noupdate="0"
else:
noupdate="1"
2010-10-15 20:51:33 +00:00
noupdate_reason = noupdate_reason.replace(',','')
2010-08-16 21:22:09 +00:00
2016-12-14 21:13:04 +00:00
maintainer = localdata.getVar('RECIPE_MAINTAINER')
rlrd = localdata.getVar('RECIPE_UPSTREAM_DATE')
2010-10-15 20:51:33 +00:00
result = dist_check.compare_in_distro_packages_list(distro_check_dir, localdata)
2012-09-10 06:53:46 +00:00
bb.note("DISTRO: %s,%s,%s,%s,%s,%s,%s,%s,%s\n" % \
(pname, pdesc, maintainer, plicense, vermatch, pcurver, pupver, noupdate_reason, rstatus))
2010-10-15 20:51:33 +00:00
line = pn
for i in result:
line = line + "," + i
bb.note("%s\n" % line)
2010-08-16 21:22:09 +00:00
}
2016-04-09 22:16:09 +00:00
do_distrodata_np[vardepsexclude] = "DATETIME"
2010-08-16 21:22:09 +00:00
addtask distrodata
do_distrodata[nostamp] = "1"
python do_distrodata() {
2015-06-04 20:43:51 +00:00
import csv
2016-12-14 21:13:04 +00:00
logpath = d.getVar('LOG_DIR')
2012-09-10 06:53:46 +00:00
bb.utils.mkdirhier(logpath)
logfile = os.path.join(logpath, "distrodata.csv")
2010-08-16 21:22:09 +00:00
2010-10-15 20:51:33 +00:00
import oe.distro_check as dist_check
2012-09-10 06:53:46 +00:00
localdata = bb.data.createCopy(d)
2016-12-14 21:13:04 +00:00
tmpdir = d.getVar('TMPDIR')
2010-10-15 20:51:33 +00:00
distro_check_dir = os.path.join(tmpdir, "distro_check")
2016-12-14 21:13:04 +00:00
datetime = localdata.getVar('DATETIME')
2015-09-02 08:59:43 +00:00
dist_check.update_distro_data(distro_check_dir, datetime, localdata)
2010-10-15 20:51:33 +00:00
2016-12-14 21:13:04 +00:00
pn = d.getVar("PN")
2010-08-16 21:22:09 +00:00
bb.note("Package Name: %s" % pn)
2012-09-10 06:53:46 +00:00
if pn.find("-native") != -1:
pnstripped = pn.split("-native")
bb.note("Native Split: %s" % pnstripped)
2016-12-14 21:13:04 +00:00
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES'))
2012-09-10 06:53:46 +00:00
2012-10-03 16:33:16 +00:00
if pn.startswith("nativesdk-"):
pnstripped = pn.replace("nativesdk-", "")
bb.note("NativeSDK Split: %s" % pnstripped)
2016-12-14 21:13:04 +00:00
localdata.setVar('OVERRIDES', "pn-" + pnstripped + ":" + d.getVar('OVERRIDES'))
2012-10-03 16:33:16 +00:00
2012-09-10 06:53:46 +00:00
if pn.find("-cross") != -1:
pnstripped = pn.split("-cross")
bb.note("cross Split: %s" % pnstripped)
2016-12-14 21:13:04 +00:00
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES'))
2012-09-10 06:53:46 +00:00
2012-10-03 16:33:16 +00:00
if pn.find("-crosssdk") != -1:
pnstripped = pn.split("-crosssdk")
bb.note("cross Split: %s" % pnstripped)
2016-12-14 21:13:04 +00:00
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES'))
2012-10-03 16:33:16 +00:00
2012-09-10 06:53:46 +00:00
if pn.find("-initial") != -1:
pnstripped = pn.split("-initial")
bb.note("initial Split: %s" % pnstripped)
2016-12-14 21:13:04 +00:00
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES'))
2012-09-10 06:53:46 +00:00
"""generate package information from .bb file"""
2016-12-14 21:13:04 +00:00
pname = localdata.getVar('PN')
pcurver = localdata.getVar('PV')
pdesc = localdata.getVar('DESCRIPTION')
2010-10-15 20:51:33 +00:00
if pdesc is not None:
pdesc = pdesc.replace(',','')
pdesc = pdesc.replace('\n','')
2016-12-14 21:13:04 +00:00
pgrp = localdata.getVar('SECTION')
plicense = localdata.getVar('LICENSE').replace(',','_')
2010-08-16 21:22:09 +00:00
2016-12-14 21:13:04 +00:00
rstatus = localdata.getVar('RECIPE_COLOR')
2010-10-15 20:51:33 +00:00
if rstatus is not None:
rstatus = rstatus.replace(',','')
2013-07-26 15:58:18 +00:00
2016-12-14 21:13:04 +00:00
pupver = localdata.getVar('RECIPE_UPSTREAM_VERSION')
2012-09-10 06:53:46 +00:00
if pcurver == pupver:
vermatch="1"
else:
vermatch="0"
2016-12-14 21:13:04 +00:00
noupdate_reason = localdata.getVar('RECIPE_NO_UPDATE_REASON')
2012-09-10 06:53:46 +00:00
if noupdate_reason is None:
noupdate="0"
else:
noupdate="1"
2010-10-15 20:51:33 +00:00
noupdate_reason = noupdate_reason.replace(',','')
2010-08-16 21:22:09 +00:00
2016-12-14 21:13:04 +00:00
maintainer = localdata.getVar('RECIPE_MAINTAINER')
rlrd = localdata.getVar('RECIPE_UPSTREAM_DATE')
2010-10-15 20:51:33 +00:00
# do the comparison
result = dist_check.compare_in_distro_packages_list(distro_check_dir, localdata)
2010-08-16 21:22:09 +00:00
2012-09-10 06:53:46 +00:00
lf = bb.utils.lockfile("%s.lock" % logfile)
2015-06-04 20:43:51 +00:00
with open(logfile, "a") as f:
row = [pname, pdesc, maintainer, plicense, vermatch, pcurver, pupver, noupdate_reason, rstatus]
row.extend(result)
writer = csv.writer(f)
writer.writerow(row)
f.close()
2010-10-15 20:51:33 +00:00
bb.utils.unlockfile(lf)
2010-08-16 21:22:09 +00:00
}
2016-04-09 22:16:09 +00:00
do_distrodata[vardepsexclude] = "DATETIME"
2010-08-16 21:22:09 +00:00
addtask distrodataall after do_distrodata
2012-07-02 12:27:46 +00:00
do_distrodataall[recrdeptask] = "do_distrodataall do_distrodata"
2013-06-19 13:05:17 +00:00
do_distrodataall[recideptask] = "do_${BB_DEFAULT_TASK}"
2010-08-16 21:22:09 +00:00
do_distrodataall[nostamp] = "1"
do_distrodataall() {
2012-09-10 06:53:46 +00:00
:
2010-08-16 21:22:09 +00:00
}
2010-12-15 02:30:47 +00:00
addhandler checkpkg_eventhandler
2013-06-15 12:17:36 +00:00
checkpkg_eventhandler[eventmask] = "bb.event.BuildStarted bb.event.BuildCompleted"
2010-12-15 02:30:47 +00:00
python checkpkg_eventhandler() {
2015-06-04 20:43:51 +00:00
import csv
2013-01-14 09:04:33 +00:00
def parse_csv_file(filename):
package_dict = {}
2015-06-04 20:43:51 +00:00
with open(filename, "r") as f:
reader = csv.reader(f, delimiter='\t')
for row in reader:
pn = row[0]
if reader.line_num == 1:
header = row
2013-01-14 09:04:33 +00:00
continue
2015-06-04 20:43:51 +00:00
if not pn in package_dict.keys():
package_dict[pn] = row
f.close()
with open(filename, "w") as f:
writer = csv.writer(f, delimiter='\t')
writer.writerow(header)
for pn in package_dict.keys():
writer.writerow(package_dict[pn])
f.close()
2013-01-14 09:04:33 +00:00
del package_dict
2010-12-15 02:30:47 +00:00
if bb.event.getName(e) == "BuildStarted":
2012-09-10 06:53:46 +00:00
import oe.distro_check as dc
logfile = dc.create_log_file(e.data, "checkpkg.csv")
2011-05-16 11:06:21 +00:00
2012-09-10 06:53:46 +00:00
lf = bb.utils.lockfile("%s.lock" % logfile)
2015-06-04 20:43:51 +00:00
with open(logfile, "a") as f:
writer = csv.writer(f, delimiter='\t')
headers = ['Package', 'Version', 'Upver', 'License', 'Section',
'Home', 'Release', 'Depends', 'BugTracker', 'PE', 'Description',
'Status', 'Tracking', 'URI', 'MAINTAINER', 'NoUpReason']
writer.writerow(headers)
f.close()
2010-12-15 02:30:47 +00:00
bb.utils.unlockfile(lf)
2013-01-14 09:04:33 +00:00
elif bb.event.getName(e) == "BuildCompleted":
import os
filename = "tmp/log/checkpkg.csv"
if os.path.isfile(filename):
lf = bb.utils.lockfile("%s.lock"%filename)
parse_csv_file(filename)
bb.utils.unlockfile(lf)
2010-12-30 18:40:32 +00:00
return
2010-12-15 02:30:47 +00:00
}
2010-11-22 06:02:37 +00:00
addtask checkpkg
do_checkpkg[nostamp] = "1"
python do_checkpkg() {
2012-09-10 06:53:46 +00:00
localdata = bb.data.createCopy(d)
2015-06-04 20:43:51 +00:00
import csv
2012-09-10 06:53:46 +00:00
import re
import tempfile
import subprocess
2015-06-02 16:51:19 +00:00
import oe.recipeutils
from bb.utils import vercmp_string
from bb.fetch2 import FetchError, NoMethodError, decodeurl
2012-09-10 06:53:46 +00:00
"""first check whether a uri is provided"""
2016-12-14 21:13:04 +00:00
src_uri = (d.getVar('SRC_URI') or '').split()
2015-09-25 11:41:36 +00:00
if src_uri:
2015-11-06 09:34:05 +00:00
uri_type, _, _, _, _, _ = decodeurl(src_uri[0])
2015-09-25 11:41:36 +00:00
else:
uri_type = "none"
2012-09-10 06:53:46 +00:00
"""initialize log files."""
2016-12-14 21:13:04 +00:00
logpath = d.getVar('LOG_DIR')
2012-09-10 06:53:46 +00:00
bb.utils.mkdirhier(logpath)
logfile = os.path.join(logpath, "checkpkg.csv")
"""generate package information from .bb file"""
2016-12-14 21:13:04 +00:00
pname = d.getVar('PN')
2012-09-10 06:53:46 +00:00
if pname.find("-native") != -1:
2016-12-14 21:13:04 +00:00
if d.getVar('BBCLASSEXTEND'):
2013-01-14 09:04:33 +00:00
return
2012-09-10 06:53:46 +00:00
pnstripped = pname.split("-native")
bb.note("Native Split: %s" % pnstripped)
2016-12-14 21:13:04 +00:00
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES'))
2012-09-10 06:53:46 +00:00
2013-01-14 09:04:33 +00:00
if pname.startswith("nativesdk-"):
2016-12-14 21:13:04 +00:00
if d.getVar('BBCLASSEXTEND'):
2013-01-14 09:04:33 +00:00
return
pnstripped = pname.replace("nativesdk-", "")
bb.note("NativeSDK Split: %s" % pnstripped)
2016-12-14 21:13:04 +00:00
localdata.setVar('OVERRIDES', "pn-" + pnstripped + ":" + d.getVar('OVERRIDES'))
2013-01-14 09:04:33 +00:00
2012-09-10 06:53:46 +00:00
if pname.find("-cross") != -1:
pnstripped = pname.split("-cross")
bb.note("cross Split: %s" % pnstripped)
2016-12-14 21:13:04 +00:00
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES'))
2012-09-10 06:53:46 +00:00
if pname.find("-initial") != -1:
pnstripped = pname.split("-initial")
bb.note("initial Split: %s" % pnstripped)
2016-12-14 21:13:04 +00:00
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES'))
2012-09-10 06:53:46 +00:00
2016-12-14 21:13:04 +00:00
pdesc = localdata.getVar('DESCRIPTION')
pgrp = localdata.getVar('SECTION')
pversion = localdata.getVar('PV')
plicense = localdata.getVar('LICENSE')
psection = localdata.getVar('SECTION')
phome = localdata.getVar('HOMEPAGE')
prelease = localdata.getVar('PR')
pdepends = localdata.getVar('DEPENDS')
pbugtracker = localdata.getVar('BUGTRACKER')
ppe = localdata.getVar('PE')
psrcuri = localdata.getVar('SRC_URI')
maintainer = localdata.getVar('RECIPE_MAINTAINER')
2012-09-10 06:53:46 +00:00
2014-11-28 01:09:43 +00:00
""" Get upstream version version """
2015-06-02 16:51:19 +00:00
pupver = ""
pstatus = ""
try:
uv = oe.recipeutils.get_recipe_upstream_version(localdata)
pupver = uv['version']
except Exception as e:
if e is FetchError:
2014-11-28 01:09:43 +00:00
pstatus = "ErrAccess"
2015-06-02 16:51:19 +00:00
elif e is NoMethodError:
pstatus = "ErrUnsupportedProto"
else:
pstatus = "ErrUnknown"
2012-09-10 06:53:46 +00:00
2015-06-02 16:51:19 +00:00
"""Set upstream version status"""
2014-11-28 01:09:43 +00:00
if not pupver:
pupver = "N/A"
else:
2015-06-02 16:51:19 +00:00
pv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pversion, uri_type)
upv, _, _ = oe.recipeutils.get_recipe_pv_without_srcpv(pupver, uri_type)
cmp = vercmp_string(pv, upv)
if cmp == -1:
pstatus = "UPDATE"
elif cmp == 0:
pstatus = "MATCH"
2012-09-10 06:53:46 +00:00
2015-09-25 11:41:36 +00:00
if psrcuri:
psrcuri = psrcuri.split()[0]
else:
psrcuri = "none"
2012-09-10 06:53:46 +00:00
pdepends = "".join(pdepends.split("\t"))
pdesc = "".join(pdesc.split("\t"))
2016-12-14 21:13:04 +00:00
no_upgr_reason = d.getVar('RECIPE_NO_UPDATE_REASON')
2012-09-10 06:53:46 +00:00
lf = bb.utils.lockfile("%s.lock" % logfile)
2015-06-04 20:43:51 +00:00
with open(logfile, "a") as f:
writer = csv.writer(f, delimiter='\t')
writer.writerow([pname, pversion, pupver, plicense, psection, phome,
2015-07-27 16:42:52 +00:00
prelease, pdepends, pbugtracker, ppe, pdesc, pstatus, pupver,
2015-06-04 20:43:51 +00:00
psrcuri, maintainer, no_upgr_reason])
f.close()
2012-09-10 06:53:46 +00:00
bb.utils.unlockfile(lf)
2010-11-22 06:02:37 +00:00
}
addtask checkpkgall after do_checkpkg
2012-07-02 12:27:46 +00:00
do_checkpkgall[recrdeptask] = "do_checkpkgall do_checkpkg"
2013-06-19 13:05:17 +00:00
do_checkpkgall[recideptask] = "do_${BB_DEFAULT_TASK}"
2010-11-22 06:02:37 +00:00
do_checkpkgall[nostamp] = "1"
do_checkpkgall() {
2012-09-10 06:53:46 +00:00
:
2010-11-22 06:02:37 +00:00
}
2011-05-16 11:06:21 +00:00
addhandler distro_check_eventhandler
2013-06-15 12:17:36 +00:00
distro_check_eventhandler[eventmask] = "bb.event.BuildStarted"
2011-05-16 11:06:21 +00:00
python distro_check_eventhandler() {
2013-06-12 16:31:57 +00:00
"""initialize log files."""
import oe.distro_check as dc
result_file = dc.create_log_file(e.data, "distrocheck.csv")
2010-12-30 18:40:32 +00:00
return
2010-11-22 06:02:37 +00:00
}
addtask distro_check
do_distro_check[nostamp] = "1"
2017-01-25 16:21:08 +00:00
do_distro_check[vardepsexclude] += "DATETIME"
2010-11-22 06:02:37 +00:00
python do_distro_check() {
"""checks if the package is present in other public Linux distros"""
import oe.distro_check as dc
2011-05-16 11:06:21 +00:00
import shutil
2011-09-20 20:40:48 +00:00
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):
return
2010-11-22 06:02:37 +00:00
localdata = bb.data.createCopy(d)
2016-12-14 21:13:04 +00:00
tmpdir = d.getVar('TMPDIR')
2010-11-22 06:02:37 +00:00
distro_check_dir = os.path.join(tmpdir, "distro_check")
2016-12-14 21:13:04 +00:00
logpath = d.getVar('LOG_DIR')
2011-05-16 11:06:21 +00:00
bb.utils.mkdirhier(logpath)
result_file = os.path.join(logpath, "distrocheck.csv")
2016-12-14 21:13:04 +00:00
datetime = localdata.getVar('DATETIME')
2015-09-02 08:59:43 +00:00
dc.update_distro_data(distro_check_dir, datetime, localdata)
2010-11-22 06:02:37 +00:00
# do the comparison
result = dc.compare_in_distro_packages_list(distro_check_dir, d)
# save the results
2011-05-16 11:06:21 +00:00
dc.save_distro_check_result(result, datetime, result_file, d)
2010-11-22 06:02:37 +00:00
}
addtask distro_checkall after do_distro_check
2012-07-02 12:27:46 +00:00
do_distro_checkall[recrdeptask] = "do_distro_checkall do_distro_check"
2013-06-19 13:05:17 +00:00
do_distro_checkall[recideptask] = "do_${BB_DEFAULT_TASK}"
2010-11-22 06:02:37 +00:00
do_distro_checkall[nostamp] = "1"
do_distro_checkall() {
2012-09-10 06:53:46 +00:00
:
2010-11-22 06:02:37 +00:00
}
2011-05-16 11:06:21 +00:00
#
#Check Missing License Text.
#Use this task to generate the missing license text data for pkg-report system,
#then we can search those recipes which license text isn't exsit in common-licenses directory
#
addhandler checklicense_eventhandler
2013-06-12 16:31:57 +00:00
checklicense_eventhandler[eventmask] = "bb.event.BuildStarted"
2011-05-16 11:06:21 +00:00
python checklicense_eventhandler() {
2013-06-12 16:31:57 +00:00
"""initialize log files."""
2015-06-04 20:43:51 +00:00
import csv
2013-06-12 16:31:57 +00:00
import oe.distro_check as dc
logfile = dc.create_log_file(e.data, "missinglicense.csv")
lf = bb.utils.lockfile("%s.lock" % logfile)
2015-06-04 20:43:51 +00:00
with open(logfile, "a") as f:
writer = csv.writer(f, delimiter='\t')
writer.writerow(['Package', 'License', 'MissingLicense'])
f.close()
2013-06-12 16:31:57 +00:00
bb.utils.unlockfile(lf)
2011-05-16 11:06:21 +00:00
return
}
addtask checklicense
do_checklicense[nostamp] = "1"
python do_checklicense() {
2015-06-04 20:43:51 +00:00
import csv
2011-05-16 11:06:21 +00:00
import shutil
2016-12-14 21:13:04 +00:00
logpath = d.getVar('LOG_DIR')
2011-05-16 11:06:21 +00:00
bb.utils.mkdirhier(logpath)
2016-12-14 21:13:04 +00:00
pn = d.getVar('PN')
2011-05-16 11:06:21 +00:00
logfile = os.path.join(logpath, "missinglicense.csv")
2016-12-14 21:13:04 +00:00
generic_directory = d.getVar('COMMON_LICENSE_DIR')
license_types = d.getVar('LICENSE')
2011-05-16 11:06:21 +00:00
for license_type in ((license_types.replace('+', '').replace('|', '&')
.replace('(', '').replace(')', '').replace(';', '')
.replace(',', '').replace(" ", "").split("&"))):
if not os.path.isfile(os.path.join(generic_directory, license_type)):
lf = bb.utils.lockfile("%s.lock" % logfile)
2015-06-04 20:43:51 +00:00
with open(logfile, "a") as f:
writer = csv.writer(f, delimiter='\t')
writer.writerow([pn, license_types, license_type])
f.close()
2011-05-16 11:06:21 +00:00
bb.utils.unlockfile(lf)
return
}
addtask checklicenseall after do_checklicense
2012-07-02 12:27:46 +00:00
do_checklicenseall[recrdeptask] = "do_checklicenseall do_checklicense"
2013-06-19 13:05:17 +00:00
do_checklicenseall[recideptask] = "do_${BB_DEFAULT_TASK}"
2011-05-16 11:06:21 +00:00
do_checklicenseall[nostamp] = "1"
do_checklicenseall() {
2012-09-10 06:53:46 +00:00
:
2011-05-16 11:06:21 +00:00
}