From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6464921707679318016 X-Received: by 10.46.95.133 with SMTP id x5mr42238lje.38.1505316410352; Wed, 13 Sep 2017 08:26:50 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.25.76.193 with SMTP id z184ls109350lfa.14.gmail; Wed, 13 Sep 2017 08:26:49 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDcWGqmsDw13mCUhiLsH2ielp08F1afH2185uKJIQ5dOw6gex6aqp3A2ocQTr0IlZtW4LU9 X-Received: by 10.46.65.84 with SMTP id o81mr912309lja.19.1505316409651; Wed, 13 Sep 2017 08:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505316409; cv=none; d=google.com; s=arc-20160816; b=Tx9U+nJYdn58Nmxjkr7cvhVvzTx+wTJgyb8IkwDPrGnmfVZ7HSYW9kTVgdluLNp+BI iFS5p3xQ2D5SF4B6QAB+im/deHi9z0r0+nz6hPjUqYPIJkg0IPB5hh3/9waz6de0mU/u ssKAN587rO0a2cFL11NUA7n3tBU+sdhxo0OdHkFpLcAX78nVqa/+nu5Z04SGRYszSrFn Xam0nhcYxvJTTNex1CwG0gkt1K3b13Lw5R6eecvstr4eY9Gm8bLNplvt2bOpkjWulsvZ r3lwR5d3sMDjC6QGSTujw/u5ZlYIJzZN/NhYzOqrDrnqnpvqnA5jW3SyXYtaAP35O0qm ogDQ== 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:arc-authentication-results; bh=vpeGd8rQnEQDHUYLI6hremn9Agwf0JYj3Pz0z2Qy4UI=; b=bmf28AQYkyaVIbKqlGWzsrkjXHTQK3rf4q7jl3UUbVZYk1ptbyEkzSuir2L5EE/Mf0 bAFkH/Fcs7/MalS+iXS8yczkQK6Ri4xBf+3clY+cxtmoVKccqa+zqsxDswek9h/cgIUU PAvmhINwrRkvaOR8gSZXIwZGSRX98zC8J+nhO9scBvO25xuAipJTA80qpyd9FjKuAlg+ EuMOaanNz4RboTURmgSj5uBLB8BHf5HcinA8NKytgtlidLka9GUHh0I+FzxsXdCkviAw HHb+rFo5iZbB4g/Hr/Y6MBbzrFAo8BXzBfRk1NHorMMdTMaJQwn8V2p5mK97JcOerZzi j1Iw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.28 is neither permitted nor denied by best guess record for domain of henning.schild@siemens.com) smtp.mailfrom=henning.schild@siemens.com Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id 191si111182wmn.2.2017.09.13.08.26.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Sep 2017 08:26:49 -0700 (PDT) Received-SPF: neutral (google.com: 192.35.17.28 is neither permitted nor denied by best guess record for domain of henning.schild@siemens.com) client-ip=192.35.17.28; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 192.35.17.28 is neither permitted nor denied by best guess record for domain of henning.schild@siemens.com) smtp.mailfrom=henning.schild@siemens.com Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id v8DFQmRn024802 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Sep 2017 17:26:48 +0200 Received: from md1em3qc ([139.25.68.40]) by mail2.siemens.de (8.15.2/8.15.2) with ESMTP id v8DFQmkO008842; Wed, 13 Sep 2017 17:26:48 +0200 Date: Wed, 13 Sep 2017 17:27:01 +0200 From: Henning Schild To: Claudius Heine Cc: Alexander Smirnov , Subject: Re: [PATCH v2 3/6] meta/dpkg: pull out actual build command from 'do_build' Message-ID: <20170913172701.78d8cd09@md1em3qc> In-Reply-To: <55f37287-c7b7-7e8a-1319-50906a9e146b@denx.de> References: <20170912155810.9434-1-henning.schild@siemens.com> <20170912155810.9434-4-henning.schild@siemens.com> <20170913154120.1e10131f@md1em3qc> <55f37287-c7b7-7e8a-1319-50906a9e146b@denx.de> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TUID: 7rPLRusBH+zI Am Wed, 13 Sep 2017 16:40:50 +0200 schrieb Claudius Heine : > Hi, > > On 13.09.2017 15:41, Henning Schild wrote: > > Am Wed, 13 Sep 2017 15:44:00 +0300 > > schrieb Alexander Smirnov : > > > >> 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 found that issue as well. But i decided to ignore it for now, > > because i did not introduce it. > > > > It would be easy to deal with it. i.e. > > > > mkdir > > touch > > mount > > do > > umount > > rm > > rmdir > > > > would become > > > > ret=0 > > mkdir > > touch > > mount > > do || ret=$? > > umount > > rm > > rmdir > > return ret > > Another solution might be to look into events and write some cleanup > code there [1]. Sounds like a good idea. It is basic error/exception handling. I am sure bitbake has some mechanism for that, my example above was just made up without any research in existing mechanism. Henning > Cheers, > Claudius > > [1] > https://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html#events >