Gentoo Archives: gentoo-commits

From: Justin Lecher <jlec@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: sci-chemistry/ambertools/files/, sci-chemistry/ambertools/
Date: Wed, 28 Oct 2015 09:07:20
Message-Id: 1446023216.f457d5639ad562f52d697a2b33a7474a8c76d0a2.jlec@gentoo
1 commit: f457d5639ad562f52d697a2b33a7474a8c76d0a2
2 Author: Justin Lecher <jlec <AT> gentoo <DOT> org>
3 AuthorDate: Wed Oct 28 09:06:45 2015 +0000
4 Commit: Justin Lecher <jlec <AT> gentoo <DOT> org>
5 CommitDate: Wed Oct 28 09:06:56 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=f457d563
7
8 sci-chemistry/ambertools: Fix for gcc-5 and format-security
9
10 Package-Manager: portage-2.2.23
11 Signed-off-by: Justin Lecher <jlec <AT> gentoo.org>
12
13 sci-chemistry/ambertools/ambertools-12_p38.ebuild | 16 ++--
14 .../files/ambertools-12_p38-format-security.patch | 100 +++++++++++++++++++++
15 .../ambertools/files/ambertools-12_p38-gcc5.patch | 28 ++++++
16 3 files changed, 136 insertions(+), 8 deletions(-)
17
18 diff --git a/sci-chemistry/ambertools/ambertools-12_p38.ebuild b/sci-chemistry/ambertools/ambertools-12_p38.ebuild
19 index 812bbdb..1c907c4 100644
20 --- a/sci-chemistry/ambertools/ambertools-12_p38.ebuild
21 +++ b/sci-chemistry/ambertools/ambertools-12_p38.ebuild
22 @@ -1,10 +1,10 @@
23 -# Copyright 1999-2014 Gentoo Foundation
24 +# Copyright 1999-2015 Gentoo Foundation
25 # Distributed under the terms of the GNU General Public License v2
26 # $Id$
27
28 EAPI=5
29
30 -inherit eutils fortran-2 multilib toolchain-funcs
31 +inherit eutils fortran-2 multilib multiprocessing toolchain-funcs
32
33 DESCRIPTION="A suite for carrying out complete molecular mechanics investigations"
34 HOMEPAGE="http://ambermd.org/#AmberTools"
35 @@ -54,6 +54,8 @@ pkg_setup() {
36
37 src_prepare() {
38 epatch \
39 + "${FILESDIR}"/${P}-gcc5.patch \
40 + "${FILESDIR}"/${P}-format-security.patch \
41 "${FILESDIR}"/${PN}-12-gentoo.patch \
42 "${WORKDIR}"/bugfixes/bugfix.{14..38}
43 cd "${S}"/AmberTools/src || die
44 @@ -69,9 +71,7 @@ src_prepare() {
45 reduce \
46 ucpp-1.3 \
47 || die
48 -}
49
50 -src_configure() {
51 cd "${S}"/AmberTools/src || die
52 sed \
53 -e "s:\\\\\$(LIBDIR)/arpack.a:-larpack:g" \
54 @@ -94,6 +94,9 @@ src_configure() {
55 -e "s:arsecond_:arscnd_:g" \
56 -i sff/time.c sff/sff.h sff/sff.c || die
57
58 +}
59 +
60 +src_configure() {
61 local myconf="--no-updates"
62
63 use X || myconf="${myconf} -noX11"
64 @@ -114,10 +117,7 @@ src_configure() {
65 }
66
67 src_test() {
68 - # Get the number of physical cores
69 - local ncpus=$(grep "^core id" /proc/cpuinfo | sort -u | wc -l)
70 - # Limit number of OpenMP threads
71 - use openmp && export OMP_NUM_THREADS=$((1+${ncpus}/2))
72 + use openmp && export OMP_NUM_THREADS=$(makeopts_jobs)
73
74 emake test
75 }
76
77 diff --git a/sci-chemistry/ambertools/files/ambertools-12_p38-format-security.patch b/sci-chemistry/ambertools/files/ambertools-12_p38-format-security.patch
78 new file mode 100644
79 index 0000000..bb22a62
80 --- /dev/null
81 +++ b/sci-chemistry/ambertools/files/ambertools-12_p38-format-security.patch
82 @@ -0,0 +1,100 @@
83 + AmberTools/src/mdgx/ChargeFit.c | 4 ++--
84 + AmberTools/src/nab/cgen.c | 2 +-
85 + AmberTools/src/nab/traceback.c | 2 +-
86 + AmberTools/src/ptraj/cluster.c | 2 +-
87 + AmberTools/src/ptraj/interface.c | 6 +++---
88 + AmberTools/src/semantics/parse.c | 2 +-
89 + 6 files changed, 9 insertions(+), 9 deletions(-)
90 +
91 +diff --git a/AmberTools/src/mdgx/ChargeFit.c b/AmberTools/src/mdgx/ChargeFit.c
92 +index fccf5d0..fe4afac 100644
93 +--- a/AmberTools/src/mdgx/ChargeFit.c
94 ++++ b/AmberTools/src/mdgx/ChargeFit.c
95 +@@ -77,9 +77,9 @@ static void AssignGridTopologies(fset *myfit, prmtop *tp)
96 + }
97 + for (i = 0; i < myfit->ngrd; i++) {
98 + if (myfit->tpname.map[i][0] == '\0') {
99 +- sprintf(myfit->tpname.map[i], tp->source);
100 ++ sprintf(myfit->tpname.map[i], "%s", tp->source);
101 + if (myfit->eprule.map[i][0] == '\0' && tp->eprulesource[0] != '\0') {
102 +- sprintf(myfit->eprule.map[i], tp->eprulesource);
103 ++ sprintf(myfit->eprule.map[i], "%s", tp->eprulesource);
104 + }
105 + }
106 + }
107 +diff --git a/AmberTools/src/nab/cgen.c b/AmberTools/src/nab/cgen.c
108 +index 6254d44..e206879 100644
109 +--- a/AmberTools/src/nab/cgen.c
110 ++++ b/AmberTools/src/nab/cgen.c
111 +@@ -1642,7 +1642,7 @@ static char *CG_gentype( char *csp, NODE_T *npt )
112 + strcpy( csp, tname );
113 + csp += strlen( csp );
114 + }else
115 +- fprintf( cg_cfp, tname );
116 ++ fprintf( cg_cfp, "%s", tname );
117 + needspace = TRUE;
118 + return( csp );
119 + }
120 +diff --git a/AmberTools/src/nab/traceback.c b/AmberTools/src/nab/traceback.c
121 +index f916474..e376552 100644
122 +--- a/AmberTools/src/nab/traceback.c
123 ++++ b/AmberTools/src/nab/traceback.c
124 +@@ -6,7 +6,7 @@
125 + int rt_errormsg( int fatal, char msg[] )
126 + {
127 +
128 +- fprintf( stderr, msg );
129 ++ fprintf( stderr, "%s", msg );
130 + if( fatal )
131 + exit( 1 );
132 + return(0);
133 +diff --git a/AmberTools/src/ptraj/cluster.c b/AmberTools/src/ptraj/cluster.c
134 +index 2cb60f0..5e0f33d 100644
135 +--- a/AmberTools/src/ptraj/cluster.c
136 ++++ b/AmberTools/src/ptraj/cluster.c
137 +@@ -1240,7 +1240,7 @@ void ClusteringMergeNames(PtrajClustering* This, ClusterNode* MergeNodeA, Cluste
138 + {
139 + return;
140 + }
141 +- sprintf(Temp, ClusterB->Name);
142 ++ sprintf(Temp, "%s", ClusterB->Name);
143 + sprintf(ClusterB->Name, "(%s,%s)", ClusterA->Name, Temp);
144 +
145 + }
146 +diff --git a/AmberTools/src/ptraj/interface.c b/AmberTools/src/ptraj/interface.c
147 +index 4087fa7..1ee4273 100644
148 +--- a/AmberTools/src/ptraj/interface.c
149 ++++ b/AmberTools/src/ptraj/interface.c
150 +@@ -97,8 +97,8 @@ interface(interfaceMode mode, char *filename)
151 +
152 + tokenlist = (Token *) &rdparmTokenlist;
153 +
154 +- fprintf(stdout, rdparm_header);
155 +- fprintf(stdout, rdparm_prompt);
156 ++ fprintf(stdout, "%s", rdparm_header);
157 ++ fprintf(stdout, "%s", rdparm_prompt);
158 + while (1) {
159 +
160 + fflush(stdout);
161 +@@ -112,7 +112,7 @@ interface(interfaceMode mode, char *filename)
162 +
163 + }
164 +
165 +- fprintf(stdout, rdparm_prompt);
166 ++ fprintf(stdout, "%s", rdparm_prompt);
167 + }
168 + }
169 + }
170 +diff --git a/AmberTools/src/semantics/parse.c b/AmberTools/src/semantics/parse.c
171 +index 55c724c..68f23da 100644
172 +--- a/AmberTools/src/semantics/parse.c
173 ++++ b/AmberTools/src/semantics/parse.c
174 +@@ -2039,7 +2039,7 @@ int n_tab;
175 + DEF_T tab[];
176 + {
177 +
178 +- fprintf( fp, oval );
179 ++ fprintf( fp, "%s", oval );
180 +
181 + }
182 +
183
184 diff --git a/sci-chemistry/ambertools/files/ambertools-12_p38-gcc5.patch b/sci-chemistry/ambertools/files/ambertools-12_p38-gcc5.patch
185 new file mode 100644
186 index 0000000..92e6495
187 --- /dev/null
188 +++ b/sci-chemistry/ambertools/files/ambertools-12_p38-gcc5.patch
189 @@ -0,0 +1,28 @@
190 + AmberTools/src/configure2 | 14 ++++++++------
191 + 1 file changed, 8 insertions(+), 6 deletions(-)
192 +
193 +diff --git a/AmberTools/src/configure2 b/AmberTools/src/configure2
194 +index 913c50d..1232f6a 100755
195 +--- a/AmberTools/src/configure2
196 ++++ b/AmberTools/src/configure2
197 +@@ -703,12 +703,14 @@ gnu)
198 + # if gcc <= 4.2, fftw3 is not compiled and pbsa fft solver and rism
199 + # are disabled
200 + if [ "$rism" != 'no' -o -n "$pbsaflag" ]; then
201 +- if ( [ $gnu_majorversion -ge 4 ] && [ $gnu_minorversion -le 2 ] ) \
202 +- || [ $gnu_majorversion -le 3 ]; then
203 +- echo "ERROR: RISM and PBSA FFT solver require version 4.3 or higher of the GNU compiler."
204 +- echo " Please re-run configure with the '-nofftw3' flag to use this compiler:"
205 +- echo " `mod_command_args '-rism' '-nofftw3'`"
206 +- exit 1
207 ++ if [ $gnu_majorversion -lt 5 ]; then
208 ++ if ( [ $gnu_majorversion -ge 4 ] && [ $gnu_minorversion -le 2 ] ) \
209 ++ || [ $gnu_majorversion -le 3 ]; then
210 ++ echo "ERROR: RISM and PBSA FFT solver require version 4.3 or higher of the GNU compiler."
211 ++ echo " Please re-run configure with the '-nofftw3' flag to use this compiler:"
212 ++ echo " `mod_command_args '-rism' '-nofftw3'`"
213 ++ exit 1
214 ++ fi
215 + fi
216 + fi
217 +