deb-dl-dir.bbclass: grep exact package from dpkg.log file

Message ID 20220510050000.900792-1-Srinuvasan_A@mentor.com
State Accepted, archived
Headers show
Series deb-dl-dir.bbclass: grep exact package from dpkg.log file | expand

Commit Message

Srinuvasan Arjunan May 9, 2022, 9 p.m. UTC
From: Srinuvasan A <srinuvasan_a@mentor.com>

When we grep the package status from dpkg.log file it returns the output
with partial matches, this leads to download src packages with an unknown version

Added provision for grep the exact package

Ex: we try to grep this "libgmp10:amd64 2:6.2.1+dfsg-1" package, but it
returns "libgmp10:amd64 2:6.2.1+dfsg-1+deb11u1" package.

Signed-off-by: Srinuvasan A <srinuvasan_a@mentor.com>
---
 meta/classes/deb-dl-dir.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Anton Mikanovich May 18, 2022, 3:03 a.m. UTC | #1
10.05.2022 08:00, Srinuvasan A wrote:
> From: Srinuvasan A <srinuvasan_a@mentor.com>
>
> When we grep the package status from dpkg.log file it returns the output
> with partial matches, this leads to download src packages with an unknown version
>
> Added provision for grep the exact package
>
> Ex: we try to grep this "libgmp10:amd64 2:6.2.1+dfsg-1" package, but it
> returns "libgmp10:amd64 2:6.2.1+dfsg-1+deb11u1" package.
>
> Signed-off-by: Srinuvasan A <srinuvasan_a@mentor.com>
> ---
>   meta/classes/deb-dl-dir.bbclass | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes/deb-dl-dir.bbclass b/meta/classes/deb-dl-dir.bbclass
> index eace510..4780228 100644
> --- a/meta/classes/deb-dl-dir.bbclass
> +++ b/meta/classes/deb-dl-dir.bbclass
> @@ -12,7 +12,7 @@ is_not_part_of_current_build() {
>       # Since we are parsing all the debs in DEBDIR, we can to some extend
>       # try to eliminate some debs that are not part of the current multiconfig
>       # build using the below method.
> -    local output="$( grep -hs "status installed ${package}:${arch} ${version}$" \
> +    local output="$( grep -xhs ".* status installed ${package}:${arch} ${version}" \
>               "${IMAGE_ROOTFS}"/var/log/dpkg.log \
>               "${BUILDCHROOT_HOST_DIR}"/var/log/dpkg.log \
>               "${BUILDCHROOT_TARGET_DIR}"/var/log/dpkg.log | head -1 )"

Applied to next, thanks.

Patch

diff --git a/meta/classes/deb-dl-dir.bbclass b/meta/classes/deb-dl-dir.bbclass
index eace510..4780228 100644
--- a/meta/classes/deb-dl-dir.bbclass
+++ b/meta/classes/deb-dl-dir.bbclass
@@ -12,7 +12,7 @@  is_not_part_of_current_build() {
     # Since we are parsing all the debs in DEBDIR, we can to some extend
     # try to eliminate some debs that are not part of the current multiconfig
     # build using the below method.
-    local output="$( grep -hs "status installed ${package}:${arch} ${version}$" \
+    local output="$( grep -xhs ".* status installed ${package}:${arch} ${version}" \
             "${IMAGE_ROOTFS}"/var/log/dpkg.log \
             "${BUILDCHROOT_HOST_DIR}"/var/log/dpkg.log \
             "${BUILDCHROOT_TARGET_DIR}"/var/log/dpkg.log | head -1 )"