From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6491554293275951104 X-Received: by 10.223.150.115 with SMTP id c48mr2612447wra.3.1511538536427; Fri, 24 Nov 2017 07:48:56 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 10.28.19.211 with SMTP id 202ls1977905wmt.1.gmail; Fri, 24 Nov 2017 07:48:56 -0800 (PST) X-Google-Smtp-Source: AGs4zMatXnd9flSvew+f6HgitBGF9GIzsutmJy+sar9LEW/gAc1i5M/q5VAS71y3i5cIcVCTmtLB X-Received: by 10.28.184.138 with SMTP id i132mr1338529wmf.30.1511538536048; Fri, 24 Nov 2017 07:48:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511538536; cv=none; d=google.com; s=arc-20160816; b=TnN0UdWFZBu4BTNsxrWGQKr6Oz+YQo2hBhRIlpVWj0cLeoUJBpkjrAqbVVIUCjcgpe nzLqvcw0E0fNRazLDkfaGIS1iQ6nyoOEaiynTWg0r4t7qhU9DzWEHdl6k1Bnecsh+KvZ pS7A8V18BBcrYjyf8zL/5P1zBXiblH/qXxSnxWjEyFYng/rEZAC1+0Tkl3Hd5HvRW3TD kCQ7VhbgRGXEELKL0evJucQAp86MIaXNeDlQnPSVUxhStwqNAohAEiWXGNmkJX77TTvo DfqebJYlXRKB+WPIwkVMT+D2koZu9bsyh7npU6G5tlJllSxzRQpRjs4T09RxwmzRgEaf jf/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :arc-authentication-results; bh=Sh0424MQJAFR4ZAi220viKBQ8yy79kHiA6j/WSwr/j0=; b=exC5fEJOEenYmeTF7eS8psxTJKCTU4kdq8egbb9kgalkhyF+y8zZ9TcvaZyT3UbqYP SWUUHA+4gZol6tUslmlKEvpcPXFVLVlwnIiAtkYk7kIdycqzzcMcejtd836GZmJaNh9q pzq1Q07k2X0k3/lVxRV/YFhTEHPGYdS2TrOuqoAC5qfidnY99QIPdGXZOyWSLTzVSaZS Bpyq5pICILB2p3rpa22NwLTrVJPBJLKR4aGcvtrcL0aiP9DxTk6yK0K6aAaDz5Vmy98h pGAYPokXefc/t7lowbKBwPHgx11DykzFW8Dcqvt7WE2oQCVoaGZidH1gIjeMU7f35LTo Q37w== 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 j13si1257522wmh.1.2017.11.24.07.48.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Nov 2017 07:48:55 -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 [10.0.2.15] ([188.227.110.165]) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id vAOFmrsh009710 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Fri, 24 Nov 2017 16:48:54 +0100 Subject: Re: [PATCH 3/4 v2] buildchroot: Add prepare and cleanup tasks To: Henning Schild Cc: isar-users@googlegroups.com References: <20171123102532.26274-1-asmirnov@ilbers.de> <20171123102532.26274-4-asmirnov@ilbers.de> <20171124155502.5533e3b7@md1em3qc> From: Alexander Smirnov Message-ID: Date: Fri, 24 Nov 2017 18:48:47 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171124155502.5533e3b7@md1em3qc> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: RdQNbGe9u2E8 On 11/24/2017 05:55 PM, Henning Schild wrote: > Will the cleanup be run if a build fails? I can not see code that takes > care of the umount in that case. > Christian promised to think about general approach for clean up hooks, so I assumed to use it for clean up. But for now I could add some clean ups to dpkg-base class. Alex > Henning > > Am Thu, 23 Nov 2017 13:25:31 +0300 > schrieb Alexander Smirnov : > >> 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 | 2 +- >> meta/classes/image.bbclass | 1 + >> meta/recipes-devtools/buildchroot/buildchroot.bb | 21 >> +++++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) >> >> diff --git a/meta/classes/dpkg-base.bbclass >> b/meta/classes/dpkg-base.bbclass index 4941f9b..21ae88d 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 >> 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 >