From owner-freebsd-ports@FreeBSD.ORG Thu Oct 14 04:19:43 2004 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4798616A4CE for ; Thu, 14 Oct 2004 04:19:43 +0000 (GMT) Received: from www.gotbrains.org (www2.gotbrains.org [206.180.149.129]) by mx1.FreeBSD.org (Postfix) with ESMTP id DA75243D41 for ; Thu, 14 Oct 2004 04:19:40 +0000 (GMT) (envelope-from clists@gotbrains.org) Received: from igor.gotbrains.org (eagle.spinneret.com [206.180.139.69]) by www.gotbrains.org (Postfix) with SMTP id 445EE211D for ; Wed, 13 Oct 2004 23:19:40 -0500 (CDT) Date: Wed, 13 Oct 2004 23:19:40 -0500 From: "Stephen P. Cravey" To: ports@freebsd.org Message-Id: <20041013231940.053cdc91.clists@gotbrains.org> X-Mailer: Sylpheed version 0.9.12 (GTK+ 1.2.10; i386-portbld-freebsd5.2.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Port dependency script for /usr/src/UPDATING 20041001 X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Oct 2004 04:19:43 -0000 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"