Skip to content

Commit f167b95

Browse files
kyriasjelly
authored andcommitted
reporead: Mention pkgname and file when failing to parse info file
Signed-off-by: Johannes Löthberg <[email protected]>
1 parent 1831b8d commit f167b95

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

devel/management/commands/reporead.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def populate(self, values):
139139
def files_list(self):
140140
data_file = io.TextIOWrapper(io.BytesIO(self.files), encoding='UTF-8')
141141
try:
142-
info = parse_info(data_file)
142+
info = parse_info(self.name, 'BytesIO', data_file)
143143
except UnicodeDecodeError:
144144
logger.warning("Could not correctly decode files list for %s",
145145
self.name)
@@ -523,7 +523,7 @@ def filesonly_update(archname, reponame, pkgs, force=False):
523523
logger.info('Finished updating arch: %s', archname)
524524

525525

526-
def parse_info(iofile):
526+
def parse_info(pkgname, filename, iofile):
527527
"""
528528
Parses an Arch repo db information file, and returns variables as a list.
529529
"""
@@ -540,7 +540,7 @@ def parse_info(iofile):
540540
elif blockname:
541541
store[blockname].append(line)
542542
else:
543-
raise Exception("Read package info outside a block: %s" % line)
543+
raise Exception("%s: Read package info outside a block while reading from %s: %s" % (pkgname, filename, line))
544544
return store
545545

546546

@@ -581,7 +581,7 @@ def parse_repo(repopath):
581581
data_file = repodb.extractfile(tarinfo)
582582
data_file = io.TextIOWrapper(io.BytesIO(data_file.read()), encoding='UTF-8')
583583
try:
584-
pkgs[pkgid].populate(parse_info(data_file))
584+
pkgs[pkgid].populate(parse_info(pkgid, fname, data_file))
585585
except UnicodeDecodeError:
586586
logger.warning("Could not correctly decode %s, skipping file", tarinfo.name)
587587
data_file.close()

0 commit comments

Comments
 (0)