diff options
Diffstat (limited to 'poky/meta/lib')
189 files changed, 1037 insertions, 51 deletions
diff --git a/poky/meta/lib/bblayers/buildconf.py b/poky/meta/lib/bblayers/buildconf.py new file mode 100644 index 0000000000..e07fc534e1 --- /dev/null +++ b/poky/meta/lib/bblayers/buildconf.py @@ -0,0 +1,85 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: GPL-2.0-only +# + +import logging +import os +import stat +import sys +import shutil +import json + +import bb.utils +import bb.process + +from bblayers.common import LayerPlugin + +logger = logging.getLogger('bitbake-layers') + +sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) + +import oe.buildcfg + +def plugin_init(plugins): + return BuildConfPlugin() + +class BuildConfPlugin(LayerPlugin): + notes_fixme = """FIXME: Please place here the description of this build configuration. +It will be shown to the users when they set up their builds via TEMPLATECONF. +""" + + def _save_conf(self, templatename, templatepath, oecorepath, relpaths_to_oecore): + confdir = os.path.join(os.environ["BBPATH"], "conf") + destdir = os.path.join(templatepath, "conf", "templates", templatename) + os.makedirs(destdir, exist_ok=True) + + with open(os.path.join(confdir, "local.conf")) as src: + with open(os.path.join(destdir, "local.conf.sample"), 'w') as dest: + dest.write(src.read()) + + with open(os.path.join(confdir, "bblayers.conf")) as src: + with open(os.path.join(destdir, "bblayers.conf.sample"), 'w') as dest: + bblayers_data = src.read() + + for (abspath, relpath) in relpaths_to_oecore: + bblayers_data = bblayers_data.replace(abspath, "##OEROOT##/" + relpath) + dest.write(bblayers_data) + + with open(os.path.join(destdir, "conf-notes.txt"), 'w') as dest: + dest.write(self.notes_fixme) + + logger.info("""Configuration template placed into {} +Please review the files in there, and particularly provide a configuration description in {} +You can try out the configuration with +TEMPLATECONF={} . {}/oe-init-build-env build-try-{}""" +.format(destdir, os.path.join(destdir, "conf-notes.txt"), destdir, oecorepath, templatename)) + + def do_save_build_conf(self, args): + """ Save the currently active build configuration (conf/local.conf, conf/bblayers.conf) as a template into a layer.\n This template can later be used for setting up builds via TEMPLATECONF. """ + repos = {} + layers = oe.buildcfg.get_layer_revisions(self.tinfoil.config_data) + targetlayer = None + oecore = None + + for l in layers: + if l[0] == os.path.abspath(args.layerpath): + targetlayer = l[0] + if l[1] == 'meta': + oecore = os.path.dirname(l[0]) + + if not targetlayer: + logger.error("Layer {} not in one of the currently enabled layers:\n{}".format(args.layerpath, "\n".join([l[0] for l in layers]))) + elif not oecore: + logger.error("Openembedded-core not in one of the currently enabled layers:\n{}".format("\n".join([l[0] for l in layers]))) + else: + relpaths_to_oecore = [(l[0], os.path.relpath(l[0], start=oecore)) for l in layers] + self._save_conf(args.templatename, targetlayer, oecore, relpaths_to_oecore) + + def register_commands(self, sp): + parser_build_conf = self.add_command(sp, 'save-build-conf', self.do_save_build_conf, parserecipes=False) + parser_build_conf.add_argument('layerpath', + help='The path to the layer where the configuration template should be saved.') + parser_build_conf.add_argument('templatename', + help='The name of the configuration template.') diff --git a/poky/meta/lib/bblayers/create.py b/poky/meta/lib/bblayers/create.py index 7ddb777dc7..0aeb5d5f7b 100644 --- a/poky/meta/lib/bblayers/create.py +++ b/poky/meta/lib/bblayers/create.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/bblayers/makesetup.py b/poky/meta/lib/bblayers/makesetup.py new file mode 100644 index 0000000000..22f89d81a4 --- /dev/null +++ b/poky/meta/lib/bblayers/makesetup.py @@ -0,0 +1,107 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: GPL-2.0-only +# + +import logging +import os +import stat +import sys +import shutil + +import bb.utils +import bb.process + +from bblayers.common import LayerPlugin + +logger = logging.getLogger('bitbake-layers') + +sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) + +import oe.buildcfg + +def plugin_init(plugins): + return MakeSetupPlugin() + +class MakeSetupPlugin(LayerPlugin): + + def _get_repo_path(self, layer_path): + repo_path, _ = bb.process.run('git rev-parse --show-toplevel', cwd=layer_path) + return repo_path.strip() + + def _get_remotes(self, repo_path): + remotes = {} + remotes_list,_ = bb.process.run('git remote', cwd=repo_path) + for r in remotes_list.split(): + uri,_ = bb.process.run('git remote get-url {r}'.format(r=r), cwd=repo_path) + remotes[r] = {'uri':uri.strip()} + return remotes + + def _get_describe(self, repo_path): + try: + describe,_ = bb.process.run('git describe --tags', cwd=repo_path) + except bb.process.ExecutionError: + return "" + return describe.strip() + + def make_repo_config(self, destdir): + """ This is a helper function for the writer plugins that discovers currently confugured layers. + The writers do not have to use it, but it can save a bit of work and avoid duplicated code, hence it is + available here. """ + repos = {} + layers = oe.buildcfg.get_layer_revisions(self.tinfoil.config_data) + try: + destdir_repo = self._get_repo_path(destdir) + except bb.process.ExecutionError: + destdir_repo = None + + for (l_path, l_name, l_branch, l_rev, l_ismodified) in layers: + if l_name == 'workspace': + continue + if l_ismodified: + logger.error("Layer {name} in {path} has uncommitted modifications or is not in a git repository.".format(name=l_name,path=l_path)) + return + repo_path = self._get_repo_path(l_path) + if repo_path not in repos.keys(): + repos[repo_path] = {'path':os.path.basename(repo_path),'git-remote':{'rev':l_rev, 'branch':l_branch, 'remotes':self._get_remotes(repo_path), 'describe':self._get_describe(repo_path)}} + if repo_path == destdir_repo: + repos[repo_path]['contains_this_file'] = True + if not repos[repo_path]['git-remote']['remotes'] and not repos[repo_path]['contains_this_file']: + logger.error("Layer repository in {path} does not have any remotes configured. Please add at least one with 'git remote add'.".format(path=repo_path)) + return + + top_path = os.path.commonpath([os.path.dirname(r) for r in repos.keys()]) + + repos_nopaths = {} + for r in repos.keys(): + r_nopath = os.path.basename(r) + repos_nopaths[r_nopath] = repos[r] + r_relpath = os.path.relpath(r, top_path) + repos_nopaths[r_nopath]['path'] = r_relpath + return repos_nopaths + + def do_make_setup(self, args): + """ Writes out a configuration file and/or a script that replicate the directory structure and revisions of the layers in a current build. """ + for p in self.plugins: + if str(p) == args.writer: + p.do_write(self, args) + + def register_commands(self, sp): + parser_setup_layers = self.add_command(sp, 'create-layers-setup', self.do_make_setup, parserecipes=False) + parser_setup_layers.add_argument('destdir', + help='Directory where to write the output\n(if it is inside one of the layers, the layer becomes a bootstrap repository and thus will be excluded from fetching).') + parser_setup_layers.add_argument('--output-prefix', '-o', + help='File name prefix for the output files, if the default (setup-layers) is undesirable.') + + self.plugins = [] + + for path in (self.tinfoil.config_data.getVar('BBPATH').split(':')): + pluginpath = os.path.join(path, 'lib', 'bblayers', 'setupwriters') + bb.utils.load_plugins(logger, self.plugins, pluginpath) + + parser_setup_layers.add_argument('--writer', '-w', choices=[str(p) for p in self.plugins], help="Choose the output format (defaults to oe-setup-layers).\n\nCurrently supported options are:\noe-setup-layers - a self-contained python script and a json config for it.\n\n", default="oe-setup-layers") + + for plugin in self.plugins: + if hasattr(plugin, 'register_arguments'): + plugin.register_arguments(parser_setup_layers) diff --git a/poky/meta/lib/bblayers/setupwriters/oe-setup-layers.py b/poky/meta/lib/bblayers/setupwriters/oe-setup-layers.py new file mode 100644 index 0000000000..f6a484b766 --- /dev/null +++ b/poky/meta/lib/bblayers/setupwriters/oe-setup-layers.py @@ -0,0 +1,50 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: GPL-2.0-only +# + +import logging +import os +import json +import stat + +logger = logging.getLogger('bitbake-layers') + +def plugin_init(plugins): + return OeSetupLayersWriter() + +class OeSetupLayersWriter(): + + def __str__(self): + return "oe-setup-layers" + + def _write_python(self, input, output): + with open(input) as f: + script = f.read() + with open(output, 'w') as f: + f.write(script) + st = os.stat(output) + os.chmod(output, st.st_mode | stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH) + + def _write_json(self, repos, output): + with open(output, 'w') as f: + json.dump(repos, f, sort_keys=True, indent=4) + + def do_write(self, parent, args): + """ Writes out a python script and a json config that replicate the directory structure and revisions of the layers in a current build. """ + repos = parent.make_repo_config(args.destdir) + json = {"version":"1.0","sources":repos} + if not repos: + raise Exception("Could not determine layer sources") + output = args.output_prefix or "setup-layers" + output = os.path.join(os.path.abspath(args.destdir),output) + self._write_json(json, output + ".json") + logger.info('Created {}.json'.format(output)) + if not args.json_only: + self._write_python(os.path.join(os.path.dirname(__file__),'../../../../scripts/oe-setup-layers'), output) + logger.info('Created {}'.format(output)) + + def register_arguments(self, parser): + parser.add_argument('--json-only', action='store_true', + help='When using the oe-setup-layers writer, write only the layer configuruation in json format. Otherwise, also a copy of scripts/oe-setup-layers (from oe-core or poky) is provided, which is a self contained python script that fetches all the needed layers and sets them to correct revisions using the data from the json.') diff --git a/poky/meta/lib/buildstats.py b/poky/meta/lib/buildstats.py index 99a8303d5e..1ffe679801 100644 --- a/poky/meta/lib/buildstats.py +++ b/poky/meta/lib/buildstats.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # # Implements system state sampling. Called by buildstats.bbclass. diff --git a/poky/meta/lib/oe/__init__.py b/poky/meta/lib/oe/__init__.py index 4e7c09da04..92f002d872 100644 --- a/poky/meta/lib/oe/__init__.py +++ b/poky/meta/lib/oe/__init__.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/cachedpath.py b/poky/meta/lib/oe/cachedpath.py index 254257a83f..0138b791d4 100644 --- a/poky/meta/lib/oe/cachedpath.py +++ b/poky/meta/lib/oe/cachedpath.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # # Based on standard python library functions but avoid diff --git a/poky/meta/lib/oe/classextend.py b/poky/meta/lib/oe/classextend.py index e08d788b75..2013b29711 100644 --- a/poky/meta/lib/oe/classextend.py +++ b/poky/meta/lib/oe/classextend.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/classutils.py b/poky/meta/lib/oe/classutils.py index 08bb66b365..ec3f6ad720 100644 --- a/poky/meta/lib/oe/classutils.py +++ b/poky/meta/lib/oe/classutils.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/copy_buildsystem.py b/poky/meta/lib/oe/copy_buildsystem.py index 79642fd76a..a0d829054e 100644 --- a/poky/meta/lib/oe/copy_buildsystem.py +++ b/poky/meta/lib/oe/copy_buildsystem.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # # This class should provide easy access to the different aspects of the diff --git a/poky/meta/lib/oe/cve_check.py b/poky/meta/lib/oe/cve_check.py index aa06497727..4f1d80f050 100644 --- a/poky/meta/lib/oe/cve_check.py +++ b/poky/meta/lib/oe/cve_check.py @@ -1,3 +1,9 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + import collections import re import itertools @@ -143,7 +149,7 @@ def get_cpe_ids(cve_product, version): else: vendor = "*" - cpe_id = f'cpe:2.3:a:{vendor}:{product}:{version}:*:*:*:*:*:*:*' + cpe_id = 'cpe:2.3:a:{}:{}:{}:*:*:*:*:*:*:*'.format(vendor, product, version) cpe_ids.append(cpe_id) return cpe_ids diff --git a/poky/meta/lib/oe/data.py b/poky/meta/lib/oe/data.py index 602130a904..37121cfad2 100644 --- a/poky/meta/lib/oe/data.py +++ b/poky/meta/lib/oe/data.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/distro_check.py b/poky/meta/lib/oe/distro_check.py index 4b2a9bec01..3494520f40 100644 --- a/poky/meta/lib/oe/distro_check.py +++ b/poky/meta/lib/oe/distro_check.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/elf.py b/poky/meta/lib/oe/elf.py index 46c884a775..fb07995b3e 100644 --- a/poky/meta/lib/oe/elf.py +++ b/poky/meta/lib/oe/elf.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/gpg_sign.py b/poky/meta/lib/oe/gpg_sign.py index aa9bb49f2c..613dab8561 100644 --- a/poky/meta/lib/oe/gpg_sign.py +++ b/poky/meta/lib/oe/gpg_sign.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/license.py b/poky/meta/lib/oe/license.py index 99cfa5f733..d9c8d94da4 100644 --- a/poky/meta/lib/oe/license.py +++ b/poky/meta/lib/oe/license.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # """Code for parsing OpenEmbedded license strings""" diff --git a/poky/meta/lib/oe/lsb.py b/poky/meta/lib/oe/lsb.py index 43e46380d7..3ec03e5042 100644 --- a/poky/meta/lib/oe/lsb.py +++ b/poky/meta/lib/oe/lsb.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/maketype.py b/poky/meta/lib/oe/maketype.py index d36082c535..7a83bdf602 100644 --- a/poky/meta/lib/oe/maketype.py +++ b/poky/meta/lib/oe/maketype.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # """OpenEmbedded variable typing support diff --git a/poky/meta/lib/oe/manifest.py b/poky/meta/lib/oe/manifest.py index 1a058dcd73..61f18adc4a 100644 --- a/poky/meta/lib/oe/manifest.py +++ b/poky/meta/lib/oe/manifest.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/npm_registry.py b/poky/meta/lib/oe/npm_registry.py index 96c0affb45..db581e280e 100644 --- a/poky/meta/lib/oe/npm_registry.py +++ b/poky/meta/lib/oe/npm_registry.py @@ -1,3 +1,9 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + import bb import json import subprocess diff --git a/poky/meta/lib/oe/overlayfs.py b/poky/meta/lib/oe/overlayfs.py index b5d5e88e80..8d7a047125 100644 --- a/poky/meta/lib/oe/overlayfs.py +++ b/poky/meta/lib/oe/overlayfs.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # # This file contains common functions for overlayfs and its QA check diff --git a/poky/meta/lib/oe/package.py b/poky/meta/lib/oe/package.py index 7d387ee81d..4aa40d70ee 100644 --- a/poky/meta/lib/oe/package.py +++ b/poky/meta/lib/oe/package.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/package_manager/__init__.py b/poky/meta/lib/oe/package_manager/__init__.py index d3b45705ec..a6bf2fe219 100644 --- a/poky/meta/lib/oe/package_manager/__init__.py +++ b/poky/meta/lib/oe/package_manager/__init__.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/package_manager/deb/__init__.py b/poky/meta/lib/oe/package_manager/deb/__init__.py index b96ea0bad4..c672454072 100644 --- a/poky/meta/lib/oe/package_manager/deb/__init__.py +++ b/poky/meta/lib/oe/package_manager/deb/__init__.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/package_manager/deb/manifest.py b/poky/meta/lib/oe/package_manager/deb/manifest.py index d8eab24a06..72983bae98 100644 --- a/poky/meta/lib/oe/package_manager/deb/manifest.py +++ b/poky/meta/lib/oe/package_manager/deb/manifest.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/package_manager/deb/rootfs.py b/poky/meta/lib/oe/package_manager/deb/rootfs.py index 8fbaca11d6..1e25b64ed9 100644 --- a/poky/meta/lib/oe/package_manager/deb/rootfs.py +++ b/poky/meta/lib/oe/package_manager/deb/rootfs.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/package_manager/deb/sdk.py b/poky/meta/lib/oe/package_manager/deb/sdk.py index f4b0b6510a..653e42ab3c 100644 --- a/poky/meta/lib/oe/package_manager/deb/sdk.py +++ b/poky/meta/lib/oe/package_manager/deb/sdk.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/package_manager/ipk/__init__.py b/poky/meta/lib/oe/package_manager/ipk/__init__.py index 7cbea0fa80..caca522fd6 100644 --- a/poky/meta/lib/oe/package_manager/ipk/__init__.py +++ b/poky/meta/lib/oe/package_manager/ipk/__init__.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/package_manager/ipk/manifest.py b/poky/meta/lib/oe/package_manager/ipk/manifest.py index ae451c5c70..469e14c3c6 100644 --- a/poky/meta/lib/oe/package_manager/ipk/manifest.py +++ b/poky/meta/lib/oe/package_manager/ipk/manifest.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/package_manager/ipk/rootfs.py b/poky/meta/lib/oe/package_manager/ipk/rootfs.py index 10a831994e..1f74f7e39a 100644 --- a/poky/meta/lib/oe/package_manager/ipk/rootfs.py +++ b/poky/meta/lib/oe/package_manager/ipk/rootfs.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/package_manager/ipk/sdk.py b/poky/meta/lib/oe/package_manager/ipk/sdk.py index e2ca415c8e..6a1f167fb7 100644 --- a/poky/meta/lib/oe/package_manager/ipk/sdk.py +++ b/poky/meta/lib/oe/package_manager/ipk/sdk.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/package_manager/rpm/__init__.py b/poky/meta/lib/oe/package_manager/rpm/__init__.py index d97dab3293..18ec5c895d 100644 --- a/poky/meta/lib/oe/package_manager/rpm/__init__.py +++ b/poky/meta/lib/oe/package_manager/rpm/__init__.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/package_manager/rpm/manifest.py b/poky/meta/lib/oe/package_manager/rpm/manifest.py index e6604b301f..6ee7c329f0 100644 --- a/poky/meta/lib/oe/package_manager/rpm/manifest.py +++ b/poky/meta/lib/oe/package_manager/rpm/manifest.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/package_manager/rpm/rootfs.py b/poky/meta/lib/oe/package_manager/rpm/rootfs.py index 00d07cd9cc..d4c415f68c 100644 --- a/poky/meta/lib/oe/package_manager/rpm/rootfs.py +++ b/poky/meta/lib/oe/package_manager/rpm/rootfs.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/package_manager/rpm/sdk.py b/poky/meta/lib/oe/package_manager/rpm/sdk.py index c5f232431f..0726a18b91 100644 --- a/poky/meta/lib/oe/package_manager/rpm/sdk.py +++ b/poky/meta/lib/oe/package_manager/rpm/sdk.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/packagedata.py b/poky/meta/lib/oe/packagedata.py index 212f048bc6..b2ed8b5a3d 100644 --- a/poky/meta/lib/oe/packagedata.py +++ b/poky/meta/lib/oe/packagedata.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/packagegroup.py b/poky/meta/lib/oe/packagegroup.py index 8fcaecde82..7b7594751a 100644 --- a/poky/meta/lib/oe/packagegroup.py +++ b/poky/meta/lib/oe/packagegroup.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/patch.py b/poky/meta/lib/oe/patch.py index 4ec9caed45..b2dc8d0a90 100644 --- a/poky/meta/lib/oe/patch.py +++ b/poky/meta/lib/oe/patch.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/path.py b/poky/meta/lib/oe/path.py index c8d8ad05b9..0dc8f172d5 100644 --- a/poky/meta/lib/oe/path.py +++ b/poky/meta/lib/oe/path.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/prservice.py b/poky/meta/lib/oe/prservice.py index 339f7aebca..2f2a0c128a 100644 --- a/poky/meta/lib/oe/prservice.py +++ b/poky/meta/lib/oe/prservice.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/qa.py b/poky/meta/lib/oe/qa.py index 89acd3ead0..b4cbc50045 100644 --- a/poky/meta/lib/oe/qa.py +++ b/poky/meta/lib/oe/qa.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/reproducible.py b/poky/meta/lib/oe/reproducible.py index 2e815df190..04a1810d4f 100644 --- a/poky/meta/lib/oe/reproducible.py +++ b/poky/meta/lib/oe/reproducible.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # import os diff --git a/poky/meta/lib/oe/rootfs.py b/poky/meta/lib/oe/rootfs.py index 9e6b411fb6..0b9911e3a6 100644 --- a/poky/meta/lib/oe/rootfs.py +++ b/poky/meta/lib/oe/rootfs.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # from abc import ABCMeta, abstractmethod diff --git a/poky/meta/lib/oe/rust.py b/poky/meta/lib/oe/rust.py index ec70b34805..1dc9cf150d 100644 --- a/poky/meta/lib/oe/rust.py +++ b/poky/meta/lib/oe/rust.py @@ -1,3 +1,9 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + # Handle mismatches between `uname -m`-style output and Rust's arch names def arch_to_rust_arch(arch): if arch == "ppc64le": diff --git a/poky/meta/lib/oe/sbom.py b/poky/meta/lib/oe/sbom.py index 52bf51440e..bbf466bbad 100644 --- a/poky/meta/lib/oe/sbom.py +++ b/poky/meta/lib/oe/sbom.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/sdk.py b/poky/meta/lib/oe/sdk.py index 27347667e8..81fcf15371 100644 --- a/poky/meta/lib/oe/sdk.py +++ b/poky/meta/lib/oe/sdk.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/spdx.py b/poky/meta/lib/oe/spdx.py index 6d56ed90df..c74ea68878 100644 --- a/poky/meta/lib/oe/spdx.py +++ b/poky/meta/lib/oe/spdx.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/sstatesig.py b/poky/meta/lib/oe/sstatesig.py index de65244932..fad10af539 100644 --- a/poky/meta/lib/oe/sstatesig.py +++ b/poky/meta/lib/oe/sstatesig.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # import bb.siggen diff --git a/poky/meta/lib/oe/terminal.py b/poky/meta/lib/oe/terminal.py index de8dcebf94..71ffc87019 100644 --- a/poky/meta/lib/oe/terminal.py +++ b/poky/meta/lib/oe/terminal.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # import logging diff --git a/poky/meta/lib/oe/types.py b/poky/meta/lib/oe/types.py index bbbabafbf6..b929afb1f3 100644 --- a/poky/meta/lib/oe/types.py +++ b/poky/meta/lib/oe/types.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oe/useradd.py b/poky/meta/lib/oe/useradd.py index 3caa3f851a..54aa86feb5 100644 --- a/poky/meta/lib/oe/useradd.py +++ b/poky/meta/lib/oe/useradd.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # import argparse diff --git a/poky/meta/lib/oe/utils.py b/poky/meta/lib/oe/utils.py index 1ee947d584..69ca8987f3 100644 --- a/poky/meta/lib/oe/utils.py +++ b/poky/meta/lib/oe/utils.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oeqa/controllers/__init__.py b/poky/meta/lib/oeqa/controllers/__init__.py index cc3836c4bf..0fc905be9a 100644 --- a/poky/meta/lib/oeqa/controllers/__init__.py +++ b/poky/meta/lib/oeqa/controllers/__init__.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # # Enable other layers to have modules in the same named directory diff --git a/poky/meta/lib/oeqa/controllers/testtargetloader.py b/poky/meta/lib/oeqa/controllers/testtargetloader.py index 23101c7371..209ff7061a 100644 --- a/poky/meta/lib/oeqa/controllers/testtargetloader.py +++ b/poky/meta/lib/oeqa/controllers/testtargetloader.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # diff --git a/poky/meta/lib/oeqa/core/utils/concurrencytest.py b/poky/meta/lib/oeqa/core/utils/concurrencytest.py index 161a2f6e90..383479c959 100644 --- a/poky/meta/lib/oeqa/core/utils/concurrencytest.py +++ b/poky/meta/lib/oeqa/core/utils/concurrencytest.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-or-later # # Modified for use in OE by Richard Purdie, 2018 diff --git a/poky/meta/lib/oeqa/runtime/cases/_qemutiny.py b/poky/meta/lib/oeqa/runtime/cases/_qemutiny.py index 6886e36502..14ff8b98b2 100644 --- a/poky/meta/lib/oeqa/runtime/cases/_qemutiny.py +++ b/poky/meta/lib/oeqa/runtime/cases/_qemutiny.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/apt.py b/poky/meta/lib/oeqa/runtime/cases/apt.py index 574a34f148..4e09374add 100644 --- a/poky/meta/lib/oeqa/runtime/cases/apt.py +++ b/poky/meta/lib/oeqa/runtime/cases/apt.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/boot.py b/poky/meta/lib/oeqa/runtime/cases/boot.py index e1ad88a174..dcee3311f7 100644 --- a/poky/meta/lib/oeqa/runtime/cases/boot.py +++ b/poky/meta/lib/oeqa/runtime/cases/boot.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/buildcpio.py b/poky/meta/lib/oeqa/runtime/cases/buildcpio.py index e29bf16ccb..bd3b46d9ef 100644 --- a/poky/meta/lib/oeqa/runtime/cases/buildcpio.py +++ b/poky/meta/lib/oeqa/runtime/cases/buildcpio.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/buildgalculator.py b/poky/meta/lib/oeqa/runtime/cases/buildgalculator.py index e5cc3e2888..2cfb3243dc 100644 --- a/poky/meta/lib/oeqa/runtime/cases/buildgalculator.py +++ b/poky/meta/lib/oeqa/runtime/cases/buildgalculator.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/buildlzip.py b/poky/meta/lib/oeqa/runtime/cases/buildlzip.py index bc70b41461..44f4f1be71 100644 --- a/poky/meta/lib/oeqa/runtime/cases/buildlzip.py +++ b/poky/meta/lib/oeqa/runtime/cases/buildlzip.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/connman.py b/poky/meta/lib/oeqa/runtime/cases/connman.py index f0d15fac9b..a488752e3f 100644 --- a/poky/meta/lib/oeqa/runtime/cases/connman.py +++ b/poky/meta/lib/oeqa/runtime/cases/connman.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/date.py b/poky/meta/lib/oeqa/runtime/cases/date.py index bd6537400e..a2523de67a 100644 --- a/poky/meta/lib/oeqa/runtime/cases/date.py +++ b/poky/meta/lib/oeqa/runtime/cases/date.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/df.py b/poky/meta/lib/oeqa/runtime/cases/df.py index bb155c9cf9..43e0ebf9ea 100644 --- a/poky/meta/lib/oeqa/runtime/cases/df.py +++ b/poky/meta/lib/oeqa/runtime/cases/df.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/dnf.py b/poky/meta/lib/oeqa/runtime/cases/dnf.py index f40c63026e..a8e23e596e 100644 --- a/poky/meta/lib/oeqa/runtime/cases/dnf.py +++ b/poky/meta/lib/oeqa/runtime/cases/dnf.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/ethernet_ip_connman.py b/poky/meta/lib/oeqa/runtime/cases/ethernet_ip_connman.py index b93ee29941..eac8f2d082 100644 --- a/poky/meta/lib/oeqa/runtime/cases/ethernet_ip_connman.py +++ b/poky/meta/lib/oeqa/runtime/cases/ethernet_ip_connman.py @@ -1,3 +1,8 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends from oeqa.core.decorator.data import skipIfQemu diff --git a/poky/meta/lib/oeqa/runtime/cases/gcc.py b/poky/meta/lib/oeqa/runtime/cases/gcc.py index 1b6e431bf4..17b1483e8d 100644 --- a/poky/meta/lib/oeqa/runtime/cases/gcc.py +++ b/poky/meta/lib/oeqa/runtime/cases/gcc.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/gi.py b/poky/meta/lib/oeqa/runtime/cases/gi.py index 42bd100a31..78c7ddda2c 100644 --- a/poky/meta/lib/oeqa/runtime/cases/gi.py +++ b/poky/meta/lib/oeqa/runtime/cases/gi.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/go.py b/poky/meta/lib/oeqa/runtime/cases/go.py index 89ba2c3ecb..7514d108f1 100644 --- a/poky/meta/lib/oeqa/runtime/cases/go.py +++ b/poky/meta/lib/oeqa/runtime/cases/go.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/gstreamer.py b/poky/meta/lib/oeqa/runtime/cases/gstreamer.py index f735f82e3b..2295769cfd 100644 --- a/poky/meta/lib/oeqa/runtime/cases/gstreamer.py +++ b/poky/meta/lib/oeqa/runtime/cases/gstreamer.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/kernelmodule.py b/poky/meta/lib/oeqa/runtime/cases/kernelmodule.py index 47fd2f850c..9c42fcc586 100644 --- a/poky/meta/lib/oeqa/runtime/cases/kernelmodule.py +++ b/poky/meta/lib/oeqa/runtime/cases/kernelmodule.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/ksample.py b/poky/meta/lib/oeqa/runtime/cases/ksample.py index c69e3fe4ac..b6848762e3 100644 --- a/poky/meta/lib/oeqa/runtime/cases/ksample.py +++ b/poky/meta/lib/oeqa/runtime/cases/ksample.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/ldd.py b/poky/meta/lib/oeqa/runtime/cases/ldd.py index 9c2caa8f65..f6841c6675 100644 --- a/poky/meta/lib/oeqa/runtime/cases/ldd.py +++ b/poky/meta/lib/oeqa/runtime/cases/ldd.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/logrotate.py b/poky/meta/lib/oeqa/runtime/cases/logrotate.py index 2bff08f9da..6ad980cb6a 100644 --- a/poky/meta/lib/oeqa/runtime/cases/logrotate.py +++ b/poky/meta/lib/oeqa/runtime/cases/logrotate.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/multilib.py b/poky/meta/lib/oeqa/runtime/cases/multilib.py index 0d1b9ae2c9..68556e45c5 100644 --- a/poky/meta/lib/oeqa/runtime/cases/multilib.py +++ b/poky/meta/lib/oeqa/runtime/cases/multilib.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/oe_syslog.py b/poky/meta/lib/oeqa/runtime/cases/oe_syslog.py index 150b70d9f0..cad0c88d26 100644 --- a/poky/meta/lib/oeqa/runtime/cases/oe_syslog.py +++ b/poky/meta/lib/oeqa/runtime/cases/oe_syslog.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/opkg.py b/poky/meta/lib/oeqa/runtime/cases/opkg.py index 9cfee1cd88..a29c93e59a 100644 --- a/poky/meta/lib/oeqa/runtime/cases/opkg.py +++ b/poky/meta/lib/oeqa/runtime/cases/opkg.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/pam.py b/poky/meta/lib/oeqa/runtime/cases/pam.py index a482ded945..b3e8b56c3c 100644 --- a/poky/meta/lib/oeqa/runtime/cases/pam.py +++ b/poky/meta/lib/oeqa/runtime/cases/pam.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/parselogs.py b/poky/meta/lib/oeqa/runtime/cases/parselogs.py index 1f9365f3a8..e16c230dfa 100644 --- a/poky/meta/lib/oeqa/runtime/cases/parselogs.py +++ b/poky/meta/lib/oeqa/runtime/cases/parselogs.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # @@ -64,6 +66,7 @@ common_errors = [ "[pulseaudio] authkey.c: Failed to load authentication key", "was skipped because of a failed condition check", "was skipped because all trigger condition checks failed", + "xf86OpenConsole: Switching VT failed", ] video_related = [ @@ -140,6 +143,7 @@ ignore_errors = { 'Failed to initialize \'/amba/timer@101e3000\': -22', 'jitterentropy: Initialization failed with host not compliant with requirements: 2', 'clcd-pl11x: probe of 10120000.display failed with error -2', + 'arm-charlcd 10008000.lcd: error -ENXIO: IRQ index 0 not found' ] + common_errors, 'qemuarm64' : [ 'Fatal server error:', diff --git a/poky/meta/lib/oeqa/runtime/cases/perl.py b/poky/meta/lib/oeqa/runtime/cases/perl.py index 2c6b3b7846..f11b300836 100644 --- a/poky/meta/lib/oeqa/runtime/cases/perl.py +++ b/poky/meta/lib/oeqa/runtime/cases/perl.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/ping.py b/poky/meta/lib/oeqa/runtime/cases/ping.py index 498f80d0a5..967b44175f 100644 --- a/poky/meta/lib/oeqa/runtime/cases/ping.py +++ b/poky/meta/lib/oeqa/runtime/cases/ping.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/ptest.py b/poky/meta/lib/oeqa/runtime/cases/ptest.py index 00742da2b5..3ef9022188 100644 --- a/poky/meta/lib/oeqa/runtime/cases/ptest.py +++ b/poky/meta/lib/oeqa/runtime/cases/ptest.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/python.py b/poky/meta/lib/oeqa/runtime/cases/python.py index ec54f1e1db..5d6d133480 100644 --- a/poky/meta/lib/oeqa/runtime/cases/python.py +++ b/poky/meta/lib/oeqa/runtime/cases/python.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/rpm.py b/poky/meta/lib/oeqa/runtime/cases/rpm.py index a4339116bf..e3cd818b2b 100644 --- a/poky/meta/lib/oeqa/runtime/cases/rpm.py +++ b/poky/meta/lib/oeqa/runtime/cases/rpm.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/rt.py b/poky/meta/lib/oeqa/runtime/cases/rt.py index 849ac1914e..15ab4dbbbb 100644 --- a/poky/meta/lib/oeqa/runtime/cases/rt.py +++ b/poky/meta/lib/oeqa/runtime/cases/rt.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/rtc.py b/poky/meta/lib/oeqa/runtime/cases/rtc.py index c4e6681324..b2159b1134 100644 --- a/poky/meta/lib/oeqa/runtime/cases/rtc.py +++ b/poky/meta/lib/oeqa/runtime/cases/rtc.py @@ -1,3 +1,8 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends from oeqa.runtime.decorator.package import OEHasPackage diff --git a/poky/meta/lib/oeqa/runtime/cases/runlevel.py b/poky/meta/lib/oeqa/runtime/cases/runlevel.py index 3a4df8ace1..6734b0f5ed 100644 --- a/poky/meta/lib/oeqa/runtime/cases/runlevel.py +++ b/poky/meta/lib/oeqa/runtime/cases/runlevel.py @@ -1,3 +1,8 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends diff --git a/poky/meta/lib/oeqa/runtime/cases/rust.py b/poky/meta/lib/oeqa/runtime/cases/rust.py index b3d6cf7f37..55b280d61d 100644 --- a/poky/meta/lib/oeqa/runtime/cases/rust.py +++ b/poky/meta/lib/oeqa/runtime/cases/rust.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/scons.py b/poky/meta/lib/oeqa/runtime/cases/scons.py index 3c7c7f7270..4a8d4d40ba 100644 --- a/poky/meta/lib/oeqa/runtime/cases/scons.py +++ b/poky/meta/lib/oeqa/runtime/cases/scons.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/scp.py b/poky/meta/lib/oeqa/runtime/cases/scp.py index f2bbc947d6..ee97b8ef66 100644 --- a/poky/meta/lib/oeqa/runtime/cases/scp.py +++ b/poky/meta/lib/oeqa/runtime/cases/scp.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/skeletoninit.py b/poky/meta/lib/oeqa/runtime/cases/skeletoninit.py index a12f1e9aae..75951beda9 100644 --- a/poky/meta/lib/oeqa/runtime/cases/skeletoninit.py +++ b/poky/meta/lib/oeqa/runtime/cases/skeletoninit.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/ssh.py b/poky/meta/lib/oeqa/runtime/cases/ssh.py index e31224b3af..13aac54396 100644 --- a/poky/meta/lib/oeqa/runtime/cases/ssh.py +++ b/poky/meta/lib/oeqa/runtime/cases/ssh.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/stap.py b/poky/meta/lib/oeqa/runtime/cases/stap.py index 480eaabf2d..3be4162108 100644 --- a/poky/meta/lib/oeqa/runtime/cases/stap.py +++ b/poky/meta/lib/oeqa/runtime/cases/stap.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/storage.py b/poky/meta/lib/oeqa/runtime/cases/storage.py index 972ef8210c..b05622fea8 100644 --- a/poky/meta/lib/oeqa/runtime/cases/storage.py +++ b/poky/meta/lib/oeqa/runtime/cases/storage.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/suspend.py b/poky/meta/lib/oeqa/runtime/cases/suspend.py index 0382d48f45..a625cc5901 100644 --- a/poky/meta/lib/oeqa/runtime/cases/suspend.py +++ b/poky/meta/lib/oeqa/runtime/cases/suspend.py @@ -1,3 +1,8 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends from oeqa.core.decorator.data import skipIfQemu diff --git a/poky/meta/lib/oeqa/runtime/cases/systemd.py b/poky/meta/lib/oeqa/runtime/cases/systemd.py index 7c44abe8ed..720b4b517a 100644 --- a/poky/meta/lib/oeqa/runtime/cases/systemd.py +++ b/poky/meta/lib/oeqa/runtime/cases/systemd.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/terminal.py b/poky/meta/lib/oeqa/runtime/cases/terminal.py index 8fcca99f47..96ba3c3195 100644 --- a/poky/meta/lib/oeqa/runtime/cases/terminal.py +++ b/poky/meta/lib/oeqa/runtime/cases/terminal.py @@ -1,3 +1,8 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends from oeqa.runtime.decorator.package import OEHasPackage diff --git a/poky/meta/lib/oeqa/runtime/cases/usb_hid.py b/poky/meta/lib/oeqa/runtime/cases/usb_hid.py index 8743174370..6f23d2ff51 100644 --- a/poky/meta/lib/oeqa/runtime/cases/usb_hid.py +++ b/poky/meta/lib/oeqa/runtime/cases/usb_hid.py @@ -1,3 +1,8 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends from oeqa.core.decorator.data import skipIfQemu diff --git a/poky/meta/lib/oeqa/runtime/cases/weston.py b/poky/meta/lib/oeqa/runtime/cases/weston.py index 1fd471e611..ee4d336482 100644 --- a/poky/meta/lib/oeqa/runtime/cases/weston.py +++ b/poky/meta/lib/oeqa/runtime/cases/weston.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/x32lib.py b/poky/meta/lib/oeqa/runtime/cases/x32lib.py index f419c8f181..014da4b386 100644 --- a/poky/meta/lib/oeqa/runtime/cases/x32lib.py +++ b/poky/meta/lib/oeqa/runtime/cases/x32lib.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/runtime/cases/xorg.py b/poky/meta/lib/oeqa/runtime/cases/xorg.py index d6845587c2..09afb1e3d1 100644 --- a/poky/meta/lib/oeqa/runtime/cases/xorg.py +++ b/poky/meta/lib/oeqa/runtime/cases/xorg.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/sdk/buildtools-cases/build.py b/poky/meta/lib/oeqa/sdk/buildtools-cases/build.py index aee2e5a8c0..c85c32496b 100644 --- a/poky/meta/lib/oeqa/sdk/buildtools-cases/build.py +++ b/poky/meta/lib/oeqa/sdk/buildtools-cases/build.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/sdk/buildtools-cases/gcc.py b/poky/meta/lib/oeqa/sdk/buildtools-cases/gcc.py index 36ba15b134..a62c4d0bc4 100644 --- a/poky/meta/lib/oeqa/sdk/buildtools-cases/gcc.py +++ b/poky/meta/lib/oeqa/sdk/buildtools-cases/gcc.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/sdk/buildtools-cases/https.py b/poky/meta/lib/oeqa/sdk/buildtools-cases/https.py index 35e549eb40..4525e3d758 100644 --- a/poky/meta/lib/oeqa/sdk/buildtools-cases/https.py +++ b/poky/meta/lib/oeqa/sdk/buildtools-cases/https.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/sdk/buildtools-cases/sanity.py b/poky/meta/lib/oeqa/sdk/buildtools-cases/sanity.py index 64baaa8f84..b9dfa39a06 100644 --- a/poky/meta/lib/oeqa/sdk/buildtools-cases/sanity.py +++ b/poky/meta/lib/oeqa/sdk/buildtools-cases/sanity.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py b/poky/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py index 5b0eca046f..6e3ee94292 100644 --- a/poky/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py +++ b/poky/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/sdk/cases/assimp.py b/poky/meta/lib/oeqa/sdk/cases/assimp.py index f166758e49..aa6541c6f6 100644 --- a/poky/meta/lib/oeqa/sdk/cases/assimp.py +++ b/poky/meta/lib/oeqa/sdk/cases/assimp.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/sdk/cases/buildcpio.py b/poky/meta/lib/oeqa/sdk/cases/buildcpio.py index e7fc211a47..c42c670add 100644 --- a/poky/meta/lib/oeqa/sdk/cases/buildcpio.py +++ b/poky/meta/lib/oeqa/sdk/cases/buildcpio.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/sdk/cases/buildepoxy.py b/poky/meta/lib/oeqa/sdk/cases/buildepoxy.py index ad08b777f2..ee515be188 100644 --- a/poky/meta/lib/oeqa/sdk/cases/buildepoxy.py +++ b/poky/meta/lib/oeqa/sdk/cases/buildepoxy.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/sdk/cases/buildgalculator.py b/poky/meta/lib/oeqa/sdk/cases/buildgalculator.py index 58ade920c9..178f07472d 100644 --- a/poky/meta/lib/oeqa/sdk/cases/buildgalculator.py +++ b/poky/meta/lib/oeqa/sdk/cases/buildgalculator.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/sdk/cases/buildlzip.py b/poky/meta/lib/oeqa/sdk/cases/buildlzip.py index 49ae756bf3..b4b7d85b88 100644 --- a/poky/meta/lib/oeqa/sdk/cases/buildlzip.py +++ b/poky/meta/lib/oeqa/sdk/cases/buildlzip.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/sdk/cases/gcc.py b/poky/meta/lib/oeqa/sdk/cases/gcc.py index eb08eadd28..fc28b9c3d4 100644 --- a/poky/meta/lib/oeqa/sdk/cases/gcc.py +++ b/poky/meta/lib/oeqa/sdk/cases/gcc.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/sdk/cases/perl.py b/poky/meta/lib/oeqa/sdk/cases/perl.py index 14d76d820f..8eab4442e8 100644 --- a/poky/meta/lib/oeqa/sdk/cases/perl.py +++ b/poky/meta/lib/oeqa/sdk/cases/perl.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/sdk/cases/python.py b/poky/meta/lib/oeqa/sdk/cases/python.py index d43354c32a..5ea992b9f3 100644 --- a/poky/meta/lib/oeqa/sdk/cases/python.py +++ b/poky/meta/lib/oeqa/sdk/cases/python.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/sdk/cases/rust.py b/poky/meta/lib/oeqa/sdk/cases/rust.py index 1075d37b49..31036f0f14 100644 --- a/poky/meta/lib/oeqa/sdk/cases/rust.py +++ b/poky/meta/lib/oeqa/sdk/cases/rust.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/sdk/files/rust/hello/build.rs b/poky/meta/lib/oeqa/sdk/files/rust/hello/build.rs new file mode 100644 index 0000000000..b1a533d5df --- /dev/null +++ b/poky/meta/lib/oeqa/sdk/files/rust/hello/build.rs @@ -0,0 +1,3 @@ +/* This is the simplest build script just to invoke host compiler + in the build process. */ +fn main() {} diff --git a/poky/meta/lib/oeqa/sdk/testmetaidesupport.py b/poky/meta/lib/oeqa/sdk/testmetaidesupport.py index 2ff76fd8e0..00ef30e82e 100644 --- a/poky/meta/lib/oeqa/sdk/testmetaidesupport.py +++ b/poky/meta/lib/oeqa/sdk/testmetaidesupport.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/_sstatetests_noauto.py b/poky/meta/lib/oeqa/selftest/cases/_sstatetests_noauto.py index bff6e7740c..5f1c8df2d4 100644 --- a/poky/meta/lib/oeqa/selftest/cases/_sstatetests_noauto.py +++ b/poky/meta/lib/oeqa/selftest/cases/_sstatetests_noauto.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/archiver.py b/poky/meta/lib/oeqa/selftest/cases/archiver.py index 75195241b7..ffdea832be 100644 --- a/poky/meta/lib/oeqa/selftest/cases/archiver.py +++ b/poky/meta/lib/oeqa/selftest/cases/archiver.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/bblayers.py b/poky/meta/lib/oeqa/selftest/cases/bblayers.py index 7d74833f61..c6bd5a1f6a 100644 --- a/poky/meta/lib/oeqa/selftest/cases/bblayers.py +++ b/poky/meta/lib/oeqa/selftest/cases/bblayers.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # @@ -6,12 +8,16 @@ import os import re import oeqa.utils.ftools as ftools -from oeqa.utils.commands import runCmd, get_bb_var, get_bb_vars +from oeqa.utils.commands import runCmd, get_bb_var, get_bb_vars, bitbake from oeqa.selftest.case import OESelftestTestCase class BitbakeLayers(OESelftestTestCase): + def setUpLocal(self): + bitbake("python3-jsonschema-native") + bitbake("-c addto_recipe_sysroot python3-jsonschema-native") + def test_bitbakelayers_layerindexshowdepends(self): result = runCmd('bitbake-layers layerindex-show-depends meta-poky') find_in_contents = re.search("openembedded-core", result.output) @@ -111,6 +117,11 @@ class BitbakeLayers(OESelftestTestCase): self.assertEqual(bb_vars['BBFILE_PRIORITY_%s' % layername], str(priority), 'BBFILE_PRIORITY_%s != %d' % (layername, priority)) + result = runCmd('bitbake-layers save-build-conf {} {}'.format(layerpath, "buildconf-1")) + for f in ('local.conf.sample', 'bblayers.conf.sample', 'conf-notes.txt'): + fullpath = os.path.join(layerpath, "conf", "templates", "buildconf-1", f) + self.assertTrue(os.path.exists(fullpath), "Template configuration file {} not found".format(fullpath)) + def get_recipe_basename(self, recipe): recipe_file = "" result = runCmd("bitbake-layers show-recipes -f %s" % recipe) @@ -121,3 +132,35 @@ class BitbakeLayers(OESelftestTestCase): self.assertTrue(os.path.isfile(recipe_file), msg = "Can't find recipe file for %s" % recipe) return os.path.basename(recipe_file) + + def validate_layersjson(self, json): + python = os.path.join(get_bb_var('STAGING_BINDIR', 'python3-jsonschema-native'), 'nativepython3') + jsonvalidator = os.path.join(get_bb_var('STAGING_BINDIR', 'python3-jsonschema-native'), 'jsonschema') + jsonschema = os.path.join(get_bb_var('COREBASE'), 'meta/files/layers.schema.json') + result = runCmd("{} {} -i {} {}".format(python, jsonvalidator, json, jsonschema)) + + def test_validate_examplelayersjson(self): + json = os.path.join(get_bb_var('COREBASE'), "meta/files/layers.example.json") + self.validate_layersjson(json) + + def test_bitbakelayers_setup(self): + result = runCmd('bitbake-layers create-layers-setup {}'.format(self.testlayer_path)) + jsonfile = os.path.join(self.testlayer_path, "setup-layers.json") + self.validate_layersjson(jsonfile) + + # The revision-under-test may not necessarily be available on the remote server, + # so replace it with a revision that has a yocto-4.0 tag. + import json + with open(jsonfile) as f: + data = json.load(f) + for s in data['sources']: + data['sources'][s]['git-remote']['rev'] = '00cfdde791a0176c134f31e5a09eff725e75b905' + with open(jsonfile, 'w') as f: + json.dump(data, f) + + testcheckoutdir = os.path.join(self.builddir, 'test-layer-checkout') + result = runCmd('{}/setup-layers --destdir {}'.format(self.testlayer_path, testcheckoutdir)) + # May not necessarily be named 'poky' or 'openembedded-core' + oecoredir = os.listdir(testcheckoutdir)[0] + testcheckoutfile = os.path.join(testcheckoutdir, oecoredir, "oe-init-build-env") + self.assertTrue(os.path.exists(testcheckoutfile), "File {} not found in test layer checkout".format(testcheckoutfile)) diff --git a/poky/meta/lib/oeqa/selftest/cases/bblogging.py b/poky/meta/lib/oeqa/selftest/cases/bblogging.py index 317e68b82f..1534a36a85 100644 --- a/poky/meta/lib/oeqa/selftest/cases/bblogging.py +++ b/poky/meta/lib/oeqa/selftest/cases/bblogging.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/bbtests.py b/poky/meta/lib/oeqa/selftest/cases/bbtests.py index 89267c7145..d97bda13c2 100644 --- a/poky/meta/lib/oeqa/selftest/cases/bbtests.py +++ b/poky/meta/lib/oeqa/selftest/cases/bbtests.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/binutils.py b/poky/meta/lib/oeqa/selftest/cases/binutils.py index 3b0b44b390..bf6fdca0d9 100644 --- a/poky/meta/lib/oeqa/selftest/cases/binutils.py +++ b/poky/meta/lib/oeqa/selftest/cases/binutils.py @@ -1,4 +1,8 @@ +# +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT +# import os from oeqa.core.decorator import OETestTag from oeqa.core.case import OEPTestResultTestCase diff --git a/poky/meta/lib/oeqa/selftest/cases/buildhistory.py b/poky/meta/lib/oeqa/selftest/cases/buildhistory.py index d865da6252..2d55994916 100644 --- a/poky/meta/lib/oeqa/selftest/cases/buildhistory.py +++ b/poky/meta/lib/oeqa/selftest/cases/buildhistory.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/buildoptions.py b/poky/meta/lib/oeqa/selftest/cases/buildoptions.py index ad604d6ae2..ee3e28d74b 100644 --- a/poky/meta/lib/oeqa/selftest/cases/buildoptions.py +++ b/poky/meta/lib/oeqa/selftest/cases/buildoptions.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/containerimage.py b/poky/meta/lib/oeqa/selftest/cases/containerimage.py index e0aea1a1ef..23c0a1408a 100644 --- a/poky/meta/lib/oeqa/selftest/cases/containerimage.py +++ b/poky/meta/lib/oeqa/selftest/cases/containerimage.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/cve_check.py b/poky/meta/lib/oeqa/selftest/cases/cve_check.py index d0b2213703..ac47af1990 100644 --- a/poky/meta/lib/oeqa/selftest/cases/cve_check.py +++ b/poky/meta/lib/oeqa/selftest/cases/cve_check.py @@ -1,3 +1,9 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + import json import os from oeqa.selftest.case import OESelftestTestCase diff --git a/poky/meta/lib/oeqa/selftest/cases/debuginfod.py b/poky/meta/lib/oeqa/selftest/cases/debuginfod.py new file mode 100644 index 0000000000..01359ec649 --- /dev/null +++ b/poky/meta/lib/oeqa/selftest/cases/debuginfod.py @@ -0,0 +1,44 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# +import os +import socketserver +import subprocess + +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import bitbake, get_bb_var, runqemu + +class Debuginfod(OESelftestTestCase): + def test_debuginfod(self): + self.write_config(""" +DISTRO_FEATURES:append = " debuginfod" +CORE_IMAGE_EXTRA_INSTALL += "elfutils" + """) + bitbake("core-image-minimal elfutils-native:do_addto_recipe_sysroot") + + native_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "elfutils-native") + cmd = [os.path.join(native_sysroot, "usr", "bin", "debuginfod"), "--verbose", get_bb_var("DEPLOY_DIR")] + for format in get_bb_var("PACKAGE_CLASSES").split(): + if format == "package_deb": + cmd.append("--scan-deb-dir") + elif format == "package_ipk": + cmd.append("--scan-deb-dir") + elif format == "package_rpm": + cmd.append("--scan-rpm-dir") + # Find a free port + with socketserver.TCPServer(("localhost", 0), None) as s: + port = s.server_address[1] + cmd.append("--port=%d" % port) + + try: + debuginfod = subprocess.Popen(cmd) + + with runqemu("core-image-minimal", runqemuparams="nographic") as qemu: + cmd = "DEBUGINFOD_URLS=http://%s:%d/ debuginfod-find debuginfo /usr/bin/debuginfod" % (qemu.server_ip, port) + status, output = qemu.run_serial(cmd) + # This should be more comprehensive + self.assertIn("/.cache/debuginfod_client/", output) + finally: + debuginfod.kill() diff --git a/poky/meta/lib/oeqa/selftest/cases/devtool.py b/poky/meta/lib/oeqa/selftest/cases/devtool.py index 34fc791f3a..142932e12f 100644 --- a/poky/meta/lib/oeqa/selftest/cases/devtool.py +++ b/poky/meta/lib/oeqa/selftest/cases/devtool.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # @@ -246,6 +248,22 @@ class DevtoolTestCase(OESelftestTestCase): if remaining_removelines: self.fail('Expected removed lines not found: %s' % remaining_removelines) + def _test_devtool_add_git_url(self, git_url, version, pn, resulting_src_uri): + self.track_for_cleanup(self.workspacedir) + self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') + result = runCmd('devtool add --version %s %s %s' % (version, pn, git_url)) + self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created') + # Check the recipe name is correct + recipefile = get_bb_var('FILE', pn) + self.assertIn('%s_git.bb' % pn, recipefile, 'Recipe file incorrectly named') + self.assertIn(recipefile, result.output) + # Test devtool status + result = runCmd('devtool status') + self.assertIn(pn, result.output) + self.assertIn(recipefile, result.output) + checkvars = {} + checkvars['SRC_URI'] = resulting_src_uri + self._test_recipe_contents(recipefile, checkvars, []) class DevtoolBase(DevtoolTestCase): @@ -380,6 +398,22 @@ class DevtoolAddTests(DevtoolBase): checkvars['DEPENDS'] = set(['dbus']) self._test_recipe_contents(recipefile, checkvars, []) + def test_devtool_add_git_style1(self): + version = 'v3.1.0' + pn = 'mbedtls' + # this will trigger reformat_git_uri with branch parameter in url + git_url = "'git://git@github.com/ARMmbed/mbedtls.git;branch=mbedtls-2.28;protocol=https'" + resulting_src_uri = "git://git@github.com/ARMmbed/mbedtls.git;branch=mbedtls-2.28;protocol=https" + self._test_devtool_add_git_url(git_url, version, pn, resulting_src_uri) + + def test_devtool_add_git_style2(self): + version = 'v3.1.0' + pn = 'mbedtls' + # this will trigger reformat_git_uri with branch parameter in url + git_url = "'git://git@github.com/ARMmbed/mbedtls.git;protocol=https'" + resulting_src_uri = "git://git@github.com/ARMmbed/mbedtls.git;protocol=https;branch=master" + self._test_devtool_add_git_url(git_url, version, pn, resulting_src_uri) + def test_devtool_add_library(self): # Fetch source tempdir = tempfile.mkdtemp(prefix='devtoolqa') @@ -540,7 +574,7 @@ class DevtoolAddTests(DevtoolBase): result = runCmd('devtool status') self.assertIn(testrecipe, result.output) self.assertIn(srcdir, result.output) - # Check recipe + # Check recipedevtool add recipefile = get_bb_var('FILE', testrecipe) self.assertIn('%s_%s.bb' % (testrecipe, testver), recipefile, 'Recipe file incorrectly named') checkvars = {} @@ -1923,7 +1957,6 @@ class DevtoolUpgradeTests(DevtoolBase): self._test_recipe_contents(newrecipefile, checkvars, []) # Try again - change just name this time result = runCmd('devtool reset -n %s' % newrecipename) - shutil.rmtree(newsrctree) add_recipe() newrecipefile = os.path.join(self.workspacedir, 'recipes', newrecipename, '%s_%s.bb' % (newrecipename, recipever)) result = runCmd('devtool rename %s %s' % (recipename, newrecipename)) @@ -1936,7 +1969,6 @@ class DevtoolUpgradeTests(DevtoolBase): self._test_recipe_contents(newrecipefile, checkvars, []) # Try again - change just version this time result = runCmd('devtool reset -n %s' % newrecipename) - shutil.rmtree(newsrctree) add_recipe() newrecipefile = os.path.join(self.workspacedir, 'recipes', recipename, '%s_%s.bb' % (recipename, newrecipever)) result = runCmd('devtool rename %s -V %s' % (recipename, newrecipever)) diff --git a/poky/meta/lib/oeqa/selftest/cases/distrodata.py b/poky/meta/lib/oeqa/selftest/cases/distrodata.py index b80d091c1c..b5554a6c3c 100644 --- a/poky/meta/lib/oeqa/selftest/cases/distrodata.py +++ b/poky/meta/lib/oeqa/selftest/cases/distrodata.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/eSDK.py b/poky/meta/lib/oeqa/selftest/cases/eSDK.py index 3ea0f66357..9f5de2cde7 100644 --- a/poky/meta/lib/oeqa/selftest/cases/eSDK.py +++ b/poky/meta/lib/oeqa/selftest/cases/eSDK.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/fetch.py b/poky/meta/lib/oeqa/selftest/cases/fetch.py index be14272e63..3d01cf69f2 100644 --- a/poky/meta/lib/oeqa/selftest/cases/fetch.py +++ b/poky/meta/lib/oeqa/selftest/cases/fetch.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/fitimage.py b/poky/meta/lib/oeqa/selftest/cases/fitimage.py index d732a9020d..14267dbaaa 100644 --- a/poky/meta/lib/oeqa/selftest/cases/fitimage.py +++ b/poky/meta/lib/oeqa/selftest/cases/fitimage.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/gcc.py b/poky/meta/lib/oeqa/selftest/cases/gcc.py index b9ea03ae62..6b9022e461 100644 --- a/poky/meta/lib/oeqa/selftest/cases/gcc.py +++ b/poky/meta/lib/oeqa/selftest/cases/gcc.py @@ -1,4 +1,8 @@ +# +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT +# import os from oeqa.core.decorator import OETestTag from oeqa.core.case import OEPTestResultTestCase diff --git a/poky/meta/lib/oeqa/selftest/cases/gdbserver.py b/poky/meta/lib/oeqa/selftest/cases/gdbserver.py new file mode 100644 index 0000000000..3621d9c13e --- /dev/null +++ b/poky/meta/lib/oeqa/selftest/cases/gdbserver.py @@ -0,0 +1,66 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# +import os +import time +import tempfile +import shutil +import concurrent.futures + +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import bitbake, get_bb_var, runqemu, runCmd + +class GdbServerTest(OESelftestTestCase): + def test_gdb_server(self): + target_arch = self.td["TARGET_ARCH"] + target_sys = self.td["TARGET_SYS"] + deploy_dir = get_bb_var("DEPLOY_DIR_IMAGE") + + features = """ +IMAGE_GEN_DEBUGFS = "1" +IMAGE_FSTYPES_DEBUGFS = "tar.bz2" +CORE_IMAGE_EXTRA_INSTALL = "gdbserver" + """ + self.write_config(features) + + gdb_recipe = "gdb-cross-" + target_arch + gdb_binary = target_sys + "-gdb" + + bitbake("core-image-minimal %s:do_addto_recipe_sysroot" % gdb_recipe) + + native_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", gdb_recipe) + r = runCmd("%s --version" % gdb_binary, native_sysroot=native_sysroot, target_sys=target_sys) + self.assertEqual(r.status, 0) + self.assertIn("GNU gdb", r.output) + + with tempfile.TemporaryDirectory(prefix="debugfs-") as debugfs: + filename = os.path.join(deploy_dir, "core-image-minimal-%s-dbg.tar.bz2" % self.td["MACHINE"]) + shutil.unpack_archive(filename, debugfs) + filename = os.path.join(deploy_dir, "core-image-minimal-%s.tar.bz2" % self.td["MACHINE"]) + shutil.unpack_archive(filename, debugfs) + + with runqemu("core-image-minimal", runqemuparams="nographic") as qemu: + status, output = qemu.run_serial("kmod --help") + self.assertIn("modprobe", output) + + with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor: + def run_gdb(): + for _ in range(5): + time.sleep(2) + cmd = "%s --batch -ex 'set sysroot %s' -ex \"target extended-remote %s:9999\" -ex \"info line kmod_help\"" % (gdb_binary, debugfs, qemu.ip) + self.logger.warning("starting gdb %s" % cmd) + r = runCmd(cmd, native_sysroot=native_sysroot, target_sys=target_sys) + self.assertEqual(0, r.status) + line_re = r"Line \d+ of \"/usr/src/debug/kmod/.*/tools/kmod.c\" starts at address 0x[0-9A-Fa-f]+ <kmod_help>" + self.assertRegex(r.output, line_re) + break + else: + self.fail("Timed out connecting to gdb") + future = executor.submit(run_gdb) + + status, output = qemu.run_serial("gdbserver --once :9999 kmod --help") + self.assertEqual(status, 1) + # The future either returns None, or raises an exception + future.result() diff --git a/poky/meta/lib/oeqa/selftest/cases/glibc.py b/poky/meta/lib/oeqa/selftest/cases/glibc.py index 6fc98e9cb4..a446543a17 100644 --- a/poky/meta/lib/oeqa/selftest/cases/glibc.py +++ b/poky/meta/lib/oeqa/selftest/cases/glibc.py @@ -1,4 +1,8 @@ +# +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT +# import os import contextlib from oeqa.core.decorator import OETestTag diff --git a/poky/meta/lib/oeqa/selftest/cases/gotoolchain.py b/poky/meta/lib/oeqa/selftest/cases/gotoolchain.py index 978898b86f..74c1c48117 100644 --- a/poky/meta/lib/oeqa/selftest/cases/gotoolchain.py +++ b/poky/meta/lib/oeqa/selftest/cases/gotoolchain.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/image_typedep.py b/poky/meta/lib/oeqa/selftest/cases/image_typedep.py index 5b182a8f94..17c98baf14 100644 --- a/poky/meta/lib/oeqa/selftest/cases/image_typedep.py +++ b/poky/meta/lib/oeqa/selftest/cases/image_typedep.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py b/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py index 7deafef6b2..d3fd52851c 100644 --- a/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py +++ b/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/incompatible_lic.py b/poky/meta/lib/oeqa/selftest/cases/incompatible_lic.py index 6279d74245..4edf60fc55 100644 --- a/poky/meta/lib/oeqa/selftest/cases/incompatible_lic.py +++ b/poky/meta/lib/oeqa/selftest/cases/incompatible_lic.py @@ -1,3 +1,8 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import bitbake @@ -134,7 +139,7 @@ INCOMPATIBLE_LICENSE:pn-core-image-minimal = "GPL-3.0* LGPL-3.0*" def test_core_image_full_cmdline_weston(self): self.write_config(""" -INHERIT += "testimage" +IMAGE_CLASSES += "testimage" INCOMPATIBLE_LICENSE:pn-core-image-full-cmdline = "GPL-3.0* LGPL-3.0*" INCOMPATIBLE_LICENSE:pn-core-image-weston = "GPL-3.0* LGPL-3.0*" # Settings for full-cmdline diff --git a/poky/meta/lib/oeqa/selftest/cases/intercept.py b/poky/meta/lib/oeqa/selftest/cases/intercept.py index f12874dc7d..12583c3099 100644 --- a/poky/meta/lib/oeqa/selftest/cases/intercept.py +++ b/poky/meta/lib/oeqa/selftest/cases/intercept.py @@ -1,3 +1,9 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import bitbake diff --git a/poky/meta/lib/oeqa/selftest/cases/kerneldevelopment.py b/poky/meta/lib/oeqa/selftest/cases/kerneldevelopment.py index b1623a1885..4325f38598 100644 --- a/poky/meta/lib/oeqa/selftest/cases/kerneldevelopment.py +++ b/poky/meta/lib/oeqa/selftest/cases/kerneldevelopment.py @@ -1,3 +1,9 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + import os from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import runCmd, get_bb_var diff --git a/poky/meta/lib/oeqa/selftest/cases/layerappend.py b/poky/meta/lib/oeqa/selftest/cases/layerappend.py index 8fb1e6c530..379ed589ad 100644 --- a/poky/meta/lib/oeqa/selftest/cases/layerappend.py +++ b/poky/meta/lib/oeqa/selftest/cases/layerappend.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/liboe.py b/poky/meta/lib/oeqa/selftest/cases/liboe.py index afe8f8809f..fab6929198 100644 --- a/poky/meta/lib/oeqa/selftest/cases/liboe.py +++ b/poky/meta/lib/oeqa/selftest/cases/liboe.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/lic_checksum.py b/poky/meta/lib/oeqa/selftest/cases/lic_checksum.py index 8f1226e6a5..5897a396d9 100644 --- a/poky/meta/lib/oeqa/selftest/cases/lic_checksum.py +++ b/poky/meta/lib/oeqa/selftest/cases/lic_checksum.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/manifest.py b/poky/meta/lib/oeqa/selftest/cases/manifest.py index 0a04c13a85..07a6c80489 100644 --- a/poky/meta/lib/oeqa/selftest/cases/manifest.py +++ b/poky/meta/lib/oeqa/selftest/cases/manifest.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/meta_ide.py b/poky/meta/lib/oeqa/selftest/cases/meta_ide.py index ce7bba401d..bae98359e5 100644 --- a/poky/meta/lib/oeqa/selftest/cases/meta_ide.py +++ b/poky/meta/lib/oeqa/selftest/cases/meta_ide.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/multiconfig.py b/poky/meta/lib/oeqa/selftest/cases/multiconfig.py index 83cbd1345d..f509cbf607 100644 --- a/poky/meta/lib/oeqa/selftest/cases/multiconfig.py +++ b/poky/meta/lib/oeqa/selftest/cases/multiconfig.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/newlib.py b/poky/meta/lib/oeqa/selftest/cases/newlib.py index 999e3e78b0..fe57aa51f2 100644 --- a/poky/meta/lib/oeqa/selftest/cases/newlib.py +++ b/poky/meta/lib/oeqa/selftest/cases/newlib.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/oelib/buildhistory.py b/poky/meta/lib/oeqa/selftest/cases/oelib/buildhistory.py index 33bd6df2f3..c3c15d83c0 100644 --- a/poky/meta/lib/oeqa/selftest/cases/oelib/buildhistory.py +++ b/poky/meta/lib/oeqa/selftest/cases/oelib/buildhistory.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/oelib/elf.py b/poky/meta/lib/oeqa/selftest/cases/oelib/elf.py index 5a5f9b4fdf..7bf550b6fd 100644 --- a/poky/meta/lib/oeqa/selftest/cases/oelib/elf.py +++ b/poky/meta/lib/oeqa/selftest/cases/oelib/elf.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/oelib/license.py b/poky/meta/lib/oeqa/selftest/cases/oelib/license.py index 3b359396b6..5eea12e761 100644 --- a/poky/meta/lib/oeqa/selftest/cases/oelib/license.py +++ b/poky/meta/lib/oeqa/selftest/cases/oelib/license.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/oelib/path.py b/poky/meta/lib/oeqa/selftest/cases/oelib/path.py index a1cfa08c09..b963e447e3 100644 --- a/poky/meta/lib/oeqa/selftest/cases/oelib/path.py +++ b/poky/meta/lib/oeqa/selftest/cases/oelib/path.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/oelib/types.py b/poky/meta/lib/oeqa/selftest/cases/oelib/types.py index 7eb49e6f95..58318b18b2 100644 --- a/poky/meta/lib/oeqa/selftest/cases/oelib/types.py +++ b/poky/meta/lib/oeqa/selftest/cases/oelib/types.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/oelib/utils.py b/poky/meta/lib/oeqa/selftest/cases/oelib/utils.py index bbf67bf9c9..0cb46425a0 100644 --- a/poky/meta/lib/oeqa/selftest/cases/oelib/utils.py +++ b/poky/meta/lib/oeqa/selftest/cases/oelib/utils.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/oescripts.py b/poky/meta/lib/oeqa/selftest/cases/oescripts.py index d3a789a6a7..ea08d9aff8 100644 --- a/poky/meta/lib/oeqa/selftest/cases/oescripts.py +++ b/poky/meta/lib/oeqa/selftest/cases/oescripts.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/overlayfs.py b/poky/meta/lib/oeqa/selftest/cases/overlayfs.py index 96beb8b869..bff22f21b6 100644 --- a/poky/meta/lib/oeqa/selftest/cases/overlayfs.py +++ b/poky/meta/lib/oeqa/selftest/cases/overlayfs.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/package.py b/poky/meta/lib/oeqa/selftest/cases/package.py index 51d835259e..2d1b48a15d 100644 --- a/poky/meta/lib/oeqa/selftest/cases/package.py +++ b/poky/meta/lib/oeqa/selftest/cases/package.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/pkgdata.py b/poky/meta/lib/oeqa/selftest/cases/pkgdata.py index 87d069de65..d786c33018 100644 --- a/poky/meta/lib/oeqa/selftest/cases/pkgdata.py +++ b/poky/meta/lib/oeqa/selftest/cases/pkgdata.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/prservice.py b/poky/meta/lib/oeqa/selftest/cases/prservice.py index 10158ca7c2..cb95503c2c 100644 --- a/poky/meta/lib/oeqa/selftest/cases/prservice.py +++ b/poky/meta/lib/oeqa/selftest/cases/prservice.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/pseudo.py b/poky/meta/lib/oeqa/selftest/cases/pseudo.py index 33593d5ce9..3ef8786022 100644 --- a/poky/meta/lib/oeqa/selftest/cases/pseudo.py +++ b/poky/meta/lib/oeqa/selftest/cases/pseudo.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/recipetool.py b/poky/meta/lib/oeqa/selftest/cases/recipetool.py index 510dae6bad..25b06cdcf0 100644 --- a/poky/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/poky/meta/lib/oeqa/selftest/cases/recipetool.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/recipeutils.py b/poky/meta/lib/oeqa/selftest/cases/recipeutils.py index 74b2098ae8..6334f1c91a 100644 --- a/poky/meta/lib/oeqa/selftest/cases/recipeutils.py +++ b/poky/meta/lib/oeqa/selftest/cases/recipeutils.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/reproducible.py b/poky/meta/lib/oeqa/selftest/cases/reproducible.py index 5042c11d8e..f4dd779842 100644 --- a/poky/meta/lib/oeqa/selftest/cases/reproducible.py +++ b/poky/meta/lib/oeqa/selftest/cases/reproducible.py @@ -16,6 +16,8 @@ import os import datetime exclude_packages = [ + 'rust', + 'rust-dbg' ] def is_excluded(package): diff --git a/poky/meta/lib/oeqa/selftest/cases/resulttooltests.py b/poky/meta/lib/oeqa/selftest/cases/resulttooltests.py index dac5c46801..c2e76f1a44 100644 --- a/poky/meta/lib/oeqa/selftest/cases/resulttooltests.py +++ b/poky/meta/lib/oeqa/selftest/cases/resulttooltests.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/rootfspostcommandstests.py b/poky/meta/lib/oeqa/selftest/cases/rootfspostcommandstests.py new file mode 100644 index 0000000000..44e2c09a6f --- /dev/null +++ b/poky/meta/lib/oeqa/selftest/cases/rootfspostcommandstests.py @@ -0,0 +1,97 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: MIT + +import os +import oe +import unittest +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import bitbake, get_bb_vars + +class ShadowUtilsTidyFiles(OESelftestTestCase): + """ + Check if shadow image rootfs files are tidy. + + The tests are focused on testing the functionality provided by the + 'tidy_shadowutils_files' rootfs postprocess command (via + SORT_PASSWD_POSTPROCESS_COMMAND). + """ + + def sysconf_build(self): + """ + Verify if shadow tidy files tests are to be run and if yes, build a + test image and return its sysconf rootfs path. + """ + + test_image = "core-image-minimal" + + config = 'IMAGE_CLASSES += "extrausers"\n' + config += 'EXTRA_USERS_PARAMS = "groupadd -g 1000 oeqatester; "\n' + config += 'EXTRA_USERS_PARAMS += "useradd -p \'\' -u 1000 -N -g 1000 oeqatester; "\n' + self.write_config(config) + + vars = get_bb_vars(("IMAGE_ROOTFS", "SORT_PASSWD_POSTPROCESS_COMMAND", "sysconfdir"), + test_image) + passwd_postprocess_cmd = vars["SORT_PASSWD_POSTPROCESS_COMMAND"] + self.assertIsNotNone(passwd_postprocess_cmd) + if (passwd_postprocess_cmd.strip() != 'tidy_shadowutils_files;'): + raise unittest.SkipTest("Testcase skipped as 'tidy_shadowutils_files' " + "rootfs post process command is not the set SORT_PASSWD_POSTPROCESS_COMMAND.") + + rootfs = vars["IMAGE_ROOTFS"] + self.assertIsNotNone(rootfs) + sysconfdir = vars["sysconfdir"] + bitbake(test_image) + self.assertIsNotNone(sysconfdir) + + return oe.path.join(rootfs, sysconfdir) + + def test_shadowutils_backup_files(self): + """ + Test that the rootfs doesn't include any known shadow backup files. + """ + + backup_files = ( + 'group-', + 'gshadow-', + 'passwd-', + 'shadow-', + 'subgid-', + 'subuid-', + ) + + rootfs_sysconfdir = self.sysconf_build() + found = [] + for backup_file in backup_files: + backup_filepath = oe.path.join(rootfs_sysconfdir, backup_file) + if os.path.exists(backup_filepath): + found.append(backup_file) + if (found): + raise Exception('The following shadow backup files were found in ' + 'the rootfs: %s' % found) + + def test_shadowutils_sorted_files(self): + """ + Test that the 'passwd' and the 'group' shadow utils files are ordered + by ID. + """ + + files = ( + 'passwd', + 'group', + ) + + rootfs_sysconfdir = self.sysconf_build() + unsorted = [] + for file in files: + filepath = oe.path.join(rootfs_sysconfdir, file) + with open(filepath, 'rb') as f: + ids = [] + lines = f.readlines() + for line in lines: + entries = line.split(b':') + ids.append(int(entries[2])) + if (ids != sorted(ids)): + unsorted.append(file) + if (unsorted): + raise Exception("The following files were not sorted by ID as expected: %s" % unsorted) diff --git a/poky/meta/lib/oeqa/selftest/cases/rpmtests.py b/poky/meta/lib/oeqa/selftest/cases/rpmtests.py new file mode 100644 index 0000000000..902d7dca3d --- /dev/null +++ b/poky/meta/lib/oeqa/selftest/cases/rpmtests.py @@ -0,0 +1,14 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import bitbake + +class BitbakeTests(OESelftestTestCase): + + def test_rpm_filenames(self): + test_recipe = "testrpm" + bitbake(test_recipe) diff --git a/poky/meta/lib/oeqa/selftest/cases/runcmd.py b/poky/meta/lib/oeqa/selftest/cases/runcmd.py index e9612389fe..6fd96b8485 100644 --- a/poky/meta/lib/oeqa/selftest/cases/runcmd.py +++ b/poky/meta/lib/oeqa/selftest/cases/runcmd.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/runtime_test.py b/poky/meta/lib/oeqa/selftest/cases/runtime_test.py index 857737f730..fe83b248f3 100644 --- a/poky/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/poky/meta/lib/oeqa/selftest/cases/runtime_test.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # @@ -23,7 +25,7 @@ class TestExport(OESelftestTestCase): Author: Mariano Lopez <mariano.lopez@intel.com> """ - features = 'INHERIT += "testexport"\n' + features = 'IMAGE_CLASSES += "testexport"\n' # These aren't the actual IP addresses but testexport class needs something defined features += 'TEST_SERVER_IP = "192.168.7.1"\n' features += 'TEST_TARGET_IP = "192.168.7.1"\n' @@ -64,7 +66,7 @@ class TestExport(OESelftestTestCase): Author: Mariano Lopez <mariano.lopez@intel.com> """ - features = 'INHERIT += "testexport"\n' + features = 'IMAGE_CLASSES += "testexport"\n' # These aren't the actual IP addresses but testexport class needs something defined features += 'TEST_SERVER_IP = "192.168.7.1"\n' features += 'TEST_TARGET_IP = "192.168.7.1"\n' @@ -119,7 +121,7 @@ class TestImage(OESelftestTestCase): if get_bb_var('DISTRO') == 'poky-tiny': self.skipTest('core-image-full-cmdline not buildable for poky-tiny') - features = 'INHERIT += "testimage"\n' + features = 'IMAGE_CLASSES += "testimage"\n' features += 'IMAGE_INSTALL:append = " libssl"\n' features += 'TEST_SUITES = "ping ssh selftest"\n' self.write_config(features) @@ -137,7 +139,7 @@ class TestImage(OESelftestTestCase): if get_bb_var('DISTRO') == 'poky-tiny': self.skipTest('core-image-full-cmdline not buildable for poky-tiny') - features = 'INHERIT += "testimage"\n' + features = 'IMAGE_CLASSES += "testimage"\n' features += 'TEST_SUITES = "ping ssh dnf_runtime dnf.DnfBasicTest.test_dnf_help"\n' # We don't yet know what the server ip and port will be - they will be patched # in at the start of the on-image test @@ -172,7 +174,7 @@ class TestImage(OESelftestTestCase): if get_bb_var('DISTRO') == 'poky-tiny': self.skipTest('core-image-full-cmdline not buildable for poky-tiny') - features = 'INHERIT += "testimage"\n' + features = 'IMAGE_CLASSES += "testimage"\n' features += 'TEST_SUITES = "ping ssh apt.AptRepoTest.test_apt_install_from_repo"\n' # We don't yet know what the server ip and port will be - they will be patched # in at the start of the on-image test @@ -222,7 +224,7 @@ class TestImage(OESelftestTestCase): qemu_packageconfig = get_bb_var('PACKAGECONFIG', 'qemu-system-native') qemu_distrofeatures = get_bb_var('DISTRO_FEATURES', 'qemu-system-native') - features = 'INHERIT += "testimage"\n' + features = 'IMAGE_CLASSES += "testimage"\n' if 'gtk+' not in qemu_packageconfig: features += 'PACKAGECONFIG:append:pn-qemu-system-native = " gtk+"\n' if 'sdl' not in qemu_packageconfig: @@ -267,7 +269,7 @@ class TestImage(OESelftestTestCase): except subprocess.CalledProcessError as e: self.fail("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.") qemu_distrofeatures = get_bb_var('DISTRO_FEATURES', 'qemu-system-native') - features = 'INHERIT += "testimage"\n' + features = 'IMAGE_CLASSES += "testimage"\n' if 'opengl' not in qemu_distrofeatures: features += 'DISTRO_FEATURES:append = " opengl"\n' features += 'TEST_SUITES = "ping ssh virgl"\n' diff --git a/poky/meta/lib/oeqa/selftest/cases/selftest.py b/poky/meta/lib/oeqa/selftest/cases/selftest.py index 7268e25939..a80a8651a5 100644 --- a/poky/meta/lib/oeqa/selftest/cases/selftest.py +++ b/poky/meta/lib/oeqa/selftest/cases/selftest.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/signing.py b/poky/meta/lib/oeqa/selftest/cases/signing.py index 6f3d4aeae9..322e753ed3 100644 --- a/poky/meta/lib/oeqa/selftest/cases/signing.py +++ b/poky/meta/lib/oeqa/selftest/cases/signing.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/sstate.py b/poky/meta/lib/oeqa/selftest/cases/sstate.py index 176766331a..e73bb94884 100644 --- a/poky/meta/lib/oeqa/selftest/cases/sstate.py +++ b/poky/meta/lib/oeqa/selftest/cases/sstate.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/sstatetests.py b/poky/meta/lib/oeqa/selftest/cases/sstatetests.py index 63827f3068..ae766f91bd 100644 --- a/poky/meta/lib/oeqa/selftest/cases/sstatetests.py +++ b/poky/meta/lib/oeqa/selftest/cases/sstatetests.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # @@ -384,8 +386,7 @@ BB_SIGNATURE_HANDLER = "OEBasicHash" self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash2") bitbake("world meta-toolchain -S none") - def get_files(d): - f = {} + def get_files(d, result): for root, dirs, files in os.walk(d): for name in files: if "meta-environment" in root or "cross-canadian" in root: @@ -393,23 +394,22 @@ BB_SIGNATURE_HANDLER = "OEBasicHash" if "do_build" not in name: # 1.4.1+gitAUTOINC+302fca9f4c-r0.do_package_write_ipk.sigdata.f3a2a38697da743f0dbed8b56aafcf79 (_, task, _, shash) = name.rsplit(".", 3) - f[os.path.join(os.path.basename(root), task)] = shash - return f + result[os.path.join(os.path.basename(root), task)] = shash - nativesdkdir = os.path.basename(glob.glob(self.topdir + "/tmp-sstatesamehash/stamps/*-nativesdk*-linux")[0]) + files1 = {} + files2 = {} + subdirs = sorted(glob.glob(self.topdir + "/tmp-sstatesamehash/stamps/*-nativesdk*-linux")) + if allarch: + subdirs.extend(sorted(glob.glob(self.topdir + "/tmp-sstatesamehash/stamps/all-*-linux"))) + + for subdir in subdirs: + nativesdkdir = os.path.basename(subdir) + get_files(self.topdir + "/tmp-sstatesamehash/stamps/" + nativesdkdir, files1) + get_files(self.topdir + "/tmp-sstatesamehash2/stamps/" + nativesdkdir, files2) - files1 = get_files(self.topdir + "/tmp-sstatesamehash/stamps/" + nativesdkdir) - files2 = get_files(self.topdir + "/tmp-sstatesamehash2/stamps/" + nativesdkdir) self.maxDiff = None self.assertEqual(files1, files2) - if allarch: - allarchdir = os.path.basename(glob.glob(self.topdir + "/tmp-sstatesamehash/stamps/all-*-linux")[0]) - - files1 = get_files(self.topdir + "/tmp-sstatesamehash/stamps/" + allarchdir) - files2 = get_files(self.topdir + "/tmp-sstatesamehash2/stamps/" + allarchdir) - self.assertEqual(files1, files2) - def test_sstate_sametune_samesigs(self): """ The sstate checksums of two identical machines (using the same tune) should be the diff --git a/poky/meta/lib/oeqa/selftest/cases/sysroot.py b/poky/meta/lib/oeqa/selftest/cases/sysroot.py index 294ba4a4a0..ef854f6fee 100644 --- a/poky/meta/lib/oeqa/selftest/cases/sysroot.py +++ b/poky/meta/lib/oeqa/selftest/cases/sysroot.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/tinfoil.py b/poky/meta/lib/oeqa/selftest/cases/tinfoil.py index c81d56d82b..0a66615fd1 100644 --- a/poky/meta/lib/oeqa/selftest/cases/tinfoil.py +++ b/poky/meta/lib/oeqa/selftest/cases/tinfoil.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/selftest/cases/wic.py b/poky/meta/lib/oeqa/selftest/cases/wic.py index 53058df226..0d664d7c39 100644 --- a/poky/meta/lib/oeqa/selftest/cases/wic.py +++ b/poky/meta/lib/oeqa/selftest/cases/wic.py @@ -1420,7 +1420,7 @@ class ModifyTests(WicTestCase): # list directory content of the first partition result = runCmd("wic ls %s:1 -n %s" % (images[0], sysroot)) - self.assertIn('\n%s ' % kerneltype.upper(), result.output) + self.assertIn('\n%s ' % kerneltype.upper(), result.output) self.assertIn('\nEFI <DIR> ', result.output) # remove file. EFI partitions are case-insensitive so exercise that too diff --git a/poky/meta/lib/oeqa/selftest/cases/wrapper.py b/poky/meta/lib/oeqa/selftest/cases/wrapper.py index 6de63310c0..f2be44262c 100644 --- a/poky/meta/lib/oeqa/selftest/cases/wrapper.py +++ b/poky/meta/lib/oeqa/selftest/cases/wrapper.py @@ -1,3 +1,8 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import bitbake diff --git a/poky/meta/lib/oeqa/utils/__init__.py b/poky/meta/lib/oeqa/utils/__init__.py index 6d1ec4cb99..fbc7f7d525 100644 --- a/poky/meta/lib/oeqa/utils/__init__.py +++ b/poky/meta/lib/oeqa/utils/__init__.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # # Enable other layers to have modules in the same named directory diff --git a/poky/meta/lib/oeqa/utils/commands.py b/poky/meta/lib/oeqa/utils/commands.py index 024261410e..f733fcdf3c 100644 --- a/poky/meta/lib/oeqa/utils/commands.py +++ b/poky/meta/lib/oeqa/utils/commands.py @@ -168,15 +168,22 @@ class Result(object): def runCmd(command, ignore_status=False, timeout=None, assert_error=True, sync=True, - native_sysroot=None, limit_exc_output=0, output_log=None, **options): + native_sysroot=None, target_sys=None, limit_exc_output=0, output_log=None, **options): result = Result() if native_sysroot: - extra_paths = "%s/sbin:%s/usr/sbin:%s/usr/bin" % \ - (native_sysroot, native_sysroot, native_sysroot) - nenv = dict(options.get('env', os.environ)) - nenv['PATH'] = extra_paths + ':' + nenv.get('PATH', '') - options['env'] = nenv + new_env = dict(options.get('env', os.environ)) + paths = new_env["PATH"].split(":") + paths = [ + os.path.join(native_sysroot, "bin"), + os.path.join(native_sysroot, "sbin"), + os.path.join(native_sysroot, "usr", "bin"), + os.path.join(native_sysroot, "usr", "sbin"), + ] + paths + if target_sys: + paths = [os.path.join(native_sysroot, "usr", "bin", target_sys)] + paths + new_env["PATH"] = ":".join(paths) + options['env'] = new_env cmd = Command(command, timeout=timeout, output_log=output_log, **options) cmd.run() diff --git a/poky/meta/lib/oeqa/utils/dump.py b/poky/meta/lib/oeqa/utils/dump.py index 95a79a571c..bcee03b576 100644 --- a/poky/meta/lib/oeqa/utils/dump.py +++ b/poky/meta/lib/oeqa/utils/dump.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/utils/ftools.py b/poky/meta/lib/oeqa/utils/ftools.py index 3093419cc7..a50aaa84c2 100644 --- a/poky/meta/lib/oeqa/utils/ftools.py +++ b/poky/meta/lib/oeqa/utils/ftools.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/utils/httpserver.py b/poky/meta/lib/oeqa/utils/httpserver.py index 58d3c3b3f8..8ce1dd42f4 100644 --- a/poky/meta/lib/oeqa/utils/httpserver.py +++ b/poky/meta/lib/oeqa/utils/httpserver.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/utils/logparser.py b/poky/meta/lib/oeqa/utils/logparser.py index 879aefca33..7cb79a8402 100644 --- a/poky/meta/lib/oeqa/utils/logparser.py +++ b/poky/meta/lib/oeqa/utils/logparser.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/utils/network.py b/poky/meta/lib/oeqa/utils/network.py index 59d01723a1..da4ffda9a9 100644 --- a/poky/meta/lib/oeqa/utils/network.py +++ b/poky/meta/lib/oeqa/utils/network.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/utils/nfs.py b/poky/meta/lib/oeqa/utils/nfs.py index a37686c914..c1218656ce 100644 --- a/poky/meta/lib/oeqa/utils/nfs.py +++ b/poky/meta/lib/oeqa/utils/nfs.py @@ -1,4 +1,8 @@ +# +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT +# import os import sys import tempfile diff --git a/poky/meta/lib/oeqa/utils/package_manager.py b/poky/meta/lib/oeqa/utils/package_manager.py index 6b67f22fdd..db799b64d6 100644 --- a/poky/meta/lib/oeqa/utils/package_manager.py +++ b/poky/meta/lib/oeqa/utils/package_manager.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # diff --git a/poky/meta/lib/oeqa/utils/qemurunner.py b/poky/meta/lib/oeqa/utils/qemurunner.py index 76296d50cd..4c3d2010fb 100644 --- a/poky/meta/lib/oeqa/utils/qemurunner.py +++ b/poky/meta/lib/oeqa/utils/qemurunner.py @@ -618,6 +618,8 @@ class QemuRunner: return self.qmp.cmd(command) def run_serial(self, command, raw=False, timeout=60): + # Returns (status, output) where status is 1 on success and 0 on error + # We assume target system have echo to get command status if not raw: command = "%s; echo $?\n" % command diff --git a/poky/meta/lib/oeqa/utils/subprocesstweak.py b/poky/meta/lib/oeqa/utils/subprocesstweak.py index b47975a4bc..3e43ed547b 100644 --- a/poky/meta/lib/oeqa/utils/subprocesstweak.py +++ b/poky/meta/lib/oeqa/utils/subprocesstweak.py @@ -1,4 +1,6 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: MIT # import subprocess diff --git a/poky/meta/lib/rootfspostcommands.py b/poky/meta/lib/rootfspostcommands.py index fdb9f5b850..5386eea409 100644 --- a/poky/meta/lib/rootfspostcommands.py +++ b/poky/meta/lib/rootfspostcommands.py @@ -1,16 +1,19 @@ # +# Copyright OpenEmbedded Contributors +# # SPDX-License-Identifier: GPL-2.0-only # import os -def sort_file(filename, mapping): +def sort_shadowutils_file(filename, mapping): """ Sorts a passwd or group file based on the numeric ID in the third column. If a mapping is given, the name from the first column is mapped via that dictionary instead (necessary for /etc/shadow and /etc/gshadow). If not, a new mapping is created on the fly and returned. """ + new_mapping = {} with open(filename, 'rb+') as f: lines = f.readlines() @@ -31,30 +34,57 @@ def sort_file(filename, mapping): # We overwrite the entire file, i.e. no truncate() necessary. f.seek(0) f.write(b''.join(lines)) + return new_mapping -def remove_backup(filename): +def sort_shadowutils_files(sysconfdir): """ - Removes the backup file for files like /etc/passwd. + Sorts shadow-utils 'passwd' and 'group' files in a rootfs' /etc directory + by ID. """ - backup_filename = filename + '-' - if os.path.exists(backup_filename): - os.unlink(backup_filename) -def sort_passwd(sysconfdir): - """ - Sorts passwd and group files in a rootfs /etc directory by ID. - Backup files are sometimes are inconsistent and then cannot be - sorted (YOCTO #11043), and more importantly, are not needed in - the initial rootfs, so they get deleted. - """ for main, shadow in (('passwd', 'shadow'), ('group', 'gshadow')): filename = os.path.join(sysconfdir, main) - remove_backup(filename) if os.path.exists(filename): - mapping = sort_file(filename, None) + mapping = sort_shadowutils_file(filename, None) filename = os.path.join(sysconfdir, shadow) - remove_backup(filename) if os.path.exists(filename): - sort_file(filename, mapping) + sort_shadowutils_file(filename, mapping) + +def remove_shadowutils_backup_file(filename): + """ + Remove shadow-utils backup file for files like /etc/passwd. + """ + + backup_filename = filename + '-' + if os.path.exists(backup_filename): + os.unlink(backup_filename) + +def remove_shadowutils_backup_files(sysconfdir): + """ + Remove shadow-utils backup files in a rootfs /etc directory. They are not + needed in the initial root filesystem and sorting them can be inconsistent + (YOCTO #11043). + """ + + for filename in ( + 'group', + 'gshadow', + 'passwd', + 'shadow', + 'subgid', + 'subuid', + ): + filepath = os.path.join(sysconfdir, filename) + remove_shadowutils_backup_file(filepath) + +def tidy_shadowutils_files(sysconfdir): + """ + Tidy up shadow-utils files. + """ + + remove_shadowutils_backup_files(sysconfdir) + sort_shadowutils_files(sysconfdir) + + return True |