summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Roos <throos@amazon.de>2022-06-28 10:32:14 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-07-01 11:31:42 +0100
commit603652a38e7b76fa93090c7eaaf2dc4e8f146f0e (patch)
tree441f759c0225824ee20ac66b26cddf71ae5d46c8
parent6958024ed2aa199e56851bf960c06dec1a3d81a1 (diff)
downloadpoky-603652a38e7b76fa93090c7eaaf2dc4e8f146f0e.tar.gz
recipetool/devtool: Fix python egg whitespace issues in PACKAGECONFIG
Substitute expressions or whitespace from python egg requires.txt when generating PACKAGECONFIG Pysetuptools sees the uvicorn.egg-info/requires.txt as extra requirements. Recipetool parses this information to generate the PACKAGECONFIG. These extra requirements contain expressions and whitespace, which are not allowed in PACKGAGECONFIG. This patch substitute them by hyphens to make PACKAGECONFIG parsable and readable. Also adding an oe-selftest for this. [YOCTO #14446] (From OE-Core rev: a854d95a79e64f3f82abfa4cc1daec750abf4249) Signed-off-by: Thomas Roos <throos@amazon.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/selftest/cases/devtool.py15
-rw-r--r--scripts/lib/recipetool/create_buildsys_python.py13
2 files changed, 27 insertions, 1 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index 3eea2b1a0e..ddf6c0c9f8 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -444,7 +444,7 @@ class DevtoolAddTests(DevtoolBase):
444 checkvars['S'] = '${WORKDIR}/MarkupSafe-%s' % testver 444 checkvars['S'] = '${WORKDIR}/MarkupSafe-%s' % testver
445 checkvars['SRC_URI'] = url 445 checkvars['SRC_URI'] = url
446 self._test_recipe_contents(recipefile, checkvars, []) 446 self._test_recipe_contents(recipefile, checkvars, [])
447 447
448 def test_devtool_add_fetch_git(self): 448 def test_devtool_add_fetch_git(self):
449 tempdir = tempfile.mkdtemp(prefix='devtoolqa') 449 tempdir = tempfile.mkdtemp(prefix='devtoolqa')
450 self.track_for_cleanup(tempdir) 450 self.track_for_cleanup(tempdir)
@@ -544,6 +544,19 @@ class DevtoolAddTests(DevtoolBase):
544 # Test devtool build 544 # Test devtool build
545 result = runCmd('devtool build %s' % pn) 545 result = runCmd('devtool build %s' % pn)
546 546
547 def test_devtool_add_python_egg_requires(self):
548 # Fetch source
549 tempdir = tempfile.mkdtemp(prefix='devtoolqa')
550 self.track_for_cleanup(tempdir)
551 testver = '0.14.0'
552 url = 'https://files.pythonhosted.org/packages/e9/9e/25d59f5043cf763833b2581c8027fa92342c4cf8ee523b498ecdf460c16d/uvicorn-%s.tar.gz' % testver
553 testrecipe = 'python3-uvicorn'
554 srcdir = os.path.join(tempdir, testrecipe)
555 # Test devtool add
556 self.track_for_cleanup(self.workspacedir)
557 self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
558 result = runCmd('devtool add %s %s -f %s' % (testrecipe, srcdir, url))
559
547class DevtoolModifyTests(DevtoolBase): 560class DevtoolModifyTests(DevtoolBase):
548 561
549 def test_devtool_modify(self): 562 def test_devtool_modify(self):
diff --git a/scripts/lib/recipetool/create_buildsys_python.py b/scripts/lib/recipetool/create_buildsys_python.py
index f4f51c88b4..5686a62d3f 100644
--- a/scripts/lib/recipetool/create_buildsys_python.py
+++ b/scripts/lib/recipetool/create_buildsys_python.py
@@ -209,6 +209,18 @@ class PythonRecipeHandler(RecipeHandler):
209 continue 209 continue
210 210
211 if line.startswith('['): 211 if line.startswith('['):
212 # PACKAGECONFIG must not contain expressions or whitespace
213 line = line.replace(" ", "")
214 line = line.replace(':', "")
215 line = line.replace('.', "-dot-")
216 line = line.replace('"', "")
217 line = line.replace('<', "-smaller-")
218 line = line.replace('>', "-bigger-")
219 line = line.replace('_', "-")
220 line = line.replace('(', "")
221 line = line.replace(')', "")
222 line = line.replace('!', "-not-")
223 line = line.replace('=', "-equals-")
212 current_feature = line[1:-1] 224 current_feature = line[1:-1]
213 elif current_feature: 225 elif current_feature:
214 extras_req[current_feature].append(line) 226 extras_req[current_feature].append(line)
@@ -297,6 +309,7 @@ class PythonRecipeHandler(RecipeHandler):
297 lines_after.append('# The following configs & dependencies are from setuptools extras_require.') 309 lines_after.append('# The following configs & dependencies are from setuptools extras_require.')
298 lines_after.append('# These dependencies are optional, hence can be controlled via PACKAGECONFIG.') 310 lines_after.append('# These dependencies are optional, hence can be controlled via PACKAGECONFIG.')
299 lines_after.append('# The upstream names may not correspond exactly to bitbake package names.') 311 lines_after.append('# The upstream names may not correspond exactly to bitbake package names.')
312 lines_after.append('# The configs are might not correct, since PACKAGECONFIG does not support expressions as may used in requires.txt - they are just replaced by text.')
300 lines_after.append('#') 313 lines_after.append('#')
301 lines_after.append('# Uncomment this line to enable all the optional features.') 314 lines_after.append('# Uncomment this line to enable all the optional features.')
302 lines_after.append('#PACKAGECONFIG ?= "{}"'.format(' '.join(k.lower() for k in extras_req))) 315 lines_after.append('#PACKAGECONFIG ?= "{}"'.format(' '.join(k.lower() for k in extras_req)))