Replace archiveuploader.parse_tagfile with apt_pkg.ParseTagFile

Bug #440014 reported by Michael Nelson on 2009-10-01
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself

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.

Changed in soyuz:
importance: Undecided → Low
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.

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  Edit
Everyone can see this information.

Other bug subscribers