From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6790334981638979584 X-Received: by 2002:a05:651c:1045:: with SMTP id x5mr4105748ljm.266.1581421123976; Tue, 11 Feb 2020 03:38:43 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:9516:: with SMTP id f22ls2111405ljh.2.gmail; Tue, 11 Feb 2020 03:38:43 -0800 (PST) X-Google-Smtp-Source: APXvYqx9RxfqDlMQwkkgp2UOaEDsCRazcZ2IBhgFAKAuAuekKLKEyaElceFiFbjyLkgA9OBMhjT2 X-Received: by 2002:a2e:9a04:: with SMTP id o4mr4097897lji.214.1581421123044; Tue, 11 Feb 2020 03:38:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581421123; cv=none; d=google.com; s=arc-20160816; b=RjzJFNiRxb/jlUEbcEV3s9rWyhSPcWb7lrokChg7N4SSkIyrXqU4jyI/AQwTZLjR5S Rdhm0Uv9ftNa4x5B7szCv/HBJdJr8S302P3UiO0XOPas9TfdANLzQnxS21PEkPBBaYTR zxY+Ole+J1IKOVNvlADqop5+f02+ft/gONqg0F79Y1+TGgPN+pxgDOBp2e0HarSAObUn MPkXYGrVCiRjXqNwa3SfVwL6m4yqn9wQKh1h0iPRCqtXIdFJ5I6l1f7B2ixdKu0K90wY ExdFoX7WvZpUiL/29QhfqxjCX9m7EZ1O8C0tuZroywTCrXUkyU5wp7EsTiT5TkIj/fAt P7dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date; bh=A/2nIZF5itmwlCDS8S0Ao3EQLhKCiYf3doxYyyRfd1s=; b=HAhwfL8cm/Jew5SSrfN9P6CMX8D8iMq448craymZjkSccdPWM6AhPB3owaXxzr19If iVwJZCKjOyqak+I9kSH3M1pJTE+ZHqvdx3FOg9DIWHB/26vLpeBlrRbatTee/AJ9agM4 p+w0S8c59lfba1UfGPFLUeNloICtsVomAJc/wK7B0nu105f3Vezl1beXFXR2S/3e16Kj e0j6bNH7Hwa8T4jsZxPM1dxgsZyzczIwzko4X9v8f835DVjSkufV62kCykRKKUJ+V1lS YfWi4tqDmMrhqwxXYIxOykp+tYJhr3C0e2Hy51V7uuwmoqFUQSN0LGhI763IXk8qYW4Y 8beA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from lizzard.sbs.de (lizzard.sbs.de. [194.138.37.39]) by gmr-mx.google.com with ESMTPS id j30si167709lfp.5.2020.02.11.03.38.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Feb 2020 03:38:42 -0800 (PST) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.39 as permitted sender) client-ip=194.138.37.39; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by lizzard.sbs.de (8.15.2/8.15.2) with ESMTPS id 01BBcfta029583 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Feb 2020 12:38:41 +0100 Received: from md1za8fc.ad001.siemens.net ([139.25.69.193]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id 01BBcf1a031486; Tue, 11 Feb 2020 12:38:41 +0100 Date: Tue, 11 Feb 2020 12:38:41 +0100 From: Henning Schild To: Vijai Kumar K Cc: , Vijai Kumar K Subject: Re: [PATCH v2] rootfs: Make rootfs finalize a separate task Message-ID: <20200211123841.1a72daed@md1za8fc.ad001.siemens.net> In-Reply-To: <20200210053753.32341-1-Vijaikumar_Kanagarajan@mentor.com> References: <20200210053753.32341-1-Vijaikumar_Kanagarajan@mentor.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TUID: dvb2Q/ULHlg1 This patch will allow you to keep your apt downloading feature downstream for yourself. I would say - propose it again together with the feature. In fact if the feature was in Isar the whole problem would go away, unless you have more postprocess functions. 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. 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: