From owner-freebsd-questions@FreeBSD.ORG Thu Dec 14 19:56:03 2006 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6FC5316A4AB for ; Thu, 14 Dec 2006 19:56:03 +0000 (UTC) (envelope-from e.schuele@computer.org) Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [204.127.192.81]) by mx1.FreeBSD.org (Postfix) with ESMTP id 47B8243CC1 for ; Thu, 14 Dec 2006 19:53:56 +0000 (GMT) (envelope-from e.schuele@computer.org) Received: from [208.206.151.59] (host59.gtisd.com?[208.206.151.59]) by comcast.net (rwcrmhc11) with ESMTP id <20061214195513m11003886qe>; Thu, 14 Dec 2006 19:55:13 +0000 Message-ID: <4581AC20.4030305@computer.org> Date: Thu, 14 Dec 2006 13:55:12 -0600 From: Eric Schuele User-Agent: Thunderbird 1.5.0.8 (X11/20061111) MIME-Version: 1.0 To: Frank Staals References: <45819393.20700@gmx.net> In-Reply-To: <45819393.20700@gmx.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: questions@freebsd.org Subject: Re: Getting a list of dependencies which have to be installed ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Dec 2006 19:56:03 -0000 On 12/14/2006 12:10, Frank Staals wrote: > Hey..., > > Is there a utility to display the dependencies of a port which have yet > to be installed ? I know you can get a complete dependency list on > freebsd.org/ports , pkg_info -r or just looking in the files in the > ports dir. But is there a command to display only the dependencies which > haven't been installed on your system yet ? I also looked at pkg_add -n > but it immediately starts fetching the packages needed. I don't want to > start downloading the complete package just because I want a list of > ports I haven't installed yet. > > Or is the only way making a diff between the pkg_info -r output and your > pkg_info -a ? If so : Is there a way to tell pkg_info when using the -r > flag on a not-yet-installed-port to only get a list of the dependencies > instead of downloading the complete package ? Or is there just an other > utility which can display this information which I'm not aware of ? > > Thanks in advance, > I needed this functionality, so I wrote a script... and sent it to the list for thoughts and opinions. After a few folks chipped in... this is what we had. Try the following (mind any wrapping): #! /bin/sh # Script to determine the differences between what is necessary for # a port, and what is already present on the local machine. awkprgt='{ count = 0 pkgs = "" for(i=5; i<=NF-2; i++) { pkg = $i # the "if" is here to hack it around when you get: # This port requires package(s) "" to build. if (pkg != "\"\"") { if (index(pkg, "\"") == 1) {pkg = substr(pkg, 2, length(pkg)-1)} if (index(pkg, "\"") > 1) {pkg = substr(pkg, 1, length(pkg)-1)} if ( system("pkg_info -e " pkg) == 1) { pkgs = pkgs " " pkg count++ } } } if ( count ) { printf "You need the following %d (%typ) perequisites:", count print pkgs } else { print "All (%typ) prerequisites are present." } } END { # triggered, eg., by audio/artswrapper (on my box, at least) if( ! FNR) { print "Bogus (empty) %s dependency information" } } ' awkit() { # Resolve "%s"-s via sed is a blunt hack # but good enough here and thus we don't have # to care about the number of occurrences awk "`echo "$awkprgt" | sed s/%typ/$1/g`" } make pretty-print-build-depends-list | awkit build make pretty-print-run-depends-list | awkit run ### End Script HTH. I use it all the time. -- Regards, Eric