Repository: spack/spack

Issue:
xsltproc bug causes gdk-pixbuf build to fail
I'm trying to install `gdk-pixbuf`, but a bug in our `libxslt` installation causes `xsltproc` to crash. libxslt itself successfully installs and passes all unit tests, but you can see the same error in the build log.

### Steps to reproduce the issue

```console
$ spack install libxslt
```

### Platform and user environment

```commandline
$ uname -a 
Darwin Vesuvius 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64
``` 

Also reproduced on Cray CNL5 (Blue Waters).

### Additional information

I see the following error message in the `libxslt` build log, and in the `gdk-pixbuf` build log when it crashes:
```
I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd
/Users/Adam/spack/var/spack/stage/libxslt-1.1.32-3h3g4g23xwxg5t43vp3rsz44tajrgu6u/libxslt-1.1.32/doc/xsltproc.xml:8: warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
]>
  ^
I/O error : Attempt to load network entity http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
warning: failed to load external entity "http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
error
xsltParseStylesheetFile : cannot parse http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
compilation error: file /Users/Adam/spack/var/spack/stage/libxslt-1.1.32-3h3g4g23xwxg5t43vp3rsz44tajrgu6u/libxslt-1.1.32/doc/xsltproc.xml line 10 element refentry
xsltParseStylesheetProcess : document is not a stylesheet
make[1]: [xsltproc.1] Error 5 (ignored)
```
I sent a message to the libxslt developers, but never heard back. Has anyone ever seen this before or know of a fix? I have a feeling that `libxml2` and/or `libxslt` should depend on `docbook-xml` and/or `docbook-xsl`, but I'm not confident these packages are being installed correctly. The Homebrew recipes are much more complicated.


Discussion:
I'm hitting up against `gdk-pixbuf` build error too (I'm trying to install `gtkplus`).

Using gcc-8.2.0 on linux centos7 x86_64

@hartzell  any thoughts?  
`libxslt` installed for me w/out any trouble (same-ish setup as @odoublewen).

I do see the same error w/ `gdk-pixbuf`

```
I/O error : Attempt to load network entity http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
warning: failed to load external entity "http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
cannot parse http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
```

Digging.....

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/docbook-xsl/package.py b/var/spack/repos/builtin/packages/docbook-xsl/package.py
--- a/var/spack/repos/builtin/packages/docbook-xsl/package.py
+++ b/var/spack/repos/builtin/packages/docbook-xsl/package.py
@@ -22,6 +22,14 @@ class DocbookXsl(Package):
     def install(self, spec, prefix):
         install_tree('.', prefix)
 
+    @property
+    def catalog(self):
+        return os.path.join(self.prefix, 'catalog.xml')
+
     def setup_environment(self, spack_env, run_env):
-        catalog = os.path.join(self.prefix, 'catalog.xml')
+        catalog = self.catalog
         run_env.set('XML_CATALOG_FILES', catalog, separator=' ')
+
+    def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
+        catalog = self.catalog
+        spack_env.prepend_path("XML_CATALOG_FILES", catalog)
diff --git a/var/spack/repos/builtin/packages/gdk-pixbuf/package.py b/var/spack/repos/builtin/packages/gdk-pixbuf/package.py
--- a/var/spack/repos/builtin/packages/gdk-pixbuf/package.py
+++ b/var/spack/repos/builtin/packages/gdk-pixbuf/package.py
@@ -27,13 +27,21 @@ class GdkPixbuf(Package):
     depends_on('shared-mime-info', type='build', when='@2.36.8: platform=linux')
     depends_on('shared-mime-info', type='build', when='@2.36.8: platform=cray')
     depends_on('pkgconfig', type='build')
+    # Building the man pages requires libxslt and the Docbook stylesheets
+    depends_on('libxslt', type='build')
+    depends_on('docbook-xsl', type='build')
     depends_on('gettext')
-    depends_on('glib')
+    depends_on('glib@2.38.0:')
     depends_on('jpeg')
     depends_on('libpng')
+    depends_on('zlib')
     depends_on('libtiff')
     depends_on('gobject-introspection')
 
+    # Replace the docbook stylesheet URL with the one that our
+    # docbook-xsl package uses/recognizes.
+    patch('docbook-cdn.patch')
+
     def url_for_version(self, version):
         url = "https://ftp.acc.umu.se/pub/gnome/sources/gdk-pixbuf/{0}/gdk-pixbuf-{1}.tar.xz"
         return url.format(version.up_to(2), version)
@@ -48,6 +56,8 @@ def install(self, spec, prefix):
         with working_dir('spack-build', create=True):
             meson('..', *std_meson_args)
             ninja('-v')
+            if self.run_tests:
+                ninja('test')
             ninja('install')
 
     def configure_args(self):
@@ -70,3 +80,8 @@ def install(self, spec, prefix):
         make('install')
         if self.run_tests:
             make('installcheck')
+
+    def setup_environment(self, spack_env, run_env):
+        # The "post-install.sh" script uses gdk-pixbuf-query-loaders,
+        # which was installed earlier.
+        spack_env.prepend_path('PATH', self.prefix.bin)


Test patch: