[v9,08/14] repository: Add a sanity test to check missing sources

Message ID 20201126111912.3037-9-Vijaikumar_Kanagarajan@mentor.com
State Superseded, archived
Headers show
Series Debsrc caching | expand

Commit Message

Vijai Kumar K Nov. 26, 2020, 1:19 a.m. UTC
Add a sanity test routine to test if sources for all packages
are present in the repo.

Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
---
 meta/classes/repository.bbclass            | 10 ++++++++++
 meta/recipes-devtools/base-apt/base-apt.bb |  2 ++
 2 files changed, 12 insertions(+)

Patch

diff --git a/meta/classes/repository.bbclass b/meta/classes/repository.bbclass
index c70138f..7b6e47b 100644
--- a/meta/classes/repository.bbclass
+++ b/meta/classes/repository.bbclass
@@ -96,3 +96,13 @@  repo_contains_package() {
     # no
     return 2
 }
+
+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}"
+    fi
+}
diff --git a/meta/recipes-devtools/base-apt/base-apt.bb b/meta/recipes-devtools/base-apt/base-apt.bb
index da3e32e..8940ae8 100644
--- a/meta/recipes-devtools/base-apt/base-apt.bb
+++ b/meta/recipes-devtools/base-apt/base-apt.bb
@@ -66,6 +66,8 @@  repo() {
     fi
 
     populate_base_apt
+    repo_sanity_test "${REPO_BASE_DIR}"/"${BASE_DISTRO}" \
+        "${REPO_BASE_DB_DIR}"/"${BASE_DISTRO}"
 }
 
 python do_cache() {