From 9cd778f1527cbb271ca40f4f3b1190ad79beb96d Mon Sep 17 00:00:00 2001
From: t-karatsu <49965247+t-karatsu@users.noreply.github.com>
Date: Thu, 21 Nov 2019 08:03:51 +0900
Subject: [PATCH] ampliconnoise: Change return type of function. (#13766)

* ampliconnoise: Change function type.

* ampliconnoise: updated api call to setup run environment
---
 .../ampliconnoise/Fix-return-type.patch       | 63 +++++++++++++++++++
 .../builtin/packages/ampliconnoise/package.py | 16 ++---
 2 files changed, 72 insertions(+), 7 deletions(-)
 create mode 100644 var/spack/repos/builtin/packages/ampliconnoise/Fix-return-type.patch

diff --git a/var/spack/repos/builtin/packages/ampliconnoise/Fix-return-type.patch b/var/spack/repos/builtin/packages/ampliconnoise/Fix-return-type.patch
new file mode 100644
index 0000000000..3af2072b2d
--- /dev/null
+++ b/var/spack/repos/builtin/packages/ampliconnoise/Fix-return-type.patch
@@ -0,0 +1,63 @@
+diff -ur spack-src.org/FCluster/FCluster.c spack-src/FCluster/FCluster.c
+--- spack-src.org/FCluster/FCluster.c	2013-08-01 23:37:40.000000000 +0900
++++ spack-src/FCluster/FCluster.c	2019-11-15 16:24:19.912747987 +0900
+@@ -750,7 +750,7 @@
+   return atResult;
+ }
+ 
+-int outputCluster(t_Params *ptParams, t_Node* tree, char **aszID, int nN)
++void outputCluster(t_Params *ptParams, t_Node* tree, char **aszID, int nN)
+ {
+   int i = 0, j = 0, k = 0, l = 0;
+   int nNodes = nN - 1;
+diff -ur spack-src.org/FCluster/FCluster.h spack-src/FCluster/FCluster.h
+--- spack-src.org/FCluster/FCluster.h	2013-08-01 23:37:40.000000000 +0900
++++ spack-src/FCluster/FCluster.h	2019-11-15 16:24:30.453873139 +0900
+@@ -71,7 +71,7 @@
+ 
+ void readDistanceMatrix(char ***paszID, char *szDistFile, float *** paafDist, int *pnN, t_Params *ptParams, float** pafW);
+ 
+-int outputCluster(t_Params *ptParams, t_Node* tree, char **aszID, int nN);
++void outputCluster(t_Params *ptParams, t_Node* tree, char **aszID, int nN);
+ 
+ void scaleDistances(float **aafDist, int nN);
+ 
+diff -ur spack-src.org/SplitClusterEven/SplitClusterEven.c spack-src/SplitClusterEven/SplitClusterEven.c
+--- spack-src.org/SplitClusterEven/SplitClusterEven.c	2013-08-01 23:37:39.000000000 +0900
++++ spack-src/SplitClusterEven/SplitClusterEven.c	2019-11-15 16:41:40.142569105 +0900
+@@ -366,7 +366,7 @@
+   
+ }
+ 
+-double maxDepth(t_Node* ptTree, double* pdDepth)
++void maxDepth(t_Node* ptTree, double* pdDepth)
+ {
+   double dOldDepth = *pdDepth;
+ 
+@@ -378,7 +378,7 @@
+   return;
+ }
+ 
+-double setDepth(t_Node* ptTree, double dDepth)
++void setDepth(t_Node* ptTree, double dDepth)
+ {
+   double dOldDepth = dDepth;
+ 
+diff -ur spack-src.org/SplitClusterEven/SplitClusterEven.h spack-src/SplitClusterEven/SplitClusterEven.h
+--- spack-src.org/SplitClusterEven/SplitClusterEven.h	2013-08-01 23:37:39.000000000 +0900
++++ spack-src/SplitClusterEven/SplitClusterEven.h	2019-11-15 16:42:17.936558096 +0900
+@@ -88,7 +88,7 @@
+ 
+ void treeSplit(t_Node* ptTree, double* pdDepth, double dSplit, t_Node **aptSplit,int* pnSplit);
+ 
+-double maxDepth(t_Node* ptTree, double* pdMaxDepth);
++void maxDepth(t_Node* ptTree, double* pdMaxDepth);
+ 
+ void writeIndices(t_Node* ptTree, FILE* ofp);
+ 
+@@ -116,4 +116,4 @@
+ 
+ void treeSplitEven(t_Node* ptTree, int nSplit, t_Node **aptSplit,int* pnSplit);
+ 
+-double setDepth(t_Node* ptTree, double dDepth);
++void setDepth(t_Node* ptTree, double dDepth);
diff --git a/var/spack/repos/builtin/packages/ampliconnoise/package.py b/var/spack/repos/builtin/packages/ampliconnoise/package.py
index 381871bd69..4323ac7f98 100644
--- a/var/spack/repos/builtin/packages/ampliconnoise/package.py
+++ b/var/spack/repos/builtin/packages/ampliconnoise/package.py
@@ -3,7 +3,7 @@
 #
 # SPDX-License-Identifier: (Apache-2.0 OR MIT)
 
-from spack import *
+import os.path
 
 
 class Ampliconnoise(MakefilePackage):
@@ -18,12 +18,14 @@ class Ampliconnoise(MakefilePackage):
     depends_on('mpi@2:')
     depends_on('gsl')
 
-    def setup_environment(self, spack_env, run_env):
-        run_env.prepend_path('PATH', self.prefix.Scripts)
-        run_env.set('PYRO_LOOKUP_FILE', join_path(self.prefix, 'Data',
-                    'LookUp_E123.dat'))
-        run_env.set('SEQ_LOOKUP_FILE', join_path(self.prefix, 'Data',
-                    'Tran.dat'))
+    patch('Fix-return-type.patch')
+
+    def setup_run_environment(self, env):
+        env.prepend_path('PATH', self.prefix.Scripts)
+        env.set('PYRO_LOOKUP_FILE', os.path.join(self.prefix, 'Data',
+                'LookUp_E123.dat'))
+        env.set('SEQ_LOOKUP_FILE', os.path.join(self.prefix, 'Data',
+                'Tran.dat'))
 
     def install(self, spec, prefix):
         make('install')
-- 
GitLab