* [PATCH] bootstrap: handle python exception for missing sources files more readable
@ 2022-04-20 11:52 Henning Schild
2022-05-05 10:17 ` Anton Mikanovich
0 siblings, 1 reply; 2+ messages in thread
From: Henning Schild @ 2022-04-20 11:52 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild, Florian Bezdeka
When a file for DISTRO_APT_SOURCES can not be found in any layer, catch
the exception and turn it into a bb.fatal. Which will be much more
readable to users.
Reported-by: Florian Bezdeka <florian.bezdeka@siemens.com>
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
.../recipes-core/isar-bootstrap/isar-bootstrap.inc | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index a6e370e3b7db..b4bd2dad87f7 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -147,14 +147,22 @@ def aggregate_aptsources_list(d, file_list, file_out):
out_fd.write("\n".encode())
def get_aptsources_list(d):
+ import errno
apt_sources_var = d.getVar("DISTRO_VARS_PREFIX") + "DISTRO_APT_SOURCES"
- return (d.getVar(apt_sources_var, True) or "").split()
+ list = (d.getVar(apt_sources_var, True) or "").split()
+ ret = []
+ for p in list:
+ try:
+ f = bb.parse.resolve_file(p, d)
+ ret.append(f)
+ except FileNotFoundError as e:
+ bb.fatal(os.strerror(errno.ENOENT) + ' "' + p + '"')
+ return ret
def generate_distro_sources(d):
apt_sources_list = get_aptsources_list(d)
for entry in apt_sources_list:
- entry_real = bb.parse.resolve_file(entry, d)
- with open(entry_real, "r") as in_fd:
+ with open(entry, "r") as in_fd:
for line in in_fd:
parsed = parse_aptsources_list_line(line)
if parsed:
--
2.35.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] bootstrap: handle python exception for missing sources files more readable
2022-04-20 11:52 [PATCH] bootstrap: handle python exception for missing sources files more readable Henning Schild
@ 2022-05-05 10:17 ` Anton Mikanovich
0 siblings, 0 replies; 2+ messages in thread
From: Anton Mikanovich @ 2022-05-05 10:17 UTC (permalink / raw)
To: Henning Schild, isar-users; +Cc: Florian Bezdeka
20.04.2022 14:52, Henning Schild wrote:
> When a file for DISTRO_APT_SOURCES can not be found in any layer, catch
> the exception and turn it into a bb.fatal. Which will be much more
> readable to users.
>
> Reported-by: Florian Bezdeka <florian.bezdeka@siemens.com>
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
Applied to next, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-05 10:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20 11:52 [PATCH] bootstrap: handle python exception for missing sources files more readable Henning Schild
2022-05-05 10:17 ` Anton Mikanovich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox