* [PATCH v3 1/6] isar-apt: Move cleanup to postprocessing
2023-02-13 7:40 [PATCH v3 0/6] Imager schroot migration Anton Mikanovich
@ 2023-02-13 7:40 ` Anton Mikanovich
2023-02-13 7:40 ` [PATCH v3 2/6] imager: Migrate from buildchroot to schroot Anton Mikanovich
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Anton Mikanovich @ 2023-02-13 7:40 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
As isar-apt now used only for packages install move its cleanup stage
from finalize task to postprocessing.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
meta/classes/image.bbclass | 5 -----
meta/classes/rootfs.bbclass | 12 ++++++++++++
.../recipes-devtools/sbuild-chroot/sbuild-chroot.inc | 1 +
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 539ec51..f47e301 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -435,11 +435,6 @@ do_rootfs_finalize() {
mountpoint -q '${ROOTFSDIR}/sys' && \
umount -l ${ROOTFSDIR}/sys
- rm -f "${ROOTFSDIR}/etc/apt/sources.list.d/isar-apt.list"
- rm -f "${ROOTFSDIR}/etc/apt/preferences.d/isar-apt"
- rm -f "${ROOTFSDIR}/etc/apt/sources.list.d/base-apt.list"
- rm -f "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar"
-
if [ -e "${ROOTFSDIR}/etc/apt/sources-list" ]; then
mv "${ROOTFSDIR}/etc/apt/sources-list" \
"${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list"
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 0eed3d0..36e74af 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -293,6 +293,18 @@ rootfs_export_dpkg_status() {
'${ROOTFS_DPKGSTATUS_DEPLOY_DIR}'/'${ROOTFS_PACKAGE_SUFFIX}'.dpkg_status
}
+ROOTFS_POSTPROCESS_COMMAND += "rootfs_cleanup_isar_apt"
+rootfs_cleanup_isar_apt[weight] = "2"
+rootfs_cleanup_isar_apt() {
+ sudo -s <<'EOSUDO'
+ set -e
+ rm -f "${ROOTFSDIR}/etc/apt/sources.list.d/isar-apt.list"
+ rm -f "${ROOTFSDIR}/etc/apt/preferences.d/isar-apt"
+ rm -f "${ROOTFSDIR}/etc/apt/sources.list.d/base-apt.list"
+ rm -f "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar"
+EOSUDO
+}
+
do_rootfs_postprocess[vardeps] = "${ROOTFS_POSTPROCESS_COMMAND}"
do_rootfs_postprocess[network] = "${TASK_USE_SUDO}"
python do_rootfs_postprocess() {
diff --git a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
index fb061da..543522a 100644
--- a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
+++ b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
@@ -49,6 +49,7 @@ ROOTFS_PACKAGES = "${SBUILD_CHROOT_PREINSTALL}"
# We don't need /etc/apt/sources.list.d/isar-apt.list' while it's handled by sbuild
ROOTFS_CONFIGURE_COMMAND:remove = "rootfs_configure_isar_apt"
+ROOTFS_POSTPROCESS_COMMAND:remove = "rootfs_cleanup_isar_apt"
DEPLOY_SCHROOT = "${@d.getVar('SCHROOT_' + d.getVar('SBUILD_VARIANT').upper() + '_DIR')}"
--
2.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 2/6] imager: Migrate from buildchroot to schroot
2023-02-13 7:40 [PATCH v3 0/6] Imager schroot migration Anton Mikanovich
2023-02-13 7:40 ` [PATCH v3 1/6] isar-apt: Move cleanup to postprocessing Anton Mikanovich
@ 2023-02-13 7:40 ` Anton Mikanovich
2023-02-13 7:40 ` [PATCH v3 3/6] imager: Move image types " Anton Mikanovich
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Anton Mikanovich @ 2023-02-13 7:40 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
Install dependencies and perform all imager actions using schroot
instead of buildchroot. All the changes made during imager task will be
lost after the finish. This requires installing imager dependencies
during every run.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
meta/classes/image-tools-extension.bbclass | 94 +++++++++++++++-------
1 file changed, 63 insertions(+), 31 deletions(-)
diff --git a/meta/classes/image-tools-extension.bbclass b/meta/classes/image-tools-extension.bbclass
index 2d3dda4..640c56c 100644
--- a/meta/classes/image-tools-extension.bbclass
+++ b/meta/classes/image-tools-extension.bbclass
@@ -5,43 +5,75 @@
#
# This file extends the image.bbclass to supply tools for futher imager functions
-inherit buildchroot
+inherit sbuild
IMAGER_INSTALL ??= ""
IMAGER_BUILD_DEPS ??= ""
DEPENDS += "${IMAGER_BUILD_DEPS}"
-do_install_imager_deps[depends] = "${BUILDCHROOT_DEP} isar-apt:do_cache_config"
-do_install_imager_deps[deptask] = "do_deploy_deb"
-do_install_imager_deps[lockfiles] += "${REPO_ISAR_DIR}/isar.lock"
-do_install_imager_deps[network] = "${TASK_USE_NETWORK_AND_SUDO}"
-do_install_imager_deps() {
- if [ -z "${@d.getVar("IMAGER_INSTALL", True).strip()}" ]; then
- exit
- fi
+SCHROOT_MOUNTS = "${WORKDIR}:${PP_WORK} ${IMAGE_ROOTFS}:${PP_ROOTFS} ${DEPLOY_DIR_IMAGE}:${PP_DEPLOY}"
+SCHROOT_MOUNTS += "${REPO_ISAR_DIR}/${DISTRO}:/isar-apt"
+
+imager_run() {
+ schroot_create_configs
+ insert_mounts
+
+ session_id=$(schroot -q -b -c ${SBUILD_CHROOT})
+ echo "Started session: ${session_id}"
+
+ # setting up error handler
+ imager_cleanup() {
+ set +e
+ schroot -q -f -e -c ${session_id} > /dev/null 2>&1
+ remove_mounts > /dev/null 2>&1
+ schroot_delete_configs > /dev/null 2>&1
+ }
+ trap 'exit 1' INT HUP QUIT TERM ALRM USR1
+ trap 'imager_cleanup' EXIT
+
+ if [ -n "${@d.getVar("IMAGER_INSTALL", True).strip()}" ]; then
+ echo "Installing deps: ${IMAGER_INSTALL}"
+
+ distro="${BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
+ if [ ${ISAR_CROSS_COMPILE} -eq 1 ]; then
+ distro="${HOST_BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
+ fi
- distro="${BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
- if [ ${ISAR_CROSS_COMPILE} -eq 1 ]; then
- distro="${HOST_BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
+ # prepare isar-apt
+ schroot -r -c ${session_id} -d / -u root -- sh -c " \
+ mkdir -p '/etc/apt/sources.list.d'
+ echo 'deb [trusted=yes] file:///isar-apt ${DEBDISTRONAME} main' > \
+ '/etc/apt/sources.list.d/isar-apt.list'
+
+ mkdir -p '/etc/apt/preferences.d'
+ cat << EOF > '/etc/apt/preferences.d/isar-apt'
+Package: *
+Pin: release n=${DEBDISTRONAME}
+Pin-Priority: 1000
+EOF"
+
+ E="${@ isar_export_proxies(d)}"
+ deb_dl_dir_import ${SCHROOT_DIR} ${distro}
+ schroot -r -c ${session_id} -d / -u root -- sh -c " \
+ apt-get update \
+ -o Dir::Etc::SourceList='sources.list.d/isar-apt.list' \
+ -o Dir::Etc::SourceParts='-' \
+ -o APT::Get::List-Cleanup='0'
+ apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
+ --allow-unauthenticated --allow-downgrades --download-only install \
+ ${IMAGER_INSTALL}"
+
+ deb_dl_dir_export ${SCHROOT_DIR} ${distro}
+ schroot -r -c ${session_id} -d / -u root -- sh -c " \
+ apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
+ --allow-unauthenticated --allow-downgrades install \
+ ${IMAGER_INSTALL}"
fi
- buildchroot_do_mounts
-
- E="${@ isar_export_proxies(d)}"
- deb_dl_dir_import ${BUILDCHROOT_DIR} ${distro}
- sudo -E chroot ${BUILDCHROOT_DIR} sh -c ' \
- apt-get update \
- -o Dir::Etc::SourceList="sources.list.d/isar-apt.list" \
- -o Dir::Etc::SourceParts="-" \
- -o APT::Get::List-Cleanup="0"
- apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
- --allow-unauthenticated --allow-downgrades --download-only install \
- ${IMAGER_INSTALL}'
-
- deb_dl_dir_export ${BUILDCHROOT_DIR} ${distro}
- sudo -E chroot ${BUILDCHROOT_DIR} sh -c ' \
- apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
- --allow-unauthenticated --allow-downgrades install \
- ${IMAGER_INSTALL}'
+ schroot -r -c ${session_id} "$@"
+
+ schroot -e -c ${session_id}
+
+ remove_mounts
+ schroot_delete_configs
}
-addtask install_imager_deps before do_image_tools
--
2.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 3/6] imager: Move image types to schroot
2023-02-13 7:40 [PATCH v3 0/6] Imager schroot migration Anton Mikanovich
2023-02-13 7:40 ` [PATCH v3 1/6] isar-apt: Move cleanup to postprocessing Anton Mikanovich
2023-02-13 7:40 ` [PATCH v3 2/6] imager: Migrate from buildchroot to schroot Anton Mikanovich
@ 2023-02-13 7:40 ` Anton Mikanovich
2023-02-13 7:40 ` [PATCH v3 4/6] imager: Split imager deps between image types Anton Mikanovich
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Anton Mikanovich @ 2023-02-13 7:40 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
Run imagetype-related commands inside schroot session during images
prepare steps.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
meta/classes/image.bbclass | 7 ++-
meta/classes/imagetypes_vm.bbclass | 9 +--
meta/classes/imagetypes_wic.bbclass | 89 ++++++++++-------------------
3 files changed, 38 insertions(+), 67 deletions(-)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index f47e301..146d69e 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -157,7 +157,7 @@ inherit ${IMGCLASSES}
# convenience variables to be used by CMDs
IMAGE_FILE_HOST = "${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.${type}"
IMAGE_FILE_CHROOT = "${PP_DEPLOY}/${IMAGE_FULLNAME}.${type}"
-SUDO_CHROOT = "sudo chroot ${BUILDCHROOT_DIR}"
+SUDO_CHROOT = "imager_run -d ${PP_ROOTFS} -u root --"
# hook up IMAGE_CMD_*
python() {
@@ -229,7 +229,6 @@ python() {
imager_build_deps.add(dep)
# construct image command
- cmds.append('\timage_do_mounts')
image_cmd = localdata.getVar('IMAGE_CMD:' + bt_clean)
if image_cmd:
localdata.setVar('type', bt)
@@ -394,6 +393,10 @@ python do_image_tools() {
}
addtask image_tools before do_build after do_rootfs
+# all imagetypes are depend on schroot and isar-apt
+do_image_tools[depends] = "${SCHROOT_DEP} isar-apt:do_cache_config"
+do_image_tools[deptask] = "do_deploy_deb"
+
python do_image() {
"""Virtual task"""
pass
diff --git a/meta/classes/imagetypes_vm.bbclass b/meta/classes/imagetypes_vm.bbclass
index 81ef866..dd84038 100644
--- a/meta/classes/imagetypes_vm.bbclass
+++ b/meta/classes/imagetypes_vm.bbclass
@@ -4,8 +4,6 @@
# This class allows to generate images for VMware and VirtualBox
#
-inherit buildchroot
-
USING_OVA = "${@bb.utils.contains('IMAGE_BASETYPES', 'ova', '1', '0', d)}"
FILESEXTRAPATHS:prepend := "${LAYERDIR_core}/classes/vm-img:"
@@ -38,9 +36,8 @@ CONVERSION_OPTIONS = "${@set_convert_options(d)}"
convert_wic() {
rm -f '${DEPLOY_DIR_IMAGE}/${VIRTUAL_MACHINE_IMAGE_FILE}'
- image_do_mounts
bbnote "Creating ${VIRTUAL_MACHINE_IMAGE_FILE} from ${SOURCE_IMAGE_FILE}"
- sudo -E chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} \
+ imager_run -p -d ${PP_WORK} -- \
/usr/bin/qemu-img convert -f raw -O ${VIRTUAL_MACHINE_IMAGE_TYPE} ${CONVERSION_OPTIONS} \
'${PP_DEPLOY}/${SOURCE_IMAGE_FILE}' '${VIRTUAL_MACHINE_DISK}'
}
@@ -83,7 +80,7 @@ IMAGE_CMD:ova() {
export LAST_CHANGE=$(date -u "+%Y-%m-%dT%H:%M:%SZ")
export OVA_FIRMWARE_UPPERCASE=$(echo ${OVA_FIRMWARE} | tr '[a-z]' '[A-Z]')
export OVF_TEMPLATE_STAGE2=$(echo ${OVF_TEMPLATE_FILE} | sed 's/.tmpl$//' )
- sudo -Es chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} <<'EOSUDO'
+ imager_run -p -d ${PP_WORK} <<'EOIMAGER'
set -e
export DISK_SIZE_BYTES=$(qemu-img info -f vmdk "${VIRTUAL_MACHINE_DISK}" \
| gawk 'match($0, /^virtual size:.*\(([0-9]+) bytes\)/, a) {print a[1]}')
@@ -100,6 +97,6 @@ IMAGE_CMD:ova() {
tar -uvf ${PP_DEPLOY}/${OVA_NAME}.ova -C ${PP_DEPLOY} ${OVA_NAME}.mf
fi
tar -uvf ${PP_DEPLOY}/${OVA_NAME}.ova -C ${PP_DEPLOY} ${VIRTUAL_MACHINE_IMAGE_FILE}
-EOSUDO
+EOIMAGER
}
IMAGE_CMD:ova[depends] = "${PN}:do_transform_template"
diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass
index b0b27a9..ed3067a 100644
--- a/meta/classes/imagetypes_wic.bbclass
+++ b/meta/classes/imagetypes_wic.bbclass
@@ -83,8 +83,6 @@ python () {
bb.build.addtask('do_transform_template', 'do_image_wic', None, d)
}
-inherit buildchroot
-
IMAGER_INSTALL:wic += "${WIC_IMAGER_INSTALL}"
# wic comes with reasonable defaults, and the proper interface is the wks file
ROOTFS_EXTRA ?= "0"
@@ -95,7 +93,6 @@ STAGING_DIR ?= "${TMPDIR}"
IMAGE_BASENAME ?= "${PN}-${DISTRO}"
FAKEROOTCMD ?= "${SCRIPTSDIR}/wic_fakeroot"
RECIPE_SYSROOT_NATIVE ?= "/"
-BUILDCHROOT_DIR = "${BUILDCHROOT_TARGET_DIR}"
WIC_CREATE_EXTRA_ARGS ?= ""
WIC_DEPLOY_PARTITIONS ?= "0"
@@ -145,26 +142,11 @@ check_for_wic_warnings() {
do_image_wic[file-checksums] += "${WKS_FILE_CHECKSUM}"
IMAGE_CMD:wic() {
- wic_do_mounts
generate_wic_image
check_for_wic_warnings
}
-wic_do_mounts[vardepsexclude] += "BITBAKEDIR"
-wic_do_mounts() {
- buildchroot_do_mounts
- sudo -s <<'EOSUDO'
- ( flock 9
- set -e
- for dir in ${BBLAYERS} ${STAGING_DIR} ${SCRIPTSDIR} ${BITBAKEDIR}; do
- mkdir -p ${BUILDCHROOT_DIR}/$dir
- if ! mountpoint ${BUILDCHROOT_DIR}/$dir >/dev/null 2>&1; then
- mount --bind --make-private $dir ${BUILDCHROOT_DIR}/$dir
- fi
- done
- ) 9>${MOUNT_LOCKFILE}
-EOSUDO
-}
+SCHROOT_MOUNTS += "${BBLAYERS} ${STAGING_DIR} ${SCRIPTSDIR} ${BITBAKEDIR}"
generate_wic_image[vardepsexclude] += "WKS_FULL_PATH BITBAKEDIR TOPDIR"
generate_wic_image() {
@@ -177,50 +159,39 @@ generate_wic_image() {
mkdir -p ${IMAGE_ROOTFS}/../pseudo
touch ${IMAGE_ROOTFS}/../pseudo/files.db
- # create the temp dir in the buildchroot to ensure uniqueness
- WICTMP=$(cd ${BUILDCHROOT_DIR}; mktemp -d -p tmp)
-
- sudo -E chroot ${BUILDCHROOT_DIR} \
- sh -c ' \
- BITBAKEDIR="$1"
- SCRIPTSDIR="$2"
- WKS_FULL_PATH="$3"
- STAGING_DIR="$4"
- MACHINE="$5"
- WICTMP="$6"
- IMAGE_FULLNAME="$7"
- IMAGE_BASENAME="$8"
- shift 8
- # The python path is hard-coded as /usr/bin/python3-native/python3 in wic. Handle that.
- mkdir -p /usr/bin/python3-native/
- if [ $(head -1 $(which bmaptool) | grep python3) ];then
+ imager_run -p -d ${PP_WORK} -u root <<'EOIMAGER'
+ set -e
+
+ # The python path is hard-coded as /usr/bin/python3-native/python3 in wic. Handle that.
+ mkdir -p /usr/bin/python3-native/
+ if [ $(head -1 $(which bmaptool) | grep python3) ];then
ln -fs /usr/bin/python3 /usr/bin/python3-native/python3
- else
+ else
ln -fs /usr/bin/python2 /usr/bin/python3-native/python3
- fi
- export PATH="$BITBAKEDIR/bin:$PATH"
- "$SCRIPTSDIR"/wic create "$WKS_FULL_PATH" \
- --vars "$STAGING_DIR/$MACHINE/imgdata/" \
- -o "/$WICTMP/${IMAGE_FULLNAME}.wic/" \
+ fi
+
+ export PATH="${BITBAKEDIR}/bin:$PATH"
+
+ "${SCRIPTSDIR}"/wic create "${WKS_FULL_PATH}" \
+ --vars "${STAGING_DIR}/${MACHINE}/imgdata/" \
+ -o "/tmp/${IMAGE_FULLNAME}.wic/" \
--bmap \
- -e "$IMAGE_BASENAME" $@' \
- my_script "${BITBAKEDIR}" "${SCRIPTSDIR}" "${WKS_FULL_PATH}" "${STAGING_DIR}" \
- "${MACHINE}" "${WICTMP}" "${IMAGE_FULLNAME}" "${IMAGE_BASENAME}" \
- ${WIC_CREATE_EXTRA_ARGS}
+ -e "${IMAGE_BASENAME}" ${WIC_CREATE_EXTRA_ARGS}
+
+ WIC_DIRECT=$(ls -t -1 /tmp/${IMAGE_FULLNAME}.wic/*.direct | head -1)
+ mv -f ${WIC_DIRECT} ${PP_DEPLOY}/${IMAGE_FULLNAME}.wic
+ mv -f ${WIC_DIRECT}.bmap ${PP_DEPLOY}/${IMAGE_FULLNAME}.wic.bmap
+ # deploy partition files if requested (ending with .p<x>)
+ if [ "${WIC_DEPLOY_PARTITIONS}" -eq "1" ]; then
+ # locate *.direct.p<x> partition files
+ find "/tmp/${IMAGE_FULLNAME}.wic/" -type f -regextype sed -regex ".*\.direct.*\.p[0-9]\{1,\}" | while read f; do
+ suffix=$(basename $f | sed 's/.*\.direct\(.*\)/\1/')
+ mv -f ${f} ${PP_DEPLOY}/${IMAGE_FULLNAME}.wic${suffix}
+ done
+ fi
+EOIMAGER
sudo chown -R $(stat -c "%U" ${LAYERDIR_core}) ${LAYERDIR_core} ${LAYERDIR_isar} ${SCRIPTSDIR} || true
- WIC_DIRECT=$(ls -t -1 ${BUILDCHROOT_DIR}/$WICTMP/${IMAGE_FULLNAME}.wic/*.direct | head -1)
- sudo chown -R $(id -u):$(id -g) ${BUILDCHROOT_DIR}/${WICTMP}
- mv -f ${WIC_DIRECT} ${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.wic
- mv -f ${WIC_DIRECT}.bmap ${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.wic.bmap
- # deploy partition files if requested (ending with .p<x>)
- if [ "${WIC_DEPLOY_PARTITIONS}" -eq "1" ]; then
- # locate *.direct.p<x> partition files
- find ${BUILDCHROOT_DIR}/${WICTMP} -type f -regextype sed -regex ".*\.direct.*\.p[0-9]\{1,\}" | while read f; do
- suffix=$(basename $f | sed 's/.*\.direct\(.*\)/\1/')
- mv -f ${f} ${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.wic${suffix}
- done
- fi
- rm -rf ${BUILDCHROOT_DIR}/${WICTMP}
+ sudo chown -R $(id -u):$(id -g) ${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.wic*
rm -rf ${IMAGE_ROOTFS}/../pseudo
}
--
2.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 4/6] imager: Split imager deps between image types
2023-02-13 7:40 [PATCH v3 0/6] Imager schroot migration Anton Mikanovich
` (2 preceding siblings ...)
2023-02-13 7:40 ` [PATCH v3 3/6] imager: Move image types " Anton Mikanovich
@ 2023-02-13 7:40 ` Anton Mikanovich
2023-02-13 7:40 ` [PATCH v3 5/6] CI: Fix used chroot recipe name Anton Mikanovich
2023-02-13 7:40 ` [PATCH v3 6/6] meta: Remove buildchroot Anton Mikanovich
5 siblings, 0 replies; 9+ messages in thread
From: Anton Mikanovich @ 2023-02-13 7:40 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
To reduce dependencies install time and disk space consumption we need
to install only those imager dependencies which used in every image
type prepare logic. So split variables between tasks.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
meta/classes/image-tools-extension.bbclass | 10 ++++++----
meta/classes/image.bbclass | 8 ++++++++
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/meta/classes/image-tools-extension.bbclass b/meta/classes/image-tools-extension.bbclass
index 640c56c..4c7ba55 100644
--- a/meta/classes/image-tools-extension.bbclass
+++ b/meta/classes/image-tools-extension.bbclass
@@ -18,6 +18,8 @@ imager_run() {
schroot_create_configs
insert_mounts
+ local_install="${@(d.getVar("INSTALL_%s" % d.getVar("BB_CURRENTTASK"), True) or '').strip()}"
+
session_id=$(schroot -q -b -c ${SBUILD_CHROOT})
echo "Started session: ${session_id}"
@@ -31,8 +33,8 @@ imager_run() {
trap 'exit 1' INT HUP QUIT TERM ALRM USR1
trap 'imager_cleanup' EXIT
- if [ -n "${@d.getVar("IMAGER_INSTALL", True).strip()}" ]; then
- echo "Installing deps: ${IMAGER_INSTALL}"
+ if [ -n "${local_install}" ]; then
+ echo "Installing imager deps: ${local_install}"
distro="${BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
if [ ${ISAR_CROSS_COMPILE} -eq 1 ]; then
@@ -61,13 +63,13 @@ EOF"
-o APT::Get::List-Cleanup='0'
apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
--allow-unauthenticated --allow-downgrades --download-only install \
- ${IMAGER_INSTALL}"
+ ${local_install}"
deb_dl_dir_export ${SCHROOT_DIR} ${distro}
schroot -r -c ${session_id} -d / -u root -- sh -c " \
apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
--allow-unauthenticated --allow-downgrades install \
- ${IMAGER_INSTALL}"
+ ${local_install}"
fi
schroot -r -c ${session_id} "$@"
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 146d69e..34b1d61 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -202,6 +202,8 @@ python() {
imager_build_deps = set()
conversion_install = set()
for bt in basetypes:
+ local_imager_install = set()
+ local_conversion_install = set()
vardeps = set()
cmds = []
bt_clean = bt.replace('-', '_').replace('.', '_')
@@ -225,6 +227,7 @@ python() {
# imager install
for dep in (d.getVar('IMAGER_INSTALL:' + bt_clean) or '').split():
imager_install.add(dep)
+ local_imager_install.add(dep)
for dep in (d.getVar('IMAGER_BUILD_DEPS:' + bt_clean) or '').split():
imager_build_deps.add(dep)
@@ -267,6 +270,7 @@ python() {
vardeps.add('CONVERSION_CMD:' + c)
for dep in (localdata.getVar('CONVERSION_DEPS:' + c) or '').split():
conversion_install.add(dep)
+ local_conversion_install.add(dep)
# remove temporary image files
if t not in image_types:
rm_images.add(localdata.expand('${IMAGE_FILE_HOST}'))
@@ -299,6 +303,10 @@ python() {
d.appendVarFlag(task, 'depends', task_deps)
bb.build.addtask(task, 'do_image', after, d)
+ # set per type imager dependencies
+ d.setVar('INSTALL_image_%s' % bt_clean, d.getVar('IMAGER_INSTALL'))
+ d.appendVar('INSTALL_image_%s' % bt_clean, ' ' + ' '.join(sorted(local_imager_install | local_conversion_install)))
+
d.appendVar('IMAGER_INSTALL', ' ' + ' '.join(sorted(imager_install | conversion_install)))
d.appendVar('IMAGER_BUILD_DEPS', ' ' + ' '.join(sorted(imager_build_deps)))
}
--
2.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 5/6] CI: Fix used chroot recipe name
2023-02-13 7:40 [PATCH v3 0/6] Imager schroot migration Anton Mikanovich
` (3 preceding siblings ...)
2023-02-13 7:40 ` [PATCH v3 4/6] imager: Split imager deps between image types Anton Mikanovich
@ 2023-02-13 7:40 ` Anton Mikanovich
2023-02-14 9:28 ` Schmidt, Adriaan
2023-02-13 7:40 ` [PATCH v3 6/6] meta: Remove buildchroot Anton Mikanovich
5 siblings, 1 reply; 9+ messages in thread
From: Anton Mikanovich @ 2023-02-13 7:40 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
We've moved to schroot, so need to adjust recipe names for sstate test
case in CI.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
testsuite/cibase.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/testsuite/cibase.py b/testsuite/cibase.py
index 6239b4d..8c60a34 100755
--- a/testsuite/cibase.py
+++ b/testsuite/cibase.py
@@ -143,7 +143,7 @@ class CIBaseTest(CIBuilder):
if not all([
check_executed_tasks('isar-bootstrap-target',
['do_bootstrap_setscene', '!do_bootstrap']),
- check_executed_tasks('buildchroot-target',
+ check_executed_tasks('sbuild-chroot-target',
['do_rootfs_install_setscene', '!do_rootfs_install']),
check_executed_tasks('isar-image-base-*',
['do_rootfs_install_setscene', '!do_rootfs_install'])
@@ -167,7 +167,7 @@ class CIBaseTest(CIBuilder):
if not all([
check_executed_tasks('isar-bootstrap-target',
['do_bootstrap_setscene']),
- check_executed_tasks('buildchroot-target',
+ check_executed_tasks('sbuild-chroot-target',
['!do_buildchroot_deploy']),
check_executed_tasks('hello',
['do_dpkg_build_setscene', 'do_deploy_deb', '!do_dpkg_build'])
@@ -181,7 +181,7 @@ class CIBaseTest(CIBuilder):
if not all([
check_executed_tasks('isar-bootstrap-target',
['do_bootstrap_setscene', '!do_bootstrap']),
- check_executed_tasks('buildchroot-target',
+ check_executed_tasks('sbuild-chroot-target',
['do_rootfs_install_setscene', '!do_rootfs_install']),
check_executed_tasks('hello',
['do_fetch', 'do_dpkg_build']),
--
2.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH v3 5/6] CI: Fix used chroot recipe name
2023-02-13 7:40 ` [PATCH v3 5/6] CI: Fix used chroot recipe name Anton Mikanovich
@ 2023-02-14 9:28 ` Schmidt, Adriaan
2023-02-14 10:30 ` Anton Mikanovich
0 siblings, 1 reply; 9+ messages in thread
From: Schmidt, Adriaan @ 2023-02-14 9:28 UTC (permalink / raw)
To: Anton Mikanovich, isar-users
Anton Mikanovich, Montag, 13. Februar 2023 08:41:
> We've moved to schroot, so need to adjust recipe names for sstate test
> case in CI.
>
> Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
> ---
> testsuite/cibase.py | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/testsuite/cibase.py b/testsuite/cibase.py
> index 6239b4d..8c60a34 100755
> --- a/testsuite/cibase.py
> +++ b/testsuite/cibase.py
> @@ -143,7 +143,7 @@ class CIBaseTest(CIBuilder):
> if not all([
> check_executed_tasks('isar-bootstrap-target',
> ['do_bootstrap_setscene', '!do_bootstrap']),
> - check_executed_tasks('buildchroot-target',
> + check_executed_tasks('sbuild-chroot-target',
> ['do_rootfs_install_setscene', '!do_rootfs_install']),
> check_executed_tasks('isar-image-base-*',
> ['do_rootfs_install_setscene', '!do_rootfs_install'])
> @@ -167,7 +167,7 @@ class CIBaseTest(CIBuilder):
> if not all([
> check_executed_tasks('isar-bootstrap-target',
> ['do_bootstrap_setscene']),
> - check_executed_tasks('buildchroot-target',
> + check_executed_tasks('sbuild-chroot-target',
> ['!do_buildchroot_deploy']),
Hi Anton,
In addition to the renaming of buildchroot-target => sbuild-chroot-target,
also the task needs to renamed in this check (do_buildchroot_deploy => do_sbuildchroot_deploy).
Thanks,
Adriaan
> check_executed_tasks('hello',
> ['do_dpkg_build_setscene', 'do_deploy_deb',
> '!do_dpkg_build'])
> @@ -181,7 +181,7 @@ class CIBaseTest(CIBuilder):
> if not all([
> check_executed_tasks('isar-bootstrap-target',
> ['do_bootstrap_setscene', '!do_bootstrap']),
> - check_executed_tasks('buildchroot-target',
> + check_executed_tasks('sbuild-chroot-target',
> ['do_rootfs_install_setscene', '!do_rootfs_install']),
> check_executed_tasks('hello',
> ['do_fetch', 'do_dpkg_build']),
> --
> 2.34.1
>
> --
> You received this message because you are subscribed to the Google Groups
> "isar-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to isar-users+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/isar-users/20230213074034.3949-6-
> amikan%40ilbers.de.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 5/6] CI: Fix used chroot recipe name
2023-02-14 9:28 ` Schmidt, Adriaan
@ 2023-02-14 10:30 ` Anton Mikanovich
0 siblings, 0 replies; 9+ messages in thread
From: Anton Mikanovich @ 2023-02-14 10:30 UTC (permalink / raw)
To: Schmidt, Adriaan, isar-users
14/02/2023 11:28, Schmidt, Adriaan wrote:
> Hi Anton,
>
> In addition to the renaming of buildchroot-target => sbuild-chroot-target,
> also the task needs to renamed in this check (do_buildchroot_deploy => do_sbuildchroot_deploy).
>
> Thanks,
> Adriaan
That's right, thanks.
Will fix it in v4.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 6/6] meta: Remove buildchroot
2023-02-13 7:40 [PATCH v3 0/6] Imager schroot migration Anton Mikanovich
` (4 preceding siblings ...)
2023-02-13 7:40 ` [PATCH v3 5/6] CI: Fix used chroot recipe name Anton Mikanovich
@ 2023-02-13 7:40 ` Anton Mikanovich
5 siblings, 0 replies; 9+ messages in thread
From: Anton Mikanovich @ 2023-02-13 7:40 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
Buildchroot is not used anywhere so remove it.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
meta-isar/conf/local.conf.sample | 2 +-
meta/classes/buildchroot.bbclass | 71 ------------------
meta/classes/image.bbclass | 15 ----
meta/classes/isar-events.bbclass | 1 -
meta/conf/bitbake.conf | 3 -
.../buildchroot/buildchroot-host.bb | 13 ----
.../buildchroot/buildchroot-target.bb | 10 ---
.../buildchroot/buildchroot.inc | 73 -------------------
.../buildchroot/files/build.sh | 17 -----
.../buildchroot/files/common.sh | 32 --------
.../buildchroot/files/configscript.sh | 15 ----
.../buildchroot/files/deps.sh | 47 ------------
12 files changed, 1 insertion(+), 298 deletions(-)
delete mode 100644 meta/classes/buildchroot.bbclass
delete mode 100644 meta/recipes-devtools/buildchroot/buildchroot-host.bb
delete mode 100644 meta/recipes-devtools/buildchroot/buildchroot-target.bb
delete mode 100644 meta/recipes-devtools/buildchroot/buildchroot.inc
delete mode 100644 meta/recipes-devtools/buildchroot/files/build.sh
delete mode 100644 meta/recipes-devtools/buildchroot/files/common.sh
delete mode 100644 meta/recipes-devtools/buildchroot/files/configscript.sh
delete mode 100644 meta/recipes-devtools/buildchroot/files/deps.sh
diff --git a/meta-isar/conf/local.conf.sample b/meta-isar/conf/local.conf.sample
index 7e0184e..1c8e156 100644
--- a/meta-isar/conf/local.conf.sample
+++ b/meta-isar/conf/local.conf.sample
@@ -24,7 +24,7 @@ MACHINE ??= "qemuarm"
# Isar Configuration Selection
#
# You need to select a specific distribution configuration which will used for both:
-# generation of buildchroot environment and target root filesystem.
+# generation of schroot environment and target root filesystem.
#
# This sets the default distribution configuration:
DISTRO ??= "debian-bullseye"
diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
deleted file mode 100644
index 5abd533..0000000
--- a/meta/classes/buildchroot.bbclass
+++ /dev/null
@@ -1,71 +0,0 @@
-# This software is a part of ISAR.
-# Copyright (C) 2018 Siemens AG
-#
-# SPDX-License-Identifier: MIT
-
-ISAR_CROSS_COMPILE ??= "0"
-
-# Choose the correct buildchroot: host or target
-python __anonymous() {
- mode = d.getVar('ISAR_CROSS_COMPILE', True)
- distro_arch = d.getVar('DISTRO_ARCH')
- if mode == "0" or d.getVar('HOST_ARCH') == distro_arch:
- dep = "buildchroot-target:do_build"
- rootfs = d.getVar('BUILDCHROOT_TARGET_DIR', False)
- else:
- dep = "buildchroot-host:do_build"
- rootfs = d.getVar('BUILDCHROOT_HOST_DIR', False)
-
- d.setVar('BUILDCHROOT_DEP', dep)
- d.setVar('BUILDCHROOT_DIR', rootfs)
-}
-
-MOUNT_LOCKFILE = "${BUILDCHROOT_DIR}.lock"
-
-buildchroot_do_mounts() {
- if [ "${USE_CCACHE}" = "1" ]; then
- mkdir -p ${CCACHE_DIR}/debug
- fi
-
- sudo -s <<'EOSUDO'
- ( flock 9
- set -e
-
- mountpoint -q '${BUILDCHROOT_DIR}/isar-apt' ||
- mount --bind '${REPO_ISAR_DIR}/${DISTRO}' '${BUILDCHROOT_DIR}/isar-apt'
- mountpoint -q '${BUILDCHROOT_DIR}/downloads' ||
- mount --bind '${DL_DIR}' '${BUILDCHROOT_DIR}/downloads'
- if [ "${USE_CCACHE}" = "1" ]; then
- mkdir -p '${BUILDCHROOT_DIR}/ccache'
- mountpoint -q '${BUILDCHROOT_DIR}/ccache' ||
- mount --bind '${CCACHE_DIR}' '${BUILDCHROOT_DIR}/ccache'
- fi
- mountpoint -q '${BUILDCHROOT_DIR}/dev' ||
- ( mount -o bind,private /dev '${BUILDCHROOT_DIR}/dev' &&
- mount -t tmpfs none '${BUILDCHROOT_DIR}/dev/shm' &&
- mount --bind /dev/pts '${BUILDCHROOT_DIR}/dev/pts' )
- mountpoint -q '${BUILDCHROOT_DIR}/proc' ||
- mount -t proc none '${BUILDCHROOT_DIR}/proc'
- mountpoint -q '${BUILDCHROOT_DIR}/sys' ||
- mount --rbind /sys '${BUILDCHROOT_DIR}/sys'
- mount --make-rslave '${BUILDCHROOT_DIR}/sys'
-
- # Mount base-apt if 'ISAR_USE_CACHED_BASE_REPO' is set
- if [ "${@repr(bb.utils.to_boolean(d.getVar('ISAR_USE_CACHED_BASE_REPO')))}" = 'True' ]
- then
- mkdir -p '${BUILDCHROOT_DIR}/base-apt'
- mountpoint -q '${BUILDCHROOT_DIR}/base-apt' || \
- mount --bind '${REPO_BASE_DIR}' '${BUILDCHROOT_DIR}/base-apt'
- fi
-
- # Refresh or remove /etc/resolv.conf at this chance
- if [ "${@repr(bb.utils.to_boolean(d.getVar('BB_NO_NETWORK')))}" = 'True' ]
- then
- rm -rf '${BUILDCHROOT_DIR}/etc/resolv.conf'
- else
- cp -L /etc/resolv.conf '${BUILDCHROOT_DIR}/etc'
- fi
-
- ) 9>'${MOUNT_LOCKFILE}'
-EOSUDO
-}
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 34b1d61..9b05713 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -32,11 +32,6 @@ PP_DEPLOY = "${PP}/deploy"
PP_ROOTFS = "${PP}/rootfs"
PP_WORK = "${PP}/work"
-BUILDROOT = "${BUILDCHROOT_DIR}${PP}"
-BUILDROOT_DEPLOY = "${BUILDCHROOT_DIR}${PP_DEPLOY}"
-BUILDROOT_ROOTFS = "${BUILDCHROOT_DIR}${PP_ROOTFS}"
-BUILDROOT_WORK = "${BUILDCHROOT_DIR}${PP_WORK}"
-
python(){
if (d.getVar('IMAGE_TRANSIENT_PACKAGES')):
bb.warn("IMAGE_TRANSIENT_PACKAGES is set and no longer supported")
@@ -69,16 +64,6 @@ DEPENDS += "${IMAGE_INSTALL}"
ISAR_RELEASE_CMD_DEFAULT = "git -C ${LAYERDIR_core} describe --tags --dirty --match 'v[0-9].[0-9]*'"
ISAR_RELEASE_CMD ?= "${ISAR_RELEASE_CMD_DEFAULT}"
-image_do_mounts() {
- sudo flock ${MOUNT_LOCKFILE} -c ' \
- mkdir -p "${BUILDROOT_DEPLOY}" "${BUILDROOT_ROOTFS}" "${BUILDROOT_WORK}"
- mount --bind "${DEPLOY_DIR_IMAGE}" "${BUILDROOT_DEPLOY}"
- mount --bind "${IMAGE_ROOTFS}" "${BUILDROOT_ROOTFS}"
- mount --bind "${WORKDIR}" "${BUILDROOT_WORK}"
- '
- buildchroot_do_mounts
-}
-
ROOTFSDIR = "${IMAGE_ROOTFS}"
ROOTFS_FEATURES += "clean-package-cache clean-pycache generate-manifest export-dpkg-status clean-log-files clean-debconf-cache"
ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${IMAGE_INSTALL}"
diff --git a/meta/classes/isar-events.bbclass b/meta/classes/isar-events.bbclass
index f52b234..7b960f3 100644
--- a/meta/classes/isar-events.bbclass
+++ b/meta/classes/isar-events.bbclass
@@ -9,7 +9,6 @@ addhandler build_started
python build_started() {
bb.utils.remove(d.getVar('TMPDIR') + "/work/*/*/*/temp/once.*")
bb.utils.remove(d.getVar('TMPDIR') + "/work/*/*/*/rootfs.mount")
- bb.utils.remove(d.getVar('TMPDIR') + "/deploy/buildchroot-*/*.mount")
}
build_started[eventmask] = "bb.event.BuildStarted"
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 522241a..e96a796 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -50,14 +50,11 @@ GITPKGV = "${@bb.fetch2.get_srcrev(d, 'gitpkgv_revision')}"
WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}/${PV}-${PR}"
GIT_DL_LINK_DIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}"
DEPLOY_DIR_BOOTSTRAP = "${DEPLOY_DIR}/bootstrap"
-DEPLOY_DIR_BUILDCHROOT = "${DEPLOY_DIR}/buildchroot"
DEPLOY_DIR_SDKCHROOT = "${DEPLOY_DIR}/sdkchroot"
DEPLOY_DIR_IMAGE = "${DEPLOY_DIR}/images/${MACHINE}"
DL_DIR ?= "${TOPDIR}/downloads"
SSTATE_DIR ?= "${TOPDIR}/sstate-cache"
SSTATE_MANIFESTS = "${TMPDIR}/sstate-control/${DISTRO}-${DISTRO_ARCH}"
-BUILDCHROOT_HOST_DIR = "${DEPLOY_DIR_BUILDCHROOT}-host/${HOST_DISTRO}-${HOST_ARCH}_${DISTRO}-${DISTRO_ARCH}"
-BUILDCHROOT_TARGET_DIR = "${DEPLOY_DIR_BUILDCHROOT}-target/${DISTRO}-${DISTRO_ARCH}"
SCHROOT_HOST_DIR = "${DEPLOY_DIR}/schroot-host/${HOST_DISTRO}-${HOST_ARCH}_${DISTRO}-${DISTRO_ARCH}"
SCHROOT_TARGET_DIR = "${DEPLOY_DIR}/schroot-target/${DISTRO}-${DISTRO_ARCH}"
SDKCHROOT_DIR = "${DEPLOY_DIR_SDKCHROOT}/${BPN}-${DISTRO}-${MACHINE}"
diff --git a/meta/recipes-devtools/buildchroot/buildchroot-host.bb b/meta/recipes-devtools/buildchroot/buildchroot-host.bb
deleted file mode 100644
index e5ce248..0000000
--- a/meta/recipes-devtools/buildchroot/buildchroot-host.bb
+++ /dev/null
@@ -1,13 +0,0 @@
-# Root filesystem for packages building
-#
-# This software is a part of ISAR.
-# Copyright (C) 2015-2018 ilbers GmbH
-
-DESCRIPTION = "Isar development filesystem for host"
-
-BUILDCHROOT_VARIANT = "host"
-
-require buildchroot.inc
-ROOTFS_ARCH = "${HOST_ARCH}"
-ROOTFS_DISTRO = "${HOST_DISTRO}"
-ROOTFS_BASE_DISTRO = "${HOST_BASE_DISTRO}"
diff --git a/meta/recipes-devtools/buildchroot/buildchroot-target.bb b/meta/recipes-devtools/buildchroot/buildchroot-target.bb
deleted file mode 100644
index 6613de6..0000000
--- a/meta/recipes-devtools/buildchroot/buildchroot-target.bb
+++ /dev/null
@@ -1,10 +0,0 @@
-# Root filesystem for packages building
-#
-# This software is a part of ISAR.
-# Copyright (C) 2015-2018 ilbers GmbH
-
-DESCRIPTION = "Isar development filesystem for target"
-
-BUILDCHROOT_VARIANT = "target"
-
-require buildchroot.inc
diff --git a/meta/recipes-devtools/buildchroot/buildchroot.inc b/meta/recipes-devtools/buildchroot/buildchroot.inc
deleted file mode 100644
index f74896f..0000000
--- a/meta/recipes-devtools/buildchroot/buildchroot.inc
+++ /dev/null
@@ -1,73 +0,0 @@
-# Common part for build chroot filesystem.
-#
-# This software is a part of ISAR.
-# Copyright (C) 2015-2018 ilbers GmbH
-
-LICENSE = "gpl-2.0"
-LIC_FILES_CHKSUM = "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
-
-FILESPATH:prepend := "${THISDIR}/files:"
-SRC_URI = "file://configscript.sh \
- file://build.sh \
- file://common.sh \
- file://deps.sh"
-PV = "1.0"
-
-inherit rootfs
-
-BUILDCHROOT_DIR = "${WORKDIR}/rootfs"
-ROOTFSDIR = "${BUILDCHROOT_DIR}"
-ROOTFS_PACKAGES = "${BUILDCHROOT_PREINSTALL}"
-ROOTFS_CLEAN_FILES = ""
-ROOTFS_MANIFEST_DEPLOY_DIR = "${DEPLOY_DIR_BUILDCHROOT}"
-ROOTFS_DPKGSTATUS_DEPLOY_DIR = "${DEPLOY_DIR_BUILDCHROOT}"
-ROOTFS_FEATURES += "generate-manifest export-dpkg-status"
-
-BUILDCHROOT_PREINSTALL ?= " \
- dpkg \
- locales \
- apt \
- equivs \
- adduser"
-
-rootfs_do_mounts:append() {
- sudo -s <<'EOSUDO'
- set -e
- mkdir -p '${BUILDCHROOT_DIR}/downloads'
- mountpoint -q '${BUILDCHROOT_DIR}/downloads' || \
- mount --bind '${DL_DIR}' '${BUILDCHROOT_DIR}/downloads'
-EOSUDO
-}
-
-ROOTFS_POSTPROCESS_COMMAND =+ "buildchroot_install_files"
-buildchroot_install_files() {
- sudo mkdir -p "${BUILDCHROOT_DIR}/home/builder"
- # Install package builder script
- sudo chmod -R a+rw "${BUILDCHROOT_DIR}/home/builder"
- sudo install -m 755 -d ${BUILDCHROOT_DIR}/isar
- sudo install -m 755 ${WORKDIR}/build.sh ${BUILDCHROOT_DIR}/isar/
- sudo install -m 755 ${WORKDIR}/common.sh ${BUILDCHROOT_DIR}/isar/
- sudo install -m 755 ${WORKDIR}/deps.sh ${BUILDCHROOT_DIR}/isar/
-
- sudo ln -sf /downloads/git "${BUILDCHROOT_DIR}/home/.git-downloads"
-
- # Configure root filesystem
- sudo install -m 755 ${WORKDIR}/configscript.sh ${BUILDCHROOT_DIR}
- USER_ID=$(id -u)
- GROUP_ID=$(id -g)
- sudo chroot ${BUILDCHROOT_DIR} /configscript.sh $USER_ID $GROUP_ID
-
-}
-
-DEPLOY_BUILDCHROOT = "${@d.getVar('BUILDCHROOT_' + d.getVar('BUILDCHROOT_VARIANT').upper() + '_DIR')}"
-
-do_buildchroot_deploy[dirs] = "${DEPLOY_DIR_BUILDCHROOT}-${BUILDCHROOT_VARIANT}"
-do_buildchroot_deploy() {
- ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_BUILDCHROOT}"
-}
-addtask buildchroot_deploy before do_build after do_rootfs
-
-CLEANFUNCS = "clean_deploy"
-clean_deploy() {
- rm -f "${DEPLOY_BUILDCHROOT}"
-}
diff --git a/meta/recipes-devtools/buildchroot/files/build.sh b/meta/recipes-devtools/buildchroot/files/build.sh
deleted file mode 100644
index d4709cf..0000000
--- a/meta/recipes-devtools/buildchroot/files/build.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-#
-# This software is a part of ISAR.
-# Copyright (C) 2015-2017 ilbers GmbH
-# Copyright (c) 2018 Siemens AG
-
-source /isar/common.sh
-
-# If autotools files have been created, update their timestamp to
-# prevent them from being regenerated
-for i in configure aclocal.m4 Makefile.am Makefile.in; do
- if [ -f "${i}" ]; then
- touch "${i}"
- fi
-done
-
-${GBP_PREFIX}dpkg-buildpackage -a$target_arch --source-option=-I
diff --git a/meta/recipes-devtools/buildchroot/files/common.sh b/meta/recipes-devtools/buildchroot/files/common.sh
deleted file mode 100644
index 73226d8..0000000
--- a/meta/recipes-devtools/buildchroot/files/common.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-#
-# This software is a part of ISAR.
-# Copyright (C) 2015-2017 ilbers GmbH
-# Copyright (c) 2018 Siemens AG
-
-set -e
-printenv | grep -q BB_VERBOSE_LOGS && set -x
-
-# assert we are either "root:root" or "builder:<gid of builder>"
-if ([ "$(id -un)" != "builder" ] || [ "$(id -g)" != "$(id -g builder)" ]) &&
- ([ "$(id -un)" != "root" ] || [ "$(id -gn)" != "root" ]); then
- echo "This script can only be run as root:root or builder:<gid of builder>!" >&2
- echo "(Currently running as $(id -un)($(id -u)):$(id -gn)($(id -g)))" >&2
- exit 1
-fi
-
-# Create human-readable names
-target_arch=$2
-
-set_arch="--host-arch $target_arch"
-
-# Go to build directory
-cd "$1"
-
-# To avoid Perl locale warnings:
-export LC_ALL=C
-export LANG=C
-export LANGUAGE=C
-
-# allow for changes to the PATH variable
-export PATH=$PATH_PREPEND:$PATH
diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh b/meta/recipes-devtools/buildchroot/files/configscript.sh
deleted file mode 100644
index c4d8cf8..0000000
--- a/meta/recipes-devtools/buildchroot/files/configscript.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-#
-# This software is a part of ISAR.
-# Copyright (C) 2015-2018 ilbers GmbH
-
-set -e
-
-debconf-set-selections <<END
-locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8
-locales locales/default_environment_locale select en_US.UTF-8
-END
-
-grep -q "builder:x:$2" /etc/group || groupadd -f --system builder -o --gid $2
-grep -q "builder:x:$1" /etc/passwd || useradd --system -o --uid $1 --gid builder --no-create-home --home /home/builder --no-user-group --comment "Isar buildchroot build user" builder
-chown -R builder:builder /home/builder
diff --git a/meta/recipes-devtools/buildchroot/files/deps.sh b/meta/recipes-devtools/buildchroot/files/deps.sh
deleted file mode 100644
index ccfc460..0000000
--- a/meta/recipes-devtools/buildchroot/files/deps.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/bash
-#
-# This software is a part of ISAR.
-# Copyright (C) 2015-2017 ilbers GmbH
-# Copyright (c) 2018 Siemens AG
-
-source /isar/common.sh
-
-# Install command to be used by mk-build-deps
-# Notes:
-# 1) everything before the -y switch is unchanged from the defaults
-# 2) we add -y to go non-interactive
-# 3) downgrades shall be allowed in case a package recipe was changed
-install_cmd="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends \
- -y --allow-downgrades $3"
-
-if [ "$3" != "--download-only" ]; then
- # Make sure that we have latest isar-apt content.
- # Options meaning:
- # Dir::Etc::SourceList - specifies which source to be used
- # Dir::Etc::SourceParts - disables looking for the other sources
- # APT::Get::List-Cleanup - do not erase obsolete packages list for
- # upstream in '/var/lib/apt/lists'
- apt-get update \
- -o Dir::Etc::SourceList="sources.list.d/isar-apt.list" \
- -o Dir::Etc::SourceParts="-" \
- -o APT::Get::List-Cleanup="0"
-fi
-
-control_file=$(pwd)/debian/control
-cd ..
-
-# Install all build deps
-if [ "$3" = "--download-only" ]; then
- # this will not return 0 even when it worked
- mk-build-deps $set_arch -t "${install_cmd}" -i -r $control_file &> \
- mk-build-deps.output || true
- cat mk-build-deps.output
- # we assume success when we find this
- grep "mk-build-deps: Unable to install all build-dep packages" mk-build-deps.output
- rm -f mk-build-deps.output
-else
- mk-build-deps $set_arch -t "${install_cmd}" -i -r $control_file
-
- # Upgrade any already installed packages in case we are partially rebuilding
- apt-get upgrade -y --allow-downgrades
-fi
--
2.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread