ximion / appstream-dep11

Python module to handle Debian DEP-11 metadata
https://github.com/ximion/appstream-generator
GNU Lesser General Public License v3.0
3 stars 3 forks source link

Crashes since "Work with Debian's package translation system" #15

Closed iainlane closed 8 years ago

iainlane commented 8 years ago
Traceback (most recent call last):
  File "/srv/appstream.debian.org/dep11-generator/scripts/dep11-generator", line 28, in <module>
    main()
  File "/srv/appstream.debian.org/dep11-generator/dep11/generator.py", line 444, in main
    gen.process_suite(params[1])
  File "/srv/appstream.debian.org/dep11-generator/dep11/generator.py", line 178, in process_suite
    pkglist = self._get_packages_for(suite_name, component, arch)
  File "/srv/appstream.debian.org/dep11-generator/dep11/generator.py", line 116, in _get_packages_for
    return read_packages_dict_from_file(self._archive_root, suite, component, arch, with_description=with_desc).values()
  File "/srv/appstream.debian.org/dep11-generator/dep11/package.py", line 102, in read_packages_dict_from_file
    pkgname = section['Package']
KeyError: 'Package'

This works on current python-apt but not trusty's - seen on Debian and Ubuntu

ximion commented 8 years ago

Will fix this when I'm home - for some reason, Python3 is unable to read the bz2 files (tested on Xenial) - I get Data corruption errors, but the file magic number and CRC checksums are fine (tested with the bzip2 command-line utility). This needs some further investigation - and might be the issue here, since the Translation file must have a Package field per section.

iainlane commented 8 years ago

Actually when it 'works' I still see no sections - I put a print inside the loop and it never executes. So doesn't crash but also does nothing. :)

ximion commented 8 years ago

Add a print(l10n_file.read(512) statement and observe a failing bz2 decompressor... (Not sure what is going on there...) TagFile swallows that error and is just empty in that case, which should cause no harm. I wonder why you are seeing that crash described above.

iainlane commented 8 years ago

print(read()) works for me but still the TagFile is bad

decompressing it manually works, doing this in memory (read + BytesIO) not - TagFile can't take a BytesIO it seems

ximion commented 8 years ago

Jup, TagFile need a filename or an open file object as parameter. Interesting that reading the bz2 file works for you... Failed for me when I tried this on Xenial yesterday.

ximion commented 8 years ago

This is fixed now, at least partially - the bz2 reading error remains.