diff options
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/bblayers/templates/layer.conf | 2 | ||||
-rw-r--r-- | meta/lib/oe/package.py | 3 | ||||
-rw-r--r-- | meta/lib/oe/package_manager.py | 40 | ||||
-rw-r--r-- | meta/lib/oe/patch.py | 1 | ||||
-rw-r--r-- | meta/lib/oe/sdk.py | 85 | ||||
-rw-r--r-- | meta/lib/oeqa/runtime/cases/buildcpio.py | 3 | ||||
-rw-r--r-- | meta/lib/oeqa/runtime/cases/kernelmodule.py | 2 |
7 files changed, 119 insertions, 17 deletions
diff --git a/meta/lib/bblayers/templates/layer.conf b/meta/lib/bblayers/templates/layer.conf index e0d9ba2fde..3c0300226c 100644 --- a/meta/lib/bblayers/templates/layer.conf +++ b/meta/lib/bblayers/templates/layer.conf @@ -2,7 +2,7 @@ BBPATH .= ":${LAYERDIR}" # We have recipes-* directories, add to BBFILES -BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \\ +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ ${LAYERDIR}/recipes-*/*/*.bbappend" BBFILE_COLLECTIONS += "%s" diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index 1e5c3aa8e1..4f3e21ad40 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py @@ -72,8 +72,7 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped= # 16 - kernel module def is_elf(path): exec_type = 0 - ret, result = oe.utils.getstatusoutput( - "file \"%s\"" % path.replace("\"", "\\\"")) + ret, result = oe.utils.getstatusoutput("file -b '%s'" % path) if ret: bb.error("split_and_strip_files: 'file %s' failed" % path) diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index 6cbb61fd84..b2aab15189 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py @@ -371,6 +371,29 @@ class PackageManager(object, metaclass=ABCMeta): pass """ + Install all packages that match a glob. + """ + def install_glob(self, globs, sdk=False): + # TODO don't have sdk here but have a property on the superclass + # (and respect in install_complementary) + if sdk: + pkgdatadir = self.d.expand("${TMPDIR}/pkgdata/${SDK_SYS}") + else: + pkgdatadir = self.d.getVar("PKGDATA_DIR") + + try: + bb.note("Installing globbed packages...") + cmd = ["oe-pkgdata-util", "-p", pkgdatadir, "list-pkgs", globs] + pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf-8") + self.install(pkgs.split(), attempt_only=True) + except subprocess.CalledProcessError as e: + # Return code 1 means no packages matched + if e.returncode != 1: + bb.fatal("Could not compute globbed packages list. Command " + "'%s' returned %d:\n%s" % + (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) + + """ Install complementary packages based upon the list of currently installed packages e.g. locales, *-dev, *-dbg, etc. This will only attempt to install these packages, if they don't exist then no error will occur. Note: every @@ -402,7 +425,7 @@ class PackageManager(object, metaclass=ABCMeta): installed_pkgs.write(output) installed_pkgs.flush() - cmd = [bb.utils.which(os.getenv('PATH'), "oe-pkgdata-util"), + cmd = ["oe-pkgdata-util", "-p", self.d.getVar('PKGDATA_DIR'), "glob", installed_pkgs.name, globs] exclude = self.d.getVar('PACKAGE_EXCLUDE_COMPLEMENTARY') @@ -412,11 +435,11 @@ class PackageManager(object, metaclass=ABCMeta): bb.note("Installing complementary packages ...") bb.note('Running %s' % cmd) complementary_pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf-8") + self.install(complementary_pkgs.split(), attempt_only=True) except subprocess.CalledProcessError as e: bb.fatal("Could not compute complementary packages list. Command " "'%s' returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) - self.install(complementary_pkgs.split(), attempt_only=True) def deploy_dir_lock(self): if self.deploy_dir is None: @@ -462,7 +485,8 @@ class RpmPM(PackageManager): task_name='target', providename=None, arch_var=None, - os_var=None): + os_var=None, + rpm_repo_workdir="oe-rootfs-repo"): super(RpmPM, self).__init__(d) self.target_rootfs = target_rootfs self.target_vendor = target_vendor @@ -476,7 +500,7 @@ class RpmPM(PackageManager): else: self.primary_arch = self.d.getVar('MACHINE_ARCH') - self.rpm_repo_dir = oe.path.join(self.d.getVar('WORKDIR'), "oe-rootfs-repo") + self.rpm_repo_dir = oe.path.join(self.d.getVar('WORKDIR'), rpm_repo_workdir) bb.utils.mkdirhier(self.rpm_repo_dir) oe.path.symlink(self.d.getVar('DEPLOY_DIR_RPM'), oe.path.join(self.rpm_repo_dir, "rpm"), True) @@ -553,7 +577,7 @@ class RpmPM(PackageManager): gpg_opts += 'repo_gpgcheck=1\n' gpg_opts += 'gpgkey=file://%s/pki/packagefeed-gpg/PACKAGEFEED-GPG-KEY-%s-%s\n' % (self.d.getVar('sysconfdir'), self.d.getVar('DISTRO'), self.d.getVar('DISTRO_CODENAME')) - if self.d.getVar('RPM_SIGN_PACKAGES') == '0': + if self.d.getVar('RPM_SIGN_PACKAGES') != '1': gpg_opts += 'gpgcheck=0\n' bb.utils.mkdirhier(oe.path.join(self.target_rootfs, "etc", "yum.repos.d")) @@ -692,7 +716,7 @@ class RpmPM(PackageManager): return packages def update(self): - self._invoke_dnf(["makecache"]) + self._invoke_dnf(["makecache", "--refresh"]) def _invoke_dnf(self, dnf_args, fatal = True, print_output = True ): os.environ['RPM_ETCCONFIGDIR'] = self.target_rootfs @@ -1065,7 +1089,7 @@ class OpkgPM(OpkgDpkgPM): output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT).decode("utf-8") bb.note(output) except subprocess.CalledProcessError as e: - (bb.fatal, bb.note)[attempt_only]("Unable to install packages. " + (bb.fatal, bb.warn)[attempt_only]("Unable to install packages. " "Command '%s' returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8"))) @@ -1364,7 +1388,7 @@ class DpkgPM(OpkgDpkgPM): bb.note("Installing the following packages: %s" % ' '.join(pkgs)) subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: - (bb.fatal, bb.note)[attempt_only]("Unable to install packages. " + (bb.fatal, bb.warn)[attempt_only]("Unable to install packages. " "Command '%s' returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8"))) diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index f1ab3dd809..584bf6c05f 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py @@ -1,4 +1,5 @@ import oe.path +import oe.types class NotFoundError(bb.BBHandledException): def __init__(self, path): diff --git a/meta/lib/oe/sdk.py b/meta/lib/oe/sdk.py index 30e1fb5316..7f71cfba6a 100644 --- a/meta/lib/oe/sdk.py +++ b/meta/lib/oe/sdk.py @@ -7,6 +7,51 @@ import shutil import glob import traceback +def generate_locale_archive(d, rootfs): + # Pretty sure we don't need this for SDK archive generation but + # keeping it to be safe... + target_arch = d.getVar('SDK_ARCH') + locale_arch_options = { \ + "arm": ["--uint32-align=4", "--little-endian"], + "armeb": ["--uint32-align=4", "--big-endian"], + "aarch64": ["--uint32-align=4", "--little-endian"], + "aarch64_be": ["--uint32-align=4", "--big-endian"], + "sh4": ["--uint32-align=4", "--big-endian"], + "powerpc": ["--uint32-align=4", "--big-endian"], + "powerpc64": ["--uint32-align=4", "--big-endian"], + "mips": ["--uint32-align=4", "--big-endian"], + "mipsisa32r6": ["--uint32-align=4", "--big-endian"], + "mips64": ["--uint32-align=4", "--big-endian"], + "mipsisa64r6": ["--uint32-align=4", "--big-endian"], + "mipsel": ["--uint32-align=4", "--little-endian"], + "mipsisa32r6el": ["--uint32-align=4", "--little-endian"], + "mips64el": ["--uint32-align=4", "--little-endian"], + "mipsisa64r6el": ["--uint32-align=4", "--little-endian"], + "i586": ["--uint32-align=4", "--little-endian"], + "i686": ["--uint32-align=4", "--little-endian"], + "x86_64": ["--uint32-align=4", "--little-endian"] + } + if target_arch in locale_arch_options: + arch_options = locale_arch_options[target_arch] + else: + bb.error("locale_arch_options not found for target_arch=" + target_arch) + bb.fatal("unknown arch:" + target_arch + " for locale_arch_options") + + localedir = oe.path.join(rootfs, d.getVar("libdir_nativesdk"), "locale") + # Need to set this so cross-localedef knows where the archive is + env = dict(os.environ) + env["LOCALEARCHIVE"] = oe.path.join(localedir, "locale-archive") + + for name in os.listdir(localedir): + path = os.path.join(localedir, name) + if os.path.isdir(path): + try: + cmd = ["cross-localedef", "--verbose"] + cmd += arch_options + cmd += ["--add-to-archive", path] + subprocess.check_output(cmd, env=env, stderr=subprocess.STDOUT) + except Exception as e: + bb.fatal("Cannot create locale archive: %s" % e.output) class Sdk(object, metaclass=ABCMeta): def __init__(self, d, manifest_dir): @@ -84,8 +129,32 @@ class Sdk(object, metaclass=ABCMeta): bb.debug(1, "printing the stack trace\n %s" %traceback.format_exc()) bb.warn("cannot remove SDK dir: %s" % path) + def install_locales(self, pm): + # This is only relevant for glibc + if self.d.getVar("TCLIBC") != "glibc": + return + + linguas = self.d.getVar("SDKIMAGE_LINGUAS") + if linguas: + import fnmatch + # Install the binary locales + if linguas == "all": + pm.install_glob("nativesdk-glibc-binary-localedata-*.utf-8", sdk=True) + else: + for lang in linguas.split(): + pm.install("nativesdk-glibc-binary-localedata-%s.utf-8" % lang) + # Generate a locale archive of them + generate_locale_archive(self.d, oe.path.join(self.sdk_host_sysroot, self.sdk_native_path)) + # And now delete the binary locales + pkgs = fnmatch.filter(pm.list_installed(), "nativesdk-glibc-binary-localedata-*.utf-8") + pm.remove(pkgs) + else: + # No linguas so do nothing + pass + + class RpmSdk(Sdk): - def __init__(self, d, manifest_dir=None): + def __init__(self, d, manifest_dir=None, rpm_workdir="oe-sdk-repo"): super(RpmSdk, self).__init__(d, manifest_dir) self.target_manifest = RpmManifest(d, self.manifest_dir, @@ -100,11 +169,17 @@ class RpmSdk(Sdk): 'pkgconfig' ] + rpm_repo_workdir = "oe-sdk-repo" + if "sdk_ext" in d.getVar("BB_RUNTASK"): + rpm_repo_workdir = "oe-sdk-ext-repo" + + self.target_pm = RpmPM(d, self.sdk_target_sysroot, self.d.getVar('TARGET_VENDOR'), 'target', - target_providename + target_providename, + rpm_repo_workdir=rpm_repo_workdir ) sdk_providename = ['/bin/sh', @@ -122,7 +197,8 @@ class RpmSdk(Sdk): 'host', sdk_providename, "SDK_PACKAGE_ARCHS", - "SDK_OS" + "SDK_OS", + rpm_repo_workdir=rpm_repo_workdir ) def _populate_sysroot(self, pm, manifest): @@ -159,6 +235,7 @@ class RpmSdk(Sdk): bb.note("Installing NATIVESDK packages") self._populate_sysroot(self.host_pm, self.host_manifest) + self.install_locales(self.host_pm) execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_HOST_COMMAND")) @@ -242,6 +319,7 @@ class OpkgSdk(Sdk): bb.note("Installing NATIVESDK packages") self._populate_sysroot(self.host_pm, self.host_manifest) + self.install_locales(self.host_pm) execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_HOST_COMMAND")) @@ -328,6 +406,7 @@ class DpkgSdk(Sdk): bb.note("Installing NATIVESDK packages") self._populate_sysroot(self.host_pm, self.host_manifest) + self.install_locales(self.host_pm) execute_pre_post_process(self.d, self.d.getVar("POPULATE_SDK_POST_HOST_COMMAND")) diff --git a/meta/lib/oeqa/runtime/cases/buildcpio.py b/meta/lib/oeqa/runtime/cases/buildcpio.py index 59edc9c2c1..79b22d04dd 100644 --- a/meta/lib/oeqa/runtime/cases/buildcpio.py +++ b/meta/lib/oeqa/runtime/cases/buildcpio.py @@ -9,8 +9,7 @@ class BuildCpioTest(OERuntimeTestCase): @classmethod def setUpClass(cls): - uri = 'https://ftp.gnu.org/gnu/cpio' - uri = '%s/cpio-2.12.tar.bz2' % uri + uri = 'https://downloads.yoctoproject.org/mirror/sources/cpio-2.12.tar.gz' cls.project = TargetBuildProject(cls.tc.target, uri, dl_dir = cls.tc.td['DL_DIR']) diff --git a/meta/lib/oeqa/runtime/cases/kernelmodule.py b/meta/lib/oeqa/runtime/cases/kernelmodule.py index 11ad7b7f01..de1a5aa445 100644 --- a/meta/lib/oeqa/runtime/cases/kernelmodule.py +++ b/meta/lib/oeqa/runtime/cases/kernelmodule.py @@ -28,7 +28,7 @@ class KernelModuleTest(OERuntimeTestCase): @OETestDepends(['gcc.GccCompileTest.test_gcc_compile']) def test_kernel_module(self): cmds = [ - 'cd /usr/src/kernel && make scripts', + 'cd /usr/src/kernel && make scripts prepare', 'cd /tmp && make', 'cd /tmp && insmod hellomod.ko', 'lsmod | grep hellomod', |