move sig2dot source to this package. TODO: decide if we want to build sig2dot as...
authormyon <myon@b513b33f-fedd-0310-b452-c3deb5f4c849>
Mon, 21 Aug 2006 10:00:54 +0000 (10:00 +0000)
committermyon <myon@b513b33f-fedd-0310-b452-c3deb5f4c849>
Mon, 21 Aug 2006 10:00:54 +0000 (10:00 +0000)
git-svn-id: svn://svn.debian.org/pgp-tools/trunk@298 b513b33f-fedd-0310-b452-c3deb5f4c849

debian/changelog
sig2dot/README.dot [new file with mode: 0644]
sig2dot/changelog [new file with mode: 0644]
sig2dot/control [new file with mode: 0644]
sig2dot/copyright [new file with mode: 0644]
sig2dot/sig2dot [new file with mode: 0755]
sig2dot/sig2dot.1 [new file with mode: 0644]

index a5e63db8bf1574d0758486348d5975202691cb0e..6e588c309cc36fae3c1e512c1f1bc9eef73482c8 100644 (file)
@@ -1,9 +1,10 @@
-signing-party (0.4.7-2) unreleased; urgency=low
+signing-party (0.4.8-1) unreleased; urgency=low
 
   * gpglist: do not die with with-fingerprint (Closes: #382019).
   * gpg-key2ps: add --list-key to gpg call (works around #382794).
+  * sig2dot: integrate source in this package.
 
- -- Christoph Berg <myon@debian.org>  Tue, 15 Aug 2006 17:48:03 +0200
+ -- Christoph Berg <myon@debian.org>  Mon, 21 Aug 2006 11:57:40 +0200
 
 signing-party (0.4.7-1) unstable; urgency=low
 
diff --git a/sig2dot/README.dot b/sig2dot/README.dot
new file mode 100644 (file)
index 0000000..943c84a
--- /dev/null
@@ -0,0 +1,9 @@
+sig2dot for Debian
+------------------
+
+The syntax definition of the .dot files which sig2dot produces
+can be found in the graphviz man pages. A copy is here:
+ * http://www.graphviz.org/Documentation.php
+ * http://www.graphviz.org/cvs/doc/info/lang.html
+
+ -- Christoph Berg <cb@df7cb.de>  Sun,  6 Mar 2005 18:11:08 +0100
diff --git a/sig2dot/changelog b/sig2dot/changelog
new file mode 100644 (file)
index 0000000..b5d3f89
--- /dev/null
@@ -0,0 +1,169 @@
+sig2dot (0.37) unstable; urgency=low
+
+  * Add patch by Matteo Corti to make the graph title configurable.
+  * Fix targets in debian/rules.
+  * Bump Standards-Version.
+
+ -- Christoph Berg <myon@debian.org>  Wed, 31 May 2006 16:33:41 +0200
+
+sig2dot (0.36) unstable; urgency=low
+
+  * Patch by Thomas Huriaux: sig2dot must not include external signatures if
+    using a subset of your keyring (Closes: #302693).
+  * Patch by Eero Häkkinen: recognize trust signatures with a level >= 10
+    (Closes: #348783).
+
+ -- Christoph Berg <myon@debian.org>  Sat, 21 Jan 2006 10:08:40 +0100
+
+sig2dot (0.35) unstable; urgency=low
+
+  * Use strict and warnings.
+  * New -h/-q/-v options.
+  * Remove comment fields from UIDs (Closes: #318751).
+  * Support localized strings for revoked keys (Closes: #318740).
+  * Bump Standards-Version.
+
+ -- Christoph Berg <myon@debian.org>  Fri, 23 Sep 2005 13:27:33 +0200
+
+sig2dot (0.34-4) unstable; urgency=high
+
+  * Fix breakage with gnupg 1.4 (keys with trust signatures) noted by Matthew
+    Wilcox (Closes: #308271).
+
+ -- Christoph Berg <cb@df7cb.de>  Wed, 18 May 2005 23:48:47 +0200
+
+sig2dot (0.34-3) unstable; urgency=low
+
+  * New maintainer (Closes: #297446).
+  * Fixed to work with gpg 1.4 output, fixed some perl -w warnings.
+  * Updated pointer to dot syntax documentation.
+  * Fixed unescaped hyphens in sig2dot.1 and removed some whitespace.
+  * Removed redundant stuff in debian/rules and fixed non-functional dh_perl
+    call.
+  * Recommends: gnupg.
+
+ -- Christoph Berg <cb@df7cb.de>  Sun,  6 Mar 2005 20:18:41 +0100
+
+sig2dot (0.34-2) unstable; urgency=low
+
+  * Orphan as in bug #297446
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Sat,  5 Mar 2005 02:43:15 -0700
+
+sig2dot (0.34-1) unstable; urgency=low
+
+  * Incorporate patch from Thomas Huriaux
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Fri, 28 Jan 2005 20:00:15 -0700
+
+sig2dot (0.33-1) unstable; urgency=low
+
+  * Fix option -d processing (closes:285706)
+
+ -- root <kmr@debian.org>  Thu, 16 Dec 2004 05:44:21 -0700
+
+sig2dot (0.32-1) unstable; urgency=low
+
+  * Fix typo (closes:207025) 
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Sun, 24 Aug 2003 13:27:57 -0600
+
+sig2dot (0.31-1) unstable; urgency=low
+
+  * Avoid potential division by 0
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Wed, 20 Aug 2003 10:47:04 -0600
+
+sig2dot (0.30k-2) unstable; urgency=low
+
+  * Add -u parameter to man page.
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Thu, 31 Jul 2003 07:58:06 -0600
+
+sig2dot (0.30k-1) unstable; urgency=low
+
+  * Add localization patch by Marcus Frings (closes:202503)
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Thu, 31 Jul 2003 00:55:01 -0600
+
+sig2dot (0.30j-1) unstable; urgency=low
+
+  * Revert patch (closes: 202484)
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Tue, 22 Jul 2003 21:27:22 -0600
+
+sig2dot (0.30i-1) unstable; urgency=low
+
+  * Incorporate patch for renderdate option setting (closes: 201339)
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Tue, 15 Jul 2003 10:24:28 -0600
+
+sig2dot (0.30h-1) unstable; urgency=low
+
+  * Incorporate patch for non-7bit names (closes:200329)
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Mon,  7 Jul 2003 10:25:19 -0600
+
+sig2dot (0.30g-1) unstable; urgency=low
+
+  * Remove double quotes around names (closes:193123)
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Fri, 16 May 2003 23:23:56 -0600
+
+sig2dot (0.30f-1) unstable; urgency=low
+
+  * Add -a option (closes:189417)
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Sun, 11 May 2003 22:27:36 -0600
+
+sig2dot (0.30e-1) unstable; urgency=low
+
+  * Add N to regex (closes:188277)
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Tue,  8 Apr 2003 19:34:50 -0600
+
+sig2dot (0.30d-1) unstable; urgency=low
+
+  * Improve comment (closes: 186608)
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Fri, 28 Mar 2003 07:52:26 -0700
+
+sig2dot (0.30c-1) unstable; urgency=low
+
+  * Add another flag to regex (closes: 186138)
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Mon, 24 Mar 2003 18:42:05 -0700
+
+sig2dot (0.30b-1) unstable; urgency=low
+
+  * Fix comment lines (closes: 183818)
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Fri,  7 Mar 2003 19:42:39 -0700
+
+sig2dot (0.30a-1) unstable; urgency=low
+
+  * Fix manpage and copyright (closes: 183613) 
+  Thanks again for Marco Bodrato
+  * Update sig2dot comments with v0.30 information
+  
+ -- Kevin M. Rosenberg <kmr@debian.org>  Thu,  6 Mar 2003 07:01:09 -0700
+
+sig2dot (0.30-1) unstable; urgency=low
+
+  * Make regex more robust. Closes:#183496.
+  Thanks Marco Bodrato.
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Wed,  5 Mar 2003 11:11:09 -0700
+
+sig2dot (0.29-2) unstable; urgency=low
+
+  * Change architecture to all
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Fri, 21 Feb 2003 12:21:08 -0700
+
+sig2dot (0.29-1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Tue, 18 Feb 2003 14:11:08 -0700
+
diff --git a/sig2dot/control b/sig2dot/control
new file mode 100644 (file)
index 0000000..8ee5907
--- /dev/null
@@ -0,0 +1,14 @@
+Source: sig2dot
+Section: graphics
+Priority: extra
+Maintainer: Christoph Berg <myon@debian.org>
+Build-Depends: debhelper (>> 4.0.0)
+Standards-Version: 3.7.2
+
+Package: sig2dot
+Architecture: all
+Depends: ${shlibs:Depends}, ${perl:Depends}
+Recommends: gnupg, springgraph
+Description: converts a list of GPG signatures to a .dot file
+ Parses output of "gpg --list-sigs" into a format suitable
+ for rendering into a graph by springgraph or graphviz.
diff --git a/sig2dot/copyright b/sig2dot/copyright
new file mode 100644 (file)
index 0000000..b72b353
--- /dev/null
@@ -0,0 +1,31 @@
+This package was debianized by Kevin M. Rosenberg <kmr@debian.org> on
+Tue, 18 Feb 2003 14:11:08 -0700.
+
+Version 0.29 was downloaded from http://www.chaosreigns.com/code/sig2dot/
+
+The current maintainer is Christoph Berg <myon@debian.org>.
+
+Upstream Authors:
+  Darxus@ChaosReigns.com with modifications by Kevin Rosenberg.
+  Versions 0.35 and later are by Christoph Berg.
+
+Copyright:
+  Copyright (c) 2002 Darxus@ChaosReigns.com
+  Copyright (c) 2005, 2006 Christoph Berg <cb@df7cb.de>
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+On Debian systems, the GNU GPL License version 2 is located in the file
+/usr/share/common-licenses/GPL-2.
diff --git a/sig2dot/sig2dot b/sig2dot/sig2dot
new file mode 100755 (executable)
index 0000000..5d3fb3f
--- /dev/null
@@ -0,0 +1,433 @@
+#!/usr/bin/perl -w
+
+# sig2dot v0.29 (c) Darxus@ChaosReigns.com, released under the GPL
+# Download from: http://www.chaosreigns.com/code/sig2dot/
+# sig2dot v0.35-0.37 (c) 2005, 2006 Christoph Berg <cb@df7cb.de>
+# Download from: http://ftp.debian.org/debian/pool/main/s/sig2dot/
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+# Parses output of "gpg --list-sigs" into a format
+# suitable for rendering into a graph by graphviz 
+# (http://www.research.att.com/sw/tools/graphviz/) like so:
+#
+# $ gpg --list-sigs --keyring ./phillylinux.gpg | ./sig2dot.pl > phillylinux.dot
+# $ neato -Tps phillylinux.dot > phillylinux.ps
+# $ convert phillylinux.ps phillylinux.jpg
+#
+# Commandline options:
+#
+# -b
+#   Black and white / do not colorize.
+#
+# -d <date>
+#   Render graph as it appeared on <date> (ignores more recent
+#   signatures).  Date must be in the format "YYYY-MM-DD".
+#   Will also ignore keys that have since been revoked.
+#
+# -a
+#   Render all keys, even if they're not signed by any other key.
+#
+# -u <"string">
+#   Support localized output of GnuPG for unknown user IDs. For
+#   example, German users have to write (with sh quotation marks!)
+#   "[User-ID nicht gefunden]" if they use GnuPG with German
+#   messages. Default is "[User id not found]".
+#
+# -r <"string">
+#   Support localized output of GnuPG for revoked keys. For
+#   example, French users have to write "révoqué" if they use
+#   GnuPG with French messages. Default is "[revoked".
+#
+# -s stats.html
+#   Produces statistics file with number of signatures per node
+#
+# -t <"string">
+#   Graph title
+#
+# -h  print help
+# -v  print version
+# -q  be quiet
+#
+# Changes:
+#
+# v0.9 2000-09-14 19:20  strip trailing whitespace from $id more cleanly
+# v0.10 2000-09-14 19:33 skip revoked keys at the request of Peter Palfrader <ppalfrad@cosy.sbg.ac.at>
+# v0.11 Nov 22 21:38     use ID for node name instead of username for uniqueness
+# v0.12 Dec 15 16:20 use names instead of IDs again in stats.html
+# v0.13 Jun 19 03:15 red is proportional to signatures
+# v0.14 Jun 19 03:25 blue is proportional to other keys signed
+# v0.15 Jun 20 17:16 fixed blue, green is proportional to ratio
+# v0.16 Jun 20 18:55 uniqed %signedby
+# v0.17 Jan 10 19:10 Use overlap=scale instead of fixed edge lengths.  Requires new version of graphviz.
+# v0.18 Jan 23 11:53 stats.html is now valid html (v.01 transitional)
+# v0.23 May  3 18:52 bunch of new stuff, including -b flag (black & white), and fixes devision by zero error
+# v0.24 May  3 18:59 add black outline to nodes, prettier (changed node attribute "color" to "fillcolor")
+# v0.25 May  3 19:06 cleaned up anti- devision by zero code a little
+# v0.26 May  4 00:08 strip all non-digit characters from $renderdate
+# v0.27 May 10 00:23:49 2002 use {}'s to write 1 line per public key instead of one line per signature (much shorter)
+# v0.28 Feb 13 2003 Change regex to handle option trust digit 
+#                   <kevin@rosenberg.net>
+# v0.29 Feb 18 2003 Add -s option to optionally produce statistics file 
+#                   <kevin@rosenberg.net>
+# v0.30 Feb 18 2003 Make --list-sigs regex more robust 
+#                   Marco Bodrato <bodrato@gulp.linux.it>
+# v0.31 Jul 28 2003 Add -u option for localized output of GnuPG
+#                   Marcus Frings <protagonist@gmx.net>
+# further changes are documented in debian/changelog
+
+use strict;
+
+my $version = "0.37";
+
+my $chartchar = "*";
+my $renderdate = "";
+my ($stats, $color, $all, $not_found, $revokestr, $title);
+
+use Getopt::Std;
+my %opt;
+getopts('d:u:r:s:bahqvt:', \%opt);
+
+sub version {
+  print <<EOT;
+sig2dot $version
+Copyright (c) 2002 Darxus\@ChaosReigns.com
+Copyright (c) 2005, 2006 Christoph Berg <cb\@df7cb.de>
+EOT
+}
+
+if ($opt{h}) {
+  version();
+  print <<EOT;
+gpg --list-sigs | $0 [-abdhqsuv] > sigs.dot
+-a              Graph all keys, even if they do not have a signature
+-b              Black and white / do not colorize.
+-d YYYY-MM-DD   Render graph as it appeared on date.
+-h              Print this help and exit.
+-q              Be quiet.
+-r sting        key-is-revoked string (default: "[revoked").
+-s stats.html   Produces statistics file with number of signatures per node.
+-t title        Graph title
+-u string       user-id-not-found string (default: "[user id not found]").
+-v              Print version and exit.
+EOT
+  exit 0;
+}
+if ($opt{v}) {
+  version();
+  exit 0;
+}
+
+if ($opt{d}) { 
+  $renderdate = $opt{d}; 
+  print STDERR "Printing from date: $renderdate.\n";
+  $renderdate =~ s/\D+//g;
+}
+if ($opt{s}) { 
+  $stats = $opt{s}; 
+  print STDERR "Print statistics to $stats.\n";
+}
+if ($opt{b}) 
+{ 
+  $color = 0; 
+  print STDERR "Black and White.\n" unless $opt{q};
+} else { 
+  $color = 1; 
+  print STDERR "Color.\n" unless $opt{q};
+}
+if ($opt{a}) {
+  $all = 1;
+} else {
+  $all = 0;
+}
+
+if ($opt{u}) {
+  $not_found = lc $opt{u};
+} else {
+  $not_found = "[user id not found]"; # this changed from gpg 1.2 -> 1.4
+}
+
+if ($opt{r}) {
+  $revokestr = lc $opt{r};
+} else {
+  $revokestr = "[revoked"; # this changed from gpg 1.2 -> 1.4
+}
+
+if ($opt{t}) {
+  $title = lc $opt{t};
+} else {
+  $title = "Keyring Statistics";
+}
+
+my ($owner, %name, %revlist, %sigstmp, %signedbytmp, %idlist, @names, %revs);
+
+while (my $line = <>)
+{
+  chomp $line;
+
+# gpg 1.2
+#pub  1024D/807CAC25 2003-08-01 Michael Ablassmeier (abi) <abi#grinser.de>
+#sig         B3B2A12C 2004-01-28   [User id not found]
+#sig 3       9456ADE2 2004-02-07   Michael Schiansky <michael#schiansky.de>
+# gpg 1.4:
+#pub   1024D/807CAC25 2003-08-01
+#uid                  Michael Ablassmeier (abi) <abi#grinser.de>
+#sig          B3B2A12C 2004-01-28  [User ID not found]
+#sig 3        9456ADE2 2004-02-07  Michael Schiansky <michael#schiansky.de>
+
+                 # type                          id       date       name
+   if ($line =~ m#([\w]+)[ !\?][ \dLNPRTX]{0,8} +([^ ]+) +([^ ]+)(?: +"?([^<"]*))?#)
+# differences:
+# " " -> "[ !\?]" (to use 'gpg --check-sigs|sig2dot.mio|springgraph|display')
+# "[ \d]" -> "[ \dLRXP]" (signature attributes)
+# "[^<]+" -> "[^<]*" (to recognise "pub" lines whitout a name)
+#  if ($line =~ m#([\w]+) [ \d]? +([^ ]+) +([^ ]+) +([^<]+)#)
+#  if ($line =~ m#([\w]+) +([^ ]+) +([^ ]+) +([^<]+)#)
+
+  {
+    my $type = $1;
+    my $id = $2;
+    my $date = $3;
+    my $name = $4 || "";
+
+    $date =~ tr/-//d;
+    if ($type eq "pub" or $renderdate eq "" or $date <= $renderdate)
+    {
+      print STDERR "Using: $line\n" unless $opt{q};
+      # strip trailing whitespace more cleanly:
+      $name =~ s/\s+$//g;
+
+      #Remove re: http://bugs.debian.org/202484
+      #$name =~ s/[^a-zA-Z \.0-9]/_/g; # handle non-7bit names
+
+      if ($type eq "pub")
+      {
+        $id = (split('/',$id))[1];
+        $owner = $id;
+        $idlist{$id} = 1 if (index($name, $revokestr) < 0);
+      }
+
+      # remove comment field
+      $name{$id} = (split ' \(', $name)[0] if $name; # gpg 1.4 fixup
+
+      # skip revoked keys 
+      if (index($name, $revokestr) >= 0) {
+        $revlist{$id} = 1;
+        next;
+      }
+
+      if ($type eq "uid") {
+       $name{$owner} = $id; # gpg 1.4 fixup
+      }
+  
+#      unless (defined @{$sigs{$owner}})
+#      {
+#        @{$sigs{$owner}} = ();
+#      }
+      if ($type eq "sig" and lc $name ne $not_found)
+      {
+       if ($id ne $owner) {
+         push (@{$sigstmp{$owner}},$id);
+         push (@{$signedbytmp{$id}},$owner);
+       }
+       if ($all or $id ne $owner) {
+         push (@names,$id,$owner);
+       }
+      }
+      if ($type eq "rev" and lc $name ne $not_found)
+      {
+       if ($id ne $owner) {
+         push (@{$revs{$owner}},$id);
+         #push (@{$revokedby{$id}},$owner);
+       }
+      }
+    } else {
+      print STDERR "Skipping due to date: $line\n";
+    }
+  } else {
+    print STDERR "Skipping due to regex: $line\n" if $line ne "";
+  }
+}
+
+my (%sigs, %signedby);
+
+for my $id (sort {$sigstmp{$a} <=> $sigstmp{$b}} keys %sigstmp) {
+  next if (defined $revlist{$id});
+  foreach my $owner (@{$signedbytmp{$id}}) {
+    next if (defined $revlist{$owner});
+    my $revoke = 0;
+    foreach my $revid (@{$revs{$owner}}) {
+      if ($revid eq $id) {
+        $revoke = 1;
+      }
+    }
+    #$res = $revlist{$id};
+    if (($revoke == 0)) {
+      push (@{$sigs{$owner}},$id);
+      push (@{$signedby{$id}},$owner);
+    }
+  }
+}
+
+print "digraph \"$title\" {\noverlap=scale\nsplines=true\nsep=.1\n";
+
+my %saw;
+@saw{@names} = ();
+@names = keys %saw;
+undef %saw;
+
+my $maxsigcount = 0;
+my (%sigcount);
+
+for my $owner (sort {$sigs{$a} <=> $sigs{$b}} keys %sigs)
+{
+  undef %saw;
+  @saw{@{$sigs{$owner}}} = ();
+  @{$sigs{$owner}} = keys %saw;
+  undef %saw;
+  undef %saw;
+  $signedby{$owner} ||= [];
+  @saw{@{$signedby{$owner}}} = ();
+  @{$signedby{$owner}} = keys %saw;
+  undef %saw;
+
+  $sigcount{$owner} = scalar(@{$sigs{$owner}});
+  if ($sigcount{$owner} > $maxsigcount)
+  {
+    $maxsigcount = $sigcount{$owner};
+  }
+}
+
+my %signedbycount;
+my ($maxsignedbycount, $maxratio) = (0, 0);
+
+for my $owner (sort {$signedby{$a} <=> $signedby{$b}} keys %signedby)
+{
+  $signedbycount{$owner} = scalar(@{$signedby{$owner}});
+  if ($signedbycount{$owner} > $maxsignedbycount)
+  {
+    $maxsignedbycount = $signedbycount{$owner};
+  }
+  if ($sigcount{$owner} and $sigcount{$owner} > 0) {
+    if ($signedbycount{$owner} / $sigcount{$owner} > $maxratio)
+    {
+      $maxratio = $signedbycount{$owner} / $sigcount{$owner};
+    }
+  }
+}
+print "//$maxratio\n";
+
+if ($stats) {
+    open (STATS,">$stats");
+    print STATS "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html><head><title>$title</title></head><body><table border=1>\n";
+
+    for my $owner (sort {$sigcount{$b} <=> $sigcount{$a}} keys %sigs)
+    {
+       print STATS "<tr><td>$name{$owner}<td>$sigcount{$owner}<td><img src=\"/images/pipe0.jpg\" height=15 width=",$sigcount{$owner} * 20," alt=\"". $chartchar x $sigcount{$owner} ."\">\n";
+    }
+    
+    print STATS "</table></body></html>\n";
+    close STATS;
+}
+
+print "node [style=filled]\n";
+for my $id (@names)
+{
+  if ((not exists $sigcount{$id}) and (not exists $signedbycount{$id}) and not $all) {
+    next;
+  }
+  next unless (defined $idlist{$id});
+  if ($color)
+  {
+    my ($red, $green, $blue) = (0, 1/3, 1/3);
+    if ($sigcount{$id}) {
+      $red = $sigcount{$id} / $maxsigcount;
+    }
+    if ($sigcount{$id} && $maxratio != 0)
+    {
+      $green = ($signedbycount{$id} / $sigcount{$id} / $maxratio * .75) * 2/3 + 1/3;
+    }
+    if ($signedbycount{$id} and $maxsignedbycount != 0) {
+      $blue = ($signedbycount{$id} / $maxsignedbycount) * 2/3 + 1/3;
+    }
+
+    my ($hue,$saturation,$value) = rgb2hsv($red,$green,$blue);
+    printf "//%d %d $red,$green,$blue\n", $sigcount{$id} || 0, $signedbycount{$id} || 0;
+    print "\"$id\" [fillcolor=\"$hue,$saturation,$value\",label=\"$name{$id}\"]\n";
+  } else {
+    print "\"$id\" [label=\"$name{$id}\"]\n";
+  }
+}
+#print "node [style=solid]\n";
+
+for my $owner (sort keys %sigs)
+{
+ print "{ ";
+  for my $id (@{$sigs{$owner}})
+  {
+    print "\"$id\" ";
+  }
+  print "} -> \"$owner\"\n";
+}
+
+print "}\n";
+
+#  Converts rgb to hsv.  All numbers are within range 0 to 1
+#  from http://twiki.org/cgi-bin/view/Codev/WebMap
+sub rgb2hsv {
+    my ($r, $g ,$b) = @_;
+    my $max = maxof($r, maxof($g, $b));
+    my $min = minof($r, minof($g, $b));
+    my $v = $max;
+    my ($s, $h);
+
+    if ($max > 0.0) {
+        $s = ($max - $min) / $max;
+    } else {
+        $s = 0;
+    }
+    if ($s > 0.0) {
+        my ($rc, $gc, $bc, $diff);
+            $diff = $max - $min;
+        $rc = ($max - $r) / $diff;
+        $gc = ($max - $g) / $diff;
+        $bc = ($max - $b) / $diff;
+        if ($r == $max) {
+            $h = ($bc - $gc) / 6.0;
+        } elsif ($g == $max) {
+            $h = (2.0 + $rc - $bc) / 6.0;
+        } else {
+            $h = (4.0 + $gc - $rc) / 6.0;
+        }
+    } else {
+       $h = 0.0;
+    }
+    if ($h < 0.0) {
+       $h += 1.0;
+    }
+    return ($h, $s, $v);
+}
+sub maxof {
+   my ($a, $b) = @_;
+
+   return $a>$b?$a:$b;
+}
+sub minof {
+   my ($a, $b) = @_;
+
+   return $a<$b?$a:$b;
+}
+
+# vim:sw=2:
diff --git a/sig2dot/sig2dot.1 b/sig2dot/sig2dot.1
new file mode 100644 (file)
index 0000000..45547c8
--- /dev/null
@@ -0,0 +1,80 @@
+.\"                                      Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH SIG2DOT 1 "May 31, 2006"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh        disable hyphenation
+.\" .hy        enable hyphenation
+.\" .ad l      left justify
+.\" .ad b      justify to both left and right margins
+.\" .nf        disable filling
+.\" .fi        enable filling
+.\" .br        insert line break
+.\" .sp <n>    insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+sig2dot \- creates a .dot file from a GPG signature listing
+.SH SYNOPSIS
+.B sig2dot [OPTIONS] < input-file > output-file
+.br
+.SH DESCRIPTION
+This manual page documents briefly the
+.B sig2dot
+command.
+Sig2dot parses the output of "gpg \-\-list\-sigs" and produces a .dot file
+that can be used as input to a graphing program.
+.SH OPTIONS
+\fIsig2dot\fP
+accepts the following options:
+.TP 16
+.B \-b
+Black and white / do not colorize.
+.TP 16
+.B \-d <date>
+Render graph as it appeared on <date> (ignores more recent
+signatures).  Date must be in the format "YYYY\-MM\-DD".
+Will also ignore keys that have since been revoked.
+.TP 16
+.B \-s <html-file-name>
+Produces a sory HTML statistics file with the number of signatures per node.
+.TP 16
+.B \-a
+Graph all keys, even if they do not have a signature
+.TP 16
+.B \-r "<key-revoked-string>"
+Sets the text for the key-revoked string used by GnuPG. The default is 
+what is used in the English version. This parameter can be set for versions 
+of GnuPG localized to other languages. Default: "[revoked".
+.TP 16
+.TP 16
+.B \-t "<title>"
+Sets the title for the graph generated. Default: "Keyring Statistics".
+.TP 16
+.B \-u "<user-not-found-string>"
+Sets the text for the user-not-found string used by GnuPG. The default is 
+what is used in the English version. This parameter can be set for versions 
+of GnuPG localized to other languages. Default: "[user id not found]".
+.TP 16
+.B \-q
+Be quiet.
+.TP 16
+.B \-h
+Print help and exit.
+.TP 16
+.B \-v
+Print version and exit.
+.SH EXAMPLE
+gpg \-\-list\-sigs | sig2dot > sigs.dot
+.sp 0
+springgraph < sigs.dot > sigs.png
+.SH SEE ALSO
+.B springgraph(1)
+.B gnupg(1)
+.SH AUTHORS
+Darxus@ChaosReigns.com with modifications by Kevin Rosenberg.
+Versions 0.35 and later are by Christoph Berg <cb@df7cb.de>.
+This manual page was written by Kevin M. Rosenberg <kmr@debian.org>,
+for the Debian GNU/Linux system (but may be used by others).