diff options
author | Nobuaki Sukegawa <nsuke@apache.org> | 2016-09-28 05:05:02 +0900 |
---|---|---|
committer | Nobuaki Sukegawa <nsuke@apache.org> | 2016-09-29 02:44:59 +0900 |
commit | 8ccf5a645c8e34e0abb6f31b216dbf77f0ac2a43 (patch) | |
tree | d47a9f8ae308c6c8897f0bca4aebb2c11e47cb2e | |
parent | 042ce7e7c894ac99489d2cd1a3d139e8d630bbdb (diff) | |
download | thrift-8ccf5a645c8e34e0abb6f31b216dbf77f0ac2a43.tar.gz |
THRIFT-3934 Automatically resolve OpenSSL binary version on Windows CI
-rwxr-xr-x | appveyor.yml | 7 | ||||
-rw-r--r-- | build/appveyor/download_openssl.py | 41 |
2 files changed, 44 insertions, 4 deletions
diff --git a/appveyor.yml b/appveyor.yml index 4324c6368..cfd8b51f3 100755 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,9 +29,8 @@ os: environment: BOOST_ROOT: C:\Libraries\boost_1_59_0 BOOST_LIBRARYDIR: C:\Libraries\boost_1_59_0\lib64-msvc-14.0 - # Unfurtunately, these versions need manual update because old versions are quickly deleted. + # Unfurtunately, this version needs manual update because old versions are quickly deleted. ANT_VERSION: 1.9.7 - OPENSSL_VERSION: 1_0_2i install: - '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64' @@ -44,8 +43,8 @@ install: - cmake --build . --config release - cd .. # OpenSSL -- appveyor DownloadFile https://slproweb.com/download/Win64OpenSSL-%OPENSSL_VERSION%.exe -- ps: Start-Process "Win64OpenSSL-${env:OPENSSL_VERSION}.exe" -ArgumentList "/silent /verysilent /sp- /suppressmsgboxes" -Wait +- C:\Python35-x64\python %APPVEYOR_BUILD_FOLDER%\build\appveyor\download_openssl.py +- ps: Start-Process "Win64OpenSSL.exe" -ArgumentList "/silent /verysilent /sp- /suppressmsgboxes" -Wait # Libevent - appveyor DownloadFile https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz - 7z x libevent-2.0.22-stable.tar.gz -so | 7z x -si -ttar > nul diff --git a/build/appveyor/download_openssl.py b/build/appveyor/download_openssl.py new file mode 100644 index 000000000..fcb72e5fc --- /dev/null +++ b/build/appveyor/download_openssl.py @@ -0,0 +1,41 @@ +import urllib.request +import sys + +OUT = 'Win64OpenSSL.exe' + +URL_STR = 'https://slproweb.com/download/Win64OpenSSL-%s.exe' + +VERSION_MAJOR = 1 +VERSION_MINOR = 0 +VERSION_PATCH = 2 +VERSION_SUFFIX = 'j' +VERSION_STR = '%d_%d_%d%s' + +TRY_COUNT = 4 + + +def main(): + for patch in range(VERSION_PATCH, TRY_COUNT): + for suffix in range(TRY_COUNT): + if patch == VERSION_PATCH: + s = VERSION_SUFFIX + else: + s = 'a' + s = chr(ord(s) + suffix) + ver = VERSION_STR % (VERSION_MAJOR, VERSION_MINOR, patch, s) + url = URL_STR % ver + try: + with urllib.request.urlopen(url) as res: + if res.getcode() == 200: + with open(OUT, 'wb') as out: + out.write(res.read()) + print('successfully downloaded from ' + url) + return 0 + except urllib.error.HTTPError: + pass + print('failed to download from ' + url, file=sys.stderr) + print('could not download openssl', file=sys.stderr) + return 1 + +if __name__ == '__main__': + sys.exit(main()) |