public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Andreas Naumann <anaumann@emlix.com>
To: isar-users@googlegroups.com
Cc: Andreas Naumann <anaumann@emlix.com>
Subject: [PATCH 2/4] mmdebstrap: Include isar-apt in bootstrapping sources
Date: Tue, 12 Aug 2025 15:02:47 +0200	[thread overview]
Message-ID: <20250812130249.709960-3-anaumann@emlix.com> (raw)
In-Reply-To: <20250812130249.709960-1-anaumann@emlix.com>

To support using custom variants of packages in bootstrap, include isar-apt
as possible distro source.
In order to avoid wasting time on copying, reuse the bind-mount technique
from the base-apt implementation.

Signed-off-by: Andreas Naumann <anaumann@emlix.com>
---
 .../isar-mmdebstrap/isar-mmdebstrap.inc       | 24 ++++++++++++++-----
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/meta/recipes-core/isar-mmdebstrap/isar-mmdebstrap.inc b/meta/recipes-core/isar-mmdebstrap/isar-mmdebstrap.inc
index 42d99756a1..b03ae7d772 100644
--- a/meta/recipes-core/isar-mmdebstrap/isar-mmdebstrap.inc
+++ b/meta/recipes-core/isar-mmdebstrap/isar-mmdebstrap.inc
@@ -136,8 +136,11 @@ do_bootstrap() {
     else
         deb_dl_dir_import "${WORKDIR}/dl_dir" "${BOOTSTRAP_BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
 
+        isar_apt_tmp="$(mktemp -d /tmp/isar-aptXXXXXXXXXX)"
         bootstrap_list="${WORKDIR}/sources.list.d/bootstrap.list"
-        install -v -m644 "${APTSRCS}" "$bootstrap_list"
+        line="copy://$isar_apt_tmp/${DISTRO} ${DEBDISTRONAME} main"
+        echo "deb [trusted=yes] ${line}" >  "$bootstrap_list"
+        cat "${APTSRCS}" >> "$bootstrap_list"
 
         syncin='flock -s ${DEB_DL_LOCK} cp -n --no-preserve=owner \
                       "${WORKDIR}/dl_dir/var/cache/apt/archives/"*.deb \
@@ -145,17 +148,23 @@ do_bootstrap() {
         syncout='flock -s ${DEB_DL_LOCK} cp -n --no-preserve=owner \
                        "$1/var/cache/apt/archives/"*.deb \
                        "${WORKDIR}/dl_dir/var/cache/apt/archives/"'
-        extra_setup="$syncin"
+        extra_setup="mount --bind '${REPO_ISAR_DIR}' $isar_apt_tmp"
+        extra_setup="$extra_setup && $syncin"
         extra_extract="$syncout"
+        extra_essential="mkdir -p \$1/$isar_apt_tmp && \
+                         echo \$1 > ${WORKDIR}/mmtmpdir && \
+                         mount -o bind,private '${REPO_ISAR_DIR}' \$1/$isar_apt_tmp"
         # prefetch apt debs because mmdebstrap will clean them on next stage
-        extra_essential='apt-get install apt -y -d \
+        extra_apt='apt-get install apt -y -d \
                                  -o Dir::State="$1/var/lib/apt" \
                                  -o Dir::Etc="$1/etc/apt" \
                                  -o Dir::Cache="$1/var/cache/apt" \
                                  -o Apt::Architecture="${BOOTSTRAP_DISTRO_ARCH}" \
                                  ${@get_apt_opts(d, '-o')}'
-        extra_essential="$extra_essential && $syncout"
-        extra_customize="$syncout"
+        extra_essential="$extra_essential && $extra_apt && $syncout"
+        extra_customize="umount \$1/$isar_apt_tmp && \
+                         umount $isar_apt_tmp && rm -rf --one-file-system $isar_apt_tmp"
+        extra_customize="$extra_customize && $syncout"
     fi
 
     if [ ! -z "${SOURCE_DATE_EPOCH}" ]; then
@@ -178,7 +187,10 @@ do_bootstrap() {
           [ -d "$tmpdir" ] && sudo rm -rf --one-file-system $tmpdir; \
           [ -n "$base_apt_tmp" ] && mountpoint -q $base_apt_tmp \
                                  && sudo umount $base_apt_tmp \
-                                 && rm -rf --one-file-system $base_apt_tmp' EXIT
+                                 && rm -rf --one-file-system $base_apt_tmp; \
+          [ -n "$isar_apt_tmp" ] && mountpoint -q $isar_apt_tmp \
+                                 && sudo umount $isar_apt_tmp \
+                                 && rm -rf --one-file-system $isar_apt_tmp' EXIT
 
     sudo TMPDIR="${BOOTSTRAP_TMPDIR}" mmdebstrap $bootstrap_args \
                    $arch_param \
-- 
2.43.0

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20250812130249.709960-3-anaumann%40emlix.com.

  parent reply	other threads:[~2025-08-12 13:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-12 13:02 [PATCH 0/4] Bootstrap from local isar-apt repo Andreas Naumann
2025-08-12 13:02 ` [PATCH 1/4] mmdebstrap: Make use of defined variables Andreas Naumann
2025-08-12 13:02 ` Andreas Naumann [this message]
2025-08-12 13:02 ` [PATCH 3/4] mmdebstrap: Allow for DISTRO_SOURCE to be empty Andreas Naumann
2025-08-12 13:02 ` [PATCH 4/4] mmdebstrap: lock isar-apt while bootstrapping Andreas Naumann

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=20250812130249.709960-3-anaumann@emlix.com \
    --to=anaumann@emlix.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