Date: Mon, 26 Apr 2004 10:35:53 -0400 From: Randy Pratt <rpratt1950@earthlink.net> To: Tuc <tuc@ttsg.com> Cc: kirma@cs.hut.fi Subject: Re: Garbage collection of installed packages Message-ID: <20040426103553.46157212.rpratt1950@earthlink.net> In-Reply-To: <200404261215.i3QCFUJ1027405@himinbjorg.tucs-beachin-obx-house.com> References: <20040426113026.GA23138@lori.mine.nu> <200404261215.i3QCFUJ1027405@himinbjorg.tucs-beachin-obx-house.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 26 Apr 2004 08:15:30 -0400 (EDT) Tuc <tuc@ttsg.com> wrote: > > > > I use this script to find packages which are NOT dependencies of other > > packages: > > > > #/bin/sh > > cd /var/db/pkg > > for i in * ; do [ -e ${i}/+REQUIRED_BY ] || echo ${i} ; done > > > > This way you also see the packages which you installed expicitly (most > > of them are not depended on by other packages either), but I suppose > > you know/recognize those. > > > I ran this.... 72 of my 176 came up. > > Some that came up that I never remember installing by hand : > > autoconf-2.13.000227_5 > autoconf-2.57_1 > automake-1.4.5_9 > bison-1.75_2 > ezm3-1.1_1 > gmake-3.80_2 > help2man-1.33.1 > intltool-0.30_1 > ispell-3.2.06_4 > libtool-1.3.5_2 > libtool-1.4.3_3 > libtool-1.5.2_1 > qmake-3.3.1 > rpm-3.0.6_9 > > > I think the ezm3 is from portupgrade, ispell maybe from elm, rpm > from linux.. Is this more that people didn't set the requirements properly? > > Thanks, Tuc/TTSG Internet Services, Inc. I think its because they are build dependencies. It seems that only run dependencies are recorded in /var/db/pkg. The sysutils/pkg_cutleaves also only uses run dependencies. If a build dependency is also a run dependency then its a moot point but there are a few instances where a dependency is only required to build a port and not required during run-time. I didn't want to remove the build dependencies since they would be needed for the next portupgrade. My solution was to first create a build dependency database of installed ports and use another script to search the database. I'm sure there are many ways to accomplish the same thing. Example usages of the script: $ find_bld_dep.sh ezm3-1.1_1 cvsup-16.1h (/usr/ports/net/cvsup) $ find_bld_dep.sh rpm-3.0.6_9 bin2iso-1.9b_2 (/usr/ports/converters/bin2iso) linux-esound-0.2.22_2 (/usr/ports/audio/linux-esound) linux-libaudiofile-0.1.11_3 (/usr/ports/audio/linux-libaudiofile) linux-realplayer-8.cs2_4 (/usr/ports/multimedia/linux-realplayer) linux_base-7.1_7 (/usr/ports/emulators/linux_base) Here are the scripts used: ---begin mk_bld_dep_db.sh--- #!/bin/sh #<title>Create ports build-dependency database</title> # db form: version|/usr/ports/category/name|dep1|dep2|dep3|...|depN # Set path/filename for database (change this) filedata="/usr/home/rpratt/build_depends.db" # Remove old database if it exists if [ -e $filedata ]; then rm $filedata fi # Find installed ports list=`pkg_info | awk -F " " '{print $1}'` # Make entry in database for each installed port for i in $list; do echo $i origin="/usr/ports/`pkg_info -qo $i`" cd $origin build_depends=`make build-depends-list` depends="" for j in $build_depends; do depends="$depends|$j" done echo "$i|$origin$depends">> $filedata done ---end mk_bld_dep_db.sh--- Then I could check it with another script: ---begin find_bld_dep.sh--- #!/bin/sh #<title>Find Build Dependencies for a Port</title> # Location of build dependency database (change this) database="/usr/home/rpratt/build_depends.db" origin="/usr/ports/`pkg_info -qo $1`" list=`grep $origin $database` for i in $list; do port=`echo $i | awk -F "|" '{print $2}` version=`echo $i | awk -F "|" '{print $1}` if [ $origin != $port ]; then echo "$version ($port)" fi done ---end find_bld_dep.sh--- Of course, you can tailor the output of the find_bld_dep.sh script to suit your needs (or the database for that matter). I'm sure that there are other/better ways to do this but the scripts were a quick throw-together to clean up the ports on a slow box. Also, they were only written for build dependencies since pkg_cutleaves takes care of the run dependency aspect quite well. HTH, Randy --
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040426103553.46157212.rpratt1950>