2013-01-14 09:04:33 +00:00
include conf/distro/include/package_regex.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
logfile = dc.create_log_file(e.data, "distrodata.csv")
lf = bb.utils.lockfile("%s.lock" % logfile)
f = open(logfile, "a")
f.write("Package,Description,Owner,License,VerMatch,Version,Upsteam,Reason,Recipe Status,Distro 1,Distro 2,Distro 3\n")
f.close()
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)
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
pn = d.getVar("PN", True)
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
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
tmpdir = d.getVar('TMPDIR', True)
2010-10-15 20:51:33 +00:00
distro_check_dir = os.path.join(tmpdir, "distro_check")
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
datetime = localdata.getVar('DATETIME', True)
2010-10-15 20:51:33 +00:00
dist_check.update_distro_data(distro_check_dir, datetime)
2012-09-10 06:53:46 +00:00
if pn.find("-native") != -1:
pnstripped = pn.split("-native")
bb.note("Native Split: %s" % pnstripped)
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES', True))
bb.data.update_data(localdata)
if pn.find("-cross") != -1:
pnstripped = pn.split("-cross")
bb.note("cross Split: %s" % pnstripped)
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES', True))
bb.data.update_data(localdata)
if pn.find("-crosssdk") != -1:
pnstripped = pn.split("-crosssdk")
bb.note("cross Split: %s" % pnstripped)
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES', True))
bb.data.update_data(localdata)
2012-10-03 16:33:16 +00:00
if pn.startswith("nativesdk-"):
pnstripped = pn.replace("nativesdk-", "")
bb.note("NativeSDK Split: %s" % pnstripped)
localdata.setVar('OVERRIDES', "pn-" + pnstripped + ":" + d.getVar('OVERRIDES', True))
bb.data.update_data(localdata)
2012-09-10 06:53:46 +00:00
if pn.find("-initial") != -1:
pnstripped = pn.split("-initial")
bb.note("initial Split: %s" % pnstripped)
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES', True))
bb.data.update_data(localdata)
"""generate package information from .bb file"""
pname = localdata.getVar('PN', True)
pcurver = localdata.getVar('PV', True)
pdesc = localdata.getVar('DESCRIPTION', True)
2010-10-15 20:51:33 +00:00
if pdesc is not None:
pdesc = pdesc.replace(',','')
pdesc = pdesc.replace('\n','')
2012-09-10 06:53:46 +00:00
pgrp = localdata.getVar('SECTION', True)
plicense = localdata.getVar('LICENSE', True).replace(',','_')
2010-08-16 21:22:09 +00:00
2012-09-10 06:53:46 +00:00
rstatus = localdata.getVar('RECIPE_COLOR', True)
2010-10-15 20:51:33 +00:00
if rstatus is not None:
rstatus = rstatus.replace(',','')
2013-07-26 15:58:18 +00:00
2012-09-10 06:53:46 +00:00
pupver = localdata.getVar('RECIPE_UPSTREAM_VERSION', True)
if pcurver == pupver:
vermatch="1"
else:
vermatch="0"
noupdate_reason = localdata.getVar('RECIPE_NO_UPDATE_REASON', True)
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
2012-09-10 06:53:46 +00:00
maintainer = localdata.getVar('RECIPE_MAINTAINER', True)
rlrd = localdata.getVar('RECIPE_UPSTREAM_DATE', True)
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
}
addtask distrodata
do_distrodata[nostamp] = "1"
python do_distrodata() {
2012-09-10 06:53:46 +00:00
logpath = d.getVar('LOG_DIR', True)
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)
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
tmpdir = d.getVar('TMPDIR', True)
2010-10-15 20:51:33 +00:00
distro_check_dir = os.path.join(tmpdir, "distro_check")
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
datetime = localdata.getVar('DATETIME', True)
2010-10-15 20:51:33 +00:00
dist_check.update_distro_data(distro_check_dir, datetime)
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
pn = d.getVar("PN", True)
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)
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES', True))
bb.data.update_data(localdata)
2012-10-03 16:33:16 +00:00
if pn.startswith("nativesdk-"):
pnstripped = pn.replace("nativesdk-", "")
bb.note("NativeSDK Split: %s" % pnstripped)
localdata.setVar('OVERRIDES', "pn-" + pnstripped + ":" + d.getVar('OVERRIDES', True))
bb.data.update_data(localdata)
2012-09-10 06:53:46 +00:00
if pn.find("-cross") != -1:
pnstripped = pn.split("-cross")
bb.note("cross Split: %s" % pnstripped)
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES', True))
bb.data.update_data(localdata)
2012-10-03 16:33:16 +00:00
if pn.find("-crosssdk") != -1:
pnstripped = pn.split("-crosssdk")
bb.note("cross Split: %s" % pnstripped)
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES', True))
bb.data.update_data(localdata)
2012-09-10 06:53:46 +00:00
if pn.find("-initial") != -1:
pnstripped = pn.split("-initial")
bb.note("initial Split: %s" % pnstripped)
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES', True))
bb.data.update_data(localdata)
"""generate package information from .bb file"""
pname = localdata.getVar('PN', True)
pcurver = localdata.getVar('PV', True)
pdesc = localdata.getVar('DESCRIPTION', True)
2010-10-15 20:51:33 +00:00
if pdesc is not None:
pdesc = pdesc.replace(',','')
pdesc = pdesc.replace('\n','')
2012-09-10 06:53:46 +00:00
pgrp = localdata.getVar('SECTION', True)
plicense = localdata.getVar('LICENSE', True).replace(',','_')
2010-08-16 21:22:09 +00:00
2012-09-10 06:53:46 +00:00
rstatus = localdata.getVar('RECIPE_COLOR', True)
2010-10-15 20:51:33 +00:00
if rstatus is not None:
rstatus = rstatus.replace(',','')
2013-07-26 15:58:18 +00:00
2012-09-10 06:53:46 +00:00
pupver = localdata.getVar('RECIPE_UPSTREAM_VERSION', True)
if pcurver == pupver:
vermatch="1"
else:
vermatch="0"
noupdate_reason = localdata.getVar('RECIPE_NO_UPDATE_REASON', True)
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
2012-09-10 06:53:46 +00:00
maintainer = localdata.getVar('RECIPE_MAINTAINER', True)
rlrd = localdata.getVar('RECIPE_UPSTREAM_DATE', True)
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)
f = open(logfile, "a")
f.write("%s,%s,%s,%s,%s,%s,%s,%s,%s" % \
(pname, pdesc, maintainer, plicense, vermatch, pcurver, pupver, noupdate_reason, rstatus))
2010-10-15 20:51:33 +00:00
line = ""
for i in result:
line = line + "," + i
f.write(line + "\n")
f.close()
bb.utils.unlockfile(lf)
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() {
2013-01-14 09:04:33 +00:00
def parse_csv_file(filename):
package_dict = {}
fd = open(filename, "r")
lines = fd.read().rsplit("\n")
fd.close()
first_line = ''
index = 0
for line in lines:
#Skip the first line
if index == 0:
first_line = line
index += 1
continue
elif line == '':
continue
index += 1
package_name = line.rsplit("\t")[0]
if '-native' in package_name or 'nativesdk-' in package_name:
original_name = package_name.rsplit('-native')[0]
if original_name == '':
original_name = package_name.rsplit('nativesdk-')[0]
if original_name in package_dict:
continue
else:
package_dict[package_name] = line
else:
new_name = package_name + "-native"
if not(new_name in package_dict):
new_name = 'nativesdk-' + package_name
if new_name in package_dict:
del package_dict[new_name]
package_dict[package_name] = line
fd = open(filename, "w")
fd.write("%s\n"%first_line)
for el in package_dict:
fd.write(package_dict[el] + "\n")
fd.close()
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)
f = open(logfile, "a")
2013-03-22 08:30:58 +00:00
f.write("Package\tVersion\tUpver\tLicense\tSection\tHome\tRelease\tDepends\tBugTracker\tPE\tDescription\tStatus\tTracking\tURI\tMAINTAINER\tNoUpReason\n")
2010-12-15 02:30:47 +00:00
f.close()
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)
import re
import tempfile
import subprocess
"""
sanity check to ensure same name and type. Match as many patterns as possible
such as:
gnome-common-2.20.0.tar.gz (most common format)
gtk+-2.90.1.tar.gz
xf86-input-synaptics-12.6.9.tar.gz
dri2proto-2.3.tar.gz
blktool_4.orig.tar.gz
libid3tag-0.15.1b.tar.gz
unzip552.tar.gz
icu4c-3_6-src.tgz
genext2fs_1.3.orig.tar.gz
gst-fluendo-mp3
"""
2013-01-14 09:04:33 +00:00
prefix1 = "[a-zA-Z][a-zA-Z0-9]*([\-_][a-zA-Z]\w+)*\+?[\-_]" # match most patterns which uses "-" as separator to version digits
2012-09-10 06:53:46 +00:00
prefix2 = "[a-zA-Z]+" # a loose pattern such as for unzip552.tar.gz
2013-01-14 09:04:33 +00:00
prefix3 = "[0-9]+[\-]?[a-zA-Z]+" # a loose pattern such as for 80325-quicky-0.4.tar.gz
2012-09-10 06:53:46 +00:00
prefix = "(%s|%s|%s)" % (prefix1, prefix2, prefix3)
2013-01-14 09:04:33 +00:00
ver_regex = "(([A-Z]*\d+[a-zA-Z]*[\.\-_]*)+)"#"((\d+[\.\-_[a-z]])+)"
# src.rpm extension was added only for rpm package. Can be removed if the rpm
# packaged will always be considered as having to be manually upgraded
suffix = "(tar\.gz|tgz|tar\.bz2|zip|xz|rpm|bz2|orig\.tar\.gz|tar\.xz|src\.tar\.gz|src\.tgz|svnr\d+\.tar\.bz2|stable\.tar\.gz|src\.rpm)"
2012-09-10 06:53:46 +00:00
2013-01-14 09:04:33 +00:00
suffixtuple = ("tar.gz", "tgz", "zip", "tar.bz2", "tar.xz", "bz2", "orig.tar.gz", "src.tar.gz", "src.rpm", "src.tgz", "svnr\d+.tar.bz2", "stable.tar.gz", "src.rpm")
2013-02-14 15:52:40 +00:00
sinterstr = "(?P<name>%s?)v?(?P<ver>%s)(\-source)?" % (prefix, ver_regex)
sdirstr = "(?P<name>%s)\.?v?(?P<ver>%s)(\-source)?[\.\-](?P<type>%s$)" % (prefix, ver_regex, suffix)
2012-09-10 06:53:46 +00:00
def parse_inter(s):
m = re.search(sinterstr, s)
if not m:
return None
else:
return (m.group('name'), m.group('ver'), "")
def parse_dir(s):
m = re.search(sdirstr, s)
if not m:
return None
else:
return (m.group('name'), m.group('ver'), m.group('type'))
2013-01-14 09:04:33 +00:00
def modelate_version(version):
if version[0] in ['.', '-']:
if version[1].isdigit():
version = version[1] + version[0] + version[2:len(version)]
else:
version = version[1:len(version)]
version = re.sub('\-', '.', version)
version = re.sub('_', '.', version)
version = re.sub('(rc)+', '.-1.', version)
version = re.sub('(alpha)+', '.-3.', version)
version = re.sub('(beta)+', '.-2.', version)
if version[0] == 'v':
version = version[1:len(version)]
return version
2012-09-10 06:53:46 +00:00
"""
Check whether 'new' is newer than 'old' version. We use existing vercmp() for the
purpose. PE is cleared in comparison as it's not for build, and PV is cleared too
for simplicity as it's somehow difficult to get from various upstream format
"""
def __vercmp(old, new):
(on, ov, ot) = old
(en, ev, et) = new
2012-12-05 14:08:11 +00:00
if on != en or (et and et not in suffixtuple):
return False
2013-01-14 09:04:33 +00:00
ov = modelate_version(ov)
ev = modelate_version(ev)
result = bb.utils.vercmp(("0", ov, ""), ("0", ev, ""))
if result < 0:
return True
else:
return False
2012-09-10 06:53:46 +00:00
"""
wrapper for fetch upstream directory info
'url' - upstream link customized by regular expression
'd' - database
'tmpf' - tmpfile for fetcher output
We don't want to exit whole build due to one recipe error. So handle all exceptions
gracefully w/o leaking to outer.
"""
def internal_fetch_wget(url, d, tmpf):
status = "ErrFetchUnknown"
"""
Clear internal url cache as it's a temporary check. Not doing so will have
bitbake check url multiple times when looping through a single url
"""
fn = d.getVar('FILE', True)
bb.fetch2.urldata_cache[fn] = {}
"""
To avoid impacting bitbake build engine, this trick is required for reusing bitbake
interfaces. bb.fetch.go() is not appliable as it checks downloaded content in ${DL_DIR}
while we don't want to pollute that place. So bb.fetch2.checkstatus() is borrowed here
which is designed for check purpose but we override check command for our own purpose
"""
ld = bb.data.createCopy(d)
d.setVar('CHECKCOMMAND_wget', "/usr/bin/env wget -t 1 --passive-ftp -O %s --user-agent=\"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/9.10 (karmic) Firefox/3.6.12\" '${URI}'" \
% tmpf.name)
bb.data.update_data(ld)
try:
fetcher = bb.fetch2.Fetch([url], ld)
fetcher.checkstatus()
status = "SUCC"
except bb.fetch2.BBFetchException, e:
status = "ErrFetch"
return status
"""
Check on middle version directory such as "2.4/" in "http://xxx/2.4/pkg-2.4.1.tar.gz",
'url' - upstream link customized by regular expression
'd' - database
'curver' - current version
Return new version if success, or else error in "Errxxxx" style
"""
def check_new_dir(url, curver, d):
pn = d.getVar('PN', True)
f = tempfile.NamedTemporaryFile(delete=False, prefix="%s-1-" % pn)
status = internal_fetch_wget(url, d, f)
fhtml = f.read()
if status == "SUCC" and len(fhtml):
newver = parse_inter(curver)
"""
match "*4.1/">*4.1/ where '*' matches chars
N.B. add package name, only match for digits
"""
2013-01-14 09:04:33 +00:00
regex = d.getVar('REGEX', True)
if regex == '':
regex = "^%s" %prefix
m = re.search("^%s" % regex, curver)
2012-09-10 06:53:46 +00:00
if m:
s = "%s[^\d\"]*?(\d+[\.\-_])+\d+/?" % m.group()
else:
s = "(\d+[\.\-_])+\d+/?"
2013-07-26 15:58:18 +00:00
2012-09-10 06:53:46 +00:00
searchstr = "[hH][rR][eE][fF]=\"%s\">" % s
2013-01-14 09:04:33 +00:00
reg = re.compile(searchstr)
2012-09-10 06:53:46 +00:00
valid = 0
for line in fhtml.split("\n"):
if line.find(curver) >= 0:
valid = 1
m = reg.search(line)
if m:
ver = m.group().split("\"")[1]
ver = ver.strip("/")
ver = parse_inter(ver)
2013-01-14 09:04:33 +00:00
if ver and __vercmp(newver, ver) == True:
2012-09-10 06:53:46 +00:00
newver = ver
"""Expect a match for curver in directory list, or else it indicates unknown format"""
if not valid:
status = "ErrParseInterDir"
else:
"""rejoin the path name"""
status = newver[0] + newver[1]
elif not len(fhtml):
status = "ErrHostNoDir"
f.close()
if status != "ErrHostNoDir" and re.match("Err", status):
logpath = d.getVar('LOG_DIR', True)
subprocess.call("cp %s %s/" % (f.name, logpath), shell=True)
os.unlink(f.name)
return status
"""
Check on the last directory to search '2.4.1' in "http://xxx/2.4/pkg-2.4.1.tar.gz",
'url' - upstream link customized by regular expression
'd' - database
'curname' - current package name
Return new version if success, or else error in "Errxxxx" style
"""
def check_new_version(url, curname, d):
"""possible to have no version in pkg name, such as spectrum-fw"""
if not re.search("\d+", curname):
return pcurver
pn = d.getVar('PN', True)
2013-01-14 09:04:33 +00:00
newver_regex = d.getVar('REGEX', True)
2012-09-10 06:53:46 +00:00
f = tempfile.NamedTemporaryFile(delete=False, prefix="%s-2-" % pn)
status = internal_fetch_wget(url, d, f)
fhtml = f.read()
if status == "SUCC" and len(fhtml):
newver = parse_dir(curname)
2012-12-05 14:08:11 +00:00
if not newver_regex:
"""this is the default matching pattern, if recipe does not """
"""provide a regex expression """
"""match "{PN}-5.21.1.tar.gz">{PN}-5.21.1.tar.gz """
pn1 = re.search("^%s" % prefix, curname).group()
s = "[^\"]*%s[^\d\"]*?(\d+[\.\-_])+[^\"]*" % pn1
searchstr = "[hH][rR][eE][fF]=\"%s\".*[>\"]" % s
reg = searchstr
else:
2013-01-14 09:04:33 +00:00
reg = newver_regex
2012-09-10 06:53:46 +00:00
valid = 0
2012-12-05 14:08:11 +00:00
count = 0
2012-09-10 06:53:46 +00:00
for line in fhtml.split("\n"):
2013-01-14 09:04:33 +00:00
if pn == 'kconfig-frontends':
m = re.findall(reg, line)
if m:
valid = 1
for match in m:
(on, ov, oe) = newver
ver = (on, match[0], oe)
if ver and __vercmp(newver, ver) == True:
newver = ver
continue
2012-12-05 14:08:11 +00:00
count += 1
m = re.search(reg, line)
2012-09-10 06:53:46 +00:00
if m:
valid = 1
2012-12-05 14:08:11 +00:00
if not newver_regex:
ver = m.group().split("\"")[1].split("/")[-1]
if ver == "download":
ver = m.group().split("\"")[1].split("/")[-2]
ver = parse_dir(ver)
else:
""" we cheat a little here, but we assume that the
regular expression in the recipe will extract exacly
the version """
(on, ov, oe) = newver
2013-01-14 09:04:33 +00:00
ver = (on, m.group('pver'), oe)
if ver and __vercmp(newver, ver) == True:
newver = ver
2012-09-10 06:53:46 +00:00
"""Expect a match for curver in directory list, or else it indicates unknown format"""
if not valid:
status = "ErrParseDir"
else:
"""newver still contains a full package name string"""
2013-02-14 15:52:40 +00:00
status = re.sub('_', '.', newver[1])
2012-09-10 06:53:46 +00:00
elif not len(fhtml):
status = "ErrHostNoDir"
f.close()
"""if host hasn't directory information, no need to save tmp file"""
if status != "ErrHostNoDir" and re.match("Err", status):
logpath = d.getVar('LOG_DIR', True)
subprocess.call("cp %s %s/" % (f.name, logpath), shell=True)
os.unlink(f.name)
return status
"""first check whether a uri is provided"""
src_uri = d.getVar('SRC_URI', True)
if not src_uri:
return
"""initialize log files."""
logpath = d.getVar('LOG_DIR', True)
bb.utils.mkdirhier(logpath)
logfile = os.path.join(logpath, "checkpkg.csv")
"""generate package information from .bb file"""
pname = d.getVar('PN', True)
if pname.find("-native") != -1:
2013-01-14 09:04:33 +00:00
if d.getVar('BBCLASSEXTEND', True):
return
2012-09-10 06:53:46 +00:00
pnstripped = pname.split("-native")
bb.note("Native Split: %s" % pnstripped)
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES', True))
bb.data.update_data(localdata)
2013-01-14 09:04:33 +00:00
if pname.startswith("nativesdk-"):
if d.getVar('BBCLASSEXTEND', True):
return
pnstripped = pname.replace("nativesdk-", "")
bb.note("NativeSDK Split: %s" % pnstripped)
localdata.setVar('OVERRIDES', "pn-" + pnstripped + ":" + d.getVar('OVERRIDES', True))
bb.data.update_data(localdata)
2012-09-10 06:53:46 +00:00
if pname.find("-cross") != -1:
pnstripped = pname.split("-cross")
bb.note("cross Split: %s" % pnstripped)
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES', True))
bb.data.update_data(localdata)
if pname.find("-initial") != -1:
pnstripped = pname.split("-initial")
bb.note("initial Split: %s" % pnstripped)
localdata.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + d.getVar('OVERRIDES', True))
bb.data.update_data(localdata)
2013-01-14 09:04:33 +00:00
chk_uri = d.getVar('REGEX_URI', True)
2012-12-05 14:08:11 +00:00
if not chk_uri:
chk_uri = src_uri
2012-09-10 06:53:46 +00:00
pdesc = localdata.getVar('DESCRIPTION', True)
pgrp = localdata.getVar('SECTION', True)
2013-07-26 15:58:17 +00:00
if localdata.getVar('PRSPV', True):
pversion = localdata.getVar('PRSPV', True)
else:
pversion = localdata.getVar('PV', True)
2012-09-10 06:53:46 +00:00
plicense = localdata.getVar('LICENSE', True)
psection = localdata.getVar('SECTION', True)
phome = localdata.getVar('HOMEPAGE', True)
prelease = localdata.getVar('PR', True)
pdepends = localdata.getVar('DEPENDS', True)
pbugtracker = localdata.getVar('BUGTRACKER', True)
ppe = localdata.getVar('PE', True)
psrcuri = localdata.getVar('SRC_URI', True)
maintainer = localdata.getVar('RECIPE_MAINTAINER', True)
found = 0
for uri in src_uri.split():
m = re.compile('(?P<type>[^:]*)').match(uri)
if not m:
raise MalformedUrl(uri)
elif m.group('type') in ('http', 'https', 'ftp', 'cvs', 'svn', 'git'):
found = 1
pproto = m.group('type')
break
if not found:
pproto = "file"
pupver = "N/A"
pstatus = "ErrUnknown"
2013-09-01 07:52:40 +00:00
(type, host, path, user, pswd, parm) = bb.fetch.decodeurl(uri)
2012-09-10 06:53:46 +00:00
if type in ['http', 'https', 'ftp']:
2013-07-26 15:58:17 +00:00
if d.getVar('PRSPV', True):
pcurver = d.getVar('PRSPV', True)
else:
pcurver = d.getVar('PV', True)
2012-09-10 06:53:46 +00:00
else:
2013-07-26 15:58:17 +00:00
if d.getVar('PRSPV', True):
pcurver = d.getVar('PRSPV', True)
else:
pcurver = d.getVar("SRCREV", True)
2012-09-10 06:53:46 +00:00
if type in ['http', 'https', 'ftp']:
newver = pcurver
altpath = path
dirver = "-"
curname = "-"
2013-07-26 15:58:18 +00:00
2012-09-10 06:53:46 +00:00
"""
match version number amid the path, such as "5.7" in:
2013-07-26 15:58:18 +00:00
http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz
2012-09-10 06:53:46 +00:00
N.B. how about sth. like "../5.7/5.8/..."? Not find such example so far :-P
"""
m = re.search(r"[^/]*(\d+\.)+\d+([\-_]r\d+)*/", path)
if m:
altpath = path.split(m.group())[0]
dirver = m.group().strip("/")
2013-07-26 15:58:18 +00:00
2012-09-10 06:53:46 +00:00
"""use new path and remove param. for wget only param is md5sum"""
2013-09-01 07:52:40 +00:00
alturi = bb.fetch.encodeurl([type, host, altpath, user, pswd, {}])
2013-01-14 09:04:33 +00:00
my_uri = d.getVar('REGEX_URI', True)
2012-12-05 14:08:11 +00:00
if my_uri:
2013-07-26 15:58:17 +00:00
if d.getVar('PRSPV', True):
newver = d.getVar('PRSPV', True)
else:
newver = d.getVar('PV', True)
2012-12-05 14:08:11 +00:00
else:
newver = check_new_dir(alturi, dirver, d)
2012-09-10 06:53:46 +00:00
altpath = path
if not re.match("Err", newver) and dirver != newver:
2013-01-14 09:04:33 +00:00
altpath = altpath.replace(dirver, newver, True)
2012-12-05 14:08:11 +00:00
# For folder in folder cases - try to enter the folder again and then try parsing
2012-09-10 06:53:46 +00:00
"""Now try to acquire all remote files in current directory"""
if not re.match("Err", newver):
curname = altpath.split("/")[-1]
2013-07-26 15:58:18 +00:00
2012-09-10 06:53:46 +00:00
"""get remote name by skipping pacakge name"""
m = re.search(r"/.*/", altpath)
if not m:
altpath = "/"
else:
altpath = m.group()
2013-01-14 09:04:33 +00:00
chk_uri = d.getVar('REGEX_URI', True)
2012-12-05 14:08:11 +00:00
if not chk_uri:
2013-09-01 07:52:40 +00:00
alturi = bb.fetch.encodeurl([type, host, altpath, user, pswd, {}])
2012-12-05 14:08:11 +00:00
else:
alturi = chk_uri
2012-09-10 06:53:46 +00:00
newver = check_new_version(alturi, curname, d)
while(newver == "ErrHostNoDir"):
if alturi == "/download":
break
else:
alturi = "/".join(alturi.split("/")[0:-2]) + "/download"
newver = check_new_version(alturi, curname, d)
2013-01-14 09:04:33 +00:00
if not re.match("Err", newver):
pupver = newver
if pupver != pcurver:
pstatus = "UPDATE"
else:
pstatus = "MATCH"
2013-07-26 15:58:18 +00:00
2012-09-10 06:53:46 +00:00
if re.match("Err", newver):
pstatus = newver + ":" + altpath + ":" + dirver + ":" + curname
elif type == 'git':
if user:
gituser = user + '@'
else:
gituser = ""
if 'protocol' in parm:
gitproto = parm['protocol']
else:
gitproto = "git"
2013-07-12 14:43:33 +00:00
# Get all tags and HEAD
if d.getVar('GIT_REGEX', True):
gitcmd = "git ls-remote %s://%s%s%s %s 2>&1" % (gitproto, gituser, host, path, d.getVar('GIT_REGEX', True))
else:
gitcmd = "git ls-remote %s://%s%s%s *tag* 2>&1" % (gitproto, gituser, host, path)
2012-09-10 06:53:46 +00:00
gitcmd2 = "git ls-remote %s://%s%s%s HEAD 2>&1" % (gitproto, gituser, host, path)
2013-07-12 14:43:33 +00:00
2012-09-10 06:53:46 +00:00
tmp = os.popen(gitcmd).read()
2013-07-12 14:43:33 +00:00
if 'unable to connect' in tmp:
tmp = None
2012-09-10 06:53:46 +00:00
tmp2 = os.popen(gitcmd2).read()
2013-07-12 14:43:33 +00:00
if 'unable to connect' in tmp2:
tmp2 = None
#This is for those repos have tag like: refs/tags/1.2.2
phash = pversion.rsplit("+")[-1]
2012-09-10 06:53:46 +00:00
if tmp:
tmpline = tmp.split("\n")
verflag = 0
2013-03-22 08:30:58 +00:00
pupver = pversion
2012-09-10 06:53:46 +00:00
for line in tmpline:
if len(line)==0:
break;
puptag = line.split("/")[-1]
2013-03-22 08:30:58 +00:00
upstr_regex = d.getVar('REGEX', True)
if upstr_regex:
puptag = re.search(upstr_regex, puptag)
else:
2013-07-12 14:43:33 +00:00
puptag = re.search("(?P<pver>([0-9][\.|_]?)+)", puptag)
2012-09-10 06:53:46 +00:00
if puptag == None:
2013-07-12 14:43:33 +00:00
continue
puptag = puptag.group('pver')
2012-09-10 06:53:46 +00:00
puptag = re.sub("_",".",puptag)
2013-03-22 08:30:58 +00:00
plocaltag = pupver.split("+git")[0]
2012-09-10 06:53:46 +00:00
if "git" in plocaltag:
plocaltag = plocaltag.split("-")[0]
result = bb.utils.vercmp(("0", puptag, ""), ("0", plocaltag, ""))
2013-07-12 14:43:33 +00:00
2012-09-10 06:53:46 +00:00
if result > 0:
2013-07-12 14:43:33 +00:00
verflag = 1
pupver = puptag
2012-09-10 06:53:46 +00:00
elif verflag == 0 :
2013-07-12 14:43:33 +00:00
pupver = plocaltag
2012-09-10 06:53:46 +00:00
#This is for those no tag repo
elif tmp2:
2013-07-12 14:43:33 +00:00
pupver = pversion.rsplit("+")[0]
2013-03-22 08:30:58 +00:00
phash = pupver
2012-09-10 06:53:46 +00:00
else:
pstatus = "ErrGitAccess"
2013-07-12 14:43:33 +00:00
if not ('ErrGitAccess' in pstatus):
latest_head = tmp2.rsplit("\t")[0][:7]
tmp3 = re.search('(?P<git_ver>(\d+[\.-]?)+)(?P<git_prefix>(\+git[r|\-|]?)AUTOINC\+)(?P<head_md5>([\w|_]+))', pversion)
tmp4 = re.search('(?P<git_ver>(\d+[\.-]?)+)(?P<git_prefix>(\+git[r|\-|]?)AUTOINC\+)(?P<head_md5>([\w|_]+))', pupver)
if not tmp4:
tmp4 = re.search('(?P<git_ver>(\d+[\.-]?)+)', pupver)
if tmp3:
# Get status of the package - MATCH/UPDATE
result = bb.utils.vercmp(("0", tmp3.group('git_ver'), ""), ("0",tmp3.group('git_ver') , ""))
# Get the latest tag
pstatus = 'MATCH'
if result < 0:
latest_pv = tmp3.group('git_ver')
2013-03-22 08:30:58 +00:00
else:
2013-07-12 14:43:33 +00:00
latest_pv = pupver
if not(tmp3.group('head_md5')[:7] in latest_head) or not(latest_head in tmp3.group('head_md5')[:7]):
pstatus = 'UPDATE'
2013-03-22 08:30:58 +00:00
2013-07-12 14:43:33 +00:00
git_prefix = tmp3.group('git_prefix')
pupver = latest_pv + tmp3.group('git_prefix') + latest_head
else:
if not tmp3:
2013-07-26 15:58:17 +00:00
bb.plain("#DEBUG# Package %s: current version (%s) doesn't match the usual pattern" %(pname, pversion))
2012-09-10 06:53:46 +00:00
elif type == 'svn':
options = []
if user:
options.append("--username %s" % user)
if pswd:
options.append("--password %s" % pswd)
svnproto = 'svn'
if 'proto' in parm:
svnproto = parm['proto']
if 'rev' in parm:
pcurver = parm['rev']
svncmd = "svn info %s %s://%s%s/%s/ 2>&1" % (" ".join(options), svnproto, host, path, parm["module"])
print svncmd
svninfo = os.popen(svncmd).read()
2013-02-26 13:35:14 +00:00
if "Can't connect to host " in svninfo or "Connection timed out" in svninfo:
svncmd = "svn info %s %s://%s%s/%s/ 2>&1" % (" ".join(options), "http",
host, path, parm["module"])
svninfo = os.popen(svncmd).read()
2012-09-10 06:53:46 +00:00
for line in svninfo.split("\n"):
if re.search("^Last Changed Rev:", line):
pupver = line.split(" ")[-1]
if pupver in pversion:
pstatus = "MATCH"
else:
pstatus = "UPDATE"
if re.match("Err", pstatus):
pstatus = "ErrSvnAccess"
2013-07-12 14:43:33 +00:00
if pstatus != "ErrSvnAccess":
tag = pversion.rsplit("+svn")[0]
svn_prefix = re.search('(\+svn[r|\-]?)', pversion)
if tag and svn_prefix:
pupver = tag + svn_prefix.group() + pupver
2012-09-10 06:53:46 +00:00
elif type == 'cvs':
pupver = "HEAD"
pstatus = "UPDATE"
elif type == 'file':
"""local file is always up-to-date"""
pupver = pcurver
pstatus = "MATCH"
else:
pstatus = "ErrUnsupportedProto"
if re.match("Err", pstatus):
pstatus += ":%s%s" % (host, path)
"""Read from manual distro tracking fields as alternative"""
pmver = d.getVar("RECIPE_UPSTREAM_VERSION", True)
if not pmver:
pmver = "N/A"
pmstatus = "ErrNoRecipeData"
else:
if pmver == pcurver:
pmstatus = "MATCH"
else:
pmstatus = "UPDATE"
2013-07-26 15:58:18 +00:00
2012-09-10 06:53:46 +00:00
psrcuri = psrcuri.split()[0]
pdepends = "".join(pdepends.split("\t"))
pdesc = "".join(pdesc.split("\t"))
2013-03-22 08:30:58 +00:00
no_upgr_reason = d.getVar('RECIPE_NO_UPDATE_REASON', True)
2012-09-10 06:53:46 +00:00
lf = bb.utils.lockfile("%s.lock" % logfile)
f = open(logfile, "a")
2013-03-22 08:30:58 +00:00
f.write("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" % \
(pname,pversion,pupver,plicense,psection, phome,prelease, pdepends,pbugtracker,ppe,pdesc,pstatus,pmver,psrcuri,maintainer, no_upgr_reason))
2012-09-10 06:53:46 +00:00
f.close()
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"
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)
bb.data.update_data(localdata)
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
tmpdir = d.getVar('TMPDIR', True)
2010-11-22 06:02:37 +00:00
distro_check_dir = os.path.join(tmpdir, "distro_check")
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
logpath = d.getVar('LOG_DIR', True)
2011-05-16 11:06:21 +00:00
bb.utils.mkdirhier(logpath)
result_file = os.path.join(logpath, "distrocheck.csv")
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
datetime = localdata.getVar('DATETIME', True)
2010-11-22 06:02:37 +00:00
dc.update_distro_data(distro_check_dir, datetime)
# 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."""
import oe.distro_check as dc
logfile = dc.create_log_file(e.data, "missinglicense.csv")
lf = bb.utils.lockfile("%s.lock" % logfile)
f = open(logfile, "a")
f.write("Package\tLicense\tMissingLicense\n")
f.close()
bb.utils.unlockfile(lf)
2011-05-16 11:06:21 +00:00
return
}
addtask checklicense
do_checklicense[nostamp] = "1"
python do_checklicense() {
import shutil
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
logpath = d.getVar('LOG_DIR', True)
2011-05-16 11:06:21 +00:00
bb.utils.mkdirhier(logpath)
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
pn = d.getVar('PN', True)
2011-05-16 11:06:21 +00:00
logfile = os.path.join(logpath, "missinglicense.csv")
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata:
sed \
-e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \
-e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \
-e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \
-e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \
-i `grep -ril bb.data *`
(From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-09 15:00:01 +00:00
generic_directory = d.getVar('COMMON_LICENSE_DIR', True)
license_types = d.getVar('LICENSE', True)
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)
f = open(logfile, "a")
f.write("%s\t%s\t%s\n" % \
(pn,license_types,license_type))
f.close()
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
}