From: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
To: <isar-users@googlegroups.com>
Cc: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
Subject: [PATCH v7 06/14] deb-dl-dir: Factor out the mounting part
Date: Wed, 25 Nov 2020 13:32:53 +0530 [thread overview]
Message-ID: <20201125080301.15818-7-Vijaikumar_Kanagarajan@mentor.com> (raw)
In-Reply-To: <20201125080301.15818-1-Vijaikumar_Kanagarajan@mentor.com>
Factor out the mount and unmount section to separate function for
easy readability. No functional change intended.
Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
---
meta/classes/deb-dl-dir.bbclass | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/meta/classes/deb-dl-dir.bbclass b/meta/classes/deb-dl-dir.bbclass
index ce691cf..b2d94e7 100644
--- a/meta/classes/deb-dl-dir.bbclass
+++ b/meta/classes/deb-dl-dir.bbclass
@@ -14,15 +14,30 @@ is_not_part_of_current_build() {
[ -z "${output}" ]
}
+debsrc_do_mounts() {
+ sudo -s <<EOSUDO
+ mkdir -p "${1}/deb-src"
+ mountpoint -q "${1}/deb-src" || \
+ mount --bind "${DEBSRCDIR}" "${1}/deb-src"
+EOSUDO
+}
+
+debsrc_undo_mounts() {
+ sudo -s <<EOSUDO
+ mkdir -p "${1}/deb-src"
+ mountpoint -q "${1}/deb-src" && \
+ umount -l "${1}/deb-src"
+ rm -rf "${1}/deb-src"
+EOSUDO
+}
+
debsrc_download() {
export rootfs="$1"
export rootfs_distro="$2"
mkdir -p "${DEBSRCDIR}"/"${rootfs_distro}"
- sudo -E -s <<'EOSUDO'
- mkdir -p "${rootfs}/deb-src"
- mountpoint -q "${rootfs}/deb-src" || \
- mount --bind "${DEBSRCDIR}" "${rootfs}/deb-src"
-EOSUDO
+
+ debsrc_do_mounts "${rootfs}"
+
( flock 9
set -e
printenv | grep -q BB_VERBOSE_LOGS && set -x
@@ -37,11 +52,8 @@ EOSUDO
sh -c ' mkdir -p "/deb-src/${1}/${2}" && cd "/deb-src/${1}/${2}" && apt-get -y --download-only --only-source source "$2"="$3" ' download-src "${rootfs_distro}" "${src}" "${version}"
done
) 9>"${DEBSRCDIR}/${rootfs_distro}.lock"
- sudo -E -s <<'EOSUDO'
- mountpoint -q "${rootfs}/deb-src" && \
- umount -l "${rootfs}/deb-src"
- rm -rf "${rootfs}/deb-src"
-EOSUDO
+
+ debsrc_undo_mounts "${rootfs}"
}
deb_dl_dir_import() {
--
2.17.1
next prev parent reply other threads:[~2020-11-25 8:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-25 8:02 [PATCH v7 00/14] Deb-src caching Vijai Kumar K
2020-11-25 8:02 ` [PATCH v7 01/14] rootfs: Make rootfs finalize a separate task Vijai Kumar K
2020-11-25 8:02 ` [PATCH v7 02/14] deb-dl-dir: Cache host distro debs separately Vijai Kumar K
2020-11-25 8:02 ` [PATCH v7 03/14] meta: cache deb srcs as part of postprocessing Vijai Kumar K
2020-11-25 8:02 ` [PATCH v7 04/14] deb-dl-dir: Make debsrc_download faster Vijai Kumar K
2020-11-25 8:02 ` [PATCH v7 05/14] deb-dl-dir: Download files only belonging to the current image Vijai Kumar K
2020-11-25 8:02 ` Vijai Kumar K [this message]
2020-11-25 8:02 ` [PATCH v7 07/14] deb-dl-dir: Fix skipping of removed files Vijai Kumar K
2020-11-25 8:02 ` [PATCH v7 08/14] repository: Add a sanity test to check missing sources Vijai Kumar K
2020-11-25 8:05 ` [PATCH v7 09/14] base-apt: Introduce BASE_REPO_FEATURES Vijai Kumar K
2020-11-25 8:05 ` [PATCH v7 10/14] repository: Fix failures due to missing section Vijai Kumar K
2020-11-25 8:05 ` [PATCH v7 11/14] scripts/ci_build.sh: Enable deb-src caching Vijai Kumar K
2020-11-25 8:05 ` [PATCH v7 12/14] rootfs: Fix possible overwrite of existing resolv.conf Vijai Kumar K
2020-11-25 8:05 ` [PATCH v7 13/14] rootfs: Handle failures when postprocess is rerun Vijai Kumar K
2020-11-25 8:06 ` [PATCH v7 14/14] doc/user_manual.md: Document details about deb-src caching Vijai Kumar K
2020-11-25 11:35 ` Jan Kiszka
2020-11-25 13:14 ` vijaikumar....@gmail.com
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=20201125080301.15818-7-Vijaikumar_Kanagarajan@mentor.com \
--to=vijaikumar_kanagarajan@mentor.com \
--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