* [PATCH 0/3] oelint.bbclass: make oelint bbclass work
@ 2014-08-01 7:15 Chong Lu
2014-08-01 7:15 ` [PATCH 1/3] " Chong Lu
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Chong Lu @ 2014-08-01 7:15 UTC (permalink / raw)
To: openembedded-core
In conf/local.conf, add 'INHERIT += "oelint"' to test.
We can get many warnings, like following:
WARNING: diffutils: HOMEPAGE is not set
WARNING: sed: DESCRIPTION is not set
WARNING: perl: DESCRIPTION is not set
WARNING: perl: debian/cpan_definstalldirs.diff doesn't have Signed-off-by
WARNING: perl: debian/cpan_definstalldirs.diff doesn't have Upstream-Status
The following changes since commit 2d1660112e54653f7bb763939d0416472c49fe01:
populate_sdk_base: Fix grep command usage on old hosts (2014-07-29 09:58:27 +0100)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib chonglu/oelint
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=chonglu/oelint
Chong Lu (3):
oelint.bbclass: make oelint bbclass work
oelint.bbclass: add patch checking
oelint.bbclass: Check for ${PN} or ${P} usage
meta/classes/oelint.bbclass | 251 ++++++++++++++------------------------------
1 file changed, 81 insertions(+), 170 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/3] oelint.bbclass: make oelint bbclass work 2014-08-01 7:15 [PATCH 0/3] oelint.bbclass: make oelint bbclass work Chong Lu @ 2014-08-01 7:15 ` Chong Lu 2014-08-01 7:15 ` [PATCH 2/3] oelint.bbclass: add patch checking Chong Lu 2014-08-01 7:15 ` [PATCH 3/3] oelint.bbclass: Check for ${PN} or ${P} usage Chong Lu 2 siblings, 0 replies; 6+ messages in thread From: Chong Lu @ 2014-08-01 7:15 UTC (permalink / raw) To: openembedded-core Remove LICENSE, MAINTAINER, PRIORITY and valid SECTION checking. Convert tab indentation into four-space. [YOCTO #5427] Signed-off-by: Chong Lu <Chong.Lu@windriver.com> --- meta/classes/oelint.bbclass | 196 ++++++-------------------------------------- 1 file changed, 26 insertions(+), 170 deletions(-) diff --git a/meta/classes/oelint.bbclass b/meta/classes/oelint.bbclass index f2e7540..1c6f4b8 100644 --- a/meta/classes/oelint.bbclass +++ b/meta/classes/oelint.bbclass @@ -1,174 +1,30 @@ addtask lint before do_fetch do_lint[nostamp] = "1" python do_lint() { - def testVar(var, explain=None): - try: - s = d[var] - return s["content"] - except KeyError: - bb.error("%s is not set" % var) - if explain: bb.note(explain) - return None - - - ############################## - # Test that DESCRIPTION exists - # - testVar("DESCRIPTION") - - - ############################## - # Test that HOMEPAGE exists - # - s = testVar("HOMEPAGE") - if s=="unknown": - bb.error("HOMEPAGE is not set") - elif not s.startswith("http://"): - bb.error("HOMEPAGE doesn't start with http://") - - - - ############################## - # Test for valid LICENSE - # - valid_licenses = { - "GPL-2" : "GPLv2", - "GPL LGPL FDL" : True, - "GPL PSF" : True, - "GPL/QPL" : True, - "GPL" : True, - "GPLv2" : True, - "IBM" : True, - "LGPL GPL" : True, - "LGPL" : True, - "MIT" : True, - "OSL" : True, - "Perl" : True, - "Public Domain" : True, - "QPL" : "GPL/QPL", - } - s = testVar("LICENSE") - if s=="unknown": - bb.error("LICENSE is not set") - elif s.startswith("Vendor"): - pass - else: - try: - newlic = valid_licenses[s] - if newlic == False: - bb.note("LICENSE '%s' is not recommended" % s) - elif newlic != True: - bb.note("LICENSE '%s' is not recommended, better use '%s'" % (s, newsect)) - except: - bb.note("LICENSE '%s' is not recommended" % s) - - - ############################## - # Test for valid MAINTAINER - # - s = testVar("MAINTAINER") - if s=="OpenEmbedded Team <openembedded-devel@openembedded.org>": - bb.error("explicit MAINTAINER is missing, using default") - elif s and s.find("@") == -1: - bb.error("You forgot to put an e-mail address into MAINTAINER") - - - ############################## - # Test for valid SECTION - # - # if Correct section: True section name is valid - # False section name is invalid, no suggestion - # string section name is invalid, better name suggested - # - valid_sections = { - # Current Section Correct section - "apps" : True, - "audio" : True, - "base" : True, - "console/games" : True, - "console/net" : "console/network", - "console/network" : True, - "console/utils" : True, - "devel" : True, - "developing" : "devel", - "devel/python" : True, - "fonts" : True, - "games" : True, - "games/libs" : True, - "gnome/base" : True, - "gnome/libs" : True, - "gpe" : True, - "gpe/libs" : True, - "gui" : False, - "libc" : "libs", - "libs" : True, - "libs/net" : True, - "multimedia" : True, - "net" : "network", - "NET" : "network", - "network" : True, - "opie/applets" : True, - "opie/applications" : True, - "opie/base" : True, - "opie/codecs" : True, - "opie/decorations" : True, - "opie/fontfactories" : True, - "opie/fonts" : True, - "opie/games" : True, - "opie/help" : True, - "opie/inputmethods" : True, - "opie/libs" : True, - "opie/multimedia" : True, - "opie/pim" : True, - "opie/setting" : "opie/settings", - "opie/settings" : True, - "opie/Shell" : False, - "opie/styles" : True, - "opie/today" : True, - "scientific" : True, - "utils" : True, - "x11" : True, - "x11/libs" : True, - "x11/wm" : True, - } - s = testVar("SECTION") - if s: - try: - newsect = valid_sections[s] - if newsect == False: - bb.note("SECTION '%s' is not recommended" % s) - elif newsect != True: - bb.note("SECTION '%s' is not recommended, better use '%s'" % (s, newsect)) - except: - bb.note("SECTION '%s' is not recommended" % s) - - if not s.islower(): - bb.error("SECTION should only use lower case") - - - - - ############################## - # Test for valid PRIORITY - # - valid_priorities = { - "standard" : True, - "required" : True, - "optional" : True, - "extra" : True, - } - s = testVar("PRIORITY") - if s: - try: - newprio = valid_priorities[s] - if newprio == False: - bb.note("PRIORITY '%s' is not recommended" % s) - elif newprio != True: - bb.note("PRIORITY '%s' is not recommended, better use '%s'" % (s, newprio)) - except: - bb.note("PRIORITY '%s' is not recommended" % s) - - if not s.islower(): - bb.error("PRIORITY should only use lower case") - + ############################## + # Test that DESCRIPTION exists + # + s = d.getVar("DESCRIPTION") + if s[1:10] == '{SUMMARY}': + bb.warn("${PN}: DESCRIPTION is not set") + + + ############################## + # Test that HOMEPAGE exists + # + s = d.getVar("HOMEPAGE") + if s == '': + bb.warn("${PN}: HOMEPAGE is not set") + elif not s.startswith("http://") and not s.startswith("https://"): + bb.warn("${PN}: HOMEPAGE doesn't start with http:// or https://") + + + ############################## + # Test for valid SECTION + # + s = d.getVar("SECTION") + if s == '': + bb.warn("${PN}: SECTION is not set") + elif not s.islower(): + bb.warn("${PN}: SECTION should only use lower case") } -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] oelint.bbclass: add patch checking 2014-08-01 7:15 [PATCH 0/3] oelint.bbclass: make oelint bbclass work Chong Lu 2014-08-01 7:15 ` [PATCH 1/3] " Chong Lu @ 2014-08-01 7:15 ` Chong Lu 2014-08-01 7:15 ` [PATCH 3/3] oelint.bbclass: Check for ${PN} or ${P} usage Chong Lu 2 siblings, 0 replies; 6+ messages in thread From: Chong Lu @ 2014-08-01 7:15 UTC (permalink / raw) To: openembedded-core Check that all patches have Signed-off-by and Upstream-Status. [YOCTO #5427] Signed-off-by: Chong Lu <Chong.Lu@windriver.com> --- meta/classes/oelint.bbclass | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/meta/classes/oelint.bbclass b/meta/classes/oelint.bbclass index 1c6f4b8..0bed74a 100644 --- a/meta/classes/oelint.bbclass +++ b/meta/classes/oelint.bbclass @@ -27,4 +27,39 @@ python do_lint() { bb.warn("${PN}: SECTION is not set") elif not s.islower(): bb.warn("${PN}: SECTION should only use lower case") + + + ############################## + # Check that all patches have Signed-off-by and Upstream-Status + # + s = d.getVar("SRC_URI").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 + + length = len("file://") + for item in s: + 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("${PN}: %s doesn't have Signed-off-by" % item) + if findKey(path, "Upstream-Status"): + bb.warn("${PN}: %s doesn't have Upstream-Status" % item) } -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] oelint.bbclass: Check for ${PN} or ${P} usage 2014-08-01 7:15 [PATCH 0/3] oelint.bbclass: make oelint bbclass work Chong Lu 2014-08-01 7:15 ` [PATCH 1/3] " Chong Lu 2014-08-01 7:15 ` [PATCH 2/3] oelint.bbclass: add patch checking Chong Lu @ 2014-08-01 7:15 ` Chong Lu 2014-08-01 7:37 ` Robert P. J. Day 2 siblings, 1 reply; 6+ messages in thread From: Chong Lu @ 2014-08-01 7:15 UTC (permalink / raw) To: openembedded-core Check for ${PN} or ${P} usage in SRC_URI or S. We should use ${BPN} or ${BP} instead to avoid breaking multilib. [YOCTO #5427] Signed-off-by: Chong Lu <Chong.Lu@windriver.com> --- meta/classes/oelint.bbclass | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/meta/classes/oelint.bbclass b/meta/classes/oelint.bbclass index 0bed74a..685a88d 100644 --- a/meta/classes/oelint.bbclass +++ b/meta/classes/oelint.bbclass @@ -62,4 +62,24 @@ python do_lint() { bb.warn("${PN}: %s doesn't have Signed-off-by" % item) if findKey(path, "Upstream-Status"): bb.warn("${PN}: %s doesn't have Upstream-Status" % item) + + + ############################## + # Check for ${PN} or ${P} usage in SRC_URI or S + # Should use ${BPN} or ${BP} instead to avoid breaking multilib + # + s = d.getVar("SRC_URI").split() + + for srcurl in s: + if not srcurl.startswith("file://"): + if not srcurl.find("{PN}") == -1: + bb.warn("${PN}: Should use BPN instead to PN in SRC_URI") + if not srcurl.find("{P}") == -1: + bb.warn("${PN}: Should use BP instead to P in SRC_URI") + + srcpath = d.getVar("S") + if not srcpath.find("{PN}") == -1: + bb.warn("${PN}: Should use BPN instead to PN in S") + if not srcpath.find("{P}") == -1: + bb.warn("${PN}: Should use BP instead to P in S") } -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] oelint.bbclass: Check for ${PN} or ${P} usage 2014-08-01 7:15 ` [PATCH 3/3] oelint.bbclass: Check for ${PN} or ${P} usage Chong Lu @ 2014-08-01 7:37 ` Robert P. J. Day 2014-08-01 7:57 ` Chong Lu 0 siblings, 1 reply; 6+ messages in thread From: Robert P. J. Day @ 2014-08-01 7:37 UTC (permalink / raw) To: Chong Lu; +Cc: openembedded-core On Fri, 1 Aug 2014, Chong Lu wrote: > Check for ${PN} or ${P} usage in SRC_URI or S. > We should use ${BPN} or ${BP} instead to avoid breaking multilib. > > [YOCTO #5427] > > Signed-off-by: Chong Lu <Chong.Lu@windriver.com> > --- > meta/classes/oelint.bbclass | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/meta/classes/oelint.bbclass b/meta/classes/oelint.bbclass > index 0bed74a..685a88d 100644 > --- a/meta/classes/oelint.bbclass > +++ b/meta/classes/oelint.bbclass > @@ -62,4 +62,24 @@ python do_lint() { > bb.warn("${PN}: %s doesn't have Signed-off-by" % item) > if findKey(path, "Upstream-Status"): > bb.warn("${PN}: %s doesn't have Upstream-Status" % item) > + > + > + ############################## > + # Check for ${PN} or ${P} usage in SRC_URI or S > + # Should use ${BPN} or ${BP} instead to avoid breaking multilib > + # > + s = d.getVar("SRC_URI").split() > + > + for srcurl in s: > + if not srcurl.startswith("file://"): > + if not srcurl.find("{PN}") == -1: > + bb.warn("${PN}: Should use BPN instead to PN in SRC_URI") > + if not srcurl.find("{P}") == -1: should you not say, "use BPN instead of PN ..."? rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ======================================================================== ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] oelint.bbclass: Check for ${PN} or ${P} usage 2014-08-01 7:37 ` Robert P. J. Day @ 2014-08-01 7:57 ` Chong Lu 0 siblings, 0 replies; 6+ messages in thread From: Chong Lu @ 2014-08-01 7:57 UTC (permalink / raw) To: Robert P. J. Day; +Cc: openembedded-core On 08/01/2014 03:37 PM, Robert P. J. Day wrote: > On Fri, 1 Aug 2014, Chong Lu wrote: > >> Check for ${PN} or ${P} usage in SRC_URI or S. >> We should use ${BPN} or ${BP} instead to avoid breaking multilib. >> >> [YOCTO #5427] >> >> Signed-off-by: Chong Lu <Chong.Lu@windriver.com> >> --- >> meta/classes/oelint.bbclass | 20 ++++++++++++++++++++ >> 1 file changed, 20 insertions(+) >> >> diff --git a/meta/classes/oelint.bbclass b/meta/classes/oelint.bbclass >> index 0bed74a..685a88d 100644 >> --- a/meta/classes/oelint.bbclass >> +++ b/meta/classes/oelint.bbclass >> @@ -62,4 +62,24 @@ python do_lint() { >> bb.warn("${PN}: %s doesn't have Signed-off-by" % item) >> if findKey(path, "Upstream-Status"): >> bb.warn("${PN}: %s doesn't have Upstream-Status" % item) >> + >> + >> + ############################## >> + # Check for ${PN} or ${P} usage in SRC_URI or S >> + # Should use ${BPN} or ${BP} instead to avoid breaking multilib >> + # >> + s = d.getVar("SRC_URI").split() >> + >> + for srcurl in s: >> + if not srcurl.startswith("file://"): >> + if not srcurl.find("{PN}") == -1: >> + bb.warn("${PN}: Should use BPN instead to PN in SRC_URI") >> + if not srcurl.find("{P}") == -1: > should you not say, "use BPN instead of PN ..."? > > rday OK, thanks. I will change this and resend a V2. Best Regards Chong ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-08-01 7:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-01 7:15 [PATCH 0/3] oelint.bbclass: make oelint bbclass work Chong Lu
2014-08-01 7:15 ` [PATCH 1/3] " Chong Lu
2014-08-01 7:15 ` [PATCH 2/3] oelint.bbclass: add patch checking Chong Lu
2014-08-01 7:15 ` [PATCH 3/3] oelint.bbclass: Check for ${PN} or ${P} usage Chong Lu
2014-08-01 7:37 ` Robert P. J. Day
2014-08-01 7:57 ` Chong Lu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox