public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v2 0/1] deb-dl-dir: Use dpkg-deb --field in debsrc_download
@ 2022-02-10 17:16 Uladzimir Bely
  2022-02-10 17:16 ` [PATCH v2 1/1] " Uladzimir Bely
  0 siblings, 1 reply; 2+ messages in thread
From: Uladzimir Bely @ 2022-02-10 17:16 UTC (permalink / raw)
  To: isar-users

Some clarification of the patch:
Debian `control` file inside .deb may (or may not) contain `Source: field`.

There are three possible cases:

1. `Source` field is missing in control file:
Package: foo
Version: 1.2.3

In this case ${source:Package} = 'foo', ${source:Version} = 1.2.3

2. `Source` field present in control file, without version:
Package: foo
Version: 1.2.3
Source: bar

In this case ${source:Package} = 'bar', ${source:Version} = 1.2.3

3. `Source` field present in control file, with version:
Package: foo
Versin: 1.2.3
Source: bar (4.5.6)

In this case ${source:Package} = 'bar', ${source:Version} = 4.5.6

So, `Source` 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 using dpkg-deb --field. Initially, `Package` and `Version`
values are used (they should always be in control file), but later they
are overrided by values from `Source` field if it exists.

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 | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

-- 
2.20.1


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

* [PATCH v2 1/1] deb-dl-dir: Use dpkg-deb --field in debsrc_download
  2022-02-10 17:16 [PATCH v2 0/1] deb-dl-dir: Use dpkg-deb --field in debsrc_download Uladzimir Bely
@ 2022-02-10 17:16 ` Uladzimir Bely
  0 siblings, 0 replies; 2+ messages in thread
From: Uladzimir Bely @ 2022-02-10 17:16 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 | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/meta/classes/deb-dl-dir.bbclass b/meta/classes/deb-dl-dir.bbclass
index 42542d74..6bb8bf64 100644
--- a/meta/classes/deb-dl-dir.bbclass
+++ b/meta/classes/deb-dl-dir.bbclass
@@ -51,8 +51,14 @@ 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}" )"
+        local src="$( dpkg-deb --field "${package}" Source | awk '{printf $1}' )"
+        if [ -z "$src" ]; then
+            src="$( dpkg-deb --field "${package}" Package )"
+        fi
+        local version="$( dpkg-deb --field "${package}" Source |  awk '{gsub(/[()]/,""); printf $2}')"
+        if [ -z "$version" ]; then
+            version="$( dpkg-deb --field "${package}" Version )"
+        fi
         local dscfile=$(find "${DEBSRCDIR}"/"${rootfs_distro}" -name "${src}_${version}.dsc")
         [ -n "$dscfile" ] && continue
 
-- 
2.20.1


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

end of thread, other threads:[~2022-02-10 17:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 17:16 [PATCH v2 0/1] deb-dl-dir: Use dpkg-deb --field in debsrc_download Uladzimir Bely
2022-02-10 17:16 ` [PATCH v2 1/1] " Uladzimir Bely

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