diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2016-08-17 22:31:25 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2016-08-22 19:43:26 +0300 |
commit | 60f9d69e016b11c468c98ea75ba0a60c44afbbc4 (patch) | |
tree | ecb49581a9e41a37943c22cd9ef3f63451b20ee7 /import-layers/yocto-poky/meta/classes/oelint.bbclass | |
parent | e18c61205e0234b03697129c20cc69c9b3940efc (diff) | |
download | openbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.tar.xz |
yocto-poky: Move to import-layers subdir
We are going to import additional layers, so create a subdir to
hold all of the layers that we import with git-subtree.
Change-Id: I6f732153a22be8ca663035c518837e3cc5ec0799
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'import-layers/yocto-poky/meta/classes/oelint.bbclass')
-rw-r--r-- | import-layers/yocto-poky/meta/classes/oelint.bbclass | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/import-layers/yocto-poky/meta/classes/oelint.bbclass b/import-layers/yocto-poky/meta/classes/oelint.bbclass new file mode 100644 index 000000000..1b051ca22 --- /dev/null +++ b/import-layers/yocto-poky/meta/classes/oelint.bbclass @@ -0,0 +1,84 @@ +addtask lint before do_build +do_lint[nostamp] = "1" +python do_lint() { + pkgname = d.getVar("PN", True) + + ############################## + # Test that DESCRIPTION exists + # + description = d.getVar("DESCRIPTION", False) + if description[1:10] == '{SUMMARY}': + bb.warn("%s: DESCRIPTION is not set" % pkgname) + + + ############################## + # Test that HOMEPAGE exists + # + homepage = d.getVar("HOMEPAGE", False) + if homepage == '': + bb.warn("%s: HOMEPAGE is not set" % pkgname) + elif not homepage.startswith("http://") and not homepage.startswith("https://"): + bb.warn("%s: HOMEPAGE doesn't start with http:// or https://" % pkgname) + + + ############################## + # Test for valid SECTION + # + section = d.getVar("SECTION", False) + if section == '': + bb.warn("%s: SECTION is not set" % pkgname) + elif not section.islower(): + bb.warn("%s: SECTION should only use lower case" % pkgname) + + + ############################## + # Check that all patches have Signed-off-by and Upstream-Status + # + srcuri = d.getVar("SRC_URI", False).split() + fpaths = (d.getVar('FILESPATH', True) or '').split(':') + + def findPatch(patchname): + for dir in fpaths: + patchpath = dir + patchname + if os.path.exists(patchpath): + return patchpath + + def findKey(path, key): + ret = True + f = file('%s' % path, mode = 'r') + line = f.readline() + while line: + if line.find(key) != -1: + ret = False + line = f.readline() + f.close() + return ret + + def checkPN(pkgname, varname, str): + if str.find("{PN}") != -1: + bb.warn("%s: should use BPN instead of PN in %s" % (pkgname, varname)) + if str.find("{P}") != -1: + bb.warn("%s: should use BP instead of P in %s" % (pkgname, varname)) + + length = len("file://") + for item in srcuri: + if item.startswith("file://"): + item = item[length:] + if item.endswith(".patch") or item.endswith(".diff"): + path = findPatch(item) + if findKey(path, "Signed-off-by"): + bb.warn("%s: %s doesn't have Signed-off-by" % (pkgname, item)) + if findKey(path, "Upstream-Status"): + bb.warn("%s: %s doesn't have Upstream-Status" % (pkgname, item)) + + + ############################## + # Check for ${PN} or ${P} usage in SRC_URI or S + # Should use ${BPN} or ${BP} instead to avoid breaking multilib + # + for s in srcuri: + if not s.startswith("file://"): + checkPN(pkgname, 'SRC_URI', s) + + checkPN(pkgname, 'S', d.getVar('S', False)) +} |