From: "'Cedric Hombourger' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: Cedric Hombourger <cedric.hombourger@siemens.com>
Subject: [PATCH] bootstrap: use only valid pairs in get_apt_source_mirror()
Date: Wed, 19 Mar 2025 07:49:37 +0100 [thread overview]
Message-ID: <20250319064937.68881-1-cedric.hombourger@siemens.com> (raw)
The following construct may generate [] entries:
mirror_list = [entry.split()
for entry in premirrors.split('\\n')
if any(entry)]
A valid pre-mirror entry is a regex and replacement URL
tupple. This causes an unpack error when evaluating:
for regex, replace in mirror_list
if the entry is e.g. " ".
For instance " re1 u1 \n re2 u2\n " would be translated to
mirorr_list = [['re1','u1'],['re2','u2'],[]]: only the first
two entries have two values, the latter has none.
It should be noted that split() will do just fine when multiple
spaces are found between components of a valid entry (leading
and trailing spaces within an entry will not cause issues).
After checking if entry is iterable ("if any(entry)"), only
process entries with exactly two components (silently ignore
others) so we do not die with an uggly unpack error exception.
Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
---
meta/classes/bootstrap.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/classes/bootstrap.bbclass b/meta/classes/bootstrap.bbclass
index c0644acb..64702d5d 100644
--- a/meta/classes/bootstrap.bbclass
+++ b/meta/classes/bootstrap.bbclass
@@ -123,7 +123,7 @@ def get_apt_source_mirror(d, aptsources_entry_list):
premirrors = d.getVar('DISTRO_APT_PREMIRRORS') or ""
mirror_list = [entry.split()
for entry in premirrors.split('\\n')
- if any(entry)]
+ if any(entry) and len(entry.split()) == 2]
for regex, replace in mirror_list:
match = re.search(regex, aptsources_entry_list[2])
--
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/20250319064937.68881-1-cedric.hombourger%40siemens.com.
next reply other threads:[~2025-03-19 6:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-19 6:49 'Cedric Hombourger' via isar-users [this message]
2025-03-19 6:54 ` 'MOESSBAUER, Felix' via isar-users
2025-03-19 6:59 ` 'cedric.hombourger@siemens.com' via isar-users
2025-03-19 7:09 ` 'MOESSBAUER, Felix' via isar-users
2025-03-25 16:57 ` Uladzimir Bely
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=20250319064937.68881-1-cedric.hombourger@siemens.com \
--to=isar-users@googlegroups.com \
--cc=cedric.hombourger@siemens.com \
/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