diff options
Diffstat (limited to 'meta/lib')
| -rw-r--r-- | meta/lib/oe/patch.py | 21 | ||||
| -rw-r--r-- | meta/lib/oe/reproducible.py | 2 | ||||
| -rw-r--r-- | meta/lib/oe/sdk.py | 4 | ||||
| -rw-r--r-- | meta/lib/oeqa/runtime/cases/parselogs.py | 14 | ||||
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/bbtests.py | 31 | ||||
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/devtool.py | 5 | ||||
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/recipetool.py | 2 | ||||
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/reproducible.py | 10 | ||||
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/runtime_test.py | 7 |
9 files changed, 80 insertions, 16 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index fccbedb519..9034fcae03 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | import oe.path | 5 | import oe.path |
| 6 | import oe.types | 6 | import oe.types |
| 7 | import subprocess | ||
| 7 | 8 | ||
| 8 | class NotFoundError(bb.BBHandledException): | 9 | class NotFoundError(bb.BBHandledException): |
| 9 | def __init__(self, path): | 10 | def __init__(self, path): |
| @@ -25,7 +26,6 @@ class CmdError(bb.BBHandledException): | |||
| 25 | 26 | ||
| 26 | def runcmd(args, dir = None): | 27 | def runcmd(args, dir = None): |
| 27 | import pipes | 28 | import pipes |
| 28 | import subprocess | ||
| 29 | 29 | ||
| 30 | if dir: | 30 | if dir: |
| 31 | olddir = os.path.abspath(os.curdir) | 31 | olddir = os.path.abspath(os.curdir) |
| @@ -56,6 +56,7 @@ def runcmd(args, dir = None): | |||
| 56 | if dir: | 56 | if dir: |
| 57 | os.chdir(olddir) | 57 | os.chdir(olddir) |
| 58 | 58 | ||
| 59 | |||
| 59 | class PatchError(Exception): | 60 | class PatchError(Exception): |
| 60 | def __init__(self, msg): | 61 | def __init__(self, msg): |
| 61 | self.msg = msg | 62 | self.msg = msg |
| @@ -298,6 +299,24 @@ class GitApplyTree(PatchTree): | |||
| 298 | PatchTree.__init__(self, dir, d) | 299 | PatchTree.__init__(self, dir, d) |
| 299 | self.commituser = d.getVar('PATCH_GIT_USER_NAME') | 300 | self.commituser = d.getVar('PATCH_GIT_USER_NAME') |
| 300 | self.commitemail = d.getVar('PATCH_GIT_USER_EMAIL') | 301 | self.commitemail = d.getVar('PATCH_GIT_USER_EMAIL') |
| 302 | if not self._isInitialized(): | ||
| 303 | self._initRepo() | ||
| 304 | |||
| 305 | def _isInitialized(self): | ||
| 306 | cmd = "git rev-parse --show-toplevel" | ||
| 307 | try: | ||
| 308 | output = runcmd(cmd.split(), self.dir).strip() | ||
| 309 | except CmdError as err: | ||
| 310 | ## runcmd returned non-zero which most likely means 128 | ||
| 311 | ## Not a git directory | ||
| 312 | return False | ||
| 313 | ## Make sure repo is in builddir to not break top-level git repos | ||
| 314 | return os.path.samefile(output, self.dir) | ||
| 315 | |||
| 316 | def _initRepo(self): | ||
| 317 | runcmd("git init".split(), self.dir) | ||
| 318 | runcmd("git add .".split(), self.dir) | ||
| 319 | runcmd("git commit -a --allow-empty -m bitbake_patching_started".split(), self.dir) | ||
| 301 | 320 | ||
| 302 | @staticmethod | 321 | @staticmethod |
| 303 | def extractPatchHeader(patchfile): | 322 | def extractPatchHeader(patchfile): |
diff --git a/meta/lib/oe/reproducible.py b/meta/lib/oe/reproducible.py index 204b9bd734..0938e4cb39 100644 --- a/meta/lib/oe/reproducible.py +++ b/meta/lib/oe/reproducible.py | |||
| @@ -41,7 +41,7 @@ def find_git_folder(d, sourcedir): | |||
| 41 | for root, dirs, files in os.walk(workdir, topdown=True): | 41 | for root, dirs, files in os.walk(workdir, topdown=True): |
| 42 | dirs[:] = [d for d in dirs if d not in exclude] | 42 | dirs[:] = [d for d in dirs if d not in exclude] |
| 43 | if '.git' in dirs: | 43 | if '.git' in dirs: |
| 44 | return root | 44 | return os.path.join(root, ".git") |
| 45 | 45 | ||
| 46 | bb.warn("Failed to find a git repository in WORKDIR: %s" % workdir) | 46 | bb.warn("Failed to find a git repository in WORKDIR: %s" % workdir) |
| 47 | return None | 47 | return None |
diff --git a/meta/lib/oe/sdk.py b/meta/lib/oe/sdk.py index 37b59afd1a..27347667e8 100644 --- a/meta/lib/oe/sdk.py +++ b/meta/lib/oe/sdk.py | |||
| @@ -115,6 +115,10 @@ def sdk_list_installed_packages(d, target, rootfs_dir=None): | |||
| 115 | 115 | ||
| 116 | rootfs_dir = [sdk_output, os.path.join(sdk_output, target_path)][target is True] | 116 | rootfs_dir = [sdk_output, os.path.join(sdk_output, target_path)][target is True] |
| 117 | 117 | ||
| 118 | if target is False: | ||
| 119 | ipkgconf_sdk_target = d.getVar("IPKGCONF_SDK") | ||
| 120 | d.setVar("IPKGCONF_TARGET", ipkgconf_sdk_target) | ||
| 121 | |||
| 118 | img_type = d.getVar('IMAGE_PKGTYPE') | 122 | img_type = d.getVar('IMAGE_PKGTYPE') |
| 119 | import importlib | 123 | import importlib |
| 120 | cls = importlib.import_module('oe.package_manager.' + img_type) | 124 | cls = importlib.import_module('oe.package_manager.' + img_type) |
diff --git a/meta/lib/oeqa/runtime/cases/parselogs.py b/meta/lib/oeqa/runtime/cases/parselogs.py index 01b633d89e..c842f95c34 100644 --- a/meta/lib/oeqa/runtime/cases/parselogs.py +++ b/meta/lib/oeqa/runtime/cases/parselogs.py | |||
| @@ -302,7 +302,7 @@ class ParseLogsTest(OERuntimeTestCase): | |||
| 302 | grepcmd = 'grep ' | 302 | grepcmd = 'grep ' |
| 303 | grepcmd += '-Ei "' | 303 | grepcmd += '-Ei "' |
| 304 | for error in errors: | 304 | for error in errors: |
| 305 | grepcmd += '\<' + error + '\>' + '|' | 305 | grepcmd += r'\<' + error + r'\>' + '|' |
| 306 | grepcmd = grepcmd[:-1] | 306 | grepcmd = grepcmd[:-1] |
| 307 | grepcmd += '" ' + str(log) + " | grep -Eiv \'" | 307 | grepcmd += '" ' + str(log) + " | grep -Eiv \'" |
| 308 | 308 | ||
| @@ -313,13 +313,13 @@ class ParseLogsTest(OERuntimeTestCase): | |||
| 313 | errorlist = ignore_errors['default'] | 313 | errorlist = ignore_errors['default'] |
| 314 | 314 | ||
| 315 | for ignore_error in errorlist: | 315 | for ignore_error in errorlist: |
| 316 | ignore_error = ignore_error.replace('(', '\(') | 316 | ignore_error = ignore_error.replace('(', r'\(') |
| 317 | ignore_error = ignore_error.replace(')', '\)') | 317 | ignore_error = ignore_error.replace(')', r'\)') |
| 318 | ignore_error = ignore_error.replace("'", '.') | 318 | ignore_error = ignore_error.replace("'", '.') |
| 319 | ignore_error = ignore_error.replace('?', '\?') | 319 | ignore_error = ignore_error.replace('?', r'\?') |
| 320 | ignore_error = ignore_error.replace('[', '\[') | 320 | ignore_error = ignore_error.replace('[', r'\[') |
| 321 | ignore_error = ignore_error.replace(']', '\]') | 321 | ignore_error = ignore_error.replace(']', r'\]') |
| 322 | ignore_error = ignore_error.replace('*', '\*') | 322 | ignore_error = ignore_error.replace('*', r'\*') |
| 323 | ignore_error = ignore_error.replace('0-9', '[0-9]') | 323 | ignore_error = ignore_error.replace('0-9', '[0-9]') |
| 324 | grepcmd += ignore_error + '|' | 324 | grepcmd += ignore_error + '|' |
| 325 | grepcmd = grepcmd[:-1] | 325 | grepcmd = grepcmd[:-1] |
diff --git a/meta/lib/oeqa/selftest/cases/bbtests.py b/meta/lib/oeqa/selftest/cases/bbtests.py index b932d5276b..4187cb840a 100644 --- a/meta/lib/oeqa/selftest/cases/bbtests.py +++ b/meta/lib/oeqa/selftest/cases/bbtests.py | |||
| @@ -163,7 +163,7 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\" | |||
| 163 | """) | 163 | """) |
| 164 | self.track_for_cleanup(os.path.join(self.builddir, "download-selftest")) | 164 | self.track_for_cleanup(os.path.join(self.builddir, "download-selftest")) |
| 165 | 165 | ||
| 166 | data = 'SRC_URI = "${GNU_MIRROR}/aspell/aspell-${PV}.tar.gz;downloadfilename=test-aspell.tar.gz"' | 166 | data = 'SRC_URI = "https://downloads.yoctoproject.org/mirror/sources/aspell-${PV}.tar.gz;downloadfilename=test-aspell.tar.gz"' |
| 167 | self.write_recipeinc('aspell', data) | 167 | self.write_recipeinc('aspell', data) |
| 168 | result = bitbake('-f -c fetch aspell', ignore_status=True) | 168 | result = bitbake('-f -c fetch aspell', ignore_status=True) |
| 169 | self.delete_recipeinc('aspell') | 169 | self.delete_recipeinc('aspell') |
| @@ -300,3 +300,32 @@ INHERIT_remove = \"report-error\" | |||
| 300 | 300 | ||
| 301 | test_recipe_summary_after = get_bb_var('SUMMARY', test_recipe) | 301 | test_recipe_summary_after = get_bb_var('SUMMARY', test_recipe) |
| 302 | self.assertEqual(expected_recipe_summary, test_recipe_summary_after) | 302 | self.assertEqual(expected_recipe_summary, test_recipe_summary_after) |
| 303 | |||
| 304 | def test_git_patchtool(self): | ||
| 305 | """ PATCHTOOL=git should work with non-git sources like tarballs | ||
| 306 | test recipe for the test must NOT containt git:// repository in SRC_URI | ||
| 307 | """ | ||
| 308 | test_recipe = "man-db" | ||
| 309 | self.write_recipeinc(test_recipe, 'PATCHTOOL=\"git\"') | ||
| 310 | src = get_bb_var("SRC_URI",test_recipe) | ||
| 311 | gitscm = re.search("git://", src) | ||
| 312 | self.assertFalse(gitscm, "test_git_patchtool pre-condition failed: {} test recipe contains git repo!".format(test_recipe)) | ||
| 313 | result = bitbake('{} -c patch'.format(test_recipe), ignore_status=False) | ||
| 314 | fatal = re.search("fatal: not a git repository (or any of the parent directories)", result.output) | ||
| 315 | self.assertFalse(fatal, "Failed to patch using PATCHTOOL=\"git\"") | ||
| 316 | self.delete_recipeinc(test_recipe) | ||
| 317 | bitbake('-cclean {}'.format(test_recipe)) | ||
| 318 | |||
| 319 | def test_git_patchtool2(self): | ||
| 320 | """ Test if PATCHTOOL=git works with git repo and doesn't reinitialize it | ||
| 321 | """ | ||
| 322 | test_recipe = "gitrepotest" | ||
| 323 | src = get_bb_var("SRC_URI",test_recipe) | ||
| 324 | gitscm = re.search("git://", src) | ||
| 325 | self.assertTrue(gitscm, "test_git_patchtool pre-condition failed: {} test recipe doesn't contains git repo!".format(test_recipe)) | ||
| 326 | result = bitbake('{} -c patch'.format(test_recipe), ignore_status=False) | ||
| 327 | srcdir = get_bb_var('S', test_recipe) | ||
| 328 | result = runCmd("git log", cwd = srcdir) | ||
| 329 | self.assertFalse("bitbake_patching_started" in result.output, msg = "Repository has been reinitialized. {}".format(srcdir)) | ||
| 330 | self.delete_recipeinc(test_recipe) | ||
| 331 | bitbake('-cclean {}'.format(test_recipe)) | ||
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index 66e326253e..7ac1fcfbeb 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
| @@ -442,6 +442,7 @@ class DevtoolAddTests(DevtoolBase): | |||
| 442 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 442 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
| 443 | self.track_for_cleanup(tempdir) | 443 | self.track_for_cleanup(tempdir) |
| 444 | url = 'gitsm://git.yoctoproject.org/mraa' | 444 | url = 'gitsm://git.yoctoproject.org/mraa' |
| 445 | url_branch = '%s;branch=master' % url | ||
| 445 | checkrev = 'ae127b19a50aa54255e4330ccfdd9a5d058e581d' | 446 | checkrev = 'ae127b19a50aa54255e4330ccfdd9a5d058e581d' |
| 446 | testrecipe = 'mraa' | 447 | testrecipe = 'mraa' |
| 447 | srcdir = os.path.join(tempdir, testrecipe) | 448 | srcdir = os.path.join(tempdir, testrecipe) |
| @@ -462,7 +463,7 @@ class DevtoolAddTests(DevtoolBase): | |||
| 462 | checkvars = {} | 463 | checkvars = {} |
| 463 | checkvars['S'] = '${WORKDIR}/git' | 464 | checkvars['S'] = '${WORKDIR}/git' |
| 464 | checkvars['PV'] = '1.0+git${SRCPV}' | 465 | checkvars['PV'] = '1.0+git${SRCPV}' |
| 465 | checkvars['SRC_URI'] = url | 466 | checkvars['SRC_URI'] = url_branch |
| 466 | checkvars['SRCREV'] = '${AUTOREV}' | 467 | checkvars['SRCREV'] = '${AUTOREV}' |
| 467 | self._test_recipe_contents(recipefile, checkvars, []) | 468 | self._test_recipe_contents(recipefile, checkvars, []) |
| 468 | # Try with revision and version specified | 469 | # Try with revision and version specified |
| @@ -481,7 +482,7 @@ class DevtoolAddTests(DevtoolBase): | |||
| 481 | checkvars = {} | 482 | checkvars = {} |
| 482 | checkvars['S'] = '${WORKDIR}/git' | 483 | checkvars['S'] = '${WORKDIR}/git' |
| 483 | checkvars['PV'] = '1.5+git${SRCPV}' | 484 | checkvars['PV'] = '1.5+git${SRCPV}' |
| 484 | checkvars['SRC_URI'] = url | 485 | checkvars['SRC_URI'] = url_branch |
| 485 | checkvars['SRCREV'] = checkrev | 486 | checkvars['SRCREV'] = checkrev |
| 486 | self._test_recipe_contents(recipefile, checkvars, []) | 487 | self._test_recipe_contents(recipefile, checkvars, []) |
| 487 | 488 | ||
diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index 3621492998..4f283cdc03 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py | |||
| @@ -375,7 +375,7 @@ class RecipetoolTests(RecipetoolBase): | |||
| 375 | temprecipe = os.path.join(self.tempdir, 'recipe') | 375 | temprecipe = os.path.join(self.tempdir, 'recipe') |
| 376 | os.makedirs(temprecipe) | 376 | os.makedirs(temprecipe) |
| 377 | pv = '1.7.3.0' | 377 | pv = '1.7.3.0' |
| 378 | srcuri = 'http://www.dest-unreach.org/socat/download/socat-%s.tar.bz2' % pv | 378 | srcuri = 'http://www.dest-unreach.org/socat/download/Archive/socat-%s.tar.bz2' % pv |
| 379 | result = runCmd('recipetool create %s -o %s' % (srcuri, temprecipe)) | 379 | result = runCmd('recipetool create %s -o %s' % (srcuri, temprecipe)) |
| 380 | dirlist = os.listdir(temprecipe) | 380 | dirlist = os.listdir(temprecipe) |
| 381 | if len(dirlist) > 1: | 381 | if len(dirlist) > 1: |
diff --git a/meta/lib/oeqa/selftest/cases/reproducible.py b/meta/lib/oeqa/selftest/cases/reproducible.py index a62757399b..546dc91120 100644 --- a/meta/lib/oeqa/selftest/cases/reproducible.py +++ b/meta/lib/oeqa/selftest/cases/reproducible.py | |||
| @@ -114,8 +114,9 @@ def compare_file(reference, test, diffutils_sysroot): | |||
| 114 | result.status = SAME | 114 | result.status = SAME |
| 115 | return result | 115 | return result |
| 116 | 116 | ||
| 117 | def run_diffoscope(a_dir, b_dir, html_dir, **kwargs): | 117 | def run_diffoscope(a_dir, b_dir, html_dir, max_report_size=0, **kwargs): |
| 118 | return runCmd(['diffoscope', '--no-default-limits', '--exclude-directory-metadata', 'yes', '--html-dir', html_dir, a_dir, b_dir], | 118 | return runCmd(['diffoscope', '--no-default-limits', '--max-report-size', str(max_report_size), |
| 119 | '--exclude-directory-metadata', 'yes', '--html-dir', html_dir, a_dir, b_dir], | ||
| 119 | **kwargs) | 120 | **kwargs) |
| 120 | 121 | ||
| 121 | class DiffoscopeTests(OESelftestTestCase): | 122 | class DiffoscopeTests(OESelftestTestCase): |
| @@ -145,6 +146,9 @@ class ReproducibleTests(OESelftestTestCase): | |||
| 145 | 146 | ||
| 146 | package_classes = ['deb', 'ipk', 'rpm'] | 147 | package_classes = ['deb', 'ipk', 'rpm'] |
| 147 | 148 | ||
| 149 | # Maximum report size, in bytes | ||
| 150 | max_report_size = 250 * 1024 * 1024 | ||
| 151 | |||
| 148 | # targets are the things we want to test the reproducibility of | 152 | # targets are the things we want to test the reproducibility of |
| 149 | targets = ['core-image-minimal', 'core-image-sato', 'core-image-full-cmdline', 'core-image-weston', 'world'] | 153 | targets = ['core-image-minimal', 'core-image-sato', 'core-image-full-cmdline', 'core-image-weston', 'world'] |
| 150 | # sstate targets are things to pull from sstate to potentially cut build/debugging time | 154 | # sstate targets are things to pull from sstate to potentially cut build/debugging time |
| @@ -321,7 +325,7 @@ class ReproducibleTests(OESelftestTestCase): | |||
| 321 | # Copy jquery to improve the diffoscope output usability | 325 | # Copy jquery to improve the diffoscope output usability |
| 322 | self.copy_file(os.path.join(jquery_sysroot, 'usr/share/javascript/jquery/jquery.min.js'), os.path.join(package_html_dir, 'jquery.js')) | 326 | self.copy_file(os.path.join(jquery_sysroot, 'usr/share/javascript/jquery/jquery.min.js'), os.path.join(package_html_dir, 'jquery.js')) |
| 323 | 327 | ||
| 324 | run_diffoscope('reproducibleA', 'reproducibleB', package_html_dir, | 328 | run_diffoscope('reproducibleA', 'reproducibleB', package_html_dir, max_report_size=self.max_report_size, |
| 325 | native_sysroot=diffoscope_sysroot, ignore_status=True, cwd=package_dir) | 329 | native_sysroot=diffoscope_sysroot, ignore_status=True, cwd=package_dir) |
| 326 | 330 | ||
| 327 | if fails: | 331 | if fails: |
diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py index b20c5b427b..f9649339e5 100644 --- a/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/meta/lib/oeqa/selftest/cases/runtime_test.py | |||
| @@ -185,6 +185,10 @@ class TestImage(OESelftestTestCase): | |||
| 185 | self.skipTest('virgl isn\'t working with Debian 9') | 185 | self.skipTest('virgl isn\'t working with Debian 9') |
| 186 | if distro and distro == 'centos-7': | 186 | if distro and distro == 'centos-7': |
| 187 | self.skipTest('virgl isn\'t working with Centos 7') | 187 | self.skipTest('virgl isn\'t working with Centos 7') |
| 188 | if distro and distro == 'centos-8': | ||
| 189 | self.skipTest('virgl isn\'t working with Centos 8') | ||
| 190 | if distro and distro == 'fedora-34': | ||
| 191 | self.skipTest('virgl isn\'t working with Fedora 34') | ||
| 188 | if distro and distro == 'opensuseleap-15.0': | 192 | if distro and distro == 'opensuseleap-15.0': |
| 189 | self.skipTest('virgl isn\'t working with Opensuse 15.0') | 193 | self.skipTest('virgl isn\'t working with Opensuse 15.0') |
| 190 | 194 | ||
| @@ -228,6 +232,9 @@ class TestImage(OESelftestTestCase): | |||
| 228 | dripath = subprocess.check_output("pkg-config --variable=dridriverdir dri", shell=True) | 232 | dripath = subprocess.check_output("pkg-config --variable=dridriverdir dri", shell=True) |
| 229 | except subprocess.CalledProcessError as e: | 233 | except subprocess.CalledProcessError as e: |
| 230 | self.skipTest("Could not determine the path to dri drivers on the host via pkg-config.\nPlease install Mesa development files (particularly, dri.pc) on the host machine.") | 234 | self.skipTest("Could not determine the path to dri drivers on the host via pkg-config.\nPlease install Mesa development files (particularly, dri.pc) on the host machine.") |
| 235 | distro = oe.lsb.distro_identifier() | ||
| 236 | if distro and distro == 'fedora-34': | ||
| 237 | self.skipTest('virgl isn\'t working with Fedora 34') | ||
| 231 | qemu_distrofeatures = get_bb_var('DISTRO_FEATURES', 'qemu-system-native') | 238 | qemu_distrofeatures = get_bb_var('DISTRO_FEATURES', 'qemu-system-native') |
| 232 | features = 'INHERIT += "testimage"\n' | 239 | features = 'INHERIT += "testimage"\n' |
| 233 | if 'opengl' not in qemu_distrofeatures: | 240 | if 'opengl' not in qemu_distrofeatures: |
