Commit a8d68e58 authored by Nirbheek Chauhan's avatar Nirbheek Chauhan 🐜 Committed by Jan Schmidt

openssl.recipe: Fix perl version checking

check_call doesn't always inherit the current environment, so it would
run the wrong Perl because our PATH changes were ignored. However, this
only happened in a `package` run where some other recipe was built
beforehand.

Instead, use `which()` now so that we read PATH directly. Also don't use
environment variables to communicate the perl path, we already have that
information in self.config.
parent a5bd5a4c
......@@ -500,12 +500,14 @@ def which(pgm, path=None):
return pext
def check_perl_version(needed):
perl = which('perl')
try:
out = check_call(['perl', '--version'])
out = check_call([perl, '--version'])
except FatalError:
return None, None
return None, None, None
m = re.search('v[0-9]+\.[0-9]+(\.[0-9]+)?', out)
if not m:
raise FatalError('Could not detect perl version')
newer = StrictVersion(m.group()[1:]) >= StrictVersion(needed)
return which('perl'), newer
found = m.group()[1:]
newer = StrictVersion(found) >= StrictVersion(needed)
return perl, found, newer
......@@ -67,11 +67,6 @@ toolchainbin = os.path.join(toolchain_prefix, 'bin')
if os.path.isdir(toolchainbin) and not toolchainbin in os.environ['PATH']:
os.environ['PATH'] = '%s%s%s' % (toolchainbin, separator, os.environ['PATH'])
# This perl is only used by openssl; we can't use it everywhere else because it
# is incapable of detecting msys tools, and so perl scripts like autom4te fail
# to detect msys tools like m4. Lucky for us, openssl doesn't use those.
os.environ['CERBERO_OPENSSL_PERL_PATH'] = os.path.join(mingw_perl_prefix, 'bin')
os.environ['ne_cv_libsfor_socket'] = '-lws2_32'
os.environ['ne_cv_libsfor_gethostbyname'] = '-lws2_32'
os.environ['ac_cv_func_malloc_0_nonnull'] ='yes'
......
......@@ -94,15 +94,15 @@ class Recipe(recipe.Recipe):
if self.config.platform == Platform.WINDOWS:
# Msys ships with a too-old perl, so we modify PATH to use the
# mingw-perl that was downloaded and installed by bootstrap.
openssl_path = os.environ['CERBERO_OPENSSL_PERL_PATH']
os.environ['PATH'] = openssl_path + ';' + os.environ['PATH']
perl, newer = shell.check_perl_version('5.10.0')
openssl_path = os.path.join(self.config.mingw_perl_prefix, 'bin')
os.environ['PATH'] = openssl_path + ';' + os.environ['PATH']
perl, found, newer = shell.check_perl_version('5.10.0')
m = 'please run bootstrap again'
if newer is None:
raise FatalError('Perl not found, ' + m)
if newer is False:
raise FatalError('Configured Perl {!r} is too old, {}'
''.format(perl, m))
raise FatalError('Configured Perl {!r} is {} which is too old, {}'
''.format(perl, found, m))
# OpenSSL guesses the libdir incorrectly on x86_64
config_sh = 'perl ./Configure --prefix=' + self.config.prefix + \
' --libdir=lib' + self.config.lib_suffix + ' '
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment