From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7057835350645800960 Date: Tue, 15 Feb 2022 21:23:36 -0800 (PST) From: "vijaikumar....@gmail.com" To: isar-users Message-Id: <80f6b3dc-55e2-4c0f-8a7c-0f240b80cb09n@googlegroups.com> In-Reply-To: <20220213073606.27476-2-ubely@ilbers.de> References: <20220213073606.27476-1-ubely@ilbers.de> <20220213073606.27476-2-ubely@ilbers.de> Subject: Re: [PATCH v3 1/1] deb-dl-dir: Use dpkg-deb --field in debsrc_download MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1648_583980007.1644989016049" X-TUID: YXTKOc5yn5fk ------=_Part_1648_583980007.1644989016049 Content-Type: multipart/alternative; boundary="----=_Part_1649_1307183976.1644989016049" ------=_Part_1649_1307183976.1644989016049 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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:'. > 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 > --- > 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 > > ------=_Part_1649_1307183976.1644989016049 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit

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

------=_Part_1649_1307183976.1644989016049-- ------=_Part_1648_583980007.1644989016049--