From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6592507174472122368 X-Received: by 2002:a6b:3294:: with SMTP id y142-v6mr3646146ioy.125.1535264513752; Sat, 25 Aug 2018 23:21:53 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a02:9145:: with SMTP id b5-v6ls1649530jag.9.gmail; Sat, 25 Aug 2018 23:21:53 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaEy40V956OcP2UKryCrmXHhDCXGvOmIdEgcuM+zgEw9Zjm+r7sQjy1wYLMgu3oPZI6q1T2 X-Received: by 2002:a02:565b:: with SMTP id o88-v6mr317414jab.14.1535264513489; Sat, 25 Aug 2018 23:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535264513; cv=none; d=google.com; s=arc-20160816; b=I0FvtfVoqeV3K2kN5Kz9WzyFDKOScpoQDBvZm0qjXhbkbQlC9ZUE1ybQ/vB2XpJufc jehmQPfTqquq+mlmZZjuLLwnxXJQI4GOvuu2+wsYuZiIwM5Vu1/92lVibJpgDE3qjzYV 2YNpOFSDBvIecQod557phDpGSu+ZYaQjBU5d36rOIdMMzdJDI48nkPuGooePTRg5HaYv w7XxvGmWDPHKuBY9nPAcofub/lzAiWMbKDVCQvrItrp9HpybqTx5+2HyKtyuh8X0ECnh BDFCTZydeIQ3sNG4uBoAukDMQ4hInjwk3660zX2sxhLkaVqjmiqyOfMKq2UlVSQmamwR vAow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:arc-authentication-results; bh=PIUSqU/2scyNjaQQDkQFF2NpGZTbqBdjDE/YQSiiKkE=; b=htTzNQZEi+7e2Nyqw0tx5RmWAhqA5Psy89C+2JaR0rW4RMpRSki2KANcQeeJXJr2Ef zkYyn80jgBGCBGYfKL3yxUvY/jcpQqkLhLn0XyXEKFqxmSGnYMPhNE/AoiCd8sf39g6o O2n2iParmVJR78qQKvJSyV6jow635bvWboO/ZxTGvcqUwp5+exrHdVYAIMyViAcJk/jn eG2tdplybL0BK1F8uhKICoCVEMScBSXeZyUx1kJ2ZsfJg8r5jnWmjcojzN8mowEU00DN UYuNKF7szJssgiVtAZFpIihibmjdFIvWAdC8iXNDKD37SLfcqB8txzzx3XDGxrcjLuLB b7yg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of cedric_hombourger@mentor.com designates 192.94.38.131 as permitted sender) smtp.mailfrom=Cedric_Hombourger@mentor.com Return-Path: Received: from relay1.mentorg.com (relay1.mentorg.com. [192.94.38.131]) by gmr-mx.google.com with ESMTPS id z13-v6si703030iop.0.2018.08.25.23.21.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Aug 2018 23:21:53 -0700 (PDT) Received-SPF: pass (google.com: domain of cedric_hombourger@mentor.com designates 192.94.38.131 as permitted sender) client-ip=192.94.38.131; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of cedric_hombourger@mentor.com designates 192.94.38.131 as permitted sender) smtp.mailfrom=Cedric_Hombourger@mentor.com Received: from nat-ies.mentorg.com ([192.94.31.2] helo=svr-ies-mbx-02.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1ftoQq-0000KB-LY from Cedric_Hombourger@mentor.com for isar-users@googlegroups.com; Sat, 25 Aug 2018 23:21:52 -0700 Received: from FRG-W10-HOMBOUR.world.mentorg.com (137.202.0.90) by svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Sun, 26 Aug 2018 07:21:48 +0100 From: Cedric Hombourger To: CC: Cedric Hombourger Subject: [PATCH v3 3/3] dpkg+linux: use Isar's lock via do_prepare[lockfiles] instead of flock Date: Sun, 26 Aug 2018 08:21:28 +0200 Message-ID: <1535264488-128-3-git-send-email-Cedric_Hombourger@mentor.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535264488-128-1-git-send-email-Cedric_Hombourger@mentor.com> References: <20180822154145.07d4a2ca@md1pvb1c.ad001.siemens.net> <1535264488-128-1-git-send-email-Cedric_Hombourger@mentor.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) To svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) X-TUID: sJB5cZ0Y0dU8 reprepro and apt operations may not run in parallel since this could result in the apt database being updated (by reprepro) while it is being read (by apt-get update). reprepro calls were already serialized with Isar's lock (via do_deploy_deb[lockfiles]). Use the same lock for do_prepare in the dpkg and linux-custom packaging code. This allows us to drop the /dpkg.lock flock and use bitbake's locking scheme instead. Signed-off-by: Cedric Hombourger --- meta/classes/dpkg.bbclass | 3 +++ meta/recipes-devtools/buildchroot/files/deps.sh | 29 ++++++++++--------------- meta/recipes-kernel/linux/linux-custom.inc | 6 +++-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass index e8bd6ba..2e53c1b 100644 --- a/meta/classes/dpkg.bbclass +++ b/meta/classes/dpkg.bbclass @@ -9,6 +9,9 @@ dpkg_prepare() { sudo -E chroot ${BUILDCHROOT_DIR} /isar/deps.sh ${PP}/${PPS} ${DISTRO_ARCH} } +# apt and reprepro may not run in parallel, acquire the Isar lock +do_prepare[lockfiles] += "${DEPLOY_DIR_APT}/isar.lock" + # Build package from sources using build script dpkg_runbuild() { E="${@ bb.utils.export_proxies(d)}" diff --git a/meta/recipes-devtools/buildchroot/files/deps.sh b/meta/recipes-devtools/buildchroot/files/deps.sh index 854a4d5..4bd604f 100644 --- a/meta/recipes-devtools/buildchroot/files/deps.sh +++ b/meta/recipes-devtools/buildchroot/files/deps.sh @@ -12,21 +12,16 @@ source /isar/common.sh # 2) we add -y to go non-interactive install_cmd="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -( - # Lock-protected because apt and dpkg do not wait in case of contention - flock 42 || exit 1 +# Make sure that we have latest isar-apt content. +# Options meaning: +# Dir::Etc::sourcelist - specifies which source to be used +# Dir::Etc::sourceparts - disables looking for the other sources +# APT::Get::List-Cleanup - do not erase obsolete packages list for +# upstream in '/var/lib/apt/lists' +apt-get update \ + -o Dir::Etc::sourcelist="sources.list.d/isar-apt.list" \ + -o Dir::Etc::sourceparts="-" \ + -o APT::Get::List-Cleanup="0" - # Make sure that we have latest isar-apt content. - # Options meaning: - # Dir::Etc::sourcelist - specifies which source to be used - # Dir::Etc::sourceparts - disables looking for the other sources - # APT::Get::List-Cleanup - do not erase obsolete packages list for - # upstream in '/var/lib/apt/lists' - apt-get update \ - -o Dir::Etc::sourcelist="sources.list.d/isar-apt.list" \ - -o Dir::Etc::sourceparts="-" \ - -o APT::Get::List-Cleanup="0" - - # Install all build deps - mk-build-deps $set_arch -t "${install_cmd}" -i -r debian/control -) 42>/dpkg.lock +# Install all build deps +mk-build-deps $set_arch -t "${install_cmd}" -i -r debian/control diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc index 26c6ad8..8438143 100644 --- a/meta/recipes-kernel/linux/linux-custom.inc +++ b/meta/recipes-kernel/linux/linux-custom.inc @@ -29,13 +29,15 @@ KERNEL_DEBIAN_DEPENDS ?= "initramfs-tools | linux-initramfs-tool, kmod, linux-ba KERNEL_HEADERS_DEBIAN_DEPENDS ?= "libc6, libssl1.1" dpkg_prepare() { - # Lock-protected because apt and dpkg do not wait in case of contention sudo -E chroot ${BUILDCHROOT_DIR} \ - flock /dpkg.lock apt-get install \ + apt-get install \ -y -o Debug::pkgProblemResolver=yes \ --no-install-recommends ${KBUILD_DEPENDS} } +# apt and reprepro may not run in parallel, acquire the Isar lock +do_prepare[lockfiles] += "${DEPLOY_DIR_APT}/isar.lock" + dpkg_runbuild() { # Install package builder script sudo install -m 755 ${WORKDIR}/build-kernel.sh ${BUILDCHROOT_DIR} -- 2.11.0