From patchwork Wed Nov 25 03:42:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijai Kumar K X-Patchwork-Id: 207 Return-Path: Delivered-To: ilbers.mnt@gmail.com Received: by 2002:a4a:df02:0:0:0:0:0 with SMTP id i2csp371389oou; Wed, 25 Nov 2020 05:43:09 -0800 (PST) X-Received: by 2002:a1c:23cf:: with SMTP id j198mr3983762wmj.6.1606311789704; Wed, 25 Nov 2020 05:43:09 -0800 (PST) ARC-Seal: i=3; a=rsa-sha256; t=1606311789; cv=pass; d=google.com; s=arc-20160816; b=p9peN9i99RQDUjRJNO0TL/+7MrTOUmaJi4QlaoqX3jd04qtoMMG4w/9fVJZCDvMHuE aKC6kievNRXPraZSO27vpCZehr881lpdmhkFhZNGdvpM8brgt2Y8ts0/HYsjfPXyN4+K pp3F6S8CwZ8Mcg0pxCiLwOgG1uE8fBHVti8VoeZAziqSWRYIYx6lkg9r5Fc2j2b3CLWq bWit3ZlHL0cCfZkTIjy8RfnoSafsOf+Y+/AWRbvQY/+Gv7zeCZ/F1po+Dz5E/RdB3vAO xW8l5ulqwQBC9l1JaejCrTkRBVEOjxAy9/X2jxWD1q/pHI2wF3mcYveD02ycVoygJ/Q6 9PCA== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr:sender :dkim-signature; bh=U3Fm0KnNCfXwivaYYbCrc263FCAf/JxP27bypS8ZplY=; b=IKxes3zLU5BwCDmiPp1mS2QHc96QgPcRbXHJ/6yWZ7jRQ/H/C7eA6uQm5YDQPg5OsI agzlf+DDaM7FBFCbXy6Dc1MINYBzSqZu65XA0HGyI+ZFk2+eKVzkY2wFbu2Rrr6ZysVg OCQ9sMYEVtsK3HwDNSzlBs2070YI0/7r9XmgKJDloVF1XUnVwud9/Cjx7UUK1QOEGakM cOxLq8OoKOmmiyn1NweXLNNsVjQaHpgqH/bgmZEPagWVR4Hb5MAvzTOC6Fl6rpeIonZw liL5gSAvGslc2znJunV5VQPRgf6tT/pkkoB8KLnp5Fw7AxHcON7gYGlOloNrvnzKyzjC 5TsQ== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@googlegroups.com header.s=20161025 header.b=pwo+obe1; arc=pass (i=2 spf=pass spfdomain=mentor.com); spf=pass (google.com: domain of isar-users+bncbcwp7lf37ukrb3n67h6qkgqebwrorgq@googlegroups.com designates 209.85.220.55 as permitted sender) smtp.mailfrom=isar-users+bncBCWP7LF37UKRB3N67H6QKGQEBWRORGQ@googlegroups.com Received: from mail-sor-f55.google.com (mail-sor-f55.google.com. [209.85.220.55]) by mx.google.com with SMTPS id f7sor1151479wrx.7.2020.11.25.05.43.09 (Google Transport Security); Wed, 25 Nov 2020 05:43:09 -0800 (PST) Received-SPF: pass (google.com: domain of isar-users+bncbcwp7lf37ukrb3n67h6qkgqebwrorgq@googlegroups.com designates 209.85.220.55 as permitted sender) client-ip=209.85.220.55; Authentication-Results: mx.google.com; dkim=pass header.i=@googlegroups.com header.s=20161025 header.b=pwo+obe1; arc=pass (i=2 spf=pass spfdomain=mentor.com); spf=pass (google.com: domain of isar-users+bncbcwp7lf37ukrb3n67h6qkgqebwrorgq@googlegroups.com designates 209.85.220.55 as permitted sender) smtp.mailfrom=isar-users+bncBCWP7LF37UKRB3N67H6QKGQEBWRORGQ@googlegroups.com ARC-Seal: i=2; a=rsa-sha256; t=1606311789; cv=pass; d=google.com; s=arc-20160816; b=NnMelt9KRAsuxWZBoEAJJNNhgvupQRiw62/xbxUqoRW2f3x9q1PsRv46F+JfVMu2Hj fxnUS5cb4OEzjTW3/wjJosfuvGRSsQuCzNl15rxaftWsPnYGWHsawLdyphHLGsVU2Ppg kL2Pn33PR2/a88jsTRJI9h8Kf8Gl1VlJeIzOjdI6AvIYUdvqCGaDQ1fITrU7zpBzynK1 bXXGs0cVedsz0eT5p+UwjiHIkAtW+Bt9tRegSNNhK5d6OOaMls09IiiS737IclBx+dJY FLxuM2J2xk1vdv2gHLbUgdmiMMywtZ6qz20wnHudIZ6TTfly4NVAvVzwQjdTyyt9Ux10 wRuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr:sender :dkim-signature; bh=U3Fm0KnNCfXwivaYYbCrc263FCAf/JxP27bypS8ZplY=; b=Yd0JB5Y668O6rWF8PRyBTrl0myOq404IfljAVVr0e9oQJZkeSRqjNhKREf8IAo80mv D4EcY8T+dIEvBwK7Z664dD9TOAv2vBFNZFIp8+nir1hyqWzyvvl4bqsXQ39DrOEq+iQb X/jaIro7lUgNDh3/1q36OHRPS2KjreB/PbxvBtAt70BPCrtiBZskuiMkeMlvt+wIBEMO 81L71MHtVNfVjD3ezQi1OHuH7xh1NNZLRqWZK0y+7edWEPbBDqL4A5Zxr8cUQEXA4xHq zA9h1lEa9S48jKSATuQb1RBWv8TgSYrkmfne/d6jKzkXrImnvmxlwK/wkWsF1rmbJe4m DlVA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of vijaikumar_kanagarajan@mentor.com designates 68.232.137.252 as permitted sender) smtp.mailfrom=Vijaikumar_Kanagarajan@mentor.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:ironport-sdr:ironport-sdr:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=U3Fm0KnNCfXwivaYYbCrc263FCAf/JxP27bypS8ZplY=; b=pwo+obe1MzyQuEc3fhZnnk2166DrBnAB9Pt8MkpCdz4QeTXcuPrajbSk3b61WtbsR3 D0dXcQQUPcNq32hT9i+zlJmc2WUgAAKSs6pSwLUZinwkpuwIrnn3vToc0ISzQTWZrv4p wrpHfMvqC9PU/B0kd4YNkjm4YQ0RiGUnn3Vl6ga9qHC20Juc8hB3ejMOmKJYwKMV7kxj QqM7vgm2Dh2nqbOXPclWjoFhVlGEJWQzeAlxFHpT6mWvIEoqcRxym7Eg6+GU7xt9fT4m K3lAEjss0LcXcczzo+Ej+A+3E+J5EDtU0h3wYzFmikaArXa9ORRxKye5vTDjCHnkQEdc CdOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:ironport-sdr:ironport-sdr:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=U3Fm0KnNCfXwivaYYbCrc263FCAf/JxP27bypS8ZplY=; b=DwHQ3GH9P48fVoFocpmQfoJueNtj8fR6ooA1JQ9wLOYmmXaiQ4cTZyvYNz6l+wXaG+ Kztx17wA1UaOjHRueeozCleKtcfDb7+qo36O+fvxJ1sZG/5ksS4p+HyES6YC3beuQ5MO hsZRSRjUOQK9livKZImFgCL8M1j++BtvJq/Z40QmENFlhcjpRWp8KchkVKrGz2Zc+/uw 5mRwSHS0OQak9yAnqG/2OO5OhkvtJ/U+aGiCBO+aDycDARlKOXgP0OQ2lXS+vToSEoml P+CIVLYuZYiaNW/eIEirutkTvQLeA2bn0UOWxhLYX35YZZ/OmiaufN8i0Yf6Qi4oUpgH 4PaQ== Sender: isar-users@googlegroups.com X-Gm-Message-State: AOAM530rlwAB2kDb7e/FGot2PI34T6yLr8+t+U9lXTzLVMJ8b0yTQQpV 28vdr/k3T4B2CHcA0+lq6Ck= X-Google-Smtp-Source: ABdhPJwJBGs2neS2Bop2E3wCDmehSE7g/KLt67Zg6sIuGMgbwHCfdMGRPwBgvXts6x6NB5muJDBrhg== X-Received: by 2002:a5d:474f:: with SMTP id o15mr4294093wrs.100.1606311789412; Wed, 25 Nov 2020 05:43:09 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a7b:c3cf:: with SMTP id t15ls67896wmj.0.experimental-gmail; Wed, 25 Nov 2020 05:43:08 -0800 (PST) X-Received: by 2002:a1c:23cf:: with SMTP id j198mr3983673wmj.6.1606311788385; Wed, 25 Nov 2020 05:43:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606311788; cv=none; d=google.com; s=arc-20160816; b=QhBUD5UEvaoMEzX69v1Y1DJNKAwHzjfgAbvSr9L6IY0dlz1ei+CGcanxuj2pzELyyQ 31t++L5jwEk3JqBnvxZhzGWMY6EvUJ9SpVVX1aBUHDjHsz9xWeFPJlntY1sOc0lZl+qp VVvPHxNU06p7d10UleKt0sk0F1V3KLs3Yjtdki/ZWM7V6tCigpOHGwaTpw0G8PWQy7zJ vMB8veO9ClFKtB2no73RShZEFj9aDNsWxssFqEwZUPzCIPmeZBpSItuQSsd6nGm2DtCn M6LyvuRKP44vub1xIwolsbrMbkxKRRaMXjhnjMDKMRuT8qx8aknXLoicbNsPYbNthqdr 7VTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:ironport-sdr:ironport-sdr; bh=H8niWxM5BKPb6fWXtTy1dn2jxNvuJlJ1fTRLh0T9ZqE=; b=Ui2dAxbnFgvnyt2u3cY1bp3ZRaIEy9B9MfFLtvf7JNR/XV3ohbljijq3r6OQC13kEU It+xPG4kM7M3V8lgrNL/l5c0JYPJqUlgQFhgLmJ0XVsquTTSYxomBaV24oOrqu7Qcr5J r5kAwcUj1ipKg16jbbw+qnxqyYUSkWFWSR6sSkDTaD+jMKJJT8ITZuenaosDyc4xOIBI Ke68d/5a9ZucUftT1TRLXnPVZcFfppvSZNWn44aa4yQxhwD5LxPoMGh0woqqJj9aRmjU wXkZKKDSTsczL/AHys910zzbKNqTvwO6SNmaocvvmBN0O6xR90IuQi1/OJDUiByRlep0 sahg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of vijaikumar_kanagarajan@mentor.com designates 68.232.137.252 as permitted sender) smtp.mailfrom=Vijaikumar_Kanagarajan@mentor.com Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com. [68.232.137.252]) by gmr-mx.google.com with ESMTPS id c20si60917wmd.2.2020.11.25.05.43.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Nov 2020 05:43:08 -0800 (PST) Received-SPF: pass (google.com: domain of vijaikumar_kanagarajan@mentor.com designates 68.232.137.252 as permitted sender) client-ip=68.232.137.252; IronPort-SDR: XMEcdsaDsirtCcaxn60XsIkN+GEtfYk3fHA/VEDHQ0nTBe1l2NobfrjUc3i/8hfFTB7Gj0ERiN UOG0NuCs3tYmUfkx+C+O+KmceY56m0zwSTTpC8von7N8nDCt7Ie0nBCEBiAkFUuMQbw3UtM/RL uFpKwBwIykErEkpyitJtkNM+rSrZI/aX6JAFxRtTci+gg4ErZ77x0qgurKbINPNjdlKnX+BwYb qpQ7rw50f+Hft1wvyg30rJyTd+zHhj++aZ9WD/s4BHVl+21b/p1eCxAim+VONCF9GWD+Zyb8V1 Vb0= X-IronPort-AV: E=Sophos;i="5.78,368,1599552000"; d="scan'208";a="55597745" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 25 Nov 2020 05:43:07 -0800 IronPort-SDR: qUsJ4YnE92ruTXC1bQZkPNg8m4cAmbYV7Zmxc9qXwRT0+o9cDGmI8IE8dJ7H3ASpz/UD5L4ZdK reRxFbRBy3jgIrhefQ14kqw/tOgfdFh/D+GgA94HtnzLGbOFMSPUj5O6MxcVuXlIVh3oNWiXHK 7P6C6MNfAmT/mnGJPFwtEGYINgJ4uopPoMQ7zI8Sm79vajrTo5HWm6e4DBMjqSmsx/tXyhuuaU kN4Pfvs4S31XjzSBrHZa4tz1ePV1zp6b5L09MNp91Uz4TbUiZFomlmY3J/bbtsget6S2Xqv+EG hbk= From: Vijai Kumar K To: CC: Vijai Kumar K Subject: [PATCH v8 01/14] rootfs: Make rootfs finalize a separate task Date: Wed, 25 Nov 2020 19:12:23 +0530 Message-ID: <20201125134236.25878-2-Vijaikumar_Kanagarajan@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201125134236.25878-1-Vijaikumar_Kanagarajan@mentor.com> References: <20201125134236.25878-1-Vijaikumar_Kanagarajan@mentor.com> MIME-Version: 1.0 X-ClientProxiedBy: SVR-ORW-MBX-06.mgc.mentorg.com (147.34.90.206) To svr-orw-mbx-01.mgc.mentorg.com (147.34.90.201) X-Original-Sender: vijaikumar_kanagarajan@mentor.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of vijaikumar_kanagarajan@mentor.com designates 68.232.137.252 as permitted sender) smtp.mailfrom=Vijaikumar_Kanagarajan@mentor.com Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1684339991183301550?= X-GMAIL-MSGID: =?utf-8?q?1684339991183301550?= 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 --- 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 a296cc0..2391529 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -63,7 +63,7 @@ image_do_mounts() { } ROOTFSDIR = "${IMAGE_ROOTFS}" -ROOTFS_FEATURES += "clean-package-cache finalize-rootfs generate-manifest" +ROOTFS_FEATURES += "clean-package-cache generate-manifest" ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${IMAGE_INSTALL}" ROOTFS_MANIFEST_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}" @@ -173,5 +173,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 afec1cb..eae14d5 100644 --- a/meta/classes/rootfs.bbclass +++ b/meta/classes/rootfs.bbclass @@ -201,45 +201,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: