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

Re: package dependency



> 
> Hi,
> 	How do I know if the package is no longer dependent by others?
> 
> 	for example, if I have a lib-blah package installed, and I want to know
> 	if there are any other packages installed on my system that depends on
> 	this package.
> 
> 	I don't want to try to remove it though.

This information is available in /var/lib/dpkg/status.  You can get it
out with the little sh script I called `debquery' which is attached
below.  I donate this sophisticated piece of software engineering to the
debian community :)  You can ask for any field you like:

# default is the Depends field
$ debquery xlib6
 xaw95
 xview
 tk42
 xquake
 lesstif

# other fields are possible:
$ debquery Suggests gnuplot
 octave

`debquery Status installed' would give you all installed packages, but,
unlike `dpkg -l' not cut off longer package names.  You need /bin/sh
and `ex' installed for the script to work.

HTH,
Eric

-- 
 E.L. Meijer (tgakem@chem.tue.nl)
 Eindhoven Univ. of Technology
 Lab. for Catalysis and Inorg. Chem. (SKA)

------ Cut here and save as `debquery' ---------------------------------
#! /bin/sh

#
# This software may be distributed under the GPL.
# I like to call it `debquery'
#
# (C) Eric Meijer, 1999
#

if [ $# -lt 1 ] || [ $# -gt 2 ]; then
echo usage: $0 \[\<field\>\] \<debian package\>
echo "field can be one of the following:"
echo "Depends (the default), Suggests, Conflicts, or any other"
echo "field found (or even not found :) in the status file"
exit
fi

if [ $# = 1 ]; then
FIELD=Depends
PACKAGE=$1
else
FIELD=$1
PACKAGE=$2
fi

STATUSFILE=/var/lib/dpkg/status

ex $STATUSFILE << _EOF_ | cut -d: -f2
g/^$FIELD:.*\<$PACKAGE\>/ ?Package? p
_EOF_


Reply to: