From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6488313435861811200 X-Received: by 10.28.114.6 with SMTP id n6mr1410301wmc.15.1511193271886; Mon, 20 Nov 2017 07:54:31 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 10.28.144.2 with SMTP id s2ls1030249wmd.12.canary-gmail; Mon, 20 Nov 2017 07:54:31 -0800 (PST) X-Google-Smtp-Source: AGs4zMYa5LAMqShbUGANCGwi3VO/EMTp1d6X66L5oAwuk28PZShygeTI9V8+v3oUXTX2Dbdbe5Qo X-Received: by 10.28.150.66 with SMTP id y63mr923047wmd.24.1511193271440; Mon, 20 Nov 2017 07:54:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511193271; cv=none; d=google.com; s=arc-20160816; b=UaMEZ+9MY1I9RGWMTYqWdD8frfzCXHHe36l+sPjBaymBcKbcdQprzobMAj3DcBcSun KF25rFlLvT4pv58cmzM7UjrQPnza34aEOtZNOKrzvmempZkG9Y49BLjN+hINRh1OSddK 9gicEzZL6VUO+mxWEIXmVd7RYVZ6ZOluditdXd5E+iFuItlcHf9nFNilUrn2hgRRyz84 5FEDHksHeRcbMH51QKwONyu+VtJxBEmIx4JRRuKwIOEEmltfl6e1jYLEH3C+gF3g/H9i G1I9dY+xyidu7nygZOqe/Ps4FB5gBnZhMSUQCjGnSrW7IcOC82VaCyP+qeynIK7Y9gso dy5Q== 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=pxaVgx0yUKI4o/uZrlSy7r5jUY+tZBk/eu2wUvGfqF8=; b=vUPrFegJvsXrATxkSL0mVi1sas0Yh68YbZVtBjRH83hOlHYHoTDVn/XoF5nFHzY6zL ZWdiVMVzWCDr7g3+vGNXC1H7IDQHrD4Y3hdW+7euFxpWy/IAzA9VYKzO1InX0E0tp2Me PEenu2UuSJgiiyJFgqFafs8kkR7bkmZCL3EDJEfRSz2gZf2Al5avrP89Ch+J6sMKmwwY +P4JhCusRkKMkKstnEwHLTMag6tnH5ZPh1rZCR9psBHMeeJsMyPUhF+XYuhGUHqRRbtQ +PAShcRHK0XPds4ES938iWnkqfZ3PzNDtq+j3CRZ2CxYxK+cU96kLmIWbc9cSV8vkRly 4PDQ== 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 j26si810435wmh.0.2017.11.20.07.54.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Nov 2017 07:54:31 -0800 (PST) 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 vAKFsSa4030684 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 20 Nov 2017 16:54:30 +0100 Subject: Re: [PATCH] Map git objects to buildchroot To: Henning Schild Cc: isar-users@googlegroups.com References: <20171120103728.08714150@md1em3qc> <20171120150641.9645-1-asmirnov@ilbers.de> <20171120163216.494df210@md1em3qc> From: Alexander Smirnov Message-ID: Date: Mon, 20 Nov 2017 18:54:23 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171120163216.494df210@md1em3qc> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: rlzMbiCuMed0 On 11/20/2017 06:32 PM, Henning Schild wrote: > 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. Sorry, didn't get your idea regarding one mount buildchroot.bb, what do you mean? BTW: we always have option to clone git repository to workspace by running in ${WORKDIR}/git: $ git repack -a in do_build() task. With this, no extra mount/umount logic is needed. We could consider this behavior for source 3.0 packages only by using some flag in recipe. Alex