public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v3 0/1] deb-dl-dir: Use dpkg-deb --field in debsrc_download
@ 2022-02-13  7:36 Uladzimir Bely
  2022-02-13  7:36 ` [PATCH v3 1/1] " Uladzimir Bely
  2022-02-22  6:38 ` [PATCH v3 0/1] " Anton Mikanovich
  0 siblings, 2 replies; 4+ messages in thread
From: Uladzimir Bely @ 2022-02-13  7:36 UTC (permalink / raw)
  To: isar-users

Debian `control` file inside .deb package may not contain `Source` field.
So, this field is virtual and the simplest way to request it - using
${source:Package} and ${source:Version} on "dpkg-deb --show --showformat".

While in bullseye this is currently broken, the patch simply emulates
the same logic using dpkg-deb --field. Initially, we try to get source
package name and version using from `Source` field and if it fails, we
just use `Package` and `Version` values.

Changes since v2:
- Replaced if/then/fi by one-line alternative
- Added comments in the code about reverting the patch when bug #1004372
in Debian is fixed

Changes since v1:
- Fixed commit message (should be BASE_REPO_FEATURES ?= "cache-deb-src",
but not ISAR_USE_CACHED_BASE_REPO)

Uladzimir Bely (1):
  deb-dl-dir: Use dpkg-deb --field in debsrc_download

 meta/classes/deb-dl-dir.bbclass | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 1/1] deb-dl-dir: Use dpkg-deb --field in debsrc_download
  2022-02-13  7:36 [PATCH v3 0/1] deb-dl-dir: Use dpkg-deb --field in debsrc_download Uladzimir Bely
@ 2022-02-13  7:36 ` Uladzimir Bely
  2022-02-16  5:23   ` vijaikumar....@gmail.com
  2022-02-22  6:38 ` [PATCH v3 0/1] " Anton Mikanovich
  1 sibling, 1 reply; 4+ messages in thread
From: Uladzimir Bely @ 2022-02-13  7:36 UTC (permalink / raw)
  To: isar-users

In Debian >= bullseye 'dpkg-deb --show --showformat' is currently broken
in case of requesting virtual fields like 'source:<FieldName>'.
This makes function 'debsrc_download' broken, so build fails when
BASE_REPO_FEATURES ?= "cache-deb-src" is enabled in local.conf

The regression came with the fix for bug #972580 in Debian.
The issue is reported to Debian bugtracker as bug #1004372.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 meta/classes/deb-dl-dir.bbclass | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/meta/classes/deb-dl-dir.bbclass b/meta/classes/deb-dl-dir.bbclass
index 42542d74..3c489a7b 100644
--- a/meta/classes/deb-dl-dir.bbclass
+++ b/meta/classes/deb-dl-dir.bbclass
@@ -51,8 +51,15 @@ debsrc_download() {
     printenv | grep -q BB_VERBOSE_LOGS && set -x
     find "${rootfs}/var/cache/apt/archives/" -maxdepth 1 -type f -iname '*\.deb' | while read package; do
         is_not_part_of_current_build "${package}" && continue
-        local src="$( dpkg-deb --show --showformat '${source:Package}' "${package}" )"
-        local version="$( dpkg-deb --show --showformat '${source:Version}' "${package}" )"
+        # Get source package name if available, fallback to package name
+        local src="$( dpkg-deb --field "${package}" Source | awk '{printf $1}' )"
+        [ -z "$src" ] && src="$( dpkg-deb --field "${package}" Package )"
+        # Get source package version if available, fallback to package version
+        local version="$( dpkg-deb --field "${package}" Source |  awk '{gsub(/[()]/,""); printf $2}')"
+        [ -z "$version" ] && version="$( dpkg-deb --field "${package}" Version )"
+        # TODO: get back to the code below when debian bug #1004372 is fixed
+        # local src="$( dpkg-deb --show --showformat '${source:Package}' "${package}" )"
+        # local version="$( dpkg-deb --show --showformat '${source:Version}' "${package}" )"
         local dscfile=$(find "${DEBSRCDIR}"/"${rootfs_distro}" -name "${src}_${version}.dsc")
         [ -n "$dscfile" ] && continue
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/1] deb-dl-dir: Use dpkg-deb --field in debsrc_download
  2022-02-13  7:36 ` [PATCH v3 1/1] " Uladzimir Bely
@ 2022-02-16  5:23   ` vijaikumar....@gmail.com
  0 siblings, 0 replies; 4+ messages in thread
From: vijaikumar....@gmail.com @ 2022-02-16  5:23 UTC (permalink / raw)
  To: isar-users


[-- Attachment #1.1: Type: text/plain, Size: 2294 bytes --]



On Sunday, February 13, 2022 at 1:06:09 PM UTC+5:30 ub...@ilbers.de wrote:

> In Debian >= bullseye 'dpkg-deb --show --showformat' is currently broken 
> in case of requesting virtual fields like 'source:<FieldName>'. 
> This makes function 'debsrc_download' broken, so build fails when 
> BASE_REPO_FEATURES ?= "cache-deb-src" is enabled in local.conf 
>
> The regression came with the fix for bug #972580 in Debian. 
> The issue is reported to Debian bugtracker as bug #1004372. 
>
> Signed-off-by: Uladzimir Bely <ub...@ilbers.de> 
> --- 
> meta/classes/deb-dl-dir.bbclass | 11 +++++++++-- 
> 1 file changed, 9 insertions(+), 2 deletions(-) 
>
> diff --git a/meta/classes/deb-dl-dir.bbclass 
> b/meta/classes/deb-dl-dir.bbclass 
> index 42542d74..3c489a7b 100644 
> --- a/meta/classes/deb-dl-dir.bbclass 
> +++ b/meta/classes/deb-dl-dir.bbclass 
> @@ -51,8 +51,15 @@ debsrc_download() { 
> printenv | grep -q BB_VERBOSE_LOGS && set -x 
> find "${rootfs}/var/cache/apt/archives/" -maxdepth 1 -type f -iname 
> '*\.deb' | while read package; do 
> is_not_part_of_current_build "${package}" && continue 
> - local src="$( dpkg-deb --show --showformat '${source:Package}' 
> "${package}" )" 
> - local version="$( dpkg-deb --show --showformat '${source:Version}' 
> "${package}" )" 
> + # Get source package name if available, fallback to package name 
> + local src="$( dpkg-deb --field "${package}" Source | awk '{printf $1}' 
> )" 
> + [ -z "$src" ] && src="$( dpkg-deb --field "${package}" Package )" 
> + # Get source package version if available, fallback to package version 
> + local version="$( dpkg-deb --field "${package}" Source | awk 
> '{gsub(/[()]/,""); printf $2}')" 
> + [ -z "$version" ] && version="$( dpkg-deb --field "${package}" Version 
> )" 
> + # TODO: get back to the code below when debian bug #1004372 is fixed 
> + # local src="$( dpkg-deb --show --showformat '${source:Package}' 
> "${package}" )" 
> + # local version="$( dpkg-deb --show --showformat '${source:Version}' 
> "${package}" )" 
> local dscfile=$(find "${DEBSRCDIR}"/"${rootfs_distro}" -name 
> "${src}_${version}.dsc") 
> [ -n "$dscfile" ] && continue


Just had a chance to look at this. Looks like we are handling the necessary 
scenarios. 

LGTM.

Thanks,
Vijai Kumar K
 

>
>
> -- 
> 2.20.1 
>
>

[-- Attachment #1.2: Type: text/html, Size: 2986 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 0/1] deb-dl-dir: Use dpkg-deb --field in debsrc_download
  2022-02-13  7:36 [PATCH v3 0/1] deb-dl-dir: Use dpkg-deb --field in debsrc_download Uladzimir Bely
  2022-02-13  7:36 ` [PATCH v3 1/1] " Uladzimir Bely
@ 2022-02-22  6:38 ` Anton Mikanovich
  1 sibling, 0 replies; 4+ messages in thread
From: Anton Mikanovich @ 2022-02-22  6:38 UTC (permalink / raw)
  To: Uladzimir Bely, isar-users

13.02.22 10:36, Uladzimir Bely wrote:
> Debian `control` file inside .deb package may not contain `Source` field.
> So, this field is virtual and the simplest way to request it - using
> ${source:Package} and ${source:Version} on "dpkg-deb --show --showformat".
>
> While in bullseye this is currently broken, the patch simply emulates
> the same logic using dpkg-deb --field. Initially, we try to get source
> package name and version using from `Source` field and if it fails, we
> just use `Package` and `Version` values.
>
> Changes since v2:
> - Replaced if/then/fi by one-line alternative
> - Added comments in the code about reverting the patch when bug #1004372
> in Debian is fixed
>
> Changes since v1:
> - Fixed commit message (should be BASE_REPO_FEATURES ?= "cache-deb-src",
> but not ISAR_USE_CACHED_BASE_REPO)
>
> Uladzimir Bely (1):
>    deb-dl-dir: Use dpkg-deb --field in debsrc_download
>
>   meta/classes/deb-dl-dir.bbclass | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
>
Applied to next, thanks.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-22  6:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-13  7:36 [PATCH v3 0/1] deb-dl-dir: Use dpkg-deb --field in debsrc_download Uladzimir Bely
2022-02-13  7:36 ` [PATCH v3 1/1] " Uladzimir Bely
2022-02-16  5:23   ` vijaikumar....@gmail.com
2022-02-22  6:38 ` [PATCH v3 0/1] " Anton Mikanovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox