Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/2] recipetool fixes
@ 2020-07-11  3:23 Tim Orling
  0 siblings, 0 replies; 4+ messages in thread
From: Tim Orling @ 2020-07-11  3:23 UTC (permalink / raw)
  To: openembedded-core

From: Tim Orling <timothy.t.orling@linux.intel.com>

During development of a perl module recipetool plugin, some issues with
the existing codebase were uncovered:
(1) It is _impossible_ to add "AUTHOR" in the appropriate location
(2) Several regex patterns are not prepended with r'

The following changes since commit b3c96103a5063eeefb0c537227eab3f77616b9c0:

  libnl: Extend for native/nativesdk (2020-07-08 10:56:11 +0100)

are available in the Git repository at:

  git://git.openembedded.org/openembedded-core-contrib timo/oe-recipetool-fixes
  http://cgit.openembedded.org/openembedded-core-contrib/log/?h=timo/oe-recipetool-fixes

Tim Orling (2):
  lib/oe/recipeutils.py: add AUTHOR; BBCLASSEXTEND
  scripts/lib/recipetool/create.py: fix regex strings

 meta/lib/oe/recipeutils.py       |  2 +-
 scripts/lib/recipetool/create.py | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.25.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 0/2] recipetool fixes
@ 2020-07-11  3:48 Tim Orling
  2020-07-11  3:48 ` [PATCH 1/2] lib/oe/recipeutils.py: add AUTHOR; BBCLASSEXTEND Tim Orling
  2020-07-11  3:48 ` [PATCH 2/2] scripts/lib/recipetool/create.py: fix regex strings Tim Orling
  0 siblings, 2 replies; 4+ messages in thread
From: Tim Orling @ 2020-07-11  3:48 UTC (permalink / raw)
  To: openembedded-core

There are some issues with the existing recipetool codebase:
(1) It is _impossible_ to insert the AUTHOR variable in the recommended
    location [1]. And the BBCLASSEXTEND variable is also missing from
    the list (although inserting that in the recommended location is
    trivial).
(2) Several regex patterns are missing the r' prefix, which leads tools
    like pylint/autopep8 to throw warnings because the regex patterns...
    are not identified as regex patterns.

[1] http://www.openembedded.org/wiki/Styleguide

The following changes since commit b3c96103a5063eeefb0c537227eab3f77616b9c0:

  libnl: Extend for native/nativesdk (2020-07-08 10:56:11 +0100)

are available in the Git repository at:

  git://git.openembedded.org/openembedded-core-contrib timo/oe-recipetool-fixes
  http://cgit.openembedded.org/openembedded-core-contrib/log/?h=timo/oe-recipetool-fixes

Tim Orling (2):
  lib/oe/recipeutils.py: add AUTHOR; BBCLASSEXTEND
  scripts/lib/recipetool/create.py: fix regex strings

 meta/lib/oe/recipeutils.py       |  2 +-
 scripts/lib/recipetool/create.py | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.24.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] lib/oe/recipeutils.py: add AUTHOR; BBCLASSEXTEND
  2020-07-11  3:48 [PATCH 0/2] recipetool fixes Tim Orling
@ 2020-07-11  3:48 ` Tim Orling
  2020-07-11  3:48 ` [PATCH 2/2] scripts/lib/recipetool/create.py: fix regex strings Tim Orling
  1 sibling, 0 replies; 4+ messages in thread
From: Tim Orling @ 2020-07-11  3:48 UTC (permalink / raw)
  To: openembedded-core

If you try to create a plugin for recipetool that
adds the AUTHOR field, it is impossible to put it
in the recommended position [1] without adding to the
recipe_progression variable.

While we are at it, also add BBCLASSEXTEND at the
end, as also recommended by [1].

[1] http://www.openembedded.org/wiki/Styleguide

Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com>
---
 meta/lib/oe/recipeutils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
index 29473a98825..36427eec918 100644
--- a/meta/lib/oe/recipeutils.py
+++ b/meta/lib/oe/recipeutils.py
@@ -24,7 +24,7 @@ from collections import OrderedDict, defaultdict
 from bb.utils import vercmp_string
 
 # Help us to find places to insert values
-recipe_progression = ['SUMMARY', 'DESCRIPTION', 'HOMEPAGE', 'BUGTRACKER', 'SECTION', 'LICENSE', 'LICENSE_FLAGS', 'LIC_FILES_CHKSUM', 'PROVIDES', 'DEPENDS', 'PR', 'PV', 'SRCREV', 'SRCPV', 'SRC_URI', 'S', 'do_fetch()', 'do_unpack()', 'do_patch()', 'EXTRA_OECONF', 'EXTRA_OECMAKE', 'EXTRA_OESCONS', 'do_configure()', 'EXTRA_OEMAKE', 'do_compile()', 'do_install()', 'do_populate_sysroot()', 'INITSCRIPT', 'USERADD', 'GROUPADD', 'PACKAGES', 'FILES', 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RPROVIDES', 'RREPLACES', 'RCONFLICTS', 'ALLOW_EMPTY', 'populate_packages()', 'do_package()', 'do_deploy()']
+recipe_progression = ['SUMMARY', 'DESCRIPTION', 'AUTHOR', 'HOMEPAGE', 'BUGTRACKER', 'SECTION', 'LICENSE', 'LICENSE_FLAGS', 'LIC_FILES_CHKSUM', 'PROVIDES', 'DEPENDS', 'PR', 'PV', 'SRCREV', 'SRCPV', 'SRC_URI', 'S', 'do_fetch()', 'do_unpack()', 'do_patch()', 'EXTRA_OECONF', 'EXTRA_OECMAKE', 'EXTRA_OESCONS', 'do_configure()', 'EXTRA_OEMAKE', 'do_compile()', 'do_install()', 'do_populate_sysroot()', 'INITSCRIPT', 'USERADD', 'GROUPADD', 'PACKAGES', 'FILES', 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RPROVIDES', 'RREPLACES', 'RCONFLICTS', 'ALLOW_EMPTY', 'populate_packages()', 'do_package()', 'do_deploy()', 'BBCLASSEXTEND']
 # Variables that sometimes are a bit long but shouldn't be wrapped
 nowrap_vars = ['SUMMARY', 'HOMEPAGE', 'BUGTRACKER', r'SRC_URI\[(.+\.)?md5sum\]', r'SRC_URI\[(.+\.)?sha256sum\]']
 list_vars = ['SRC_URI', 'LIC_FILES_CHKSUM']
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] scripts/lib/recipetool/create.py: fix regex strings
  2020-07-11  3:48 [PATCH 0/2] recipetool fixes Tim Orling
  2020-07-11  3:48 ` [PATCH 1/2] lib/oe/recipeutils.py: add AUTHOR; BBCLASSEXTEND Tim Orling
@ 2020-07-11  3:48 ` Tim Orling
  1 sibling, 0 replies; 4+ messages in thread
From: Tim Orling @ 2020-07-11  3:48 UTC (permalink / raw)
  To: openembedded-core

Python now expects regex strings to be prepended with r.
Silence pylint/autopep8 and similar warnings by identifying
these regex patterns as... regex patterns.

Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com>
---
 scripts/lib/recipetool/create.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 8d78c5b6f99..566c75369a9 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -66,7 +66,7 @@ class RecipeHandler(object):
         libdir = d.getVar('libdir')
         base_libdir = d.getVar('base_libdir')
         libpaths = list(set([base_libdir, libdir]))
-        libname_re = re.compile('^lib(.+)\.so.*$')
+        libname_re = re.compile(r'^lib(.+)\.so.*$')
         pkglibmap = {}
         for lib, item in shlib_providers.items():
             for path, pkg in item.items():
@@ -428,7 +428,7 @@ def create_recipe(args):
 
     if scriptutils.is_src_url(source):
         # Warn about github archive URLs
-        if re.match('https?://github.com/[^/]+/[^/]+/archive/.+(\.tar\..*|\.zip)$', source):
+        if re.match(r'https?://github.com/[^/]+/[^/]+/archive/.+(\.tar\..*|\.zip)$', source):
             logger.warning('github archive files are not guaranteed to be stable and may be re-generated over time. If the latter occurs, the checksums will likely change and the recipe will fail at do_fetch. It is recommended that you point to an actual commit or tag in the repository instead (using the repository URL in conjunction with the -S/--srcrev option).')
         # Fetch a URL
         fetchuri = reformat_git_uri(urldefrag(source)[0])
@@ -830,7 +830,7 @@ def create_recipe(args):
         elif line.startswith('PV = '):
             if realpv:
                 # Replace the first part of the PV value
-                line = re.sub('"[^+]*\+', '"%s+' % realpv, line)
+                line = re.sub(r'"[^+]*\+', '"%s+' % realpv, line)
         lines_before.append(line)
 
     if args.also_native:
@@ -1066,8 +1066,8 @@ def crunch_license(licfile):
     import oe.utils
 
     # Note: these are carefully constructed!
-    license_title_re = re.compile('^\(?(#+ *)?(The )?.{1,10} [Ll]icen[sc]e( \(.{1,10}\))?\)?:?$')
-    license_statement_re = re.compile('^(This (project|software) is( free software)? (released|licen[sc]ed)|(Released|Licen[cs]ed)) under the .{1,10} [Ll]icen[sc]e:?$')
+    license_title_re = re.compile(r'^\(?(#+ *)?(The )?.{1,10} [Ll]icen[sc]e( \(.{1,10}\))?\)?:?$')
+    license_statement_re = re.compile(r'^(This (project|software) is( free software)? (released|licen[sc]ed)|(Released|Licen[cs]ed)) under the .{1,10} [Ll]icen[sc]e:?$')
     copyright_re = re.compile('^(#+)? *Copyright .*$')
 
     crunched_md5sums = {}
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-11  3:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-11  3:48 [PATCH 0/2] recipetool fixes Tim Orling
2020-07-11  3:48 ` [PATCH 1/2] lib/oe/recipeutils.py: add AUTHOR; BBCLASSEXTEND Tim Orling
2020-07-11  3:48 ` [PATCH 2/2] scripts/lib/recipetool/create.py: fix regex strings Tim Orling
  -- strict thread matches above, loose matches on Subject: below --
2020-07-11  3:23 [PATCH 0/2] recipetool fixes Tim Orling

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox