From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6464921707335385088 X-Received: by 10.223.172.196 with SMTP id o62mr915411wrc.10.1505231882603; Tue, 12 Sep 2017 08:58:02 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.28.152.75 with SMTP id a72ls448019wme.23.canary-gmail; Tue, 12 Sep 2017 08:58:02 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDmFuyo8V/XG6ceimemhEYmJJj2pxD2Fh4sABEg+VtmkNa3KStTUGqtgksnn5stbIgzjSKw X-Received: by 10.28.142.201 with SMTP id q192mr1889wmd.23.1505231882255; Tue, 12 Sep 2017 08:58:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505231882; cv=none; d=google.com; s=arc-20160816; b=Byu71QaXVUd9KWrdX/J2Nj92vCgI0R1b1v6Hf4TRA+ox6OtTBikKnm4mI2jebdlNGN lp56GZBjh34wsvPxUM9eIgEGLq6o1z/LbBEiMWn5USRvxCsqbxqE20n/niTIkGaGRRZ/ 3yNgYrbPHNH9QmWT1Tuooko0BV4svg70b4E4hCnIyFJD9YUEOXgXahahQxWdR6uXxn6j 0gUZiEUcfGxtYfPEx/pEcqf3dF+1orwPblRNhc35hCgvhpSTiuhvE1dBeXrz1dtfJyWq yo8rTV2Kdl7541QJWBwJhOmohV9wYY6A8vGBhOoyleKvQDsJFfdSXpIRqAjKzKTdy9aS ULXg== 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=Nn+aEc3vD7Sow5Ce2x1hmh/U4Ubj0T67gKRbrJeXGpU=; b=tTyaaRBwOfQAIC3RMs/Bg0HKWxUvE4f+iWt7mLaVhkKbj/s9NL5SKuwll3tvpMXVmg DVSUkr9VLRCXSNKuMu2GfT5zJexeM0AdTv99rf0bFLkpkA0nmyQGJANNYZW61eu13AYi 3PY5tepbVIeLAw18REqZVtj4fxohG1YfIQziIl4UyPYpfE9HwyKsdYagSkeXJeLO6hoD 2/hTa35qzI95MrjOA3c7ZNryssJ9+yHmhpCA9kqTbh5vYWEKFhs9aKVNiO4hBe0UrD0P fG/10Tti79C3fPs7ieLO773TVy3MxoHyhJgCs9JZDTJJ6tV+XqEQIpUk/M1JMjFILef6 xplg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.2 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 thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id e135si775010wmg.6.2017.09.12.08.58.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 08:58:02 -0700 (PDT) Received-SPF: neutral (google.com: 192.35.17.2 is neither permitted nor denied by best guess record for domain of henning.schild@siemens.com) client-ip=192.35.17.2; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 192.35.17.2 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 thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id v8CFw1sn004046 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Sep 2017 17:58:01 +0200 Received: from md1em3qc.ww002.siemens.net ([139.25.68.40]) by mail2.siemens.de (8.15.2/8.15.2) with ESMTP id v8CFw19L001102; Tue, 12 Sep 2017 17:58:01 +0200 From: Henning Schild To: isar-users@googlegroups.com Cc: Alexander Smirnov , Henning Schild , Claudius Heine Subject: [PATCH v2 4/6] meta/dpkg: Move 'do_build' and buildchroot stuff to dpkg-base.bbclass Date: Tue, 12 Sep 2017 17:58:08 +0200 Message-Id: <20170912155810.9434-5-henning.schild@siemens.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170912155810.9434-1-henning.schild@siemens.com> References: <20170912155810.9434-1-henning.schild@siemens.com> X-TUID: tSqbhP/pzdFN Issue: 'do_build' contains the steps we need to "enter" and "exit" BUILDCHROOT to build packages in there. Other classes that build debian packages might need that as well but can not use it as long as it is in dkpg.bbclass. Change: Pull 'do_build' and all the buildchroot related stuff out of dpkg.bbclass and into dpkg-base.bbclass. All that remains is the implementation of the function dpkg_build(). 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-base.bbclass | 25 +++++++++++++++++++++++++ meta/classes/dpkg.bbclass | 20 -------------------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass index 64fd0e8..2402858 100644 --- a/meta/classes/dpkg-base.bbclass +++ b/meta/classes/dpkg-base.bbclass @@ -1,6 +1,31 @@ # This software is a part of ISAR. # Copyright (C) 2017 Siemens AG +# Add dependency from buildchroot creation +DEPENDS += "buildchroot" +do_build[deptask] = "do_build" + +# Each package should have its own unique build folder, so use +# recipe name as identifier +PP = "/home/builder/${PN}" + +BUILDROOT = "${BUILDCHROOT_DIR}/${PP}" +do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}" + +# default to "emtpy" implementation +dpkg_runbuild() { + die "This should never be called, overwrite it in your derived class" +} + +# Wrap the function dpkg_runbuild with the bind mount for buildroot +do_build() { + mkdir -p ${BUILDROOT} + sudo mount --bind ${WORKDIR} ${BUILDROOT} + dpkg_runbuild + sudo umount ${BUILDROOT} + rm -rf ${BUILDROOT} +} + # Install package to dedicated deploy directory do_install() { install -m 644 ${WORKDIR}/*.deb ${DEPLOY_DIR_DEB}/ diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass index 5c3c1f8..c10f5ba 100644 --- a/meta/classes/dpkg.bbclass +++ b/meta/classes/dpkg.bbclass @@ -3,27 +3,7 @@ inherit dpkg-base -# Add dependency from buildchroot creation -DEPENDS += "buildchroot" -do_build[deptask] = "do_build" - -# Each package should have its own unique build folder, so use -# recipe name as identifier -PP = "/home/builder/${PN}" - -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} } - -# Wrap the function dpkg_runbuild with the bind mount for buildroot -do_build() { - mkdir -p ${BUILDROOT} - sudo mount --bind ${WORKDIR} ${BUILDROOT} - dpkg_runbuild - sudo umount ${BUILDROOT} - rm -rf ${BUILDROOT} -} -- 2.13.5