You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ns...@apache.org on 2016/09/28 17:45:31 UTC

[2/2] thrift git commit: THRIFT-3934 Automatically resolve OpenSSL binary version on Windows CI

THRIFT-3934 Automatically resolve OpenSSL binary version on Windows CI


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/8ccf5a64
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/8ccf5a64
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/8ccf5a64

Branch: refs/heads/master
Commit: 8ccf5a645c8e34e0abb6f31b216dbf77f0ac2a43
Parents: 042ce7e
Author: Nobuaki Sukegawa <ns...@apache.org>
Authored: Wed Sep 28 05:05:02 2016 +0900
Committer: Nobuaki Sukegawa <ns...@apache.org>
Committed: Thu Sep 29 02:44:59 2016 +0900

----------------------------------------------------------------------
 appveyor.yml                       |  7 +++---
 build/appveyor/download_openssl.py | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/8ccf5a64/appveyor.yml
----------------------------------------------------------------------
diff --git a/appveyor.yml b/appveyor.yml
index 4324c63..cfd8b51 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

http://git-wip-us.apache.org/repos/asf/thrift/blob/8ccf5a64/build/appveyor/download_openssl.py
----------------------------------------------------------------------
diff --git a/build/appveyor/download_openssl.py b/build/appveyor/download_openssl.py
new file mode 100644
index 0000000..fcb72e5
--- /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())