From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Claudius Heine <ch@denx.de>,
Cedric Hombourger <Cedric_Hombourger@mentor.com>
Subject: [PATCH] rootfs: Take isar-apt shared lock during repository
Date: Tue, 3 Sep 2019 07:41:40 +0200 [thread overview]
Message-ID: <96728688-e707-9e8f-4f32-9ded7b5300b4@siemens.com> (raw)
From: Jan Kiszka <jan.kiszka@siemens.com>
We take this lock already for install_imager_deps, but we also need it
conceptually for the rootfs installation. Also here, pulling from
isar-apt can race with not-yet finished deployments of parallel builds,
even if the target package is not shared. See e9a5d8adf6b5 for further
details.
To avoid holding the lock across the whole lengthy package installation,
introduce command flags that define the beginning and the end of the
locked section so that do_rootfs_install can manage that.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta/classes/rootfs.bbclass | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index c7e0435..314efd7 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -93,6 +93,7 @@ EOSUDO
ROOTFS_INSTALL_COMMAND += "rootfs_install_pkgs_update"
rootfs_install_pkgs_update[weight] = "5"
+rootfs_install_pkgs_update[isar-lock] = "acquire-before"
rootfs_install_pkgs_update() {
sudo -E chroot '${ROOTFSDIR}' /usr/bin/apt-get update \
-o Dir::Etc::sourcelist="sources.list.d/isar-apt.list" \
@@ -108,6 +109,7 @@ rootfs_install_resolvconf() {
ROOTFS_INSTALL_COMMAND += "rootfs_install_pkgs_download"
rootfs_install_pkgs_download[weight] = "600"
+rootfs_install_pkgs_download[isar-lock] = "release-after"
rootfs_install_pkgs_download() {
sudo -E chroot '${ROOTFSDIR}' \
/usr/bin/apt-get ${ROOTFS_APT_ARGS} --download-only ${ROOTFS_PACKAGES}
@@ -153,7 +155,15 @@ python do_rootfs_install() {
for cmd in cmds:
progress_reporter.next_stage()
+
+ if (d.getVarFlag(cmd, 'isar-lock') or "") == "acquire-before":
+ lock = bb.utils.lockfile(d.getVar("REPO_ISAR_DIR") + "/isar.lock",
+ shared=True)
+
bb.build.exec_func(cmd, d)
+
+ if (d.getVarFlag(cmd, 'isar-lock') or "") == "release-after":
+ bb.utils.unlockfile(lock)
progress_reporter.finish()
}
addtask rootfs_install before do_rootfs_postprocess after do_unpack
--
2.16.4
next reply other threads:[~2019-09-03 5:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-03 5:41 Jan Kiszka [this message]
2019-09-18 13:46 ` Baurzhan Ismagulov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=96728688-e707-9e8f-4f32-9ded7b5300b4@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=Cedric_Hombourger@mentor.com \
--cc=ch@denx.de \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox