Replace archiveuploader.parse_tagfile with apt_pkg.ParseTagFile

Bug #440014 reported by Michael Nelson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
Low
Unassigned

Bug Description

I'm currently doing a fix for bug 436182 but the lp.archiveuploader.tagfiles.parse_tagfile_lines function is becoming increasingly unwieldy.

Perhaps there's a historical reason for why it's being used, but I'd be keen to replace it with apt_pkg.ParseTagFile(). I won't do it as part of bug 436182 - as it would affect *lots* of critical code require checking the test coverage thoroughly, but it would be great to do.

Tags: lp-soyuz
Changed in soyuz:
importance: Undecided → Low
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

apt_pkg.ParseTagFile is marked as deprecated; I believe you pass a file (or presumably anything else that iterates lines) to the TagFile constructor instead.

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Actually, no, the stupid thing is expected to be a file or fileno.

To read and verify a Release file and represent it as a dict, AFAICT, you can just:

sections = list(apt_pkg.TagFile(file(filename)))
assert len(sections) <= 1, "I don't know how to deal with multiple sections."
return dict(sections[0])

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.