From 943c007fb5ff42e7aaa053a17b43d02f3d047ec8 Mon Sep 17 00:00:00 2001
From: Tom Scogland <tom.scogland@gmail.com>
Date: Fri, 9 Dec 2016 17:19:53 -0800
Subject: [PATCH] update flux dependencies and package (#2541)

* update flux dependencies and package

* refinements from @adamjstewart

* fix flux document generation

The docbook-xsl package has been added, and correctly configures catalog
files to generate documentation correctly with asciidoc.
---
 .../builtin/packages/asciidoc/package.py      |  2 +
 .../builtin/packages/docbook-xml/package.py   |  8 +++
 .../builtin/packages/docbook-xsl/package.py   | 53 +++++++++++++++++++
 .../repos/builtin/packages/flux/package.py    | 35 ++++++------
 .../repos/builtin/packages/libffi/package.py  |  7 +--
 .../builtin/packages/libjson-c/package.py     | 10 ++--
 .../repos/builtin/packages/libxslt/package.py |  8 +--
 .../repos/builtin/packages/munge/package.py   |  7 +--
 8 files changed, 90 insertions(+), 40 deletions(-)
 create mode 100644 var/spack/repos/builtin/packages/docbook-xsl/package.py

diff --git a/var/spack/repos/builtin/packages/asciidoc/package.py b/var/spack/repos/builtin/packages/asciidoc/package.py
index 811d34afa8..552030d965 100644
--- a/var/spack/repos/builtin/packages/asciidoc/package.py
+++ b/var/spack/repos/builtin/packages/asciidoc/package.py
@@ -36,6 +36,8 @@ class Asciidoc(Package):
 
     depends_on('libxml2')
     depends_on('libxslt')
+    depends_on('docbook-xml')
+    depends_on('docbook-xsl')
 
     def install(self, spec, prefix):
         configure('--prefix=%s' % prefix)
diff --git a/var/spack/repos/builtin/packages/docbook-xml/package.py b/var/spack/repos/builtin/packages/docbook-xml/package.py
index 87137168f3..f1e1a08c8f 100644
--- a/var/spack/repos/builtin/packages/docbook-xml/package.py
+++ b/var/spack/repos/builtin/packages/docbook-xml/package.py
@@ -41,3 +41,11 @@ def install(self, spec, prefix):
                 install_tree(src, dst, symlinks=True)
             else:
                 install(src, dst)
+
+    def setup_dependent_environment(self, spack_env, run_env, extension_spec):
+        catalog = os.path.join(self.spec.prefix, 'catalog.xml')
+        spack_env.set('XML_CATALOG_FILES', catalog, separator=' ')
+
+    def setup_environment(self, spack_env, run_env):
+        catalog = os.path.join(self.spec.prefix, 'catalog.xml')
+        run_env.set('XML_CATALOG_FILES', catalog, separator=' ')
diff --git a/var/spack/repos/builtin/packages/docbook-xsl/package.py b/var/spack/repos/builtin/packages/docbook-xsl/package.py
new file mode 100644
index 0000000000..5de9cecdbb
--- /dev/null
+++ b/var/spack/repos/builtin/packages/docbook-xsl/package.py
@@ -0,0 +1,53 @@
+##############################################################################
+# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
+# Produced at the Lawrence Livermore National Laboratory.
+#
+# This file is part of Spack.
+# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
+# LLNL-CODE-647188
+#
+# For details, see https://github.com/llnl/spack
+# Please also see the LICENSE file for our notice and the LGPL.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License (as
+# published by the Free Software Foundation) version 2.1, February 1999.
+#
+# 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 terms and
+# conditions of the GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##############################################################################
+import os
+from spack import *
+
+
+class DocbookXsl(Package):
+    """Docbook XSL vocabulary."""
+    homepage = "http://docbook.sourceforge.net/"
+    url = "https://downloads.sourceforge.net/project/docbook/docbook-xsl/1.79.1/docbook-xsl-1.79.1.tar.bz2"
+
+    version('1.79.1', 'b48cbf929a2ad85e6672f710777ca7bc')
+
+    depends_on('docbook-xml')
+
+    def install(self, spec, prefix):
+        for item in os.listdir('.'):
+            src = os.path.abspath(item)
+            dst = os.path.join(prefix, item)
+            if os.path.isdir(item):
+                install_tree(src, dst, symlinks=True)
+            else:
+                install(src, dst)
+
+    def setup_dependent_environment(self, spack_env, run_env, extension_spec):
+        catalog = os.path.join(self.spec.prefix, 'catalog.xml')
+        spack_env.set('XML_CATALOG_FILES', catalog, separator=' ')
+
+    def setup_environment(self, spack_env, run_env):
+        catalog = os.path.join(self.spec.prefix, 'catalog.xml')
+        run_env.set('XML_CATALOG_FILES', catalog, separator=' ')
diff --git a/var/spack/repos/builtin/packages/flux/package.py b/var/spack/repos/builtin/packages/flux/package.py
index 2fd2392b5e..7abd9f46bd 100644
--- a/var/spack/repos/builtin/packages/flux/package.py
+++ b/var/spack/repos/builtin/packages/flux/package.py
@@ -26,15 +26,18 @@
 import os
 
 
-class Flux(Package):
+class Flux(AutotoolsPackage):
     """ A next-generation resource manager (pre-alpha) """
 
     homepage = "https://github.com/flux-framework/flux-core"
-    url      = "https://github.com/flux-framework/flux-core"
+    url      = "https://github.com/flux-framework/flux-core/releases/download/v0.6.0/flux-core-0.6.0.tar.gz"
 
+    version('0.6.0', md5='d44a0f719744771d168edd205bd8e74e')
     version('master', branch='master',
             git='https://github.com/flux-framework/flux-core')
 
+    variant('docs', default=True, description='Build flux manpages')
+
     # Also needs autotools, but should use the system version if available
     depends_on("zeromq@4.0.4:")
     depends_on("czmq@2.2:")
@@ -45,20 +48,20 @@ class Flux(Package):
     depends_on("libxslt")
     depends_on("python")
     depends_on("py-cffi")
+    depends_on("jansson")
+
+    depends_on("asciidoc", type='build', when="+docs")
 
-    # TODO: This provides a catalog, hacked with environment below for now
-    depends_on("docbook-xml", type='build')
-    depends_on("asciidoc", type='build')
+    depends_on("autoconf", type='build', when='@master')
+    depends_on("automake", type='build', when='@master')
+    depends_on("libtool", type='build', when='@master')
 
-    def install(self, spec, prefix):
-        # Bootstrap with autotools
-        bash = which('bash')
-        bash('./autogen.sh')
-        bash('./autogen.sh')  # yes, twice, intentionally
+    def autoreconf(self, spec, prefix):
+        if os.path.exists('autogen.sh'):
+            # Bootstrap with autotools
+            bash = which('bash')
+            bash('./autogen.sh')
+            bash('./autogen.sh')  # yes, twice, intentionally
 
-        # Fix asciidoc dependency on xml style sheets and whatnot
-        os.environ['XML_CATALOG_FILES'] = os.path.join(
-            spec['docbook-xml'].prefix, 'catalog.xml')
-        # Configure, compile & install
-        configure("--prefix=" + prefix)
-        make("install", "V=1")
+    def configure_args(self):
+        return ['--disable-docs'] if '+docs' not in self.spec else []
diff --git a/var/spack/repos/builtin/packages/libffi/package.py b/var/spack/repos/builtin/packages/libffi/package.py
index fa113ee86c..ddb7709ddf 100644
--- a/var/spack/repos/builtin/packages/libffi/package.py
+++ b/var/spack/repos/builtin/packages/libffi/package.py
@@ -25,7 +25,7 @@
 from spack import *
 
 
-class Libffi(Package):
+class Libffi(AutotoolsPackage):
     """The libffi library provides a portable, high level programming
     interface to various calling conventions. This allows a programmer
     to call any function specified by a call interface description at
@@ -37,8 +37,3 @@ class Libffi(Package):
     # version('3.1', 'f5898b29bbfd70502831a212d9249d10',url =
     # "ftp://sourceware.org/pub/libffi/libffi-3.1.tar.gz") # Has a bug
     # $(lib64) instead of ${lib64} in libffi.pc
-
-    def install(self, spec, prefix):
-        configure("--prefix=%s" % prefix)
-        make()
-        make("install")
diff --git a/var/spack/repos/builtin/packages/libjson-c/package.py b/var/spack/repos/builtin/packages/libjson-c/package.py
index 662ed3cb5a..561c8ab71f 100644
--- a/var/spack/repos/builtin/packages/libjson-c/package.py
+++ b/var/spack/repos/builtin/packages/libjson-c/package.py
@@ -25,15 +25,11 @@
 from spack import *
 
 
-class LibjsonC(Package):
+class LibjsonC(AutotoolsPackage):
     """ A JSON implementation in C """
     homepage = "https://github.com/json-c/json-c/wiki"
     url      = "https://s3.amazonaws.com/json-c_releases/releases/json-c-0.11.tar.gz"
 
-    version('0.11', 'aa02367d2f7a830bf1e3376f77881e98')
-
-    def install(self, spec, prefix):
-        configure('--prefix=%s' % prefix)
+    parallel = False
 
-        make(parallel=False)
-        make("install")
+    version('0.11', 'aa02367d2f7a830bf1e3376f77881e98')
diff --git a/var/spack/repos/builtin/packages/libxslt/package.py b/var/spack/repos/builtin/packages/libxslt/package.py
index 47d1c170c6..9c5a42bcfb 100644
--- a/var/spack/repos/builtin/packages/libxslt/package.py
+++ b/var/spack/repos/builtin/packages/libxslt/package.py
@@ -25,7 +25,7 @@
 from spack import *
 
 
-class Libxslt(Package):
+class Libxslt(AutotoolsPackage):
     """Libxslt is the XSLT C library developed for the GNOME
        project. XSLT itself is a an XML language to define
        transformation for XML. Libxslt is based on libxml2 the XML C
@@ -37,13 +37,9 @@ class Libxslt(Package):
     url      = "http://xmlsoft.org/sources/libxslt-1.1.28.tar.gz"
 
     version('1.1.28', '9667bf6f9310b957254fdcf6596600b7')
+    version('1.1.29', 'a129d3c44c022de3b9dcf6d6f288d72e')
 
     depends_on("libxml2")
     depends_on("xz")
     depends_on("zlib")
     depends_on("libgcrypt")
-
-    def install(self, spec, prefix):
-        configure("--prefix=%s" % prefix)
-        make()
-        make("install")
diff --git a/var/spack/repos/builtin/packages/munge/package.py b/var/spack/repos/builtin/packages/munge/package.py
index 51455006e9..38dbfa1cc1 100644
--- a/var/spack/repos/builtin/packages/munge/package.py
+++ b/var/spack/repos/builtin/packages/munge/package.py
@@ -26,7 +26,7 @@
 import os
 
 
-class Munge(Package):
+class Munge(AutotoolsPackage):
     """ MUNGE Uid 'N' Gid Emporium """
     homepage = "https://code.google.com/p/munge/"
     url      = "https://github.com/dun/munge/releases/download/munge-0.5.11/munge-0.5.11.tar.bz2"
@@ -39,7 +39,4 @@ class Munge(Package):
 
     def install(self, spec, prefix):
         os.makedirs(os.path.join(prefix, "lib/systemd/system"))
-        configure("--prefix=%s" % prefix)
-
-        make()
-        make("install")
+        super(Munge, self).install(spec, prefix)
-- 
GitLab