summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oeqa/selftest/cases/devtool.py4
-rw-r--r--meta/lib/oeqa/selftest/cases/recipetool.py112
2 files changed, 85 insertions, 31 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index 2a11886e4b..21e2268689 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -543,7 +543,7 @@ class DevtoolAddTests(DevtoolBase):
543 self.track_for_cleanup(self.workspacedir) 543 self.track_for_cleanup(self.workspacedir)
544 self.add_command_to_tearDown('bitbake -c cleansstate %s' % testrecipe) 544 self.add_command_to_tearDown('bitbake -c cleansstate %s' % testrecipe)
545 self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') 545 self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
546 result = runCmd('devtool add %s %s -f %s' % (testrecipe, srcdir, url)) 546 result = runCmd('devtool add --no-pypi %s %s -f %s' % (testrecipe, srcdir, url))
547 self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created. %s' % result.output) 547 self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created. %s' % result.output)
548 self.assertTrue(os.path.isfile(os.path.join(srcdir, 'setup.py')), 'Unable to find setup.py in source directory') 548 self.assertTrue(os.path.isfile(os.path.join(srcdir, 'setup.py')), 'Unable to find setup.py in source directory')
549 self.assertTrue(os.path.isdir(os.path.join(srcdir, '.git')), 'git repository for external source tree was not created') 549 self.assertTrue(os.path.isdir(os.path.join(srcdir, '.git')), 'git repository for external source tree was not created')
@@ -562,7 +562,7 @@ class DevtoolAddTests(DevtoolBase):
562 result = runCmd('devtool reset -n %s' % testrecipe) 562 result = runCmd('devtool reset -n %s' % testrecipe)
563 shutil.rmtree(srcdir) 563 shutil.rmtree(srcdir)
564 fakever = '1.9' 564 fakever = '1.9'
565 result = runCmd('devtool add %s %s -f %s -V %s' % (testrecipe, srcdir, url, fakever)) 565 result = runCmd('devtool add --no-pypi %s %s -f %s -V %s' % (testrecipe, srcdir, url, fakever))
566 self.assertTrue(os.path.isfile(os.path.join(srcdir, 'setup.py')), 'Unable to find setup.py in source directory') 566 self.assertTrue(os.path.isfile(os.path.join(srcdir, 'setup.py')), 'Unable to find setup.py in source directory')
567 # Test devtool status 567 # Test devtool status
568 result = runCmd('devtool status') 568 result = runCmd('devtool status')
diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py
index 4bc28a4f2e..b59e53f599 100644
--- a/meta/lib/oeqa/selftest/cases/recipetool.py
+++ b/meta/lib/oeqa/selftest/cases/recipetool.py
@@ -457,13 +457,15 @@ class RecipetoolCreateTests(RecipetoolBase):
457 457
458 def test_recipetool_create_python3_setuptools(self): 458 def test_recipetool_create_python3_setuptools(self):
459 # Test creating python3 package from tarball (using setuptools3 class) 459 # Test creating python3 package from tarball (using setuptools3 class)
460 # Use the --no-pypi switch to avoid creating a pypi enabled recipe and
461 # and check the created recipe as if it was a more general tarball
460 temprecipe = os.path.join(self.tempdir, 'recipe') 462 temprecipe = os.path.join(self.tempdir, 'recipe')
461 os.makedirs(temprecipe) 463 os.makedirs(temprecipe)
462 pn = 'python-magic' 464 pn = 'python-magic'
463 pv = '0.4.15' 465 pv = '0.4.15'
464 recipefile = os.path.join(temprecipe, '%s_%s.bb' % (pn, pv)) 466 recipefile = os.path.join(temprecipe, '%s_%s.bb' % (pn, pv))
465 srcuri = 'https://files.pythonhosted.org/packages/84/30/80932401906eaf787f2e9bd86dc458f1d2e75b064b4c187341f29516945c/python-magic-%s.tar.gz' % pv 467 srcuri = 'https://files.pythonhosted.org/packages/84/30/80932401906eaf787f2e9bd86dc458f1d2e75b064b4c187341f29516945c/python-magic-%s.tar.gz' % pv
466 result = runCmd('recipetool create -o %s %s' % (temprecipe, srcuri)) 468 result = runCmd('recipetool create --no-pypi -o %s %s' % (temprecipe, srcuri))
467 self.assertTrue(os.path.isfile(recipefile)) 469 self.assertTrue(os.path.isfile(recipefile))
468 checkvars = {} 470 checkvars = {}
469 checkvars['LICENSE'] = set(['MIT']) 471 checkvars['LICENSE'] = set(['MIT'])
@@ -474,6 +476,82 @@ class RecipetoolCreateTests(RecipetoolBase):
474 inherits = ['setuptools3'] 476 inherits = ['setuptools3']
475 self._test_recipe_contents(recipefile, checkvars, inherits) 477 self._test_recipe_contents(recipefile, checkvars, inherits)
476 478
479 def test_recipetool_create_python3_setuptools_pypi_tarball(self):
480 # Test creating python3 package from tarball (using setuptools3 and pypi classes)
481 temprecipe = os.path.join(self.tempdir, 'recipe')
482 os.makedirs(temprecipe)
483 pn = 'python-magic'
484 pv = '0.4.15'
485 recipefile = os.path.join(temprecipe, '%s_%s.bb' % (pn, pv))
486 srcuri = 'https://files.pythonhosted.org/packages/84/30/80932401906eaf787f2e9bd86dc458f1d2e75b064b4c187341f29516945c/python-magic-%s.tar.gz' % pv
487 result = runCmd('recipetool create -o %s %s' % (temprecipe, srcuri))
488 self.assertTrue(os.path.isfile(recipefile))
489 checkvars = {}
490 checkvars['LICENSE'] = set(['MIT'])
491 checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=16a934f165e8c3245f241e77d401bb88'
492 checkvars['PYPI_PACKAGE'] = pn
493 inherits = ['setuptools3', 'pypi']
494 self._test_recipe_contents(recipefile, checkvars, inherits)
495
496 def test_recipetool_create_python3_setuptools_pypi(self):
497 # Test creating python3 package from pypi url (using setuptools3 and pypi classes)
498 # Intentionnaly using setuptools3 class here instead of any of the pep517 class
499 # to avoid the toml dependency and allows this test to run on host autobuilders
500 # with older version of python
501 temprecipe = os.path.join(self.tempdir, 'recipe')
502 os.makedirs(temprecipe)
503 pn = 'python-magic'
504 pv = '0.4.15'
505 recipefile = os.path.join(temprecipe, '%s_%s.bb' % (pn, pv))
506 # First specify the required version in the url
507 srcuri = 'https://pypi.org/project/%s/%s' % (pn, pv)
508 runCmd('recipetool create -o %s %s' % (temprecipe, srcuri))
509 self.assertTrue(os.path.isfile(recipefile))
510 checkvars = {}
511 checkvars['LICENSE'] = set(['MIT'])
512 checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=16a934f165e8c3245f241e77d401bb88'
513 checkvars['PYPI_PACKAGE'] = pn
514 inherits = ['setuptools3', "pypi"]
515 self._test_recipe_contents(recipefile, checkvars, inherits)
516
517 # Now specify the version as a recipetool parameter
518 runCmd('rm -rf %s' % recipefile)
519 self.assertFalse(os.path.isfile(recipefile))
520 srcuri = 'https://pypi.org/project/%s' % pn
521 runCmd('recipetool create -o %s %s --version %s' % (temprecipe, srcuri, pv))
522 self.assertTrue(os.path.isfile(recipefile))
523 checkvars = {}
524 checkvars['LICENSE'] = set(['MIT'])
525 checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=16a934f165e8c3245f241e77d401bb88'
526 checkvars['PYPI_PACKAGE'] = pn
527 inherits = ['setuptools3', "pypi"]
528 self._test_recipe_contents(recipefile, checkvars, inherits)
529
530 # Now, try to grab latest version of the package, so we cannot guess the name of the recipe,
531 # unless hardcoding the latest version but it means we will need to update the test for each release,
532 # so use a regexp
533 runCmd('rm -rf %s' % recipefile)
534 self.assertFalse(os.path.isfile(recipefile))
535 recipefile_re = r'%s_(.*)\.bb' % pn
536 result = runCmd('recipetool create -o %s %s' % (temprecipe, srcuri))
537 dirlist = os.listdir(temprecipe)
538 if len(dirlist) > 1:
539 self.fail('recipetool created more than just one file; output:\n%s\ndirlist:\n%s' % (result.output, str(dirlist)))
540 if len(dirlist) < 1 or not os.path.isfile(os.path.join(temprecipe, dirlist[0])):
541 self.fail('recipetool did not create recipe file; output:\n%s\ndirlist:\n%s' % (result.output, str(dirlist)))
542 import re
543 match = re.match(recipefile_re, dirlist[0])
544 self.assertTrue(match)
545 latest_pv = match.group(1)
546 self.assertTrue(latest_pv != pv)
547 recipefile = os.path.join(temprecipe, '%s_%s.bb' % (pn, latest_pv))
548 # Do not check LIC_FILES_CHKSUM here to avoid having updating the test on each release
549 checkvars = {}
550 checkvars['LICENSE'] = set(['MIT'])
551 checkvars['PYPI_PACKAGE'] = pn
552 inherits = ['setuptools3', "pypi"]
553 self._test_recipe_contents(recipefile, checkvars, inherits)
554
477 def test_recipetool_create_python3_pep517_setuptools_build_meta(self): 555 def test_recipetool_create_python3_pep517_setuptools_build_meta(self):
478 # This test require python 3.11 or above for the tomllib module 556 # This test require python 3.11 or above for the tomllib module
479 # or tomli module to be installed 557 # or tomli module to be installed
@@ -498,13 +576,7 @@ class RecipetoolCreateTests(RecipetoolBase):
498 checkvars['SUMMARY'] = 'A library for working with the color formats defined by HTML and CSS.' 576 checkvars['SUMMARY'] = 'A library for working with the color formats defined by HTML and CSS.'
499 checkvars['LICENSE'] = set(['BSD-3-Clause']) 577 checkvars['LICENSE'] = set(['BSD-3-Clause'])
500 checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=702b1ef12cf66832a88f24c8f2ee9c19' 578 checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=702b1ef12cf66832a88f24c8f2ee9c19'
501 checkvars['SRC_URI'] = 'https://files.pythonhosted.org/packages/a1/fb/f95560c6a5d4469d9c49e24cf1b5d4d21ffab5608251c6020a965fb7791c/webcolors-${PV}.tar.gz' 579 inherits = ['python_setuptools_build_meta', 'pypi']
502 checkvars['SRC_URI[md5sum]'] = 'c9be30c5b0cf1cad32e4cbacbb2229e9'
503 checkvars['SRC_URI[sha1sum]'] = 'c90b84fb65eed9b4c9dea7f08c657bfac0e820a5'
504 checkvars['SRC_URI[sha256sum]'] = 'c225b674c83fa923be93d235330ce0300373d02885cef23238813b0d5668304a'
505 checkvars['SRC_URI[sha384sum]'] = '45652af349660f19f68d01361dd5bda287789e5ea63608f52a8cea526ac04465614db2ea236103fb8456b1fcaea96ed7'
506 checkvars['SRC_URI[sha512sum]'] = '074aaf135ac6b0025b88b731d1d6dfa4c539b4fff7195658cc58a4326bb9f0449a231685d312b4a1ec48ca535a838bfa5c680787fe0e61473a2a092c448937d0'
507 inherits = ['python_setuptools_build_meta']
508 580
509 self._test_recipe_contents(recipefile, checkvars, inherits) 581 self._test_recipe_contents(recipefile, checkvars, inherits)
510 582
@@ -532,13 +604,7 @@ class RecipetoolCreateTests(RecipetoolBase):
532 checkvars['SUMMARY'] = 'Simple module to parse ISO 8601 dates' 604 checkvars['SUMMARY'] = 'Simple module to parse ISO 8601 dates'
533 checkvars['LICENSE'] = set(['MIT']) 605 checkvars['LICENSE'] = set(['MIT'])
534 checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=aab31f2ef7ba214a5a341eaa47a7f367' 606 checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=aab31f2ef7ba214a5a341eaa47a7f367'
535 checkvars['SRC_URI'] = 'https://files.pythonhosted.org/packages/b9/f3/ef59cee614d5e0accf6fd0cbba025b93b272e626ca89fb70a3e9187c5d15/iso8601-${PV}.tar.gz' 607 inherits = ['python_poetry_core', 'pypi']
536 checkvars['SRC_URI[md5sum]'] = '6e33910eba87066b3be7fcf3d59d16b5'
537 checkvars['SRC_URI[sha1sum]'] = 'efd225b2c9fa7d9e4a1ec6ad94f3295cee982e61'
538 checkvars['SRC_URI[sha256sum]'] = '6b1d3829ee8921c4301998c909f7829fa9ed3cbdac0d3b16af2d743aed1ba8df'
539 checkvars['SRC_URI[sha384sum]'] = '255002433fe65c19adfd6b91494271b613cb25ef6a35ac77436de1e03d60cc07bf89fd716451b917f1435e4384860ef6'
540 checkvars['SRC_URI[sha512sum]'] = 'db57ab2a25ef91e3bc479c8539d27e853cf1fbf60986820b8999ae15d7e566425a1e0cfba47d0f3b23aa703db0576db368e6c110ba2a2f46c9a34e8ee3611fb7'
541 inherits = ['python_poetry_core']
542 608
543 self._test_recipe_contents(recipefile, checkvars, inherits) 609 self._test_recipe_contents(recipefile, checkvars, inherits)
544 610
@@ -566,13 +632,7 @@ class RecipetoolCreateTests(RecipetoolBase):
566 checkvars['SUMMARY'] = 'Backported and Experimental Type Hints for Python 3.8+' 632 checkvars['SUMMARY'] = 'Backported and Experimental Type Hints for Python 3.8+'
567 checkvars['LICENSE'] = set(['PSF-2.0']) 633 checkvars['LICENSE'] = set(['PSF-2.0'])
568 checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=fcf6b249c2641540219a727f35d8d2c2' 634 checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=fcf6b249c2641540219a727f35d8d2c2'
569 checkvars['SRC_URI'] = 'https://files.pythonhosted.org/packages/1f/7a/8b94bb016069caa12fc9f587b28080ac33b4fbb8ca369b98bc0a4828543e/typing_extensions-${PV}.tar.gz' 635 inherits = ['python_flit_core', 'pypi']
570 checkvars['SRC_URI[md5sum]'] = '74bafe841fbd1c27324afdeb099babdf'
571 checkvars['SRC_URI[sha1sum]'] = 'f8bed69cbad4a57a1a67bf8a31b62b657b47f7a3'
572 checkvars['SRC_URI[sha256sum]'] = 'df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef'
573 checkvars['SRC_URI[sha384sum]'] = '0bd0112234134d965c6884f3c1f95d27b6ae49cfb08108101158e31dff33c2dce729331628b69818850f1acb68f6c8d0'
574 checkvars['SRC_URI[sha512sum]'] = '5fbff10e085fbf3ac2e35d08d913608d8c8bca66903435ede91cdc7776d775689a53d64f5f0615fe687c6c228ac854c8651d99eb1cb96ec61c56b7ca01fdd440'
575 inherits = ['python_flit_core']
576 636
577 self._test_recipe_contents(recipefile, checkvars, inherits) 637 self._test_recipe_contents(recipefile, checkvars, inherits)
578 638
@@ -601,13 +661,7 @@ class RecipetoolCreateTests(RecipetoolBase):
601 checkvars['HOMEPAGE'] = 'https://github.com/python-jsonschema/jsonschema' 661 checkvars['HOMEPAGE'] = 'https://github.com/python-jsonschema/jsonschema'
602 checkvars['LICENSE'] = set(['MIT']) 662 checkvars['LICENSE'] = set(['MIT'])
603 checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7a60a81c146ec25599a3e1dabb8610a8 file://json/LICENSE;md5=9d4de43111d33570c8fe49b4cb0e01af' 663 checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=7a60a81c146ec25599a3e1dabb8610a8 file://json/LICENSE;md5=9d4de43111d33570c8fe49b4cb0e01af'
604 checkvars['SRC_URI'] = 'https://files.pythonhosted.org/packages/e4/43/087b24516db11722c8687e0caf0f66c7785c0b1c51b0ab951dfde924e3f5/jsonschema-${PV}.tar.gz' 664 inherits = ['python_hatchling', 'pypi']
605 checkvars['SRC_URI[md5sum]'] = '4d6667ce76f820c35082c2d60a4896ab'
606 checkvars['SRC_URI[sha1sum]'] = '9173714cb88964d07f3a3f4fcaaef638b8ceac0c'
607 checkvars['SRC_URI[sha256sum]'] = 'ec84cc37cfa703ef7cd4928db24f9cb31428a5d0fa77747b8b51a847458e0bbf'
608 checkvars['SRC_URI[sha384sum]'] = '7a53181f0e679aa3dc3eb4d05a420877b7b9bff2d02e81f5c289a37ed1127d6c0cca1f5a5f9e4e166f089ab36bcc2be9'
609 checkvars['SRC_URI[sha512sum]'] = '60fa769faf6e3fc2c14eb9acd189c86e9d366b157230a5681d36552af0c159cb1ad33fd920668a36afdab98bc97253f91501704c5c07b5009fdaf9d29b52060d'
610 inherits = ['python_hatchling']
611 665
612 self._test_recipe_contents(recipefile, checkvars, inherits) 666 self._test_recipe_contents(recipefile, checkvars, inherits)
613 667