Update of /cvsroot/fink/fink/perlmod/Fink
In directory sc8-pr-cvs17:/tmp/cvs-serv2847/perlmod/Fink
Modified Files:
ChangeLog Engine.pm
Log Message:
fink list --format=dotty, this has been sitting in my fink tree for a bit :)
Index: Engine.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/Engine.pm,v
retrieving revision 1.409
retrieving revision 1.410
diff -u -d -r1.409 -r1.410
--- Engine.pm 18 Jun 2007 22:12:48 -0000 1.409
+++ Engine.pm 28 Aug 2007 13:23:10 -0000 1.410
@@ -425,7 +425,7 @@
sub do_real_list {
my ($pattern, @allnames, @selected);
my ($formatstr, $desclen, $name, $section, $maintainer);
- my ($buildonly);
+ my ($buildonly, $format);
my %options =
(
"installedstate" => 0
@@ -440,7 +440,7 @@
use Getopt::Long;
$formatstr = "%s %-15.15s %-11.11s %s\n";
$desclen = 43;
-
+ $format = 'table';
my @options = (
[ 'width|w=s' => \$width,
@@ -449,6 +449,8 @@
'set the width based on the terminal width.', 'NUM' ],
[ 'tab|t' => \$dotab,
'Outputs the list with tabs as field delimiter.' ],
+ [ 'format|f=s' => \$format,
+ 'The output format. (default: table)' ],
);
if ($cmd eq "list") {
@@ -542,6 +544,12 @@
}
}
+ if ($format eq 'dotty') {
+ print "digraph packages {\n";
+ print "concentrate=true;\n";
+ print "size=\"30,40\";\n";
+ }
+
my $reload_disable_save = Fink::Status->is_reload_disabled(); # save
previous setting
Fink::Status->disable_reload(1); # don't keep stat()ing status db
foreach my $pname (sort @selected) {
@@ -605,14 +613,32 @@
next unless $ok;
}
+ my $dispname = $pname;
if ($namelen && length($pname) > $namelen) {
# truncate pkg name if wider than its field
- $pname = substr($pname, 0, $namelen - 3)."...";
+ $dispname = substr($pname, 0, $namelen - 3)."...";
}
- printf $formatstr,
- $iflag, $pname, $lversion, $description;
+ if ($format eq 'dotty') {
+ print "\"$pname\" [shape=box];\n";
+ if (ref $vo) {
+ for my $dep (@{$vo->get_depends()}) {
+ for my $subdep (@$dep) {
+ $subdep =~ s/^(\S+).*?$/$1/;
+ print "\"$pname\" ->
\"$subdep\";\n";
+ }
+ }
+ }
+ } else {
+ printf $formatstr,
+ $iflag, $pname, $lversion, $description;
+ }
}
+
+ if ($format eq 'dotty') {
+ print "}\n";
+ }
+
Fink::Status->disable_reload($reload_disable_save); # restore previous
setting
}
Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.1484
retrieving revision 1.1485
diff -u -d -r1.1484 -r1.1485
--- ChangeLog 1 Aug 2007 15:39:27 -0000 1.1484
+++ ChangeLog 28 Aug 2007 13:23:10 -0000 1.1485
@@ -1,3 +1,7 @@
+2007-08-02 Benjamin Reed <[EMAIL PROTECTED]>
+
+ * Engine.pm: Implement fink list --format=dotty.
+
2007-08-01 Benjamin Reed <[EMAIL PROTECTED]>
* Validation.pm: Handle /usr/X11 packages properly.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Fink-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-commits