Handle arbitrary doxygen versions in Docker image build scripts.
authorM. Eric Irrgang <mei2n@virginia.edu>
Fri, 29 May 2020 12:18:04 +0000 (12:18 +0000)
committerM. Eric Irrgang <mei2n@virginia.edu>
Fri, 29 May 2020 12:18:04 +0000 (12:18 +0000)
Refs #3539

admin/containers/scripted_gmx_docker_builds.py

index 022aed7a50df939f258f1151c33c6883688d45ce..4aa57d5176fe2b643e206e535702a4e26de64bc8 100644 (file)
@@ -402,11 +402,14 @@ def add_python_stages(building_blocks: typing.Mapping[str, bb_base],
     output_stages['pyenv'] = pyenv_stage
 
 
-def add_doxygen_stages(input_args,
-                       output_stages: typing.MutableMapping[str, hpccm.Stage]):
-    """Add appropriate stages according to doxygen input arguments."""
+def add_documentation_dependencies(input_args,
+                                   output_stages: typing.MutableMapping[str, hpccm.Stage]):
+    """Add appropriate layers according to doxygen input arguments."""
     if input_args.doxygen is None:
         return
+    output_stages['main'] += hpccm.primitives.shell(
+        commands=['sed -i \'/\"XPS\"/d;/\"PDF\"/d;/\"PS\"/d;/\"EPS\"/d;/disable ghostscript format types/d\' /etc/ImageMagick-6/policy.xml'])
+    output_stages['main'] += hpccm.building_blocks.pip(pip='pip3', packages=['sphinx==1.6.1'])
     if input_args.doxygen == '1.8.5':
         doxygen_commit = 'ed4ed873ab0e7f15116e2052119a6729d4589f7a'
         output_stages['main'] += hpccm.building_blocks.generic_autotools(
@@ -421,12 +424,23 @@ def add_doxygen_stages(input_args,
             prefix='',
             configure_opts=[
                 '--flex /tmp/install-of-flex/bin/flex',
-                '--static'],
-            postinstall=[
-                'sed -i \'/\"XPS\"/d;/\"PDF\"/d;/\"PS\"/d;/\"EPS\"/d;/disable ghostscript format types/d\' /etc/ImageMagick-6/policy.xml'])
-        output_stages['main'] += hpccm.building_blocks.pip(pip='pip3', packages=['sphinx==1.6.1'])
+                '--static'])
     else:
-        raise RuntimeError('Unhandled doxygen version: {}'.format(input_args.doxygen))
+        version = input_args.doxygen
+        archive_name = 'doxygen-{}.linux.bin.tar.gz'.format(version)
+        archive_url = 'https://sourceforge.net/projects/doxygen/files/rel-{}/{}'.format(
+            version,
+            archive_name
+        )
+        binary_path = 'doxygen-{}/bin/doxygen'.format(version)
+        commands = [
+            'mkdir doxygen && cd doxygen',
+            'wget {}'.format(archive_url),
+            'tar xf {} {}'.format(archive_name, binary_path),
+            'cp {} /usr/local/bin/'.format(binary_path),
+            'cd .. && rm -rf doxygen'
+        ]
+        output_stages['main'] += hpccm.primitives.shell(commands=commands)
 
 
 def build_stages(args) -> typing.Iterable[hpccm.Stage]:
@@ -483,7 +497,7 @@ def build_stages(args) -> typing.Iterable[hpccm.Stage]:
 
     # Add documentation requirements (doxygen and sphinx + misc).
     if args.doxygen is not None:
-        add_doxygen_stages(args, stages)
+        add_documentation_dependencies(args, stages)
 
     if 'pyenv' in stages and stages['pyenv'] is not None:
         stages['main'] += hpccm.primitives.copy(_from='pyenv', _mkdir=True, src=['/root/.pyenv/'],