more sgrep stuff for dpkg (was Re: Upgrade procedure for tetex)
for anyone who is interested, i have a new version of that sgrep based TeX
dependancy checking script i posted a few days ago.
Most of the tetex issues seem to be on their way to being resolved, but
i'm still working on this sgrep stuff. i'm convinced that sgrep can be a
very useful tool for extracting information out of Packages files and also
from /var/lib/dpkg/status. (I started working on this because I wanted to
create some php and/or cgi forms for browsing the status file. i'm
gradually getting the hang of sgrep in my copious amounts of spare time
The new version of my script is much faster (2 seconds elapsed time
compared to 49 seconds) by eliminating the really clumsy for loop.
It also checks for Recommends & Suggests as well as Depends. I still
haven't implemented any way of listing only those packages which aren't in
Section: tex - it probably isnt difficult but i don't think it is
important enough to bother with at the moment.
it has one bug that i've discovered so far. It incorrectly lists packages
kbd & dbview. This is because kbd Suggests: svgatextmode and dbview
Suggests: textutils. These match the 'contains ... or "tex" ...' part of
the sgrep search. I havent yet figured out how to get sgrep to use a
regexp for contains instead of a string literal.
anyway, here it is. do whatever you want with it.
# -v verbose output
# list of OLD_TEX_PACKAGES compiled from Recommends, Provides, & Conflicts
# lines of new TeX packages, plus "dvipsk" which Lyx complains about.
# I think I got them all but don't count on it.
OLD_TEX_PACKAGES="amslatex amstex babel bibtex dvipsk kpathsea latex lout
ltxmisc ltxtool makeindex mfbasfnt mfdcfnt mflib mfnfss
ps2pk psnfss texi2html texidoc texinfo texlib texpsfnt
textfm xdvik bibtex kpathsea tex texbin dvipsk"
# convert old TeX packages list into suitable form for sgrep.
sed -e 's/\([^ ]*\)/"\1" or/g' \
-e 's/or"" //g' \
if [ "$1" = "-v" ] ; then
echo Searching for packages which depend, reccomend, or suggest $OLDTEX
OUTPUT='Package: \|Depends: \|Recommends: \|Suggests: \|^$' ;
OUTPUT='Package: ' ;
zcat $PACKAGE_FILES | \
sgrep "DEB_PKG containing ((DEB_DEPENDS containing ($OLDTEX)) or (DEB_RECOMMENDS containing ($OLDTEX)) or (DEB_SUGGESTS containing ($OLDTEX)))" |\