public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
To: <isar-users@googlegroups.com>
Cc: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
Subject: [PATCH v8 09/14] base-apt: Introduce BASE_REPO_FEATURES
Date: Wed, 25 Nov 2020 19:14:09 +0530	[thread overview]
Message-ID: <20201125134414.26061-5-Vijaikumar_Kanagarajan@mentor.com> (raw)
In-Reply-To: <20201125134414.26061-1-Vijaikumar_Kanagarajan@mentor.com>

Eventhough we are collecting the debsrcs as part of postprocess,
it could not be considered a ROOTFS_FEATURE, instead a base-apt one.
Introduce BASE_REPO_FEATURES, to provide user with control to enable
or disable cache-deb-src. Disabled by default, since it is not required
for normal offline build to work.

Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
---
 meta-isar/conf/local.conf.sample           | 4 ++++
 meta/classes/image.bbclass                 | 4 +++-
 meta/classes/repository.bbclass            | 9 +++++----
 meta/classes/rootfs.bbclass                | 1 -
 meta/recipes-devtools/base-apt/base-apt.bb | 1 +
 5 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/meta-isar/conf/local.conf.sample b/meta-isar/conf/local.conf.sample
index 07a7781..ec0a384 100644
--- a/meta-isar/conf/local.conf.sample
+++ b/meta-isar/conf/local.conf.sample
@@ -181,6 +181,10 @@ ISAR_CROSS_COMPILE ?= "0"
 # NOTE: this works for amd64 and arm64 targets so far
 #ISAR_ENABLE_COMPAT_ARCH ?= "1"
 
+# Uncomment this to enable caching of all source packages.
+# Without this feature, only sources of packages downloaded with apt:// are downloaded.
+#BASE_REPO_FEATURES ?= "cache-deb-src"
+
 #
 # Uncomment this to enable use of cached base repository
 #ISAR_USE_CACHED_BASE_REPO ?= "1"
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 6ca5759..5c2c88c 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -63,10 +63,12 @@ image_do_mounts() {
 }
 
 ROOTFSDIR = "${IMAGE_ROOTFS}"
-ROOTFS_FEATURES += "clean-package-cache generate-manifest cach-deb-src"
+ROOTFS_FEATURES += "clean-package-cache generate-manifest"
 ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${IMAGE_INSTALL}"
 ROOTFS_MANIFEST_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}"
 
+ROOTFS_POSTPROCESS_COMMAND_prepend = "${@bb.utils.contains('BASE_REPO_FEATURES', 'cache-deb-src', 'cache_deb_src', '', d)} "
+
 inherit rootfs
 inherit image-sdk-extension
 inherit image-tools-extension
diff --git a/meta/classes/repository.bbclass b/meta/classes/repository.bbclass
index 7b6e47b..1f475dc 100644
--- a/meta/classes/repository.bbclass
+++ b/meta/classes/repository.bbclass
@@ -100,9 +100,10 @@ repo_contains_package() {
 repo_sanity_test() {
     local dir="$1"
     local dbdir="$2"
-    local output="$( reprepro -s -b "${dir}" --dbdir "${dbdir}" sourcemissing )"
-    if [ -n "${output}" ]; then
-        bbwarn "One or more sources are missing in base-apt"
-        bbwarn "${output}"
+    if [ "${@bb.utils.contains('BASE_REPO_FEATURES', 'cache-deb-src', 'yes', 'no', d)}" = "yes" ];then
+        local output="$( reprepro -s -b "${dir}" --dbdir "${dbdir}" sourcemissing )"
+        if [ -n "${output}" ]; then
+            bbfatal "One or more sources are missing in repo. ${output}"
+        fi
     fi
 }
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index cfabeae..0aa5502 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -185,7 +185,6 @@ python do_rootfs_install() {
 }
 addtask rootfs_install before do_rootfs_postprocess after do_unpack
 
-ROOTFS_POSTPROCESS_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'cache-deb-src', 'cache_deb_src', '', d)}"
 cache_deb_src() {
     rootfs_install_resolvconf
     deb_dl_dir_import ${ROOTFSDIR} ${ROOTFS_DISTRO}
diff --git a/meta/recipes-devtools/base-apt/base-apt.bb b/meta/recipes-devtools/base-apt/base-apt.bb
index 8940ae8..506a28f 100644
--- a/meta/recipes-devtools/base-apt/base-apt.bb
+++ b/meta/recipes-devtools/base-apt/base-apt.bb
@@ -10,6 +10,7 @@ SRC_URI = "file://distributions.in"
 
 BASE_REPO_KEY ?= ""
 KEYFILES ?= ""
+BASE_REPO_FEATURES ?= ""
 
 populate_base_apt() {
     find "${DEBDIR}"/"${DISTRO}" -name '*\.deb' | while read package; do
-- 
2.17.1


  parent reply	other threads:[~2020-11-25 13:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25 13:42 [PATCH v8 00/14] Deb-src caching Vijai Kumar K
2020-11-25 13:42 ` [PATCH v8 01/14] rootfs: Make rootfs finalize a separate task Vijai Kumar K
2020-11-25 13:42 ` [PATCH v8 02/14] deb-dl-dir: Cache host distro debs separately Vijai Kumar K
2020-11-25 13:42 ` [PATCH v8 03/14] meta: cache deb srcs as part of postprocessing Vijai Kumar K
2020-11-25 13:42 ` [PATCH v8 04/14] deb-dl-dir: Make debsrc_download faster Vijai Kumar K
2020-11-25 13:44   ` [PATCH v8 05/14] deb-dl-dir: Download files only belonging to the current image Vijai Kumar K
2020-11-25 13:44     ` [PATCH v8 06/14] deb-dl-dir: Factor out the mounting part Vijai Kumar K
2020-11-25 13:44     ` [PATCH v8 07/14] deb-dl-dir: Fix skipping of removed files Vijai Kumar K
2020-11-25 13:44     ` [PATCH v8 08/14] repository: Add a sanity test to check missing sources Vijai Kumar K
2020-11-25 13:44     ` Vijai Kumar K [this message]
2020-11-25 13:45       ` [PATCH v8 10/14] repository: Fix failures due to missing section Vijai Kumar K
2020-11-25 13:45         ` [PATCH v8 11/14] scripts/ci_build.sh: Enable deb-src caching Vijai Kumar K
2020-11-25 13:45         ` [PATCH v8 12/14] rootfs: Fix possible overwrite of existing resolv.conf Vijai Kumar K
2020-11-25 13:45         ` [PATCH v8 13/14] rootfs: Handle failures when postprocess is rerun Vijai Kumar K
2020-11-25 13:45         ` [PATCH v8 14/14] doc/user_manual.md: Document details about deb-src caching Vijai Kumar K

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=20201125134414.26061-5-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