ghc-pkg dump output has changed slightly, it now indents values with spaces
to make then line up or something

haddock-interfaces:   /usr/lib/ghc-doc/haddock/th-lift-0.8.1/th-lift.haddock
haddock-html:         /usr/share/doc/libghc-th-lift-doc/html/

In some cases, it also wraps single line values to the next line:

haddock-interfaces:
    
/usr/lib/ghc-doc/haddock/filepath-bytestring-1.4.2.1.6/filepath-bytestring.haddock

This patch partially fixed it for me, but does not deal with the line wrapping,
which would take more of a rfc-822 type parser than this.

--- /usr/lib/ghc-doc/gen_contents_index.old     2020-08-05 17:05:47.355190738 
-0400
+++ /usr/lib/ghc-doc/gen_contents_index 2020-08-05 17:05:49.967249906 -0400
@@ -26,13 +26,13 @@
     my $fh = shift;
     my %dat;
     while (<$fh>) {
-       if (/^name: (.*)/) {
+       if (/^name:\s+(.*)/) {
            $dat{pkg} = $1;
-       } elsif (/^version: (.*)/) {
+       } elsif (/^version:\s+(.*)/) {
            $dat{ver} = $1;
-       } elsif (/^haddock-interfaces: (.*)/) {
+       } elsif (/^haddock-interfaces:\s+(.*)/) {
            $dat{ifaces} = $1;
-       } elsif (/^haddock-html: (.*)/) {
+       } elsif (/^haddock-html:\s+(.*)/) {
            $dat{html} = $1;
        } elsif (/^---/) {
            process(\%dat, @_);

-- 
see shy jo

Attachment: signature.asc
Description: PGP signature

Reply via email to