Re: interpreting Status field in dpkg status/available file
On Tue, Feb 27, 2001 at 10:22:37AM +0000, Julian Gilbey wrote:
> On Tue, Feb 27, 2001 at 12:21:11PM +1100, Craig Sanders wrote:
> > [...] the dlocate -l" search feature.
> >
> > one of the things i need to do is parse the Status field so i can produce
> > the same 3-letter codes that dpkg does.
>
> Why? Can't you just take the output of
> COLUMNS=1000 dpkg -l \*
> and let dpkg do the work? It doesn't chop off any package names.
i could do that but i don't want to. that's basically what i did in the
last version.
a big part of the point of dlocate is speed. it's a LOT faster to run
grep-dctrl or just 'cat /var/lib/dpkg/status' and parse the output than
it is to run "dpkg -l".
dpkg's output hasn't changed much for ages (except for a bug a few
versions ago where it acted differently when called from a cron job
without a tty), but i just don't like making hard-coded assumptions
about textual output.
by parsing the status file i know precisely what i am going to get
as input and not have to worry about spacing of fields or number of
"words" in a field - there are no field names or field delimiters in
dpkg's output. not serious problems, but aesthetically unpleasing.
also, i want to know how to do it - and submit the result as a
subroutine for dpkg-perl (if it's still being maintained) and/or
grep-dctrl.
craig
--
craig sanders <cas@taz.net.au>
GnuPG Key: 1024D/CD5626F0
Key fingerprint: 9674 7EE2 4AC6 F5EF 3C57 52C3 EC32 6810 CD56 26F0
Reply to: