[elbe-devel] [PATCH] elbepack: handle ValueError from Debian 822 parsing
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Mon Feb 12 12:55:27 CET 2024
When a duplicate field in a copyright file is parsed this will be
reported as ValueError.
For example debian/copyright from elfutils (0.188-2.1):
```
File debian/_deb822_repro/parsing.py:3112, in parse_deb822_file(sequence, accept_files_with_error_tokens, accept_files_with_duplicated_fields, encoding)
3110 if dup_field is not None:
3111 msg = 'Duplicate field "{dup_field}" in paragraph number {no}'
-> 3112 raise ValueError(msg.format(dup_field=dup_field, no=no))
3114 return deb822_file
ValueError: Duplicate field "Comment" in paragraph number 2
```
Handle ValueError the same as the other exceptions.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/licencexml.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/elbepack/licencexml.py b/elbepack/licencexml.py
index d98def15ecde..cd58bb231179 100644
--- a/elbepack/licencexml.py
+++ b/elbepack/licencexml.py
@@ -77,7 +77,7 @@ class copyright_xml:
for cc in c.all_files_paragraphs():
files.append((cc.files, cc.license.synopsis, cc.copyright))
- except (NotMachineReadableError, MachineReadableFormatError) as E:
+ except (NotMachineReadableError, MachineReadableFormatError, ValueError) as E:
logging.warning("Error in copyright of package '%s': %s", pkg_name, E)
except Warning as W:
logging.warning("Warning in copyright of package '%s' : %s", pkg_name, W)
--
2.43.1
More information about the elbe-devel
mailing list