On Tuesday, February 11, 2020 at 5:08:43 PM UTC+5:30, Henning Schild wrote: > > This patch will allow you to keep your apt downloading feature > downstream for yourself. I would say - propose it again together with > the feature. > I can push that feature if it is needed upstream, which I doubt, since I don't vision an upstream use-case where-in one would need to download all the sources. Also, It would need your base-apt series. > > In fact if the feature was in Isar the whole problem would go away, > unless you have more postprocess functions. > Yes. We have one per se for our QA layer. To export dpkg status file to deploy directory. This will be used by debsecan. > We discussed postprocessing a couple of times, it is really bad style > and enabling it as a feature that is easy to use we provoke downstream > layers making mistakes by implementing their stuff as such postprocess > functions. > I see the ability to add custom post-processing as a useful feature. Not sure if anyone actually uses them in their downstream layers. It is good to have if you know what you are doing. As long as this provision is there, people would use it. If we feel that this provision is unnecessary and would lead to issues, well, we could go ahead and remove it. Thanks, Vijai Kumar K Henning > > On Mon, 10 Feb 2020 11:07:53 +0530 > Vijai Kumar K > wrote: > > > With the current implementation it is difficult to append a > > postprocess function which requires a chroot environment. > > For example, to add a postprocess function which runs apt-get to > > download all source of packages installed in the target. > > > > rootfs_postprocess_finalize is not actually an optional feature > > but instead a necessary cleanup function for image class. > > So, move the implementation to image class and make it as a task. > > > > Signed-off-by: Vijai Kumar K > > > --- > > > > Changes in v2: > > - The solution is changed to remove rootfs_finalize from > > ROOTFS_POSTPROCESS_COMMAND. > > > > meta/classes/image.bbclass | 41 > > ++++++++++++++++++++++++++++++++++++- meta/classes/rootfs.bbclass | > > 39 ----------------------------------- 2 files changed, 40 > > insertions(+), 40 deletions(-) > > > > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass > > index 725bc04..98338ac 100644 > > --- a/meta/classes/image.bbclass > > +++ b/meta/classes/image.bbclass > > @@ -60,7 +60,7 @@ image_do_mounts() { > > } > > > > ROOTFSDIR = "${IMAGE_ROOTFS}" > > -ROOTFS_FEATURES += "copy-package-cache clean-package-cache > > finalize-rootfs generate-manifest" +ROOTFS_FEATURES += > > "copy-package-cache clean-package-cache generate-manifest" > > ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${IMAGE_INSTALL}" > > ROOTFS_MANIFEST_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}" > > @@ -169,5 +169,44 @@ python do_deploy() { > > } > > addtask deploy before do_build after do_image > > > > +do_rootfs_finalize() { > > + sudo -s <<'EOSUDO' > > + test -e "${ROOTFSDIR}/chroot-setup.sh" && \ > > + "${ROOTFSDIR}/chroot-setup.sh" "cleanup" "${ROOTFSDIR}" > > + rm -f "${ROOTFSDIR}/chroot-setup.sh" > > + > > + test ! -e "${ROOTFSDIR}/usr/share/doc/qemu-user-static" && \ > > + find "${ROOTFSDIR}/usr/bin" \ > > + -maxdepth 1 -name 'qemu-*-static' -type f -delete > > + > > + mountpoint -q '${ROOTFSDIR}/isar-apt' && \ > > + umount -l ${ROOTFSDIR}/isar-apt > > + rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/isar-apt > > + > > + mountpoint -q '${ROOTFSDIR}/base-apt' && \ > > + umount -l ${ROOTFSDIR}/base-apt > > + rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/base-apt > > + > > + mountpoint -q '${ROOTFSDIR}/dev' && \ > > + umount -l ${ROOTFSDIR}/dev > > + mountpoint -q '${ROOTFSDIR}/sys' && \ > > + umount -l ${ROOTFSDIR}/proc > > + mountpoint -q '${ROOTFSDIR}/sys' && \ > > + umount -l ${ROOTFSDIR}/sys > > + > > + rm -f "${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf" > > + > > + 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" > > + > > + mv "${ROOTFSDIR}/etc/apt/sources-list" \ > > + "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list" > > + > > + rm -f "${ROOTFSDIR}/etc/apt/sources-list" > > +EOSUDO > > +} > > +addtask rootfs_finalize before do_rootfs after do_rootfs_postprocess > > + > > # Last so that the image type can overwrite tasks if needed > > inherit ${IMAGE_TYPE} > > diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass > > index 64eaef7..153038a 100644 > > --- a/meta/classes/rootfs.bbclass > > +++ b/meta/classes/rootfs.bbclass > > @@ -197,45 +197,6 @@ rootfs_generate_manifest () { > > ${ROOTFS_MANIFEST_DEPLOY_DIR}/"${PF}".manifest > > } > > > > -ROOTFS_POSTPROCESS_COMMAND += > > "${@bb.utils.contains('ROOTFS_FEATURES', 'finalize-rootfs', > > 'rootfs_postprocess_finalize', '', d)}" > > -rootfs_postprocess_finalize() { > > - sudo -s <<'EOSUDO' > > - test -e "${ROOTFSDIR}/chroot-setup.sh" && \ > > - "${ROOTFSDIR}/chroot-setup.sh" "cleanup" "${ROOTFSDIR}" > > - rm -f "${ROOTFSDIR}/chroot-setup.sh" > > - > > - test ! -e "${ROOTFSDIR}/usr/share/doc/qemu-user-static" && \ > > - find "${ROOTFSDIR}/usr/bin" \ > > - -maxdepth 1 -name 'qemu-*-static' -type f -delete > > - > > - mountpoint -q '${ROOTFSDIR}/isar-apt' && \ > > - umount -l ${ROOTFSDIR}/isar-apt > > - rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/isar-apt > > - > > - mountpoint -q '${ROOTFSDIR}/base-apt' && \ > > - umount -l ${ROOTFSDIR}/base-apt > > - rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/base-apt > > - > > - mountpoint -q '${ROOTFSDIR}/dev' && \ > > - umount -l ${ROOTFSDIR}/dev > > - mountpoint -q '${ROOTFSDIR}/sys' && \ > > - umount -l ${ROOTFSDIR}/proc > > - mountpoint -q '${ROOTFSDIR}/sys' && \ > > - umount -l ${ROOTFSDIR}/sys > > - > > - rm -f "${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf" > > - > > - 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" > > - > > - mv "${ROOTFSDIR}/etc/apt/sources-list" \ > > - "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list" > > - > > - rm -f "${ROOTFSDIR}/etc/apt/sources-list" > > -EOSUDO > > -} > > - > > do_rootfs_postprocess[vardeps] = "${ROOTFS_POSTPROCESS_COMMAND}" > > python do_rootfs_postprocess() { > > # Take care that its correctly mounted: > >