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

Re: dpkg searcher



On Tue, May 04, 1999 at 11:55:02PM +0100, Adrian Bridgett wrote:
> Fed up with dpkg -s/-S/-L/--print-avail being slow?
> 
> If so, try this little Perl script I wrote.  Comments and suggestions
> most welcome. I'll probably package it properly a bit later on (I need
> to write a manpage really).
>
> I've been using Jim Picks "davail" and "dfind" for far too long :-)

have you seen dlocate? (originally written by Jim Pick, enhanced by me to
add extra features).  unlike your fdpkg, it doesn't do 'dpkg --status' but
it does do everything else (and more).  see below for timing tests of
dlocate vs fdpkg.


    [ UPDATE - i've now modified dlocate to use grep-dctrl to support  ]
    [ '-s' package status reports. i first used fdpkg, but preferred   ]
    [ the output of grep-dctrl (fdpkg prints extra cruft which makes   ]
    [ it harder for another program to parse the output...grep-dctrl   ]
    [ just prints what you asked for, and no more...unfortunately,     ]
    [ grep-dctrl is slower than fdpkg).                                ]

# dlocate --help
Usage: dlocate [option] [string...]

Options:
    (no option) string  list all records that match
    -S        string      list records where files match
    -L        package     list all files in package
    -s        package     print package's status
    -ls       package     'ls -ldF' of all files in package
    -du       package     'du -sck' of all files in package
    -conf     package     list conffiles in package
    -lsconf   package     'ls -ldF' of conffiles in package
    -md5sum   package     list package's md5sums (if any)
    -md5check package     check package's md5sums (if any)
    -man      package     list package's man pages (if any)

  The -L and -S commands are roughly analagous to the
  equivalent dpkg commands.


i've been meaning to make a package of this for ages, it's a very useful
tool. i think that the best thing to do would be to create a dpkg-utils
package containing dlocate and fdpkg and other dpkg related utilities
(e.g. i have another script called 'dpkg-man' which lists the man pages
in a package in a format suitable for use on a man command line..."man
`dpkg-man PACKAGE`" to view all the man pages for a package)

in short, consider this message to be an "intention to package
dpkg-utils" along with a request for submissions of useful dpkg related
utilities.




TIMING TESTS
------------

(all timing tests below were run twice to prevent caching from skewing
relative timings. tests were performed on a Cyrix 166 with 200MB RAM)

dlocate is 5 times faster for searches because it uses a
pre-genetated GNU locate database which indexes the contents of
/var/lib/dpkg/info/*.list


# time fdpkg -S /etc/apt
apt.list
--------
/etc/apt


real    0m8.519s
user    0m7.300s
sys     0m0.760s

# time dlocate -S /etc/apt
apt: /etc/apt

real    0m1.633s
user    0m1.430s
sys     0m0.100s


also of interest is that dlocate's output is easily parsed even with
simple shell scripts/tools, while fdpkg's output is difficult to parse.


dlocate is 5 times faster on package listings, too (possibly due to
difference in startup time of perl vs bash):

# time fdpkg -L apt >/dev/null

real    0m0.545s
user    0m0.490s
sys     0m0.040s

# time dlocate -L apt >/dev/null

real    0m0.102s
user    0m0.040s
sys     0m0.050s

craig

--
craig sanders


Reply to: