[v3] classes/repository: use the proper filename to find the packages under repo

Message ID 20241120093204.977261-1-srinuvasan.a@siemens.com
State Superseded, archived
Headers show
Series [v3] classes/repository: use the proper filename to find the packages under repo | expand

Commit Message

srinuvasan.a Nov. 20, 2024, 9:32 a.m. UTC
From: Srinuvasan A <srinuvasan.a@siemens.com>

This patch fixes the issue in repo_contians_package function, here we
are adding a few packages to repo again even though the repo already contains those
packages, ideally we should skip those

reproduce the issue:

1. Create the base-apt
2. Again retrigger the base-apt (assume that there is no changes in the previously built base-apt)

here we observed few packages getting added again to the APT, even those
packages already available in the repo.

Basically few packages having the epoch version (automake, git-man, ssh) in the download folder,
but the same packages are cached in the repo without the epoch version, due to this
mismatch, it tries to add the packages again into the repo, to fix this issue,
just find the package name in the repo without the epoch version.

Signed-off-by: Srinuvasan A <srinuvasan.a@siemens.com>
---
 meta/classes/repository.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Uladzimir Bely Nov. 27, 2024, 7:25 a.m. UTC | #1
On Wed, 2024-11-20 at 15:02 +0530, srinuvasan.a@siemens.com wrote:
> From: Srinuvasan A <srinuvasan.a@siemens.com>
> 
> This patch fixes the issue in repo_contians_package function, here we
> are adding a few packages to repo again even though the repo already
> contains those
> packages, ideally we should skip those
> 
> reproduce the issue:
> 
> 1. Create the base-apt
> 2. Again retrigger the base-apt (assume that there is no changes in
> the previously built base-apt)
> 
> here we observed few packages getting added again to the APT, even
> those
> packages already available in the repo.
> 
> Basically few packages having the epoch version (automake, git-man,
> ssh) in the download folder,
> but the same packages are cached in the repo without the epoch
> version, due to this
> mismatch, it tries to add the packages again into the repo, to fix
> this issue,
> just find the package name in the repo without the epoch version.
> 
> Signed-off-by: Srinuvasan A <srinuvasan.a@siemens.com>

Hello.

Since now we have https://groups.google.com/g/isar-users/c/NrVHusKyNTA
series merged to next, this patch gets incompatible and likely not
needed anymore.

> ---
>  meta/classes/repository.bbclass | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/repository.bbclass
> b/meta/classes/repository.bbclass
> index 28e712fd..043c8621 100644
> --- a/meta/classes/repository.bbclass
> +++ b/meta/classes/repository.bbclass
> @@ -99,7 +99,8 @@ repo_contains_package() {
>      local file="$2"
>      local package
>  
> -    package=$(find ${dir} -name ${file##*/})
> +    file_name=$(echo "${file##*/}" | sed 's/[0-9]\+%3a//g')
> +    package=$(find ${dir} -name ${file_name})
>      if [ -n "$package" ]; then
>          # yes
>          cmp --silent "$package" "$file" && return 0

Patch

diff --git a/meta/classes/repository.bbclass b/meta/classes/repository.bbclass
index 28e712fd..043c8621 100644
--- a/meta/classes/repository.bbclass
+++ b/meta/classes/repository.bbclass
@@ -99,7 +99,8 @@  repo_contains_package() {
     local file="$2"
     local package
 
-    package=$(find ${dir} -name ${file##*/})
+    file_name=$(echo "${file##*/}" | sed 's/[0-9]\+%3a//g')
+    package=$(find ${dir} -name ${file_name})
     if [ -n "$package" ]; then
         # yes
         cmp --silent "$package" "$file" && return 0