mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-30 15:35:49 +00:00
Check for openSSL version in SConstruct.
* Uses the platform specific openssl binary to detect the current version.
This commit is contained in:
committed by
Vinnie Falco
parent
2b0034667d
commit
39a387b54c
29
SConstruct
29
SConstruct
@@ -49,13 +49,38 @@ import os
|
||||
import subprocess
|
||||
import sys
|
||||
import textwrap
|
||||
import time
|
||||
import SCons.Action
|
||||
|
||||
sys.path.append(os.path.join('src', 'beast', 'site_scons'))
|
||||
|
||||
import Beast
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
def parse_time(t):
|
||||
return time.strptime(t, '%a %b %d %H:%M:%S %Z %Y')
|
||||
|
||||
CHECK_PLATFORMS = 'Darwin', 'Debian', 'Ubuntu'
|
||||
CHECK_COMMAND = 'openssl version -a'
|
||||
CHECK_LINE = 'built on: '
|
||||
BUILD_TIME = 'Mon Apr 7 20:33:19 UTC 2014'
|
||||
OPENSSL_ERROR = ('Your openSSL was built on %s; '
|
||||
'rippled needs a version built on or after %s.')
|
||||
|
||||
def check_openssl():
|
||||
if Beast.system.platform in CHECK_PLATFORMS:
|
||||
for line in subprocess.check_output(CHECK_COMMAND.split()).splitlines():
|
||||
if line.startswith(CHECK_LINE):
|
||||
line = line[len(CHECK_LINE):]
|
||||
if parse_time(line) < parse_time(BUILD_TIME):
|
||||
raise Exception(OPENSSL_ERROR % (line, BUILD_TIME))
|
||||
else:
|
||||
break
|
||||
else:
|
||||
raise Exception("Didn't find any '%s' line in '$ %s'" %
|
||||
(CHECK_LINE, CHECK_COMMAND))
|
||||
|
||||
|
||||
def import_environ(env):
|
||||
'''Imports environment settings into the construction environment'''
|
||||
@@ -187,6 +212,8 @@ def config_base(env):
|
||||
CXXCOMSTR='Compiling ' + Beast.blue('$SOURCES'),
|
||||
LINKCOMSTR='Linking ' + Beast.blue('$TARGET'),
|
||||
)
|
||||
check_openssl()
|
||||
|
||||
#git = Beast.Git(env) # TODO(TOM)
|
||||
if False: #git.exists:
|
||||
env.Append(CPPDEFINES={'GIT_COMMIT_ID' : '"%s"' % git.commit_id})
|
||||
|
||||
@@ -69,6 +69,8 @@ class __System(object):
|
||||
else:
|
||||
raise Exception('Unknown system platform "' + self.name + '"')
|
||||
|
||||
self.platform = self.distro or self.name
|
||||
|
||||
def __str__(self):
|
||||
return self.__display
|
||||
|
||||
|
||||
Reference in New Issue
Block a user