* [PATCH 0/3] repository: small fixes for repo_{contains,del}_packages
@ 2024-11-22 5:48 'Cedric Hombourger' via isar-users
2024-11-22 5:48 ` [PATCH 1/3] repository: repo_del_package should not remove source packages 'Cedric Hombourger' via isar-users
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: 'Cedric Hombourger' via isar-users @ 2024-11-22 5:48 UTC (permalink / raw)
To: isar-users; +Cc: Cedric Hombourger
repo_del_package should only remove binary packages (.deb), not
previously added source packages.
repo_contains_package should not assume that the name of downloaded .deb
files will match filenames used by reprepro.
Cedric Hombourger (3):
repository: repo_del_package should not remove source packages
repository: align repo_contains_package signature with other repo
functions
repository: make repo_contains_package query the package database
meta/classes/repository.bbclass | 40 ++++++++++++++++------
meta/recipes-devtools/base-apt/base-apt.bb | 5 ++-
2 files changed, 34 insertions(+), 11 deletions(-)
--
2.34.1
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20241122054816.3371334-1-cedric.hombourger%40siemens.com.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] repository: repo_del_package should not remove source packages
2024-11-22 5:48 [PATCH 0/3] repository: small fixes for repo_{contains,del}_packages 'Cedric Hombourger' via isar-users
@ 2024-11-22 5:48 ` 'Cedric Hombourger' via isar-users
2024-11-22 5:48 ` [PATCH 2/3] repository: align repo_contains_package signature with other repo functions 'Cedric Hombourger' via isar-users
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: 'Cedric Hombourger' via isar-users @ 2024-11-22 5:48 UTC (permalink / raw)
To: isar-users; +Cc: Cedric Hombourger
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(-)
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() {
--
2.34.1
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20241122054816.3371334-2-cedric.hombourger%40siemens.com.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/3] repository: align repo_contains_package signature with other repo functions
2024-11-22 5:48 [PATCH 0/3] repository: small fixes for repo_{contains,del}_packages 'Cedric Hombourger' via isar-users
2024-11-22 5:48 ` [PATCH 1/3] repository: repo_del_package should not remove source packages 'Cedric Hombourger' via isar-users
@ 2024-11-22 5:48 ` 'Cedric Hombourger' via isar-users
2024-11-22 5:48 ` [PATCH 3/3] repository: make repo_contains_package query the package database 'Cedric Hombourger' via isar-users
2024-11-27 7:11 ` [PATCH 0/3] repository: small fixes for repo_{contains,del}_packages Uladzimir Bely
3 siblings, 0 replies; 5+ messages in thread
From: 'Cedric Hombourger' via isar-users @ 2024-11-22 5:48 UTC (permalink / raw)
To: isar-users; +Cc: Cedric Hombourger
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(-)
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
--
2.34.1
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20241122054816.3371334-3-cedric.hombourger%40siemens.com.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/3] repository: make repo_contains_package query the package database
2024-11-22 5:48 [PATCH 0/3] repository: small fixes for repo_{contains,del}_packages 'Cedric Hombourger' via isar-users
2024-11-22 5:48 ` [PATCH 1/3] repository: repo_del_package should not remove source packages 'Cedric Hombourger' via isar-users
2024-11-22 5:48 ` [PATCH 2/3] repository: align repo_contains_package signature with other repo functions 'Cedric Hombourger' via isar-users
@ 2024-11-22 5:48 ` 'Cedric Hombourger' via isar-users
2024-11-27 7:11 ` [PATCH 0/3] repository: small fixes for repo_{contains,del}_packages Uladzimir Bely
3 siblings, 0 replies; 5+ messages in thread
From: 'Cedric Hombourger' via isar-users @ 2024-11-22 5:48 UTC (permalink / raw)
To: isar-users; +Cc: Cedric Hombourger
Debian package repositories (created/updated with dak) and reprepro
repositories do not have the same file naming convention (e.g. the
latter does not use Epoch). A full directory scan may also be
expensive for large repositories: use reprepro listfilter to check
for matching packages in the database.
Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
---
meta/classes/repository.bbclass | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/meta/classes/repository.bbclass b/meta/classes/repository.bbclass
index b20ec091..bc5852a5 100644
--- a/meta/classes/repository.bbclass
+++ b/meta/classes/repository.bbclass
@@ -98,7 +98,28 @@ repo_contains_package() {
local file="$4"
local package
- package=$(find ${dir} -name ${file##*/})
+ # Extract meta-data from the provided .deb file
+ package=$(dpkg-deb -f ${file} Package Version Architecture)
+
+ # Output for each field is "Field: Value"
+ # odd indexes hold field names, even indexes hold values
+ set -- ${package}
+
+ # lookup ${file} in the database for the current suite
+ package=$(reprepro -b ${dir} --dbdir ${dbdir} \
+ --list-format '${$fullfilename}\n' \
+ listfilter ${codename} '
+ Package (= '${2}'),
+ Version (= '${4}'),
+ Architecture (= '${6}'),
+ $PackageType (= deb)')
+
+ # we only need the first match (should there be more). Use shell builtins to avoid
+ # spawning an additional process (e.g. "head")
+ set -- ${package}
+ package="${1}"
+
+ # package found in the database?
if [ -n "$package" ]; then
# yes
cmp --silent "$package" "$file" && return 0
--
2.34.1
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20241122054816.3371334-4-cedric.hombourger%40siemens.com.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] repository: small fixes for repo_{contains,del}_packages
2024-11-22 5:48 [PATCH 0/3] repository: small fixes for repo_{contains,del}_packages 'Cedric Hombourger' via isar-users
` (2 preceding siblings ...)
2024-11-22 5:48 ` [PATCH 3/3] repository: make repo_contains_package query the package database 'Cedric Hombourger' via isar-users
@ 2024-11-27 7:11 ` Uladzimir Bely
3 siblings, 0 replies; 5+ messages in thread
From: Uladzimir Bely @ 2024-11-27 7:11 UTC (permalink / raw)
To: Cedric Hombourger, isar-users
On Fri, 2024-11-22 at 06:48 +0100, 'Cedric Hombourger' via isar-users
wrote:
> repo_del_package should only remove binary packages (.deb), not
> previously added source packages.
>
> repo_contains_package should not assume that the name of downloaded
> .deb
> files will match filenames used by reprepro.
>
> Cedric Hombourger (3):
> repository: repo_del_package should not remove source packages
> repository: align repo_contains_package signature with other repo
> functions
> repository: make repo_contains_package query the package database
>
> meta/classes/repository.bbclass | 40 ++++++++++++++++----
> --
> meta/recipes-devtools/base-apt/base-apt.bb | 5 ++-
> 2 files changed, 34 insertions(+), 11 deletions(-)
>
> --
> 2.34.1
>
Applied to next, thanks.
--
Best regards,
Uladzimir.
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/fa92f935d0b02f97606438d426abc63786341d63.camel%40ilbers.de.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-11-27 7:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-22 5:48 [PATCH 0/3] repository: small fixes for repo_{contains,del}_packages 'Cedric Hombourger' via isar-users
2024-11-22 5:48 ` [PATCH 1/3] repository: repo_del_package should not remove source packages 'Cedric Hombourger' via isar-users
2024-11-22 5:48 ` [PATCH 2/3] repository: align repo_contains_package signature with other repo functions 'Cedric Hombourger' via isar-users
2024-11-22 5:48 ` [PATCH 3/3] repository: make repo_contains_package query the package database 'Cedric Hombourger' via isar-users
2024-11-27 7:11 ` [PATCH 0/3] repository: small fixes for repo_{contains,del}_packages Uladzimir Bely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox