This repository was archived by the owner on Feb 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch_test.go
More file actions
845 lines (744 loc) · 34.2 KB
/
Copy pathpatch_test.go
File metadata and controls
845 lines (744 loc) · 34.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
package parspack
import (
"testing"
)
func TestPatch(t *testing.T) {
spackPackage := `# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import glob
import os.path
import re
class Picard(Package):
"""Picard is a set of command line tools for manipulating high-throughput
sequencing (HTS) data and formats such as SAM/BAM/CRAM and VCF.
"""
homepage = "http://broadinstitute.github.io/picard/"
url = "https://github.com/broadinstitute/picard/releases/download/2.9.2/picard.jar"
_urlfmt = "https://github.com/broadinstitute/picard/releases/download/{0}/picard.jar"
_oldurlfmt = 'https://github.com/broadinstitute/picard/releases/download/{0}/picard-tools-{0}.zip'
# They started distributing a single jar file at v2.6.0, prior to
# that it was a .zip file with multiple .jar and .so files
version('develop', commit='xfdss46kjsldkfu8')
version('2.24.0', sha256='70e91039bccc6f6db60f18c41713218a8cdf45f591f02c1012c062152b27cd7b', expand=False)
version('2.20.8', sha256='aff92d618ee9e6bafc1ab4fbfa89fc557a0dbe596ae4b92fe3bf93ebf95c7105', expand=False)
version('2.19.0', sha256='f97fc3f7a73b55cceea8b6a6488efcf1b2fbf8cad61d88645704ddd45a8c5950', expand=False)
version('2.18.3', sha256='0e0fc45d9a822ee9fa562b3bb8f1525a439e4cd541429a1a4ca4646f37189b70', expand=False)
version('2.18.0', sha256='c4c64b39ab47968e4afcaf1a30223445ee5082eab31a03eee240e54c2e9e1dce', expand=False)
version('2.17.0', sha256='ffea8bf90e850919c0833e9dcc16847d40090a1ef733c583a710a3282b925998', expand=False)
version('2.16.0', sha256='01cf3c930d2b4841960497491512d327bf669c1ed2e753152e1e651a27288c2d', expand=False)
version('2.15.0', sha256='dc3ff74c704954a10796b390738078617bb0b0fef15731e9d268ed3b26c6a285', expand=False)
version('2.13.2', sha256='db7749f649e8423053fb971e6af5fb8a9a1a797cb1f20fef1100edf9f82f6f94', expand=False)
version('2.10.0', sha256='e256d5e43656b7d8be454201a7056dce543fe9cbeb30329a0d8c22d28e655775', expand=False)
version('2.9.4', sha256='0ecee9272bd289d902cc18053010f0364d1696e7518ac92419a99b2f0a1cf689', expand=False)
version('2.9.3', sha256='6cca26ce5094b25a82e1a8d646920d584c6db5f009476196dc285be6522e00ce', expand=False)
version('2.9.2', sha256='05714b9743a7685a43c94a93f5d03aa4070d3ab6e20151801301916d3e546eb7', expand=False)
version('2.9.0', sha256='9a57f6bd9086ea0f5f1a6d9d819459854cb883bb8093795c916538ed9dd5de64', expand=False)
version('2.8.3', sha256='97a4b6c8927c8cb5f3450630c9b39bf210ced8c271f198119118ce1c24b8b0f6', expand=False)
version('2.6.0', sha256='671d9e86e6bf0c28ee007aea55d07e2456ae3a57016491b50aab0fd2fd0e493b', expand=False)
version('1.140', sha256='0d27287217413db6b846284c617d502eaa578662dcb054a7017083eab9c54438', expand=True)
depends_on('java@8:', type='run')
def install(self, spec, prefix):
mkdirp(prefix.bin)
# The list of files to install varies with release...
# ... but skip the spack-build-{env}out.txt files.
files = [x for x in glob.glob("*") if not re.match("^spack-", x)]
for f in files:
install(f, prefix.bin)
# Set up a helper script to call java on the jar file,
# explicitly codes the path for java and the jar file.
script_sh = join_path(os.path.dirname(__file__), "picard.sh")
script = prefix.bin.picard
install(script_sh, script)
set_executable(script)
# Munge the helper script to explicitly point to java and the
# jar file.
java = self.spec['java'].prefix.bin.java
kwargs = {'ignore_absent': False, 'backup': False, 'string': False}
filter_file('^java', java, script, **kwargs)
filter_file('picard.jar', join_path(prefix.bin, 'picard.jar'),
script, **kwargs)
def setup_run_environment(self, env):
"""The Picard docs suggest setting this as a convenience."""
env.prepend_path('PICARD', join_path(self.prefix.bin, 'picard.jar'))
def url_for_version(self, version):
if version < Version('2.6.0'):
return self._oldurlfmt.format(version)
else:
return self._urlfmt.format(version)
`
result, err := Decode(spackPackage)
if err != nil {
t.Fatal(err)
}
output, _ := PatchVersion(result, spackPackage)
if output != spackPackage {
t.Error(output)
t.Error(spackPackage)
}
}
func TestPatchComplicatedUrl(t *testing.T) {
spackPackage := `# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Htslib(AutotoolsPackage):
"""C library for high-throughput sequencing data formats."""
homepage = "https://github.com/samtools/htslib"
url = "https://github.com/samtools/htslib/releases/download/1.10.2/htslib-1.10.2.tar.bz2"
version('develop', submodules=True)
version('master')
version('1.11', sha256='cffadd9baa6fce27b8fe0b01a462b489f06a5433dfe92121f667f40f632538d7')
version('1.10.2', sha256='e3b543de2f71723830a1e0472cf5489ec27d0fbeb46b1103e14a11b7177d1939')
version('1.9', sha256='e04b877057e8b3b8425d957f057b42f0e8509173621d3eccaedd0da607d9929a')
version('1.8', sha256='c0ef1eec954a98cc708e9f99f6037db85db45670b52b6ab37abcc89b6c057ca1')
version('1.7', sha256='be3d4e25c256acdd41bebb8a7ad55e89bb18e2fc7fc336124b1e2c82ae8886c6')
version('1.6', sha256='9588be8be0c2390a87b7952d644e7a88bead2991b3468371347965f2e0504ccb')
version('1.5', sha256='a02b515ea51d86352b089c63d778fb5e8b9d784937cf157e587189cb97ad922d')
version('1.4', sha256='5cfc8818ff45cd6e924c32fec2489cb28853af8867a7ee8e755c4187f5883350')
version('1.3.1', sha256='49d53a2395b8cef7d1d11270a09de888df8ba06f70fe68282e8235ee04124ae6')
version('1.2', sha256='125c01421d5131afb4c3fd2bc9c7da6f4f1cd9ab5fc285c076080b9aca24bffc')
variant('libcurl',
default = True,
description = 'Enable libcurl-based support for http/https/etc URLs,'
' for versions >= 1.3. This also enables S3 and GCS support.')
depends_on('zlib')
depends_on('bzip2', when='@1.4:')
depends_on('xz', when='@1.4:')
depends_on('curl', when='@1.3:+libcurl')
depends_on('m4', when="@1.2")
depends_on('autoconf', when="@1.2")
depends_on('automake', when="@1.2")
depends_on('libtool', when="@1.2")
# v1.2 uses the automagically assembled tarball from .../archive/...
# everything else uses the tarballs uploaded to the release
def url_for_version(self, version):
if version.string == '1.2':
return 'https://github.com/samtools/htslib/archive/1.2.tar.gz'
else:
url = "https://github.com/samtools/htslib/releases/download/{0}/htslib-{0}.tar.bz2"
return url.format(version.dotted)
def configure_args(self):
spec = self.spec
args = []
if spec.satisfies('@1.3:'):
args.extend(self.enable_or_disable('libcurl'))
return args
`
result, err := Decode(spackPackage)
if err != nil {
t.Fatal(err)
}
output, _ := PatchVersion(result, spackPackage)
if output != spackPackage {
t.Error(output)
t.Error(spackPackage)
}
}
func TestPatchNoUrl(t *testing.T) {
spackPackage := `# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path
import shutil
import sys
import tempfile
import spack.util.environment
class Octave(AutotoolsPackage, GNUMirrorPackage):
"""GNU Octave is a high-level language, primarily intended for numerical
computations.
It provides a convenient command line interface for solving linear and
nonlinear problems numerically, and for performing other numerical
experiments using a language that is mostly compatible with Matlab.
It may also be used as a batch-oriented language.
"""
homepage = "https://www.gnu.org/software/octave/"
gnu_mirror_path = "octave/octave-4.0.0.tar.gz"
maintainers = ['mtmiller']
extendable = True
version('6.3.0', sha256='232065f3a72fc3013fe9f17f429a3df69d672c1f6b6077029a31c8f3cd58a66e', extension='.tar.gz', tag='hello')
version('6.2.0', sha256='457d1fda8634a839e2fd7cfc55b98bd56f36b6ae73d31bb9df43dde3012caa7c')
version('6.1.0', sha256='6ff34e401658622c44094ecb67e497672e4337ca2d36c0702d0403ecc60b0a57')
version('5.2.0', sha256='2fea62b3c78d6f38e9451da8a4d26023840725977dffee5250d3d180f56595e1')
version('5.1.0', sha256='e36b1124cac27c7caa51cc57de408c31676d5f0096349b4d50b57bfe1bcd7495')
version('4.4.1', sha256='09fbd0f212f4ef21e53f1d9c41cf30ce3d7f9450fb44911601e21ed64c67ae97')
version('4.4.0', sha256='72f846379fcec7e813d46adcbacd069d72c4f4d8f6003bcd92c3513aafcd6e96')
version('4.2.2', sha256='77b84395d8e7728a1ab223058fe5e92dc38c03bc13f7358e6533aab36f76726e')
version('4.2.1', sha256='80c28f6398576b50faca0e602defb9598d6f7308b0903724442c2a35a605333b')
version('4.2.0', sha256='443ba73782f3531c94bcf016f2f0362a58e186ddb8269af7dcce973562795567')
version('4.0.2', sha256='39cd8fd36c218fc00adace28d74a6c7c9c6faab7113a5ba3c4372324c755bdc1')
version('4.0.0', sha256='4c7ee0957f5dd877e3feb9dfe07ad5f39b311f9373932f0d2a289dc97cca3280')
# patches
# see https://savannah.gnu.org/bugs/?50234
patch('patch_4.2.1_inline.diff', when='@4.2.1')
# Variants
variant('readline', default=True)
variant('arpack', default=False)
variant('curl', default=False)
variant('fftw', default=False)
variant('fltk', default=False)
variant('fontconfig', default=False)
variant('freetype', default=False)
variant('glpk', default=False)
variant('gl2ps', default=False)
variant('gnuplot', default=False)
variant('magick', default=False)
variant('hdf5', default=False)
variant('jdk', default=False)
variant('llvm', default=False)
variant('opengl', default=False)
variant('qhull', default=False)
variant('qrupdate', default=False)
variant('qscintilla', default=False)
variant('qt', default=False)
variant('suitesparse', default=False)
variant('zlib', default=False)
# Required dependencies
depends_on('blas')
depends_on('lapack')
# Octave does not configure with sed from darwin:
depends_on('sed', when=sys.platform == 'darwin', type='build')
depends_on('pcre')
depends_on('pkgconfig', type='build')
# Strongly recommended dependencies
depends_on('readline', when='+readline')
# Optional dependencies
depends_on('arpack-ng', when='+arpack')
depends_on('curl', when='+curl')
depends_on('fftw', when='+fftw')
depends_on('fltk', when='+fltk')
depends_on('fontconfig', when='+fontconfig')
depends_on('freetype', when='+freetype')
depends_on('glpk', when='+glpk')
depends_on('gl2ps', when='+gl2ps')
depends_on('gnuplot', when='+gnuplot')
depends_on('imagemagick', when='+magick')
depends_on('hdf5', when='+hdf5')
depends_on('java', when='+jdk') # TODO: requires Java 6 ?
depends_on('llvm', when='+llvm')
depends_on('gl', when='+opengl')
depends_on('gl', when='+fltk')
depends_on('qhull', when='+qhull')
depends_on('qrupdate', when='+qrupdate')
depends_on('qscintilla', when='+qscintilla')
depends_on('qt+opengl', when='+qt')
depends_on('suite-sparse', when='+suitesparse')
depends_on('zlib', when='+zlib')
def patch(self):
# Filter mkoctfile.in.cc to use underlying compilers and not
# Spack compiler wrappers. We are patching the template file
# and not mkoctfile.cc since the latter is generated as part
# of the build.
mkoctfile_in = os.path.join(
self.stage.source_path, 'src', 'mkoctfile.in.cc'
)
quote = lambda s: '"' + s + '"'
entries_to_patch = {
r'%OCTAVE_CONF_MKOCTFILE_CC%': quote(self.compiler.cc),
r'%OCTAVE_CONF_MKOCTFILE_CXX%': quote(self.compiler.cxx),
r'%OCTAVE_CONF_MKOCTFILE_F77%': quote(self.compiler.f77),
r'%OCTAVE_CONF_MKOCTFILE_DL_LD%': quote(self.compiler.cxx),
r'%OCTAVE_CONF_MKOCTFILE_LD_CXX%': quote(self.compiler.cxx)
}
for pattern, subst in entries_to_patch.items():
filter_file(pattern, subst, mkoctfile_in)
@run_after('install')
@on_package_attributes(run_tests=True)
def check_mkoctfile_works_outside_of_build_env(self):
# Check that mkoctfile is properly configured and can compile
# Octave extensions outside of the build env
mkoctfile = Executable(os.path.join(self.prefix, 'bin', 'mkoctfile'))
helloworld_cc = os.path.join(
os.path.dirname(__file__), 'helloworld.cc'
)
tmp_dir = tempfile.mkdtemp()
shutil.copy(helloworld_cc, tmp_dir)
# We need to unset these variables since we are still within
# Spack's build environment when running tests
vars_to_unset = ['CC', 'CXX', 'F77', 'FC']
with spack.util.environment.preserve_environment(*vars_to_unset):
# Delete temporarily the environment variables that point
# to Spack compiler wrappers
for v in vars_to_unset:
del os.environ[v]
# Check that mkoctfile outputs the expected value for CC
cc = mkoctfile('-p', 'CC', output=str)
msg = "mkoctfile didn't output the expected CC compiler"
assert self.compiler.cc in cc, msg
# Try to compile an Octave extension
shutil.copy(helloworld_cc, tmp_dir)
with working_dir(tmp_dir):
mkoctfile('helloworld.cc')
def configure_args(self):
# See
# https://github.com/macports/macports-ports/blob/master/math/octave/
# https://github.com/Homebrew/homebrew-science/blob/master/octave.rb
spec = self.spec
config_args = []
# Required dependencies
config_args.extend([
"--with-blas=%s" % spec['blas'].libs.ld_flags,
"--with-lapack=%s" % spec['lapack'].libs.ld_flags
])
# Strongly recommended dependencies
if '+readline' in spec:
config_args.append('--enable-readline')
else:
config_args.append('--disable-readline')
# Optional dependencies
if '+arpack' in spec:
sa = spec['arpack-ng']
config_args.extend([
"--with-arpack-includedir=%s" % sa.prefix.include,
"--with-arpack-libdir=%s" % sa.prefix.lib
])
else:
config_args.append("--without-arpack")
if '+curl' in spec:
config_args.extend([
"--with-curl-includedir=%s" % spec['curl'].prefix.include,
"--with-curl-libdir=%s" % spec['curl'].prefix.lib
])
else:
config_args.append("--without-curl")
if '+fftw' in spec:
config_args.extend([
"--with-fftw3-includedir=%s" % spec['fftw'].prefix.include,
"--with-fftw3-libdir=%s" % spec['fftw'].prefix.lib,
"--with-fftw3f-includedir=%s" % spec['fftw'].prefix.include,
"--with-fftw3f-libdir=%s" % spec['fftw'].prefix.lib
])
else:
config_args.extend([
"--without-fftw3",
"--without-fftw3f"
])
if '+fltk' in spec:
config_args.extend([
"--with-fltk-prefix=%s" % spec['fltk'].prefix,
"--with-fltk-exec-prefix=%s" % spec['fltk'].prefix
])
else:
config_args.append("--without-fltk")
if '+glpk' in spec:
config_args.extend([
"--with-glpk-includedir=%s" % spec['glpk'].prefix.include,
"--with-glpk-libdir=%s" % spec['glpk'].prefix.lib
])
else:
config_args.append("--without-glpk")
if '+magick' in spec:
config_args.append("--with-magick=%s"
% spec['imagemagick'].prefix.lib)
else:
config_args.append("--without-magick")
if '+hdf5' in spec:
config_args.extend([
"--with-hdf5-includedir=%s" % spec['hdf5'].prefix.include,
"--with-hdf5-libdir=%s" % spec['hdf5'].prefix.lib
])
else:
config_args.append("--without-hdf5")
if '+jdk' in spec:
config_args.extend([
"--with-java-homedir=%s" % spec['java'].home,
"--with-java-includedir=%s" % spec['java'].home.include,
"--with-java-libdir=%s" % spec['java'].libs.directories[0]
])
else:
config_args.append("--disable-java")
if '~opengl' and '~fltk' in spec:
config_args.extend([
"--without-opengl",
"--without-framework-opengl"
])
# TODO: opengl dependency and package is missing?
if '+qhull' in spec:
config_args.extend([
"--with-qhull-includedir=%s" % spec['qhull'].prefix.include,
"--with-qhull-libdir=%s" % spec['qhull'].prefix.lib
])
else:
config_args.append("--without-qhull")
if '+qrupdate' in spec:
config_args.extend([
"--with-qrupdate-includedir=%s"
% spec['qrupdate'].prefix.include,
"--with-qrupdate-libdir=%s" % spec['qrupdate'].prefix.lib
])
else:
config_args.append("--without-qrupdate")
if '+zlib' in spec:
config_args.extend([
"--with-z-includedir=%s" % spec['zlib'].prefix.include,
"--with-z-libdir=%s" % spec['zlib'].prefix.lib
])
else:
config_args.append("--without-z")
# If 64-bit BLAS is used:
if (spec.satisfies('^openblas+ilp64') or
spec.satisfies('^intel-mkl+ilp64') or
spec.satisfies('^intel-parallel-studio+mkl+ilp64')):
config_args.append('F77_INTEGER_8_FLAG=-fdefault-integer-8')
# Use gfortran calling-convention %fj
if spec.satisfies('%fj'):
config_args.append('--enable-fortran-calling-convention=gfortran')
return config_args
# ========================================================================
# Set up environment to make install easy for Octave extensions.
# ========================================================================
def setup_dependent_package(self, module, dependent_spec):
"""Called before Octave modules' install() methods.
In most cases, extensions will only need to have one line:
octave('--eval', 'pkg install %s' % self.stage.archive_file)
"""
# Octave extension builds can have a global Octave executable function
module.octave = Executable(join_path(self.spec.prefix.bin, 'octave'))
`
result, err := Decode(spackPackage)
if err != nil {
t.Fatal(err)
}
output, _ := PatchVersion(result, spackPackage)
if output != spackPackage {
t.Error(output)
t.Error(spackPackage)
}
}
func TestPatchNoVersion(t *testing.T) {
spackPackage := `# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
import re
import os
from spack import *
class Git(AutotoolsPackage):
"""Git is a free and open source distributed version control
system designed to handle everything from small to very large
projects with speed and efficiency.
"""
homepage = "http://git-scm.com"
url = "https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.12.0.tar.gz"
executables = ['^git$']
# In order to add new versions here, add a new list entry with:
# * version: {version}
# * sha256: the sha256sum of the git-{version}.tar.gz
# * sha256_manpages: the sha256sum of the corresponding manpage from
# https://www.kernel.org/pub/software/scm/git/git-manpages-{version}.tar.gz
# You can find the source here: https://mirrors.edge.kernel.org/pub/software/scm/git/sha256sums.asc
releases = [
{
'version': '2.31.1',
'sha256': '46d37c229e9d786510e0c53b60065704ce92d5aedc16f2c5111e3ed35093bfa7',
'sha256_manpages': 'd330498aaaea6928b0abbbbb896f6f605efd8d35f23cbbb2de38c87a737d4543'
},
{
'version': '2.31.0',
'sha256': 'bc6168777883562569144d536e8a855b12d25d46870d95188a3064260d7784ee',
'sha256_manpages': 'a51b760c36be19113756839a9110b328a09abfff0d57f1c93ddac3974ccbc238'
},
{
'version': '2.30.1',
'sha256': '23a3e53f0d2dd3e62a8147b24a1a91d6ffe95b92123ef4dbae04e9a6205e71c0',
'sha256_manpages': 'db323e1b242e9d0337363b1e538c8b879e4c46eedbf94d3bee9e65dab6d49138'
},
{
'version': '2.30.0',
'sha256': 'd24c4fa2a658318c2e66e25ab67cc30038a35696d2d39e6b12ceccf024de1e5e',
'sha256_manpages': 'e23035ae232c9a5eda57db258bc3b7f1c1060cfd66920f92c7d388b6439773a6'
},
{
'version': '2.29.0',
'sha256': 'fa08dc8424ef80c0f9bf307877f9e2e49f1a6049e873530d6747c2be770742ff',
'sha256_manpages': '8f3bf70ddb515674ce2e19572920a39b1be96af12032b77f1dd57898981fb151'
},
{
'version': '2.28.0',
'sha256': 'f914c60a874d466c1e18467c864a910dd4ea22281ba6d4d58077cb0c3f115170',
'sha256_manpages': '3cfca28a88d5b8112ea42322b797a500a14d0acddea391aed0462aff1ab11bf7'
},
{
'version': '2.27.0',
'sha256': '77ded85cbe42b1ffdc2578b460a1ef5d23bcbc6683eabcafbb0d394dffe2e787',
'sha256_manpages': '414e4b17133e54d846f6bfa2479f9757c50e16c013eb76167a492ae5409b8947'
},
{
'version': '2.26.0',
'sha256': 'aa168c2318e7187cd295a645f7370cc6d71a324aafc932f80f00c780b6a26bed',
'sha256_manpages': 'c1ffaf0b4cd1e80a0eb0d4039e208c9d411ef94d5da44e38363804e1a7961218'
},
{
'version': '2.25.0',
'sha256': 'a98c9b96d91544b130f13bf846ff080dda2867e77fe08700b793ab14ba5346f6',
'sha256_manpages': '22b2380842ef75e9006c0358de250ead449e1376d7e5138070b9a3073ef61d44'
},
{
'version': '2.21.0',
'sha256': '85eca51c7404da75e353eba587f87fea9481ba41e162206a6f70ad8118147bee',
'sha256_manpages': '14c76ebb4e31f9e55cf5338a04fd3a13bced0323cd51794ccf45fc74bd0c1080'
},
{
'version': '2.20.1',
'sha256': 'edc3bc1495b69179ba4e272e97eff93334a20decb1d8db6ec3c19c16417738fd',
'sha256_manpages': 'e9c123463abd05e142defe44a8060ce6e9853dfd8c83b2542e38b7deac4e6d4c'
},
{
'version': '2.19.2',
'sha256': 'db893ad69c9ac9498b09677c5839787eba2eb3b7ef2bc30bfba7e62e77cf7850',
'sha256_manpages': '60334ecd59ee10319af4a7815174d10991d1afabacd3b3129d589f038bf25542'
},
{
'version': '2.19.1',
'sha256': 'ec4dc96456612c65bf6d944cee9ac640145ec7245376832b781cb03e97cbb796',
'sha256_manpages': 'bd27f58dc90a661e3080b97365eb7322bfa185de95634fc59d98311925a7d894'
},
{
'version': '2.18.0',
'sha256': '94faf2c0b02a7920b0b46f4961d8e9cad08e81418614102898a55f980fa3e7e4',
'sha256_manpages': '6cf38ab3ad43ccdcd6a73ffdcf2a016d56ab6b4b240a574b0bb96f520a04ff55'
},
{
'version': '2.17.1',
'sha256': 'ec6452f0c8d5c1f3bcceabd7070b8a8a5eea11d4e2a04955c139b5065fd7d09a',
'sha256_manpages': '9732053c1a618d2576c1751d0249e43702f632a571f84511331882beb360677d'
},
{
'version': '2.17.0',
'sha256': '7a0cff35dbb14b77dca6924c33ac9fe510b9de35d5267172490af548ec5ee1b8',
'sha256_manpages': '41b58c68e90e4c95265c75955ddd5b68f6491f4d57b2f17c6d68e60bbb07ba6a'
},
{
'version': '2.15.1',
'sha256': '85fca8781a83c96ba6db384cc1aa6a5ee1e344746bafac1cbe1f0fe6d1109c84',
'sha256_manpages': '472454c494c9a7f50ad38060c3eec372f617de654b20f3eb3be59fc17a683fa1',
},
{
'version': '2.14.1',
'sha256': '01925349b9683940e53a621ee48dd9d9ac3f9e59c079806b58321c2cf85a4464',
'sha256_manpages': '8c5810ce65d44cd333327d3a115c5b462712a2f81225d142e07bd889ad8dc0e0',
},
{
'version': '2.13.0',
'sha256': '9f2fa8040ebafc0c2caae4a9e2cb385c6f16c0525bcb0fbd84938bc796372e80',
'sha256_manpages': 'e764721796cad175a4cf9a4afe7fb4c4fc57582f6f9a6e214239498e0835355b',
},
{
'version': '2.12.2',
'sha256': 'd9c6d787a24670d7e5100db2367c250ad9756ef8084fb153a46b82f1d186f8d8',
'sha256_manpages': '6e7ed503f1190734e57c9427df356b42020f125fa36ab0478777960a682adf50',
},
{
'version': '2.12.1',
'sha256': '65d62d10caf317fc1daf2ca9975bdb09dbff874c92d24f9529d29a7784486b43',
'sha256_manpages': '35e46b8acd529ea671d94035232b1795919be8f3c3a363ea9698f1fd08d7d061',
},
{
'version': '2.12.0',
'sha256': '882f298daf582a07c597737eb4bbafb82c6208fe0e73c047defc12169c221a92',
'sha256_manpages': '1f7733a44c59f9ae8dd321d68a033499a76c82046025cc2a6792299178138d65',
},
{
'version': '2.11.1',
'sha256': 'a1cdd7c820f92c44abb5003b36dc8cb7201ba38e8744802399f59c97285ca043',
'sha256_manpages': 'ee567e7b0f95333816793714bb31c54e288cf8041f77a0092b85e62c9c2974f9',
},
{
'version': '2.11.0',
'sha256': 'd3be9961c799562565f158ce5b836e2b90f38502d3992a115dfb653d7825fd7e',
'sha256_manpages': '437a0128acd707edce24e1a310ab2f09f9a09ee42de58a8e7641362012dcfe22',
},
{
'version': '2.9.3',
'sha256': 'a252b6636b12d5ba57732c8469701544c26c2b1689933bd1b425e603cbb247c0',
'sha256_manpages': '8ea1a55b048fafbf0c0c6fcbca4b5b0f5e9917893221fc7345c09051d65832ce',
},
{
'version': '2.9.2',
'sha256': '3cb09a3917c2d8150fc1708f3019cf99a8f0feee6cd61bba3797e3b2a85be9dc',
'sha256_manpages': 'ac5c600153d1e4a1c6494e250cd27ca288e7667ad8d4ea2f2386f60ba1b78eec',
},
{
'version': '2.9.1',
'sha256': 'c2230873bf77f93736473e6a06501bf93eed807d011107de6983dc015424b097',
'sha256_manpages': '324f5f173f2bd50b0102b66e474b81146ccc078d621efeb86d7f75e3c1de33e6',
},
{
'version': '2.9.0',
'sha256': 'bff7560f5602fcd8e37669e0f65ef08c6edc996e4f324e4ed6bb8a84765e30bd',
'sha256_manpages': '35ba69a8560529aa837e395a6d6c8d42f4d29b40a3c1cc6e3dc69bb1faadb332',
},
{
'version': '2.8.4',
'sha256': '626e319f8a24fc0866167ea5f6bf3e2f38f69d6cb2e59e150f13709ca3ebf301',
'sha256_manpages': '953a8eadaf4ae96dbad2c3ec12384c677416843917ef83d94b98367ffd55afc0',
},
{
'version': '2.8.3',
'sha256': '2dad50c758339d6f5235309db620e51249e0000ff34aa2f2acbcb84c2123ed09',
'sha256_manpages': '2dad50c758339d6f5235309db620e51249e0000ff34aa2f2acbcb84c2123ed09',
},
{
'version': '2.8.2',
'sha256': 'a029c37ee2e0bb1efea5c4af827ff5afdb3356ec42fc19c1d40216d99e97e148',
'sha256_manpages': '82d322211aade626d1eb3bcf3b76730bfdd2fcc9c189950fb0a8bdd69c383e2f',
},
{
'version': '2.8.1',
'sha256': 'cfc66324179b9ed62ee02833f29d39935f4ab66874125a3ab9d5bb9055c0cb67',
'sha256_manpages': 'df46de0c172049f935cc3736361b263c5ff289b77077c73053e63ae83fcf43f4',
},
{
'version': '2.8.0',
'sha256': '2c6eee5506237e0886df9973fd7938a1b2611ec93d07f64ed3447493ebac90d1',
'sha256_manpages': '2c48902a69df3bec3b8b8f0350a65fd1b662d2f436f0e64d475ecd1c780767b6',
},
{
'version': '2.7.3',
'sha256': '30d067499b61caddedaf1a407b4947244f14d10842d100f7c7c6ea1c288280cd',
'sha256_manpages': '84b487c9071857ab0f15f11c4a102a583d59b524831cda0dc0954bd3ab73920b',
},
{
'version': '2.7.1',
'sha256': 'b4ab42798b7fb038eaefabb0c32ce9dbde2919103e5e2a35adc35dd46258a66f',
'sha256_manpages': '0313cf4d283336088883d8416692fb6c547512233e11dbf06e5b925b7e762d61',
},
]
for release in releases:
version(release['version'], sha256=release['sha256'])
resource(
name='git-manpages',
url="https://www.kernel.org/pub/software/scm/git/git-manpages-{0}.tar.gz".format(
release['version']),
sha256=release['sha256_manpages'],
placement='git-manpages',
when='@{0}'.format(release['version']))
variant('tcltk', default=False,
description='Gitk: provide Tcl/Tk in the run environment')
variant('svn', default=False,
description='Provide SVN Perl dependency in run environment')
variant('perl', default=True,
description='Do not use Perl scripts or libraries at all')
depends_on('curl')
depends_on('expat')
depends_on('gettext')
depends_on('iconv')
depends_on('libidn2')
depends_on('openssl')
depends_on('pcre', when='@:2.13')
depends_on('pcre2', when='@2.14:')
depends_on('perl', when='+perl')
depends_on('zlib')
depends_on('openssh', type='run')
depends_on('autoconf', type='build')
depends_on('automake', type='build')
depends_on('libtool', type='build')
depends_on('m4', type='build')
depends_on('tk', type=('build', 'link'), when='+tcltk')
depends_on('perl-alien-svn', type='run', when='+svn')
conflicts('+svn', when='~perl')
@classmethod
def determine_version(cls, exe):
output = Executable(exe)('--version', output=str, error=str)
match = re.search(r'git version (\S+)', output)
return match.group(1) if match else None
@classmethod
def determine_variants(cls, exes, version_str):
prefix = os.path.dirname(exes[0])
variants = ''
if 'gitk' in os.listdir(prefix):
variants += '+tcltk'
else:
variants += '~tcltk'
return variants
# See the comment in setup_build_environment re EXTLIBS.
def patch(self):
filter_file(r'^EXTLIBS =$',
'#EXTLIBS =',
'Makefile')
def setup_build_environment(self, env):
# We use EXTLIBS rather than LDFLAGS so that git's Makefile
# inserts the information into the proper place in the link commands
# (alongside the # other libraries/paths that configure discovers).
# LDFLAGS is inserted *before* libgit.a, which requires libintl.
# EXTFLAGS is inserted *after* libgit.a.
# This depends on the patch method above, which keeps the Makefile
# from stepping on the value that we pass in via the environment.
#
# The test avoids failures when git is an external package.
# In that case the node in the DAG gets truncated and git DOES NOT
# have a gettext dependency.
if 'gettext' in self.spec:
if 'intl' in self.spec['gettext'].libs.names:
env.append_flags('EXTLIBS', '-L{0} -lintl'.format(
self.spec['gettext'].prefix.lib))
env.append_flags('CFLAGS', '-I{0}'.format(
self.spec['gettext'].prefix.include))
if '~perl' in self.spec:
env.append_flags('NO_PERL', '1')
def configure_args(self):
spec = self.spec
configure_args = [
'--with-curl={0}'.format(spec['curl'].prefix),
'--with-expat={0}'.format(spec['expat'].prefix),
'--with-iconv={0}'.format(spec['iconv'].prefix),
'--with-openssl={0}'.format(spec['openssl'].prefix),
'--with-zlib={0}'.format(spec['zlib'].prefix),
]
if '+perl' in self.spec:
configure_args.append('--with-perl={0}'.format(spec['perl'].command.path))
if '^pcre' in self.spec:
configure_args.append('--with-libpcre={0}'.format(
spec['pcre'].prefix))
if '^pcre2' in self.spec:
configure_args.append('--with-libpcre2={0}'.format(
spec['pcre2'].prefix))
if '+tcltk' in self.spec:
configure_args.append('--with-tcltk={0}'.format(
self.spec['tk'].prefix.bin.wish))
else:
configure_args.append('--without-tcltk')
return configure_args
@run_after('configure')
def filter_rt(self):
if sys.platform == 'darwin':
# Don't link with -lrt; the system has no (and needs no) librt
filter_file(r' -lrt$', '', 'Makefile')
def check(self):
make('test')
@run_after('install')
def install_completions(self):
install_tree('contrib/completion', self.prefix.share)
@run_after('install')
def install_manpages(self):
prefix = self.prefix
with working_dir('git-manpages'):
install_tree('man1', prefix.share.man.man1)
install_tree('man5', prefix.share.man.man5)
install_tree('man7', prefix.share.man.man7)
def setup_run_environment(self, env):
# Setup run environment if using SVN extension
# Libs from perl-alien-svn and apr-util are required in
# LD_LIBRARY_PATH
# TODO: extend to other platforms
if "+svn platform=linux" in self.spec:
perl_svn = self.spec['perl-alien-svn']
env.prepend_path('LD_LIBRARY_PATH', join_path(
perl_svn.prefix, 'lib', 'perl5', 'x86_64-linux-thread-multi',
'Alien', 'SVN'))
`
result, err := Decode(spackPackage)
if err != nil {
t.Fatal(err)
}
output, _ := PatchVersion(result, spackPackage)
if output != spackPackage {
t.Error(output)
t.Error(spackPackage)
}
}