On Fri, Jul 03, 2009 at 12:47:36PM +0000, Jacob Meuser wrote:
> On Fri, Jul 03, 2009 at 08:39:04AM +0100, Edd Barrett wrote:
> > On Fri, Jul 03, 2009 at 08:26:57AM +0200, Merljin wrote:
> > > Another quick question - it is possible to update all outdated ports
> > > with one command ?
> > 
> > You could easily parse the output of out-of-date and run 'make update'
> > in the out of date directories.
> > 
> > I wonder if you could add this functionailty to out-of-date? During
> > release time there are no binary packages for snapshots, so it has a
> > valid use.
> 
> $ cat `which ood`
> #!/bin/sh
> OOD="`mktemp -t ood.XXXX`"
> cd /usr/ports
> ./infrastructure/build/out-of-date | tee "$OOD"
> make SUBDIRLIST="$OOD" update
> rm "$OOD"

bah.  that is not so good, because it doesn't build in the right
order.

#!/bin/sh
OOD="`mktemp -t ood.XXXX`"
OODS="`mktemp -t oods.XXXX`"
cd /usr/ports
./infrastructure/build/out-of-date | tee "$OOD"
make SUBDIRLIST="$OOD" build-dir-depends | tsort | tail -r |
(while read i j
do
        k=`echo $i | sed s#,-.*##`
        l=`grep "$k" "$OOD"`
        if test -n "$l"
        then
                if test -z "`grep \"$l\" \"$OODS\"`"
                then
                        echo "$l" >> "$OODS"
                fi
        fi
done)
make SUBDIRLIST="$OODS" BULK=Yes update clean
rm "$OOD" "$OODS"

works for me (that is, it correctly orders the output of out-of-date)
but I wonder if it will work when there are flavored ports.

I used "k=`echo $i | sed s#,-.*##`" to remove sub-package names
because out-of-date will give package specs like "audio/faad,-main",
but build-dir-depends might give "audio/faad".  all subpackages
are built at the same time (disregarding pseudo flavors) so it
doesn't seem to be a problem.  but I wonder if it would be a good
idea to explicitly use -main in dependency specs?

-- 
[email protected]
SDF Public Access UNIX System - http://sdf.lonestar.org

Reply via email to