[1/3] repository: repo_del_package should not remove source packages

Message ID 20241122054816.3371334-2-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
When the architecture of the binary package is "all", repo_del_package would
remove the architecture filter to remove binary for any packages. This
unfortunately causes reprepro to also remove the source package. Modify this
function to use "reprepro removefilter" where we can make sure that only .deb
packages are removed.

Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
---
 meta/classes/repository.bbclass | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

Patch

diff --git a/meta/classes/repository.bbclass b/meta/classes/repository.bbclass
index 28e712fd..42d15823 100644
--- a/meta/classes/repository.bbclass
+++ b/meta/classes/repository.bbclass
@@ -84,14 +84,11 @@  repo_del_package() {
     if [ -n "${GNUPGHOME}" ]; then
         export GNUPGHOME="${GNUPGHOME}"
     fi
-    local p=$( dpkg-deb --show --showformat '${Package}' "${file}" )
-    local a=$( dpkg-deb --show --showformat '${Architecture}' "${file}" )
-    # removing "all" means no arch
-    local aarg="-A ${a}"
-    [ "${a}" = "all" ] && aarg=""
-    reprepro -b "${dir}" --dbdir "${dbdir}" -C main ${aarg} \
-        remove "${codename}" \
-        "${p}"
+    set -- $( dpkg-deb --show --showformat '${Package} ${Architecture}' "${file}" )
+    local p="${1}" a="${2}"
+    reprepro -b "${dir}" --dbdir "${dbdir}" -C main \
+        removefilter "${codename}" \
+        'Package (= '${p}'), Architecture (= '${a}'), $PackageType (= deb)'
 }
 
 repo_contains_package() {