Re: Graphing the garnome dependencies



If anybody want a graphviz gar....

Makefile:

GARNAME = graphviz
GARVERSION = 1.10
CATEGORIES = misc
DISTFILES = $(GARNAME)-$(GARVERSION).tar.gz
MASTER_SITES = http://www.graphviz.org/pub/graphviz/ARCHIVE/
 
DESCRIPTION = graphviz
define BLURB
 #FIXME: blurb goes here
endef
 
CONFIGURE_SCRIPTS = $(WORKSRC)/configure
BUILD_SCRIPTS = $(WORKSRC)/Makefile
INSTALL_SCRIPTS = $(WORKSRC)/Makefile
 
CONFIGURE_ARGS = $(DIRPATHS)
 
include ../category.mk

checksums:

e1402531abff68d146bf94e72b44dc2a  download/graphviz-1.10.tar.gz

and you must run "dot -Tps garnome.dot > garnome.ps" of course :)

Gonzalo

How to use:

   * cd to the gnome directory of the unpacked garnome release
   * run the script, it will generate a garnome.dot file
   * run "dot -Tps > garnome.ps" (requires the graphviz package)
   * Use your favourite postscript viewer to view the file
   * Marvel at the mess :-)


It shows lots of unnecessary dependencies. An example would be
libmrproject which depends on glib and libxml2. The dependency on
libxml2 isn't necessary since glib depends on gtk-doc which in turn
depends on libxslt which depends on libxml2.

It is quite good fun to watch how the layout of the graph changes as the
superfluous dependencies are removed.


Cheers,
Jens

Note, it will also work in the bootstrap, misc and mono directories.
  
#!/usr/bin/perl -w

use strict;

my $outfile = "garnome.dot";


my @makefiles = `find . -maxdepth 2 -name Makefile`;
print "makefils: @makefiles";

open DOT, ">$outfile" or die "Failed to open $outfile for write: $!\n";
print DOT "digraph garnome {\n";

foreach my $makefile (@makefiles) {
    open FH, $makefile or die "Failed to open $makefile: $!\n";
    my @lines = <FH>;
    close FH;

    my ($garname, @deps);
    foreach (@lines) {
	if (/^GARNAME\s*=\s*(\S*)\s*/) {
	    $garname = $1;
	    next;
	}

	if (/^LIBDEPS\s*=\s*(.*)/) {
	    @deps = split " ", $1;
	    next;
	}
    }

    foreach (@deps) {
	my ($dummy, $depname) = split '/', $_;
	print DOT "\"$garname\" -> \"$depname\"\n";
    }
}
print DOT "}\n";
close DOT;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]