Meeting/Flooding/Lists

Nik Clayton nik at freebsd.org
Thu Aug 8 21:47:37 BST 2002


--5dNcufZ4prhark0F
Content-Type: multipart/mixed; boundary="qD3brAgIG4LbUq6d"
Content-Disposition: inline


--qD3brAgIG4LbUq6d
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Aug 08, 2002 at 10:07:40AM +0100, Jonathan Belson wrote:
> > One minor request for next time... can we have wireless net access? (I =
can
> > supply a self supporting basestation that can sit outside any firewall).
>=20
> Not a bad idea - Nik could have made all his clever perl scripts available
> for download :-)

Here's the one that draws package graphs.  It's definitely not rocket
science.

Usage is

     pkg2graph.pl name_of_package > graph.png

or

     pkg2graph.pl /var/db/pkg/name_of_package > graph.png

When I get some free time I'll tidy it up, add a few necessary command
line options to specify things like output format, and put it in the
ports tree.

You need to have installed ports/graphics/p5-GraphViz first.

N
--=20
FreeBSD: The Power to Serve      http://www.freebsd.org/               (__)
FreeBSD Documentation Project    http://www.freebsd.org/docproj/    \\\'',)
                                                                      \/  \=
 ^
   --- 15B8 3FFC DDB4 34B0 AA5F  94B7 93A8 0764 2C37 E375 ---         .\._/=
_)

--qD3brAgIG4LbUq6d
Content-Type: application/x-perl
Content-Disposition: attachment; filename="pkg2graph.pl"
Content-Transfer-Encoding: quoted-printable

#!/usr/bin/perl -w=0A#=0A# Copyright (c) 2002 Nik Clayton=0A# All rights re=
served.=0A#=0A# Redistribution and use in source and binary forms, with or =
without=0A# modification, are permitted provided that the following conditi=
ons=0A# are met:=0A# 1. Redistributions of source code must retain the abov=
e copyright=0A#    notice, this list of conditions and the following discla=
imer.=0A# 2. Redistributions in binary form must reproduce the above copyri=
ght=0A#    notice, this list of conditions and the following disclaimer in =
the=0A#    documentation and/or other materials provided with the distribut=
ion.=0A#=0A# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS =
IS'' AND=0A# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED =
TO, THE=0A# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICU=
LAR PURPOSE=0A# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTO=
RS BE LIABLE=0A# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, =
OR CONSEQUENTIAL=0A# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF=
 SUBSTITUTE GOODS=0A# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINE=
SS INTERRUPTION)=0A# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER=
 IN CONTRACT, STRICT=0A# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERW=
ISE) ARISING IN ANY WAY=0A# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISE=
D OF THE POSSIBILITY OF=0A# SUCH DAMAGE.=0A#=0A# $Id$=0A#=0A=0Ause strict;=
=0Ause GraphViz;=0A=0Amy $g =3D GraphViz->new(concentrate =3D> 1,=0A		     =
 rankdir =3D> 1,=0A		      node =3D> {shape =3D> 'box'});=0A=0Amy $pkg =3D =
shift;=0A$pkg =3D~ s|^/var/db/pkg/||;	# Trim off the directory name=0A$pkg =
=3D~ s|/$||;			# Trim off trailing slash=0A=0Amy %seen =3D ();			# Keep tra=
ck of already seen packages=0A=0Adepends($pkg);=0A=0Asub depends {=0A    my=
 $this_pkg =3D shift;=0A=0A    return if $seen{$this_pkg};	# Bottom out the=
 recursion=0A    $seen{$this_pkg}++;=0A=0A    $g->add_node($this_pkg);=0A  =
  open(F, "/var/db/pkg/$this_pkg/+CONTENTS") or die "open(): $!\n";=0A    f=
oreach(<F>) {=0A	# Skip non pkgdep lines.  If we have found one then $1 wil=
l =0A	# contain the name of the dependency=0A	next if ! /^\@pkgdep\s+(.*)$/=
;=0A=0A	# Add an edge from this package to the dependency=0A	$g->add_edge($=
this_pkg =3D> $1);=0A=0A	# Recurse, doing the same thing for the dependency=
=0A	depends($1);=0A    }=0A    close(F);=0A}=0A=0Aprint $g->as_png();=0A
--qD3brAgIG4LbUq6d--

--5dNcufZ4prhark0F
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj1S2OkACgkQk6gHZCw343Wt1wCfdhUlrYpJIUDYWeF6qXGZzjLn
+4oAn10tTAWA+AgfgcSnr7/tcLdFYItu
=Xji1
-----END PGP SIGNATURE-----

--5dNcufZ4prhark0F--




More information about the Ukfreebsd mailing list