portmaster [was: New /bin/sh based script to manage ports]

David J. Weller-Fahy dave-lists-freebsd-ports at weller-fahy.com
Sun Feb 19 06:51:13 PST 2006


* David J. Weller-Fahy <dave-lists-freebsd-ports at weller-fahy.com> [2006-02-19 15:40 +0100]:
> Hrm... would something like the attached script be sufficient?  it
> outputs a tree-like view of what will be updated.  It's not very
> complex, and doesn't take into account things like removing ports
> already ouput from any future output, but it works for me.

Which apparently didn't get through, here's an inline version:
#v+
#!/bin/sh
list_ports () {
	depth=$1
	shift
	for port in $@; do
		pkg_cur=`grep -l " ORIGIN:${port#/usr/ports/}$" /var/db/pkg/*/+CONTENTS`
		pkg_cur=${pkg_cur#/var/db/pkg/}
		pkg_cur=${pkg_cur%/+CONTENTS}
		pkg_new=`cd $port && make -V PKGNAME`
		test "`pkg_version -t $pkg_cur $pkg_new`" = "<" \
			&& echo "$depth>$pkg_cur::$pkg_new"
		deps=`cd $port && make all-depends-list`
		test -n "$deps" \
			&& list_ports ":$depth" $deps
	done
	depth=${depth#:}
}

for port in `portmaster -an | grep '^===>>> La' | awk '{print $6}'`; do
	orig=`grep '^@comment ORIGIN:' /var/db/pkg/$port/+CONTENTS`
	list_ports "" /usr/ports/${orig#@comment ORIGIN:}
done
#v-

Regards,
-- 
dave [ please don't CC me ]


More information about the freebsd-ports mailing list