Hello,

I've computed dependency graph of failed packages (based on the 113-item list
sent by Marcela on Wednesday. See attached compressed SVG file.

The graph is layed out in such way that Required packages are below, arrow
shows what package depends on that package. Thus I recommend to start with
packages at bottom and prefer the ones that have a lot of incoming edges (e.g.
perl-namespace-clean or Perl-Catalyst-Runtime).

Generator is attached too. It accepts list of package names delimited by new
line on stdin, and it prints SVG file to stdout. The only insufficency is it
uses Requires instead of BuildRequires as I do not know how to ask repoquery
for that.)

-- Petr

<<attachment: graph-20100512.svgz>>

#!/usr/bin/env perl
use warnings;
use strict;
use Graph::Directed;
use GraphViz;

sub add_package($$@) {
    my ($graph, $subject, @deps) = @_;

    foreach $_ (@deps) {
        $graph->add_edge($subject, $_);
    }
    $graph->set_vertex_attribute($subject, 'broken', 1);
}

sub draw_graph($$) {
    my ($graph, $picture) = @_;

    foreach $_ ($graph->vertices) {
        if ($graph->has_vertex_attribute($_, 'broken')) {
            $picture->add_node($_, color=>'red');
        } else {
            $picture->add_node($_);
        }
    }

    foreach $_ ($graph->edges) {
        $picture->add_edge($$_[0], $$_[1]);
    }
}

# Build dependency graph
my $graph = Graph::Directed->new();

while (<>) {
    chomp;
    my $subject = $_;
    my @dependencies;

    @_ = split /\n/, `repoquery --requires "$subject"`;
    @_ = grep /^perl\(/, @_;
    @_ = map {
        #m/\(([^)]+)/;
        s/.*\(([^)]+).*/perl-$1/;
        s/::/-/g;
        $_;
    } @_;

    @dependencies = @_;

    add_package($graph, $subject, @dependencies);
}
#print "Rich graphs is $graph\n";

# Minimize graph
foreach $_ (grep {$graph->is_sink_vertex($_)} ($graph->vertices)) {
    if (!$graph->has_vertex_attribute($_, 'broken')) {
        $graph->delete_vertex($_);
    }
}


# Draw graph
my $picture = GraphViz->new(directed => 1, layout => 'dot');
draw_graph($graph, $picture);
print $picture->as_svg;

Attachment: pgpRHBRARZBR9.pgp
Description: PGP signature

--
Fedora Extras Perl SIG
http://www.fedoraproject.org/wiki/Extras/SIGs/Perl
perl-devel mailing list
perl-de...@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/perl-devel

Reply via email to