From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6464921707679318016 X-Received: by 10.25.92.197 with SMTP id u66mr1021279lfi.10.1505306650640; Wed, 13 Sep 2017 05:44:10 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.25.145.81 with SMTP id y17ls66565lfj.53.gmail; Wed, 13 Sep 2017 05:44:10 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCi397yixJm+NZM72AxiCVlLAM9FKfIXqhLywIEssoiWiRIwUSIjN8fFiiHCQDWIRm04Ad/ X-Received: by 10.25.228.134 with SMTP id x6mr1425240lfi.33.1505306650151; Wed, 13 Sep 2017 05:44:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505306650; cv=none; d=google.com; s=arc-20160816; b=EKogJi8c8wY2xEyJEjfxJInvcajB98S1zFtYaHru41QQ80KRn9iuEChTamAg4d+OQr A5odcxk7rMLKxBexro73x84sDGz7BnPPphsYc4KBwwvSKItKm4CJpCdmmaZ17VZ1d3J+ lp9lYol4L44dy2shYGvOPMN6D9XwQFUGDrlbnuF3LcA5cqwrkpX3KJ4QLYidRPHADFIR nAAkmGGrDvKbaaBLLTMZfsiY1DomBpTlY/J2tLY5Juruj4081fbBn/dV3CZCysbzfx7Q v6N87W015refRufMn8aOclLVhEME1oKyqhJoUeqgdmpo/XT4wmTegahYR6z1WhPbYDYn /GVw== 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=coTUH+dSkiqGH52b3ReWfXdXBnuHuQh7m6FBT/efpiE=; b=ycIRMCq6hkberhtq4bot+YNECM2Nam2zZru9BR23bmvDa3659fvLCoLnt9YhxPu44n +QV+x2hLev/tTzXf3ql5zJeHsdi/C2164xMq/bWWTaGuugu7jlUsstmRBIIRJE2DipZ1 sZ7vcjA38l8jptsaTsiIqsQApdBvpSU/WszIEYAGPzWFL63Mv31wY0/mILo32D1zbwp8 5lxQKOYMC+uO9jL0r2WgB5LXzmkRC7SXPQSaT8hkMKmYSqqsELaXDscmPTcXUuQkgGXV uPnPcNv5J7qUIFXGrxHXBjsokg7Y+K8coRyNG8Al1VZZZm1Oqf5op+O5v+Tnp8sQANdQ VUbg== 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 b130si71038wme.0.2017.09.13.05.44.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Sep 2017 05:44:09 -0700 (PDT) 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 v8DCi509011777 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Wed, 13 Sep 2017 14:44:07 +0200 Subject: Re: [PATCH v2 3/6] meta/dpkg: pull out actual build command from 'do_build' To: Henning Schild , isar-users@googlegroups.com Cc: Claudius Heine References: <20170912155810.9434-1-henning.schild@siemens.com> <20170912155810.9434-4-henning.schild@siemens.com> From: Alexander Smirnov Message-ID: Date: Wed, 13 Sep 2017 15:44:00 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170912155810.9434-4-henning.schild@siemens.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: wFy9ARDaE1DD Hi, On 09/12/2017 06:58 PM, Henning Schild wrote: > Issue: > The 'do_build' task in dpkg does more than just building, it also > prepares the build environment and cleans it up after building. > Other classes building debian packages might need the same steps while > implementing the actual build step in a different way. > > Change: > Pull the actual building out into a function that gets called from > 'do_build' between the pre and post stuff. > > Impact: > This patch does not change the behaviour of Isar. It addresses the issue > and prepares for another patch. > > Signed-off-by: Henning Schild > --- > meta/classes/dpkg.bbclass | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass > index abd4cef..5c3c1f8 100644 > --- a/meta/classes/dpkg.bbclass > +++ b/meta/classes/dpkg.bbclass > @@ -15,10 +15,15 @@ BUILDROOT = "${BUILDCHROOT_DIR}/${PP}" > do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}" > > # Build package from sources using build script > +dpkg_runbuild() { > + sudo chroot ${BUILDCHROOT_DIR} /build.sh ${PP}/${SRC_DIR} > +} That's one of the weak places in Isar (also there are several others with the same issue). If chroot failed - we will have some folders mounted. Can we somehow track return value and perform clean-up if build failed? I do not mean to rework this patch, this could be done later. The question is if it's possible in general with such splitting approach. Alex > + > +# Wrap the function dpkg_runbuild with the bind mount for buildroot > do_build() { > mkdir -p ${BUILDROOT} > sudo mount --bind ${WORKDIR} ${BUILDROOT} > - sudo chroot ${BUILDCHROOT_DIR} /build.sh ${PP}/${SRC_DIR} > + dpkg_runbuild > sudo umount ${BUILDROOT} > rm -rf ${BUILDROOT} > } >