Adding externals for bison and flex (#18358)

* Adding externals for bison and flex

Added because bison actually pulls in a ton of stuff.

* Need to escape parentheses.

* Need to add re package.

* Adding re package.
This commit is contained in:
Robert Blake 2020-08-28 14:22:28 -07:00 committed by GitHub
parent aca370a3a2
commit eb8ff0bc81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 0 deletions

View File

@ -6,6 +6,7 @@
from spack import *
from spack.operating_systems.mac_os import macos_version
import sys
import re
class Bison(AutotoolsPackage, GNUMirrorPackage):
@ -16,6 +17,8 @@ class Bison(AutotoolsPackage, GNUMirrorPackage):
homepage = "https://www.gnu.org/software/bison/"
gnu_mirror_path = "bison/bison-3.6.4.tar.gz"
executables = ['^bison$']
version('3.6.4', sha256='8183de64b5383f3634942c7b151bf2577f74273b2731574cdda8a8f3a0ab13e9')
version('3.6.3', sha256='4b4c4943931e811f1073006ce3d8ee022a02b11b501e9cbf4def3613b24a3e63')
version('3.6.2', sha256='e28ed3aad934de2d1df68be209ac0b454f7b6d3c3d6d01126e5cd2cbadba089a')
@ -49,3 +52,9 @@ class Bison(AutotoolsPackage, GNUMirrorPackage):
patch('secure_snprintf.patch', level=0, when='@3.0.4')
build_directory = 'spack-build'
@classmethod
def determine_version(cls, exe):
output = Executable(exe)('--version', output=str, error=str)
match = re.search(r'bison \(GNU Bison\)\s+(\S+)', output)
return match.group(1) if match else None

View File

@ -5,6 +5,7 @@
from spack import *
import os
import re
class Flex(AutotoolsPackage):
@ -13,6 +14,8 @@ class Flex(AutotoolsPackage):
homepage = "https://github.com/westes/flex"
url = "https://github.com/westes/flex/releases/download/v2.6.1/flex-2.6.1.tar.gz"
executables = ['^flex$']
version('2.6.4', sha256='e87aae032bf07c26f85ac0ed3250998c37621d95f8bd748b31f15b33c45ee995')
version('2.6.3', sha256='68b2742233e747c462f781462a2a1e299dc6207401dac8f0bbb316f48565c2aa')
# Avoid flex '2.6.2' (major bug)
@ -43,6 +46,25 @@ class Flex(AutotoolsPackage):
# - https://github.com/westes/flex/issues/241
patch('https://github.com/westes/flex/commit/24fd0551333e7eded87b64dd36062da3df2f6380.patch', sha256='09c22e5c6fef327d3e48eb23f0d610dcd3a35ab9207f12e0f875701c677978d3', when='@2.6.4')
@classmethod
def determine_version(cls, exe):
output = Executable(exe)('--version', output=str, error=str)
match = re.search(r'flex\s+(\S+)', output)
return match.group(1) if match else None
@classmethod
def determine_variants(cls, exes, version):
results = []
for exe in exes:
variants = ''
path = os.path.dirname(exe)
if 'lex' in os.listdir(path):
variants += "+lex"
else:
variants += "~lex"
results.append(variants)
return results
@when('@:2.6.0,2.6.4')
def autoreconf(self, spec, prefix):
autogen = Executable('./autogen.sh')