public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Cedric Hombourger' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: ubely@ilbers.de,
	Cedric Hombourger <cedric.hombourger@siemens.com>,
	Srinuvasan A <srinuvasan.a@siemens.com>
Subject: [RFC PATCH 1/1] deb-dl-dir: do not assume Version being before Source in RC822 headers
Date: Fri, 11 Apr 2025 08:52:53 +0200	[thread overview]
Message-ID: <20250411065253.1037538-2-cedric.hombourger@siemens.com> (raw)
In-Reply-To: <20250411065253.1037538-1-cedric.hombourger@siemens.com>

Caching of Debian source packages uses "apt dumpavail" to list sources
known to the apt cache and "apt-ftparchive" to list sources that were
downloaded. With the former, the Source field may appear before the
Version field. The awk script used to list source,version tuples
assuming the following order: Package Version [Source] Size. It now
handles the case where Source may appear before Version (as seen in
the "apt dumpavail" output.

Fixes: 40f67049
Reported-by: Srinuvasan A <srinuvasan.a@siemens.com>
Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
---
 meta/classes/deb-dl-dir.bbclass | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/meta/classes/deb-dl-dir.bbclass b/meta/classes/deb-dl-dir.bbclass
index 75877750..af031ced 100644
--- a/meta/classes/deb-dl-dir.bbclass
+++ b/meta/classes/deb-dl-dir.bbclass
@@ -35,8 +35,12 @@ debsrc_source_version_filter() {
     # if <source-version> is not specified then it is <binary-version>.
     # The awk script handles these optional fields. It looks for Size: as a
     # trigger to print the source,version tupple
-    awk '/^Package:/ { s=$2; }
-         /^Version:/ { v=$2; next }
+    #
+    # Notes: Source may appear before Version. We however assume that
+    # Package is the first pattern we will match in a package block
+    # and Size the last.
+    awk '/^Package:/ { s=$2; v="" }
+         /^Version:/ { if (v == "") v=$2 }
          /^Source:/ { s=$2; if ($3 ~ /^\(/) v=substr($3, 2, length($3)-2) }
          /^Size:/ { print s, v}' \
     | sort -u
-- 
2.39.5

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20250411065253.1037538-2-cedric.hombourger%40siemens.com.

      reply	other threads:[~2025-04-11  6:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-11  6:52 [RFC PATCH 0/1] " 'Cedric Hombourger' via isar-users
2025-04-11  6:52 ` 'Cedric Hombourger' via isar-users [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250411065253.1037538-2-cedric.hombourger@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=cedric.hombourger@siemens.com \
    --cc=srinuvasan.a@siemens.com \
    --cc=ubely@ilbers.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox