From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6488313435861811200 X-Received: by 10.28.209.68 with SMTP id i65mr209671wmg.27.1511191919318; Mon, 20 Nov 2017 07:31:59 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 10.223.181.129 with SMTP id c1ls2533862wre.9.gmail; Mon, 20 Nov 2017 07:31:59 -0800 (PST) X-Google-Smtp-Source: AGs4zMaEhFR4ZIxHKXypu/xE6YT90Dr8z1sWqGdr10ui1W0sItLC+W718m/ZSQSymT2ZE5bpzZEh X-Received: by 10.28.184.216 with SMTP id i207mr1575369wmf.2.1511191918981; Mon, 20 Nov 2017 07:31:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511191918; cv=none; d=google.com; s=arc-20160816; b=Uo3DVm7E+0SfnEciSgNKwssY//2yc2dRgHeyzD8MylpQ7giVrbJqinsufEsU7h4SG8 QZJuv9uwsgXtk1fTLkmRTuX6+REWxeP7i7xOcYXuJ76nUeEJED707a64WhwMATjbqLQ4 RJ+rwQ16rWHffyrCaBKavUeUFTDYucWUukWJ1L+7TMMQcSGfxt5tbU5M8CveJ3IehX+j 1lU9zcGwmZEhQ/ojPTZt++7bLNpEEtevY4yJh1rW2W909ETk4RIU4p28bXfbdqtmUpSi TkJ+Rw/+Nxedq2aRMRfqtv2QGK4jBV3/O35dGAdbxjZ2sJVKi0CHeBFcErY4sr56OQxG Odiw== 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=FOmV/4y6W/pcWqs7+VI7ah1+FrySVkZDN+UfjU0VYCc=; b=RPjOe6UwBEiWawm9iKOrUsQN9CSeoY21DPgviZIGk/k3Cey+TrfH8R5GDrBWKmYVpp ndWh2pYKcyD0alUCRuuWhFiccw+9wy82bqJVWOgrcNYJDsZBSTYGZPi/z8Pu1Qdn5skZ jzFwqwCMb6QAe62tkSIIBD3mnOdt/1hGV8iKN0B3wZaPa4ZVnpk33q0lL3w9t9vfJWFz 8RvlM33d+QL7BoNXnteQLLewjOyjUYJEZixseiZdaXW5bsBVEc4cXPmHle8HVs9ToOtU U3y+t6NUspbeS92OZFMQXchNYXrDuipUZnJWYYuIMPDaEybwZsJ4Oc5a88o8ZBMiqUKR fYWA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.2 as permitted sender) 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 r6si630592wrg.2.2017.11.20.07.31.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Nov 2017 07:31:58 -0800 (PST) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.2 as permitted sender) client-ip=192.35.17.2; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=henning.schild@siemens.com Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id vAKFVw35016257 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 Nov 2017 16:31:58 +0100 Received: from md1em3qc ([139.25.68.40]) by mail3.siemens.de (8.15.2/8.15.2) with ESMTP id vAKFVwlp006825; Mon, 20 Nov 2017 16:31:58 +0100 Date: Mon, 20 Nov 2017 16:32:16 +0100 From: Henning Schild To: Alexander Smirnov Cc: Subject: Re: [PATCH] Map git objects to buildchroot Message-ID: <20171120163216.494df210@md1em3qc> In-Reply-To: <20171120150641.9645-1-asmirnov@ilbers.de> References: <20171120103728.08714150@md1em3qc> <20171120150641.9645-1-asmirnov@ilbers.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: 0ArxjYOo7Au5 Am Mon, 20 Nov 2017 18:06:41 +0300 schrieb Alexander Smirnov : > Hi Christian, > > The patch above has 2 major issues: > > 1. It mounts ${GITDIR} to buildchroot during package building. This > variable is static, so it's the same for each recipe. This means that > if several packages are building in parallel, the folder > ${BUILDCHROOT_DIR}/${GITDIR} could be mounted/unmounted while there > is active I/O operation by another package. To be honest, I don't > know what could happen, but believe in worst case. True, that must not happen! > 2. Using host configuration in buildchroot could lead to some > problems. Lets consider the following example: > - User override ${DL_DIR} to point it to local cache, let's > say: /home/builder/XXX > - Isar uses the following path to build package > YYY: /home/builder/YYY > - If XXX equals YYY, you will probably experience some problems, > because your source tree will be overriden by incorect mount. > > So I'd see the more generic solution like patch below: > > 8<-- > > dpkg-base: Map git objects to buildchroot > > This patch mounts git repository to buildchroot into the respective > folder: > > /git/$REPO_NAME > > Also it updates git alternative to correctly point to objects in > buildchroot. > > Signed-off-by: Alexander Smirnov > --- > meta/classes/dpkg-base.bbclass | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/meta/classes/dpkg-base.bbclass > b/meta/classes/dpkg-base.bbclass index 35af6d5..147cfce 100644 > --- a/meta/classes/dpkg-base.bbclass > +++ b/meta/classes/dpkg-base.bbclass > @@ -19,12 +19,25 @@ dpkg_runbuild() { > > # Wrap the function dpkg_runbuild with the bind mount for buildroot > do_build() { > + if [ -d ${WORKDIR}/git/.git ]; then > + OBJ_PATH=$(cat ${WORKDIR}/git/.git/objects/info/alternates) > + REPO_PATH=$(dirname $OBJ_PATH) > + REPO_NAME=$(basename $REPO_PATH) > + sudo mkdir -p ${BUILDCHROOT_DIR}/git/$REPO_NAME > + sudo mount --bind $REPO_PATH > ${BUILDCHROOT_DIR}/git/$REPO_NAME > + echo "/git/$REPO_NAME/objects" > > ${WORKDIR}/git/.git/objects/info/alternates > + fi > + > mkdir -p ${BUILDROOT} > sudo mount --bind ${WORKDIR} ${BUILDROOT} > _do_build_cleanup() { > ret=$? > sudo umount ${BUILDROOT} 2>/dev/null || true > sudo rmdir ${BUILDROOT} 2>/dev/null || true > + if [ -d ${WORKDIR}/git/.git ]; then > + sudo umount ${BUILDCHROOT_DIR}/git/$REPO_NAME > + sudo rm -rf ${BUILDCHROOT_DIR}/git/$REPO_NAME > + fi > (exit $ret) || bb_exit_handler > } > trap '_do_build_cleanup' EXIT I would not do this either. There should be one mount in buildchroot.bb and one umount. Additional umounts could be allowed in exception handlers, in case they can not call out to functions from buildchroot. Henning