From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6521574339082452992 X-Received: by 10.28.69.194 with SMTP id l63mr150912wmi.18.1518597431377; Wed, 14 Feb 2018 00:37:11 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 10.28.206.133 with SMTP id e127ls2012367wmg.10.canary-gmail; Wed, 14 Feb 2018 00:37:10 -0800 (PST) X-Google-Smtp-Source: AH8x227rSB0OwhAoVjRiRX+6sPWmDMI8MfFUsN12yQZjBbngb8JqbIrhr+VbOgJ+XdQkWOdh4SA5 X-Received: by 10.28.192.4 with SMTP id q4mr425268wmf.25.1518597430175; Wed, 14 Feb 2018 00:37:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518597430; cv=none; d=google.com; s=arc-20160816; b=r7wHKU//3pH/XpG3ZFKr0KAOyrmRL1WlfKcNB1VwRlSYFleImY98XVbcMHJyea+NOn 51ivQVPt3tvnHQkz8gZWRBrle/W21VSObVkl7mP/SJjaVXmX0pK53eQcszJvJrxbnwdT 9iM4ccRfo5v8X4n1qPAFbkqMFi5DWbddJT1DczVRrOvLhk7tHwrc1kxzBAF7o4bttghq YI6Uz2yRcOP5P8nv6wct9/zQscN4O1LqwjI0Hcuu9SqQ/3dPHK5XPPy/IqN/Joh6G5hr wxzEtdK+yoPUR8WXFixfyz8K+2UJowsQOBEqNMmI14fZD3o73UaajMfTMskxevgBZg42 DUbA== 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:to:subject :arc-authentication-results; bh=Mk84r8lo11xGdIQnW5TzwDZVjOas+4L1uq30ZUjY44k=; b=HeD+HEFJiTc7eeYPWOJJD6m0zW6b3d7c33w0gJuFCOnqM1/VqeWvTGRnkW1fbSNwKi k1zKiN6HiT5FBpG2hzbMoycgKUFbBWkM+Kirarq0nvg8HjMHQ0sgq/mWXL9pyIgHJKgE aoNekJSe/bmwOHqxelKpa7Gc/yPY3bFwzMP1n0zA1XDuRF+/CN72keNBOhNXxgqIHVn6 Ri0KUPvZKV2kzfbaLRzZUdLQKWtyoUpW88U+xtWdYqEFR0NnSpsTBaIt9KsJqSXqurWo pjqaCCHFVXrttLqofm2PmmxlpDxOudfNBvECfCYs4WayCBOWz9NQ6hNNNnJ+blJvIqg4 NsOQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id r20si100404wmg.0.2018.02.14.00.37.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Feb 2018 00:37:10 -0800 (PST) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) client-ip=192.35.17.28; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=jan.kiszka@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 w1E8b9Qu024846 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Feb 2018 09:37:09 +0100 Received: from [167.87.7.84] ([167.87.7.84]) by mail2.siemens.de (8.15.2/8.15.2) with ESMTP id w1E8b92U029276; Wed, 14 Feb 2018 09:37:09 +0100 Subject: Re: [PATCH v2 5/9] Move buildchroot mounts into dpkg-base class To: Alexander Smirnov , isar-users References: <697b09bb60a515430f655989e859263922148264.1518552327.git.jan.kiszka@siemens.com> <640ea89d-7320-30b9-fd22-4747ee3f727f@ilbers.de> <4e4079c2-d3b5-cd05-8133-b31a38f2c814@siemens.com> <16192e0edf0.27ac.034a6b0541ed39b7fb4e17f4ac219eaa@ilbers.de> From: Jan Kiszka Message-ID: Date: Wed, 14 Feb 2018 09:37:09 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: <16192e0edf0.27ac.034a6b0541ed39b7fb4e17f4ac219eaa@ilbers.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-TUID: RtW5i7iLujkT On 2018-02-14 06:54, Alexander Smirnov wrote: > > Jan Kiszka 13 февраля 2018 г. 23:48:02 написал: > >> On 2018-02-13 21:17, Alexander Smirnov wrote: >>> >>> >>> On 02/13/2018 11:05 PM, Jan Kiszka wrote: >>>> From: Jan Kiszka >>>> >>>> This avoids the unfortunate setup_mounts task which is either not >>>> executed on rebuilds or causes excessive package rebuilds. We just need >>>> ensure prior to switching into the buildchroot that all mount points >>>> are >>>> populated. >>>> >>>> Signed-off-by: Jan Kiszka >>>> --- >>>>   meta/classes/dpkg-base.bbclass                   | 13 +++++++++- >>>>   meta/recipes-devtools/buildchroot/buildchroot.bb | 30 >>>> +++--------------------- >>>>   2 files changed, 15 insertions(+), 28 deletions(-) >>>> >>>> diff --git a/meta/classes/dpkg-base.bbclass >>>> b/meta/classes/dpkg-base.bbclass >>>> index a45fbce..66132da 100644 >>>> --- a/meta/classes/dpkg-base.bbclass >>>> +++ b/meta/classes/dpkg-base.bbclass >>>> @@ -2,7 +2,7 @@ >>>>   # Copyright (C) 2017 Siemens AG >>>>     # Add dependency from buildchroot creation >>>> -do_build[depends] = "buildchroot:do_setup_mounts" >>>> +do_build[depends] = "buildchroot:do_build" >>>>     # Add dependency between Isar recipes >>>>   DEPENDS ?= "" >>>> @@ -20,11 +20,22 @@ dpkg_runbuild() { >>>>       die "This should never be called, overwrite it in your derived >>>> class" >>>>   } >>>>   +mount_if_needed() { >>>> + >>>> +    # The test may race with parallel builds. So probe, mount if >>>> needed, and >>>> +    # then only fail if both the mount and yet another probe failed >>>> as well. >>>> +    grep -q $2 /proc/mounts || sudo mount $1 $2 || grep -q $2 >>>> /proc/mounts >>> >>> This could lead to have lots of remounts on the same folder during >>> parallel execution. This should be done in a separate task and protected >>> by [lockfiles]. >> >> No, it won't - please re-read the code. It's a classic retry pattern, >> and it's even detecting errors. >> > > 'mount --bind' never fails. So if several do_build() have passed first > grep in parallel, then each one will mount 'isar-apt'. Or I don't > understand this. That is a valid remark - I wasn't aware of that behaviour (and explaining this earlier would have helped a lot). I will come up with a safe variant using flock soon. And before you pull out your task idea again, I'd like to cite from the bitbake manual: "Any task that depends (possibly indirectly) on a [nostamp] task will always be executed as well. This can cause unnecessary rebuilding if you are not careful." That's why its broken by design. Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux