summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-06-19 17:22:04 +0530
committerJan Schmidt <jan@centricular.com>2018-07-21 16:28:33 +1000
commita8d68e584a4da8731bf46a088d452513b715d49c (patch)
treef08c8c52ae2b217485593c088722a0c457543a21
parenta5bd5a4c4912d30d2e45f93e53c2ea11c880edb2 (diff)
openssl.recipe: Fix perl version checking1.14.2
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.
-rw-r--r--cerbero/utils/shell.py10
-rw-r--r--config/windows.config5
-rw-r--r--recipes/openssl.recipe10
3 files changed, 11 insertions, 14 deletions
diff --git a/cerbero/utils/shell.py b/cerbero/utils/shell.py
index f5991cac..15d896cc 100644
--- a/cerbero/utils/shell.py
+++ b/cerbero/utils/shell.py
@@ -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
diff --git a/config/windows.config b/config/windows.config
index 8da98c06..f36fc52e 100644
--- a/config/windows.config
+++ b/config/windows.config
@@ -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'
diff --git a/recipes/openssl.recipe b/recipes/openssl.recipe
index 44b59d0e..7ababdf7 100644
--- a/recipes/openssl.recipe
+++ b/recipes/openssl.recipe
@@ -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 + ' '