From 783673127fa835152bb3f3c242a1ab5a65f26193 Mon Sep 17 00:00:00 2001 From: Xinyu Hou Date: Fri, 24 Apr 2015 16:57:51 +0100 Subject: [PATCH 1/2] Reverted to legacy Mac deployment and signing #4591 --- ext/toolchain/commands1.py | 100 ++++++++++++++++++++++++++++++------- 1 file changed, 81 insertions(+), 19 deletions(-) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index 484b9da9..78b8cb88 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -716,6 +716,8 @@ class InternalCommands: if sys.platform == 'darwin' and not "clean" in args: self.macPostGuiMake(target) + + self.fixQtFrameworksLayout(target) else: raise Exception('Unsupported platform: ' + sys.platform) @@ -742,29 +744,89 @@ class InternalCommands: if not self.macIdentity: raise Exception("run config with --mac-identity") - if sys.version_info < (2, 4): - raise Exception("Python 2.4 or greater required.") + if self.enableMakeGui: + # use qt to copy libs to bundle so no dependencies are needed. do not create a + # dmg at this point, since we need to sign it first, and then create our own + # after signing (so that qt does not affect the signed app bundle). + bin = "macdeployqt Synergy.app -verbose=2" + self.try_chdir(targetDir) + err = os.system(bin) + self.restore_chdir() + print bundleTargetDir + if err != 0: + raise Exception(bin + " failed with error: " + str(err)) - (qMajor, qMinor, qRev) = self.getQmakeVersion() - if qMajor >= 5: - output = commands.getstatusoutput( - "macdeployqt %s/Synergy.app -verbose=2 -codesign='%s'" % ( - targetDir, self.macIdentity)) - else: - # no code signing available in old versions - output = commands.getstatusoutput( - "macdeployqt %s/Synergy.app -verbose=2" % ( - targetDir)) - - print output[1] - if "ERROR" in output[1]: (qMajor, qMinor, qRev) = self.getQmakeVersion() - if qMajor >= 5: - # only listen to errors in qt 5+ - raise Exception("macdeployqt failed") + if qMajor <= 4: + frameworkRootDir = "/Library/Frameworks" + else: + # TODO: auto-detect, qt can now be installed anywhere. + frameworkRootDir = "/Developer/Qt5.2.1/5.2.1/clang_64/lib" + + target = bundleTargetDir + "/Contents/Frameworks" + + # copy the missing Info.plist files for the frameworks. + for root, dirs, files in os.walk(target): + for dir in dirs: + if dir.startswith("Qt"): + shutil.copy( + frameworkRootDir + "/" + dir + "/Contents/Info.plist", + target + "/" + dir + "/Resources/") + + def symlink(self, source, target): + if not os.path.exists(target): + os.symlink(source, target) + + def move(self, source, target): + if os.path.exists(source): + shutil.move(source, target) + + def fixQtFrameworksLayout(self, target): + # reorganize Qt frameworks layout on Mac 10.9.5 or later + # http://goo.gl/BFnQ8l + # QtCore example: + # QtCore.framework/ + # QtCore -> Versions/Current/QtCore + # Resources -> Versions/Current/Resources + # Versions/ + # Current -> 5 + # 5/ + # QtCore + # Resources/ + # Info.plist + targetDir = self.getGenerator().getBinDir(target) + + target = targetDir + "/Synergy.app/Contents/Frameworks" + (major, minor) = self.getMacVersion() + if major == 10: + if minor >= 9: + for root, dirs, files in os.walk(target): + for dir in dirs: + if dir.startswith("Qt"): + self.try_chdir(target + "/" + dir +"/Versions") + self.symlink("5", "Current") + self.move("../Resources", "5") + self.restore_chdir() + + self.try_chdir(target + "/" + dir) + dot = dir.find('.') + frameworkName = dir[:dot] + self.symlink("Versions/Current/" + frameworkName, frameworkName) + self.symlink("Versions/Current/Resources", "Resources") + self.restore_chdir() def signmac(self): - print "signmac is now obsolete" + self.loadConfig() + if not self.macIdentity: + raise Exception("run config with --mac-identity") + + self.try_chdir("bin/Release/") + err = os.system( + 'codesign --deep -fs "' + self.macIdentity + '" Synergy.app') + self.restore_chdir() + + if err != 0: + raise Exception("codesign failed with error: " + str(err)) def signwin(self, pfx, pwdFile, dist): generator = self.getGeneratorFromConfig().cmakeName From 4af987e8de92d5f0a38c5ace7a683580a9e9843c Mon Sep 17 00:00:00 2001 From: XinyuHou Date: Wed, 29 Apr 2015 13:25:01 +0100 Subject: [PATCH 2/2] Made secure socket logging more user friendly #4558 --- src/lib/plugin/ns/SecureSocket.cpp | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/lib/plugin/ns/SecureSocket.cpp b/src/lib/plugin/ns/SecureSocket.cpp index 5104c0d7..4b5d199c 100644 --- a/src/lib/plugin/ns/SecureSocket.cpp +++ b/src/lib/plugin/ns/SecureSocket.cpp @@ -108,6 +108,7 @@ SecureSocket::secureRead(void* buffer, UInt32 n) { int r = 0; if (m_ssl->m_ssl != NULL) { + LOG((CLOG_DEBUG2 "reading secure socket")); r = SSL_read(m_ssl->m_ssl, buffer, n); bool fatal, retry; @@ -126,6 +127,7 @@ SecureSocket::secureWrite(const void* buffer, UInt32 n) { int r = 0; if (m_ssl->m_ssl != NULL) { + LOG((CLOG_DEBUG2 "writing secure socket")); r = SSL_write(m_ssl->m_ssl, buffer, n); bool fatal, retry; @@ -346,31 +348,19 @@ SecureSocket::checkResult(int n, bool& fatal, bool& retry) case SSL_ERROR_ZERO_RETURN: // connection closed - LOG((CLOG_DEBUG2 "secure socket error: SSL_ERROR_ZERO_RETURN")); + LOG((CLOG_DEBUG2 "SSL connection has been closed")); break; case SSL_ERROR_WANT_READ: - LOG((CLOG_DEBUG2 "secure socket error: SSL_ERROR_WANT_READ")); - retry = true; - break; - case SSL_ERROR_WANT_WRITE: - LOG((CLOG_DEBUG2 "secure socket error: SSL_ERROR_WANT_WRITE")); - retry = true; - break; - case SSL_ERROR_WANT_CONNECT: - LOG((CLOG_DEBUG2 "secure socket error: SSL_ERROR_WANT_CONNECT")); - retry = true; - break; - case SSL_ERROR_WANT_ACCEPT: - LOG((CLOG_DEBUG2 "secure socket error: SSL_ERROR_WANT_ACCEPT")); + LOG((CLOG_DEBUG2 "need to retry the same SSL function")); retry = true; break; case SSL_ERROR_SYSCALL: - LOG((CLOG_ERR "secure socket error: SSL_ERROR_SYSCALL")); + LOG((CLOG_ERR "some secure socket I/O error occurred")); if (ERR_peek_error() == 0) { if (n == 0) { LOG((CLOG_ERR "an EOF violates the protocol")); @@ -390,12 +380,12 @@ SecureSocket::checkResult(int n, bool& fatal, bool& retry) break; case SSL_ERROR_SSL: - LOG((CLOG_ERR "secure socket error: SSL_ERROR_SSL")); + LOG((CLOG_ERR "a failure in the SSL library occurred")); fatal = true; break; default: - LOG((CLOG_ERR "secure socket error: unknown")); + LOG((CLOG_ERR "unknown secure socket error")); fatal = true; break; }