[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Translating apt lists directly



  Hi all,

  I've been scratching my head over a problem that I'd like to solve,
and I thought maybe this list could help.

  I'd like to generate some cut-down versions of my apt database for
debugging purposes (think unit tests).  Essentially I want to take all
the apt and dpkg databases, strip out all packages but a small set and
all references to packages outside this set, and write this
stripped-down set of files to a directory tree.

  I've got the "hard" part of the code written, to parse dependency
fields from files containing RFC822-style stanzas and throw out entries
that talk about packages outside the subset of the archive I'm building.
But I'm not sure what the best way is to iterate over the files that
store state for apt and dpkg.

  The best thing I can think of is to walk over everything in
/var/lib/apt/lists, along with /var/lib/dpkg/status and
/var/lib/apt/extended_states, treat each stanza as information about a
package and run my transform on a per-stanza basis after dropping
stanzas corresponding to packages outside my live set.

  I'm a little hesitant to do that, though, because those files are
technically internal implementation details of dpkg and apt.  Admittedly
this is just for building debug inputs, but still ... does anyone know a
way of handling this (in C++, of course) that's "officially" sanctioned?

   Thanks,
  Daniel



Reply to: