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]. Cheers, Claudius [1] https://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html#events -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de PGP key: 6FF2 E59F 00C6 BC28 31D8 64C1 1173 CB19 9808 B153 Keyserver: hkp://pool.sks-keyservers.net