Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Oct 2004 23:19:40 -0500
From:      "Stephen P. Cravey" <clists@gotbrains.org>
To:        ports@freebsd.org
Subject:   Port dependency script for /usr/src/UPDATING 20041001
Message-ID:  <20041013231940.053cdc91.clists@gotbrains.org>

next in thread | raw e-mail | index | archive | help
Since it looks like upgrading to 5.3 is going to result in lots of port
rebuilding:

It seemed to me that rebuilding certain ports before rebuilding the
ports that they depend on might, in some situations, be a bad thing.
I've written a very rudimentary script that sorts through your ports
tree (using pkg_info and grep and awk)and organizes them into a list in
the order of dependency. On my P4 2.4 and 301 ports, it takes about 30
seconds.

Example output file:

########### 1 ###############
db41-4.1.25_2
expat-1.95.8
fam-2.6.9_6
freetype-1.3.1_3
freetype2-2.1.7_3
gdbm-1.8.3_1
gsfonts-8.11_2
gsm-1.0.10
javavmwrapper-1.5
jpeg-6b_3
libghttp-1.0.9
libiconv-1.9.2_1
libid3tag-0.15.0b_1
libltdl-1.5.8
########### 2 ###############
autoconf-2.53_3
docbook-sk-4.1.2_3
docbook-xml-4.2_1
fontconfig-2.2.3,1
gd-2.0.28,1
gettext-0.13.1_1
glib-1.2.10_11
gpgme-0.3.16_1
guile-1.6.4_6
imake-6.7.0_2
libao-0.8.4_1
libart_lgpl2-2.3.16
libaudiofile-0.2.6
libijs-0.35


In this case, the ports listed in section "1" do not depend on anything.
The ports in section "2" ONLY depend on one ore more ports from section
"1". Section "3" (not in this example) would have ports that only depend
on ports in sections "1" and "2".

I'm sure there's a better way to do this, but it took me 15 minutes to
write. If you know of a better way, send me email. Watch out for
linewraps. Here it comes:

#!/bin/tcsh
#Insert BSD license here.
cd /var/db/pkg
pkg_info -Rr * > /tmp/pr
echo "########### 1 ###############" > /tmp/pp
grep -A 3 Information /tmp/pr | grep -B 3 Required | grep Information
|tr -d ":"| awk '{print $3}' >> /tmp/pp

foreach port (`cat /tmp/pp | grep -v "#"`)
    grep -v $port /tmp/pr > /tmp/ps
    mv /tmp/ps /tmp/pr
end

set myexit
@ myexit = 0
set myrun
@ myrun = 2

while ( $myexit == 0 )
    echo "########### $myrun ###############" >> /tmp/pp
    grep -A 3 Information /tmp/pr | grep -B 3 Required | grep
Information |tr -d ":"| awk '{print $3}' >> /tmp/pp

	foreach port (`cat /tmp/pp | grep -v "#"`)
        grep -v $port /tmp/pr > /tmp/ps
        mv /tmp/ps /tmp/pr
    end
    grep Dependency /tmp/pr
    @ myexit = "$?"
    @ myrun++
end

echo "########### $myrun ###############" >> /tmp/pp
grep Information /tmp/pr | tr -d ":"| awk '{print $3}' >> /tmp/pp
rm /tmp/pr
echo "File is /tmp/pp"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041013231940.053cdc91.clists>