From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6491554293275951104 X-Received: by 10.46.80.14 with SMTP id e14mr1114556ljb.30.1511733656201; Sun, 26 Nov 2017 14:00:56 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 10.46.101.66 with SMTP id z63ls1637820ljb.7.gmail; Sun, 26 Nov 2017 14:00:56 -0800 (PST) X-Google-Smtp-Source: AGs4zMbMj/gXigCwH4SWHOeFMTNpr4SFXgQVIUsYyfTQhNHE/77DOUwc9XGCSszcWebVF6+End8G X-Received: by 10.25.216.16 with SMTP id p16mr1131115lfg.5.1511733656090; Sun, 26 Nov 2017 14:00:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511733656; cv=none; d=google.com; s=arc-20160816; b=ow/ro/EOJ+6H34SzAfWHIa1U/f1ENHVCqgbOx1HZPgKyO6xb1veGUwkDdVtjw1TA6h 39dX5sFrLGsTNVAd4kHhn9n8HIWcYBpgZX7+MNol6KXSxfgOlvdb1IeLFW8upNHKOR9h C9E83mJ2dN1GwhJMGvJvu723J9rFBD20sSBMbzP5P6U3lnb08lKwrjDNrNwq3+RSCU8V 1pCoonXTQJbl2dn2H1KxhU9nhYpuZEkhBk34lMYxYu7Qz8axwokeSct1a/7hmMxWl/Oe +BkwJj77Glv72kNFPH34R8WAeeYFkFeaHh8A4l9br8g6UANgZoiFbQ3cytEiTAYwPiyp j9Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=bUPdsUWfFw3ptn4jqrBvG8u6xawXLYE0/9BfXux4Wyc=; b=B3ukvc3Rr//y/fFVlvJrgPRKsIHWP9dNuS5x0Gqdabo9quGffG1Pv9RVWeO3hH+YPf Ae6a4TF3gLUN71sOm/SL5MbU+Wc6HqiYagKr5HBVrQ198Ewf9YweOGQsVX63OmI7XOJQ w9C0m3vmm86m0hu2P1/DudJ3Idbt2h8fg2wXOq9Gicl71ogFVLy37kQXgva/dupxHDSh bfusJ4NVihltaqw8enYp7t1MuwoepxVwB0kcWL8x2+SZ+X/2k8nKRtck3DWDEp5BMk5X ozgC+9o2pkpcYaR2O59RehiDeVSr763P9nGC3a2+9cvstxUu5ZnPNgLnyuutxOKwSJ1K 5TDw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Return-Path: Received: from aqmola.ilbers.de (aqmola.ilbers.de. [85.214.62.211]) by gmr-mx.google.com with ESMTPS id 64si33138ljz.5.2017.11.26.14.00.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Nov 2017 14:00:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) client-ip=85.214.62.211; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Received: from localhost.localdomain ([188.227.110.165]) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id vAQM0WuO016985 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 26 Nov 2017 23:00:40 +0100 From: Alexander Smirnov To: isar-users@googlegroups.com Cc: Alexander Smirnov Subject: [PATCH v3 3/4] buildchroot: Add prepare and cleanup tasks Date: Mon, 27 Nov 2017 01:00:24 +0300 Message-Id: <20171126220025.14168-4-asmirnov@ilbers.de> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171126220025.14168-1-asmirnov@ilbers.de> References: <20171126220025.14168-1-asmirnov@ilbers.de> X-TUID: Vl7lNTE8g2Pe Some packages could require builchroot filesystem tunning, for example share Isar downloads folder with chroot filesystem. This patch adds two tasks for buildchroot: 1. 'do_prepare': This task is executed after buildchroot rootfs generation and before 'do_build' from packages to be built. Some notes: - An individual task is required for the case when you want to rebuild some package, this would require to run this preparation stuff for existing buildchroot rootfs. - This task should not have stamp. This means that anytime you want to build something, 'do_prepare' should be executed. 2. 'do_cleanup': This task is executed after all the packages are deployed. Some notes: - This task also should not have stamp. - This task depends from the recipes listed in IMAGE_INSTALL. Signed-off-by: Alexander Smirnov --- meta/classes/dpkg-base.bbclass | 3 ++- meta/classes/image.bbclass | 1 + meta/recipes-devtools/buildchroot/buildchroot.bb | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass index 4941f9b..5d7f8b6 100644 --- a/meta/classes/dpkg-base.bbclass +++ b/meta/classes/dpkg-base.bbclass @@ -2,7 +2,7 @@ # Copyright (C) 2017 Siemens AG # Add dependency from buildchroot creation -do_build[depends] = "buildchroot:do_build" +do_build[depends] = "buildchroot:do_prepare" # Each package should have its own unique build folder, so use # recipe name as identifier @@ -24,6 +24,7 @@ do_build() { ret=$? sudo umount ${BUILDROOT} 2>/dev/null || true sudo rmdir ${BUILDROOT} 2>/dev/null || true + (exit $ret) || sudo umount ${BUILDCHROOT_DIR}/git (exit $ret) || bb_exit_handler } trap '_do_build_cleanup' EXIT diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 7813b16..b0f645c 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -83,6 +83,7 @@ do_populate() { addtask populate before do_build after do_unpack do_populate[deptask] = "do_deploy_deb" +do_populate[depends] = "buildchroot:do_cleanup" do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}" diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb index 6a94733..fe88e98 100644 --- a/meta/recipes-devtools/buildchroot/buildchroot.bb +++ b/meta/recipes-devtools/buildchroot/buildchroot.bb @@ -67,7 +67,28 @@ do_build() { # Install package builder script sudo install -m 755 ${WORKDIR}/build.sh ${BUILDCHROOT_DIR} + # Create share point for downloads + sudo install -d ${BUILDCHROOT_DIR}/git + # Configure root filesystem sudo chroot ${BUILDCHROOT_DIR} /configscript.sh _do_build_cleanup } + +do_prepare[nostamp] = "1" + +do_prepare() { + sudo mount --bind ${GITDIR} ${BUILDCHROOT_DIR}/git +} + +addtask prepare after do_build + +DEPENDS += "${IMAGE_INSTALL}" +do_cleanup[deptask] = "do_deploy_deb" +do_cleanup[nostamp] = "1" + +do_cleanup() { + sudo umount ${BUILDCHROOT_DIR}/git +} + +addtask cleanup after do_prepare -- 2.9.5