[2/3] repository: align repo_contains_package signature with other repo functions

Message ID 20241122054816.3371334-3-cedric.hombourger@siemens.com
State Under Review, archived
Headers show
Series repository: small fixes for repo_{contains,del}_packages | expand

Commit Message

cedric.hombourger@siemens.com Nov. 22, 2024, 5:48 a.m. UTC
All repository functions take four arguments:
 - path to the repository
 - path to the database used by the repository management tool
 - codename
 - file/package

repo_contains_package was the only function deviating from this scheme and its
current implementation only takes a repository path and a file. Since the
repositoty class was introduced to hide implementation details (so we could
move away from reprepro if we wanted to), align that function with others.
The only caller found in the repository (base-apt) was changed to use the new
(standard) API.

Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
---
 meta/classes/repository.bbclass            | 4 +++-
 meta/recipes-devtools/base-apt/base-apt.bb | 5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

Patch

diff --git a/meta/classes/repository.bbclass b/meta/classes/repository.bbclass
index 42d15823..b20ec091 100644
--- a/meta/classes/repository.bbclass
+++ b/meta/classes/repository.bbclass
@@ -93,7 +93,9 @@  repo_del_package() {
 
 repo_contains_package() {
     local dir="$1"
-    local file="$2"
+    local dbdir="$2"
+    local codename="$3"
+    local file="$4"
     local package
 
     package=$(find ${dir} -name ${file##*/})
diff --git a/meta/recipes-devtools/base-apt/base-apt.bb b/meta/recipes-devtools/base-apt/base-apt.bb
index 2766bc71..4fad76c5 100644
--- a/meta/recipes-devtools/base-apt/base-apt.bb
+++ b/meta/recipes-devtools/base-apt/base-apt.bb
@@ -24,7 +24,10 @@  populate_base_apt() {
 
         # Check if this package is already in base-apt
         ret=0
-        repo_contains_package "${REPO_BASE_DIR}/${base_distro}" "${package}" ||
+        repo_contains_package "${REPO_BASE_DIR}/${base_distro}" \
+            "${REPO_BASE_DB_DIR}"/"${base_distro}" \
+            "${BASE_DISTRO_CODENAME}" \
+            "${package}" ||
             ret=$?
         [ "${ret}" = "0" ] && continue
         if [ "${ret}" = "1" ]; then