public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Uladzimir Bely <ubely@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH v4 04/13] meta: Always use base-apt repo in local mode
Date: Wed, 22 Feb 2023 07:41:16 +0100	[thread overview]
Message-ID: <20230222064125.22754-5-ubely@ilbers.de> (raw)
In-Reply-To: <20230222064125.22754-1-ubely@ilbers.de>

This means only local URLs in apt sources.list* are present during
the build. Any installation of packages is done from local base-apt.
So, base-apt should be always mounted in *_do_mounts since now.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 meta/classes/buildchroot.bbclass              | 10 ++--
 meta/classes/rootfs.bbclass                   | 10 ++--
 .../isar-bootstrap/isar-bootstrap.inc         | 32 ++++++-------
 meta/recipes-devtools/base-apt/base-apt.bb    | 46 -------------------
 4 files changed, 20 insertions(+), 78 deletions(-)

diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroot.bbclass
index 5abd533b..22a03d45 100644
--- a/meta/classes/buildchroot.bbclass
+++ b/meta/classes/buildchroot.bbclass
@@ -50,13 +50,9 @@ buildchroot_do_mounts() {
             mount --rbind /sys '${BUILDCHROOT_DIR}/sys'
         mount --make-rslave '${BUILDCHROOT_DIR}/sys'
 
-        # Mount base-apt if 'ISAR_USE_CACHED_BASE_REPO' is set
-        if [ "${@repr(bb.utils.to_boolean(d.getVar('ISAR_USE_CACHED_BASE_REPO')))}" = 'True' ]
-        then
-            mkdir -p '${BUILDCHROOT_DIR}/base-apt'
-            mountpoint -q '${BUILDCHROOT_DIR}/base-apt' || \
-                mount --bind '${REPO_BASE_DIR}' '${BUILDCHROOT_DIR}/base-apt'
-        fi
+        mkdir -p '${BUILDCHROOT_DIR}/base-apt'
+        mountpoint -q '${BUILDCHROOT_DIR}/base-apt' || \
+            mount --bind '${REPO_BASE_DIR}' '${BUILDCHROOT_DIR}/base-apt'
 
         # Refresh or remove /etc/resolv.conf at this chance
         if [ "${@repr(bb.utils.to_boolean(d.getVar('BB_NO_NETWORK')))}" = 'True' ]
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 0eed3d02..92d665db 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -54,13 +54,9 @@ rootfs_do_mounts() {
                 mount --bind '${REPO_ISAR_DIR}/${DISTRO}' '${ROOTFSDIR}/isar-apt'
         fi
 
-        # Mount base-apt if 'ISAR_USE_CACHED_BASE_REPO' is set
-        if [ "${@repr(bb.utils.to_boolean(d.getVar('ISAR_USE_CACHED_BASE_REPO')))}" = 'True' ]
-        then
-            mkdir -p '${ROOTFSDIR}/base-apt'
-            mountpoint -q '${ROOTFSDIR}/base-apt' || \
-                mount --bind '${REPO_BASE_DIR}' '${ROOTFSDIR}/base-apt'
-        fi
+        mkdir -p '${ROOTFSDIR}/base-apt'
+        mountpoint -q '${ROOTFSDIR}/base-apt' || \
+            mount --bind '${REPO_BASE_DIR}' '${ROOTFSDIR}/base-apt'
 
 EOSUDO
 }
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 99d75e21..01668b93 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -42,10 +42,9 @@ python () {
     # installation afterwards. However, debootstrap will include the key into
     # the rootfs automatically thus the right place is distro_bootstrap_keys.
 
-    if bb.utils.to_boolean(d.getVar('ISAR_USE_CACHED_BASE_REPO')):
-        own_pub_key = d.getVar("BASE_REPO_KEY")
-        if own_pub_key:
-            distro_bootstrap_keys += own_pub_key.split()
+    own_pub_key = d.getVar("BASE_REPO_KEY")
+    if own_pub_key:
+        distro_bootstrap_keys += own_pub_key.split()
 
     for key in distro_bootstrap_keys:
         d.appendVar("SRC_URI", " %s" % key)
@@ -284,7 +283,7 @@ do_bootstrap() {
     if [ -f "${DISTRO_BOOTSTRAP_KEYRING}" ]; then
         debootstrap_args="$debootstrap_args --keyring=${DISTRO_BOOTSTRAP_KEYRING}"
     fi
-    if [ "${ISAR_USE_CACHED_BASE_REPO}" = "1" -a -z "${BASE_REPO_KEY}" ]; then
+    if [ -z "${BASE_REPO_KEY}" ]; then
         debootstrap_args="$debootstrap_args --no-check-gpg"
     fi
     E="${@ isar_export_proxies(d)}"
@@ -311,24 +310,21 @@ do_bootstrap() {
         install -v -m644 "${APTPREFS}" \
                          "${ROOTFSDIR}/etc/apt/preferences.d/bootstrap"
         mkdir -p "${ROOTFSDIR}/etc/apt/sources.list.d"
-        if [ "${ISAR_USE_CACHED_BASE_REPO}" = "1" ]; then
-            line="file:///base-apt/${BOOTSTRAP_BASE_DISTRO} ${BASE_DISTRO_CODENAME} main"
-            if [ -z "${BASE_REPO_KEY}" ]; then
-                line="[trusted=yes] ${line}"
-            fi
-            echo "deb ${line}" >  "${ROOTFSDIR}/etc/apt/sources.list.d/base-apt.list"
+
+        line="file:///base-apt/${BOOTSTRAP_BASE_DISTRO} ${BASE_DISTRO_CODENAME} main"
+        if [ -z "${BASE_REPO_KEY}" ]; then
+            line="[trusted=yes] ${line}"
+        fi
+        echo "deb ${line}" >  "${ROOTFSDIR}/etc/apt/sources.list.d/base-apt.list"
             line="file:///base-apt/${BASE_DISTRO} ${BASE_DISTRO_CODENAME} main"
             if [ -z "${BASE_REPO_KEY}" ]; then
                 line="[trusted=yes] ${line}"
             fi
-            echo "deb-src ${line}" >>  "${ROOTFSDIR}/etc/apt/sources.list.d/base-apt.list"
+        echo "deb-src ${line}" >>  "${ROOTFSDIR}/etc/apt/sources.list.d/base-apt.list"
+
+        mkdir -p ${ROOTFSDIR}/base-apt
+        mount --bind ${REPO_BASE_DIR} ${ROOTFSDIR}/base-apt
 
-            mkdir -p ${ROOTFSDIR}/base-apt
-            mount --bind ${REPO_BASE_DIR} ${ROOTFSDIR}/base-apt
-        else
-            install -v -m644 "${APTSRCS}" \
-                             "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list"
-        fi
         install -v -m644 "${APTSRCS_INIT}" "${ROOTFSDIR}/etc/apt/sources-list"
         rm -f "${ROOTFSDIR}/etc/apt/sources.list"
         rm -rf "${ROOTFSDIR}/var/lib/apt/lists/"*
diff --git a/meta/recipes-devtools/base-apt/base-apt.bb b/meta/recipes-devtools/base-apt/base-apt.bb
index ea885fe6..d5b3cf4e 100644
--- a/meta/recipes-devtools/base-apt/base-apt.bb
+++ b/meta/recipes-devtools/base-apt/base-apt.bb
@@ -10,43 +10,6 @@ SRC_URI = "file://distributions.in"
 
 BASE_REPO_KEY ?= ""
 KEYFILES ?= ""
-BASE_REPO_FEATURES ?= ""
-
-populate_base_apt() {
-    base_distro="${1}"
-
-    find "${DEBDIR}"/"${base_distro}-${BASE_DISTRO_CODENAME}" -name '*\.deb' | while read package; do
-        # NOTE: due to packages stored by reprepro are not modified, we can
-        # use search by filename to check if package is already in repo. In
-        # addition, md5sums are compared to ensure that the package is the
-        # same and should not be overwritten. This method is easier and more
-        # robust than querying reprepro by name.
-
-        # Check if this package is already in base-apt
-        ret=0
-        repo_contains_package "${REPO_BASE_DIR}/${base_distro}" "${package}" ||
-            ret=$?
-        [ "${ret}" = "0" ] && continue
-        if [ "${ret}" = "1" ]; then
-            repo_del_package "${REPO_BASE_DIR}"/"${base_distro}" \
-                "${REPO_BASE_DB_DIR}"/"${base_distro}" \
-                "${BASE_DISTRO_CODENAME}" \
-                "${package}"
-        fi
-
-        repo_add_packages "${REPO_BASE_DIR}"/"${base_distro}" \
-            "${REPO_BASE_DB_DIR}"/"${base_distro}" \
-            "${BASE_DISTRO_CODENAME}" \
-            "${package}"
-    done
-
-    find "${DEBSRCDIR}"/"${base_distro}-${BASE_DISTRO_CODENAME}" -name '*\.dsc' | while read package; do
-        repo_add_srcpackage "${REPO_BASE_DIR}"/"${base_distro}" \
-            "${REPO_BASE_DB_DIR}"/"${base_distro}" \
-            "${BASE_DISTRO_CODENAME}" \
-            "${package}"
-    done
-}
 
 do_cache[stamp-extra-info] = "${DISTRO}"
 do_cache[lockfiles] = "${REPO_BASE_DIR}/isar.lock"
@@ -57,9 +20,6 @@ repo() {
         "${BASE_DISTRO_CODENAME}" \
         "${WORKDIR}/distributions.in" \
         "${KEYFILES}"
-    populate_base_apt "${BASE_DISTRO}"
-    repo_sanity_test "${REPO_BASE_DIR}"/"${BASE_DISTRO}" \
-        "${REPO_BASE_DB_DIR}"/"${BASE_DISTRO}"
 
     if [ '${BASE_DISTRO}' != '${HOST_BASE_DISTRO}' ]; then
         repo_create "${REPO_BASE_DIR}"/"${HOST_BASE_DISTRO}" \
@@ -67,16 +27,10 @@ repo() {
             "${BASE_DISTRO_CODENAME}" \
             "${WORKDIR}/distributions.in" \
             "${KEYFILES}"
-        populate_base_apt "${HOST_BASE_DISTRO}"
-        repo_sanity_test "${REPO_BASE_DIR}"/"${HOST_BASE_DISTRO}" \
-            "${REPO_BASE_DB_DIR}"/"${HOST_BASE_DISTRO}"
     fi
 }
 
 python do_cache() {
-    if not bb.utils.to_boolean(d.getVar('ISAR_USE_CACHED_BASE_REPO')):
-        return 0
-
     for key in d.getVar('BASE_REPO_KEY').split():
         d.appendVar("SRC_URI", " %s" % key)
         fetcher = bb.fetch2.Fetch([key], d)
-- 
2.20.1


  parent reply	other threads:[~2023-02-22  6:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22  6:41 [PATCH v4 00/13] Improving base-apt usage PoC Uladzimir Bely
2023-02-22  6:41 ` [PATCH v4 01/13] scripts: Add debrepo python script handling base-apt Uladzimir Bely
2023-02-22  6:41 ` [PATCH v4 02/13] meta: Add debrepo bbclass handling base-apt prefetching Uladzimir Bely
2023-02-22  6:41 ` [PATCH v4 03/13] meta-isar: Add local ubuntu-focal public key Uladzimir Bely
2023-02-22  6:41 ` Uladzimir Bely [this message]
2023-02-22  6:41 ` [PATCH v4 05/13] meta: move base-apt from deploy directory to the top Uladzimir Bely
2023-02-22  6:41 ` [PATCH v4 06/13] meta: Use cached base-apt repo to debootstrap Uladzimir Bely
2023-02-22  6:41 ` [PATCH v4 07/13] meta: Setup debrepo context for dpkg-base Uladzimir Bely
2023-02-22  6:41 ` [PATCH v4 08/13] meta: Setup debrepo context for buildchroot Uladzimir Bely
2023-02-22  6:41 ` [PATCH v4 09/13] meta: Setup debrepo context for sbuild-chroot Uladzimir Bely
2023-02-22  6:41 ` [PATCH v4 10/13] base-apt: Predownload packages to base-apt before install Uladzimir Bely
2023-02-22  6:41 ` [PATCH v4 11/13] meta: Add cache-deb-src functionality to base-apt Uladzimir Bely
2023-02-22  6:41 ` [PATCH v4 12/13] meta: Specify grub-efi packages arch Uladzimir Bely
2023-02-22  6:41 ` [PATCH v4 13/13] isar-apt: Fix copying isar-apt to workdir Uladzimir Bely

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=20230222064125.22754-5-ubely@ilbers.de \
    --to=ubely@ilbers.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