From 5687902b016bae43a46bd34eb243ff7bcadc0f99 Mon Sep 17 00:00:00 2001 From: Uladzimir Bely Date: Wed, 12 Jul 2023 11:18:43 +0300 Subject: [PATCH 1/2] Remove buildchroot dependency from npm.bbclass Switch from buildchroot to npm-flavored sbuild chroot for preparing and building npm packages. Signed-off-by: Uladzimir Bely [Jan: rebased] Signed-off-by: Jan Kiszka --- classes/npm.bbclass | 65 +++++++-------------------------------------- 1 file changed, 10 insertions(+), 55 deletions(-) diff --git a/classes/npm.bbclass b/classes/npm.bbclass index cf3083133..3bc2e39bf 100644 --- a/classes/npm.bbclass +++ b/classes/npm.bbclass @@ -8,7 +8,6 @@ # - cp package-lock.json /path/to/recipe/files/npm-shrinkwrap.json inherit dpkg-raw -inherit buildchroot NPMPN ?= "${PN}" NPM_SHRINKWRAP ?= "file://npm-shrinkwrap.json" @@ -71,43 +70,26 @@ python() { d.setVar('NPM_MAPPED_NAME', mapped_name) } -BUILDROOT = "${BUILDCHROOT_DIR}/${PP}" +SCHROOT_MOUNTS = "${WORKDIR}" npm_fetch_do_mounts() { - mkdir -p ${BUILDROOT} - sudo mount --bind ${WORKDIR} ${BUILDROOT} - - buildchroot_do_mounts + schroot_create_configs + insert_mounts } npm_fetch_undo_mounts() { - i=0 - while ! sudo umount ${BUILDROOT}; do - sleep 0.1 - if [ `expr $i % 100` -eq 0 ] ; then - bbwarn "${BUILDROOT}: Couldn't unmount ($i), retrying..." - fi - if [ $i -ge 10000 ]; then - bbfatal "${BUILDROOT}: Couldn't unmount after timeout" - fi - i=`expr $i + 1` - done - sudo rmdir ${BUILDROOT} + remove_mounts + schroot_delete_configs } def get_npm_bundled_tgz(d): return "{0}-{1}-bundled.tgz".format(d.getVar('NPM_MAPPED_NAME'), d.getVar('PV')) -def runcmd(d, cmd, dir): +def runcmd(d, cmd): import subprocess - import os - uid = os.geteuid() - gid = os.getegid() - chrootcmd = "sudo -E chroot --userspec={0}:{1} ".format(uid, gid) - chrootcmd += d.getVar('BUILDCHROOT_DIR') - chrootcmd += " sh -c 'cd {0}/{1}; {2}'".format(d.getVar('PP'), dir, cmd) + chrootcmd = "schroot -c {0} -- {1}".format(d.getVar('SBUILD_CHROOT'), cmd) bb.note("Running " + chrootcmd) (retval, output) = subprocess.getstatusoutput(chrootcmd) if retval: @@ -125,34 +107,6 @@ def apply_mirrors_in_shrinkwrap(path, pattern, subst): with open(path, 'w') as f: json.dump(data, f, indent=2) -do_install_npm() { - install_cmd="sudo -E chroot ${BUILDCHROOT_DIR} \ - apt-get install -y -o Debug::pkgProblemResolver=yes \ - --no-install-recommends" - - npm_fetch_do_mounts - - E="${@ bb.utils.export_proxies(d)}" - deb_dl_dir_import "${BUILDCHROOT_DIR}" ${BASE_DISTRO}-${BASE_DISTRO_CODENAME} - sudo -E chroot ${BUILDCHROOT_DIR} \ - apt-get update \ - -o Dir::Etc::sourcelist="sources.list.d/isar-apt.list" \ - -o Dir::Etc::sourceparts="-" \ - -o APT::Get::List-Cleanup="0" - ${install_cmd} --download-only ${NPM_CLASS_PACKAGE} - deb_dl_dir_export "${BUILDCHROOT_DIR}" ${BASE_DISTRO}-${BASE_DISTRO_CODENAME} - ${install_cmd} ${NPM_CLASS_PACKAGE} - - npm_fetch_undo_mounts -} -do_install_npm[depends] += "${BUILDCHROOT_DEP}" -do_install_npm[depends] += "${@d.getVarFlag('do_apt_fetch', 'depends')}" -do_install_npm[depends] += "${@(d.getVar('NPM_CLASS_PACKAGE') + ':do_deploy_deb') if d.getVar('OWN_NPM_CLASS_PACKAGE') == '1' else ''}" -do_install_npm[lockfiles] += "${REPO_ISAR_DIR}/isar.lock" -do_install_npm[network] += "${TASK_USE_SUDO}" - -addtask install_npm before do_fetch - python fetch_npm() { import json, os, shutil, re @@ -212,7 +166,7 @@ python fetch_npm() { json_objs = {'dependencies': { npmpn: '' }} json.dump(json_objs, outfile, indent=2) - runcmd(d, "npm ci --global-style --ignore-scripts --verbose", "fetch-tmp") + runcmd(d, "npm ci --global-style --ignore-scripts --verbose") package_filename = "node_modules/" + npmpn + "/package.json" with open(package_filename) as infile: @@ -228,7 +182,7 @@ python fetch_npm() { os.rename("node_modules/" + npmpn, "package") - runcmd(d, "tar czf package.tgz --exclude .bin package", "fetch-tmp") + runcmd(d, "tar czf package.tgz --exclude .bin package") shutil.copyfile("package.tgz", bundled_tgz) with open(bundled_tgz_hash, 'w') as hash_file: @@ -239,6 +193,7 @@ python fetch_npm() { } do_fetch[postfuncs] += "fetch_npm" do_fetch[cleandirs] += "${WORKDIR}/fetch-tmp" +do_fetch[depends] += "${SCHROOT_DEP}" python clean_npm() { import os From b0b296b8bc43de020ec18063361fac4da43b5d59 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Thu, 12 Oct 2023 09:04:25 +0200 Subject: [PATCH 2/2] Update Isar and isar-cip-core revisions With our last dependency on buildchroot gone, we can bump Isar as well. One patch is needed for it to cure a regression there. This also implies to update isar-cip-core which had buildchroot traces in the past. No other impact on us. Signed-off-by: Jan Kiszka --- .../0001-dpkg-source-Drop-I-filter.patch | 30 +++++++++++++++++++ kas/iot2050.yml | 6 ++-- 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 isar-patches/0001-dpkg-source-Drop-I-filter.patch diff --git a/isar-patches/0001-dpkg-source-Drop-I-filter.patch b/isar-patches/0001-dpkg-source-Drop-I-filter.patch new file mode 100644 index 000000000..9a734a4fe --- /dev/null +++ b/isar-patches/0001-dpkg-source-Drop-I-filter.patch @@ -0,0 +1,30 @@ +From f8f39f9722ebc24cd41e6c41bb22f8ebe9295414 Mon Sep 17 00:00:00 2001 +From: Jan Kiszka +Date: Thu, 12 Oct 2023 13:17:32 +0200 +Subject: [PATCH] dpkg-source: Drop -I filter + +This is a regression of 38b832ad8248 which added this while factoring +out this step. However, some packages may break over this, e.g. the +edk2-standalonemm-rpmb recipe in isar-cip-core. + +Signed-off-by: Jan Kiszka +--- + meta/classes/dpkg-source.bbclass | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/meta/classes/dpkg-source.bbclass b/meta/classes/dpkg-source.bbclass +index 1f4f8164..a86b4635 100644 +--- a/meta/classes/dpkg-source.bbclass ++++ b/meta/classes/dpkg-source.bbclass +@@ -12,7 +12,7 @@ do_dpkg_source() { + if [ ! -z "${SOURCE_DATE_EPOCH}" ]; then + export SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH}" + fi +- sh -c "cd ${WORKDIR}; dpkg-source -I -b ${PPS}" ++ sh -c "cd ${WORKDIR}; dpkg-source -b ${PPS}" + } + addtask dpkg_source after do_prepare_build before do_dpkg_build + +-- +2.35.3 + diff --git a/kas/iot2050.yml b/kas/iot2050.yml index e6de729cb..717ffe7b7 100644 --- a/kas/iot2050.yml +++ b/kas/iot2050.yml @@ -27,7 +27,7 @@ repos: isar: url: https://github.com/ilbers/isar - commit: ecc7cae423a828d294575301c1584fbe303cba3e + commit: 6b6c74411074e3d3a08f044e681c3f1216727b6e layers: meta: patches: @@ -35,10 +35,12 @@ repos: path: isar-patches/0001-optee-client-Fix-native-arm64-build.patch 02: path: isar-patches/0001-meta-optee-client-Generalize-and-update-shutdown-rul.patch + 03: + path: isar-patches/0001-dpkg-source-Drop-I-filter.patch cip-core: url: https://gitlab.com/cip-project/cip-core/isar-cip-core.git - commit: 7d3a05b3351726c5c76912f5c73d4720f4a46b18 + commit: 3d8e24c0cc6cb811b57648bd356bce2ae5e94795 local_conf_header: standard: |