Determining what a port will install... (more than pretty-print-*) [Soln]

Eric Schuele e.schuele at computer.org
Mon Oct 3 09:57:49 PDT 2005


hmm... apologies on the poor formating.

Eric Schuele wrote:
> Hello,
> 
> Some time back I posted a question regarding how to determine what
> ports/packages would need to be installed on my machine when I install a 
> new (new to the local machine) port.
> 
> For example, if I do not presently have openoffice installed... what
> will get installed when I 'make install clean' it?  Note that I want the
> differences between what is needed to build/run the port and what is
> already present on the machine.
> 
> At the time no one responded with a clear way to do this... so I finally
> had a few minutes to write a script to do it for me.  I thought someone
> else might find it useful... So I'm posting it here for comments and
> thoughts (be gentle, I'm new to awk).
> 
> I find it useful, especially for laptops... which may have a small HDD
> and little memory.  I generally try to install the minimum necessary to
> do my work.
> 
> #! /bin/sh
> 
> # Script to determine the differences between what is necessary for
> # a port, and what is already present on the local machine.
> 
> make pretty-print-build-depends-list | \
>  awk '{
>         count = 0
>         pkgs = ""
>         for(i=5; i<=NF-2; i++) {
>       pkg = $i
>     
>       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 ) {
>           print "You need the following (build) perequisites:"
>           print pkgs
>         }
>         else {
>           print "All (build) prerequisites are present."
>         }
> 
>       }'
> 
> make pretty-print-run-depends-list | \
>  awk '{
>         count = 0
>         pkgs = ""
>         for(i=5; i<=NF-2; i++) {
>       pkg = $i
>     
>       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 ) {
>           print "You need the following (run) perequisites:"
>           print pkgs
>         }
>         else {
>           print "All (run) prerequisites are present."
>         }
> 
>       }'
> 


-- 
Regards,
Eric


More information about the freebsd-questions mailing list