From e0cb5bda6ed26498a14d102f8aa906c8bd0dfa3e Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 21 Mar 2015 18:38:25 +0000 Subject: [PATCH 1/9] Separated post back build into release and debug #4464 Also related to #4463 --- ext/toolchain/commands1.py | 114 ++++++++++++++------------- temp.diff | 153 +++++++++++++++++++++++++++++++++++++ 2 files changed, 215 insertions(+), 52 deletions(-) create mode 100644 temp.diff diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index f29a721e..ccbe04e6 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -698,43 +698,47 @@ class InternalCommands: raise Exception('Build command not supported with generator: ' + generator) def makeGui(self, targets, args=""): - name = "Synergy.app" - self.try_chdir(self.getGenerator().binDir) - if os.path.exists(name): - print "removing exisiting bundle" - shutil.rmtree(name) - self.restore_chdir() + for target in targets: + + if sys.platform == 'win32': + + gui_make_cmd = self.w32_make_cmd + ' ' + target + args + print 'Make GUI command: ' + gui_make_cmd - if sys.platform == 'win32': - gui_make_cmd = self.w32_make_cmd - elif sys.platform in ['linux2', 'sunos5', 'freebsd7', 'darwin']: - gui_make_cmd = self.make_cmd + " -w" - else: - raise Exception('Unsupported platform: ' + sys.platform) - - gui_make_cmd += args - - print 'Make GUI command: ' + gui_make_cmd - - if sys.platform == 'win32': - for target in targets: self.try_chdir(self.gui_dir) - err = os.system(gui_make_cmd + ' ' + target) + err = os.system(gui_make_cmd) self.restore_chdir() if err != 0: raise Exception(gui_make_cmd + ' failed with error: ' + str(err)) - else: - self.try_chdir(self.gui_dir) - err = os.system(gui_make_cmd) - self.restore_chdir() - if err != 0: - raise Exception(gui_make_cmd + ' failed with error: ' + str(err)) + elif sys.platform in ['linux2', 'sunos5', 'freebsd7', 'darwin']: - if sys.platform == 'darwin' and not "clean" in args: - for target in targets: - self.macPostMake(target) + gui_make_cmd = self.make_cmd + " -w" + args + print 'Make GUI command: ' + gui_make_cmd + + # start with a clean app bundle + targetDir = self.getGenerator().getBinDir(target) + bundleTargetDir = targetDir + '/Synergy.app' + if os.path.exists(bundleTargetDir): + shutil.rmtree(bundleTargetDir) + + binDir = self.getGenerator().binDir + bundleTempDir = binDir + '/Synergy.app' + if os.path.exists(bundleTempDir): + shutil.rmtree(bundleTempDir) + + self.try_chdir(self.gui_dir) + err = os.system(gui_make_cmd) + self.restore_chdir() + + if err != 0: + raise Exception(gui_make_cmd + ' failed with error: ' + str(err)) + + if sys.platform == 'darwin' and not "clean" in args: + self.macPostGuiMake(target) + else: + raise Exception('Unsupported platform: ' + sys.platform) def symlink(self, source, target): if not os.path.exists(target): @@ -744,36 +748,41 @@ class InternalCommands: if os.path.exists(source): shutil.move(source, target) - def macPostMake(self, target): + def macPostGuiMake(self, target): - dir = self.getGenerator().binDir + bundle = 'Synergy.app' + binDir = self.getGenerator().binDir + targetDir = self.getGenerator().getBinDir(target) + bundleTempDir = binDir + '/' + bundle + bundleTargetDir = targetDir + '/' + bundle + + if os.path.exists(bundleTempDir): + shutil.move(bundleTempDir, bundleTargetDir) if self.enableMakeCore: # copy core binaries into the bundle, since the gui # now looks for the binaries in the current app dir. - targetDir = self.getGenerator().getBinDir(target) - bundleBinDir = dir + "/Synergy.app/Contents/MacOS/" + bundleBinDir = bundleTargetDir + "/Contents/MacOS/" shutil.copy(targetDir + "/synergyc", bundleBinDir) shutil.copy(targetDir + "/synergys", bundleBinDir) shutil.copy(targetDir + "/syntool", bundleBinDir) - if self.enableMakeGui: + self.loadConfig() + if not self.macIdentity: + raise Exception("run config with --mac-identity") - self.loadConfig() - 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.") - # 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 -codesign='" + self.macIdentity + "'" - self.try_chdir(dir) - err = os.system(bin) - self.restore_chdir() - - if err != 0: - raise Exception(bin + " failed with error: " + str(err)) + output = os.popen( + "macdeployqt %s/Synergy.app -verbose=2 -codesign='%s'" % ( + targetDir, self.macIdentity)).read() + + print output + + if "ERROR" in output: + raise Exception("macdeployqt failed") def signmac(self): print "signmac is now obsolete" @@ -1183,16 +1192,16 @@ class InternalCommands: def distMac(self): self.loadConfig() - dir = self.getGenerator().binDir + binDir = self.getGenerator().getBinDir('Release') name = "Synergy" - dist = dir + "/" + name + dist = binDir + "/" + name # ensure dist dir is clean if os.path.exists(dist): shutil.rmtree(dist) os.makedirs(dist) - shutil.move(dir + "/" + name + ".app", dist + "/" + name + ".app") + shutil.move(binDir + "/" + name + ".app", dist + "/" + name + ".app") self.try_chdir(dist) err = os.system("ln -s /Applications") @@ -1205,7 +1214,7 @@ class InternalCommands: cmd = "hdiutil create " + fileName + " -srcfolder ./" + name + "/ -ov" - self.try_chdir(dir) + self.try_chdir(binDir) err = os.system(cmd) self.restore_chdir() @@ -1376,8 +1385,9 @@ class InternalCommands: pattern = re.escape(self.project + '-') + '\d+\.\d+\.\d+' + re.escape('-' + platform + '.' + ext) - # only use release dir if not windows target = '' + if type == 'mac': + target = 'Release' for filename in os.listdir(self.getBinDir(target)): if re.search(pattern, filename): diff --git a/temp.diff b/temp.diff new file mode 100644 index 00000000..7f46f6e2 --- /dev/null +++ b/temp.diff @@ -0,0 +1,153 @@ +diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py +index f29a721..cdd2ac6 100644 +--- a/ext/toolchain/commands1.py ++++ b/ext/toolchain/commands1.py +@@ -698,43 +698,49 @@ class InternalCommands: + raise Exception('Build command not supported with generator: ' + generator) + + def makeGui(self, targets, args=""): +- name = "Synergy.app" +- self.try_chdir(self.getGenerator().binDir) +- if os.path.exists(name): +- print "removing exisiting bundle" +- shutil.rmtree(name) +- self.restore_chdir() +- +- if sys.platform == 'win32': +- gui_make_cmd = self.w32_make_cmd +- elif sys.platform in ['linux2', 'sunos5', 'freebsd7', 'darwin']: +- gui_make_cmd = self.make_cmd + " -w" +- else: +- raise Exception('Unsupported platform: ' + sys.platform) +- +- gui_make_cmd += args +- +- print 'Make GUI command: ' + gui_make_cmd ++ for target in targets: + +- if sys.platform == 'win32': +- for target in targets: ++ if sys.platform == 'win32': ++ ++ gui_make_cmd = self.w32_make_cmd + ' ' + target + args ++ print 'Make GUI command: ' + gui_make_cmd ++ + self.try_chdir(self.gui_dir) +- err = os.system(gui_make_cmd + ' ' + target) ++ err = os.system(gui_make_cmd) + self.restore_chdir() + + if err != 0: + raise Exception(gui_make_cmd + ' failed with error: ' + str(err)) +- else: +- self.try_chdir(self.gui_dir) +- err = os.system(gui_make_cmd) +- self.restore_chdir() + +- if err != 0: +- raise Exception(gui_make_cmd + ' failed with error: ' + str(err)) ++ elif sys.platform in ['linux2', 'sunos5', 'freebsd7', 'darwin']: + +- if sys.platform == 'darwin' and not "clean" in args: +- for target in targets: +- self.macPostMake(target) ++ gui_make_cmd = self.make_cmd + " -w" + args ++ print 'Make GUI command: ' + gui_make_cmd ++ ++ # start with a clean app bundle ++ targetDir = self.getGenerator().getBinDir(target) ++ bundleTargetDir = targetDir + '/Synergy.app' ++ print bundleTargetDir ++ if os.path.exists(bundleTargetDir): ++ shutil.rmtree(bundleTargetDir) ++ ++ binDir = self.getGenerator().binDir ++ bundleTempDir = binDir + '/Synergy.app' ++ print bundleTempDir ++ if os.path.exists(bundleTempDir): ++ shutil.rmtree(bundleTempDir) ++ ++ self.try_chdir(self.gui_dir) ++ err = os.system(gui_make_cmd) ++ self.restore_chdir() ++ ++ if err != 0: ++ raise Exception(gui_make_cmd + ' failed with error: ' + str(err)) ++ ++ if sys.platform == 'darwin' and not "clean" in args: ++ self.macPostGuiMake(target) ++ else: ++ raise Exception('Unsupported platform: ' + sys.platform) + + def symlink(self, source, target): + if not os.path.exists(target): +@@ -744,36 +750,51 @@ class InternalCommands: + if os.path.exists(source): + shutil.move(source, target) + +- def macPostMake(self, target): ++ def macPostGuiMake(self, target): + +- dir = self.getGenerator().binDir ++ bundle = 'Synergy.app' ++ binDir = self.getGenerator().binDir ++ targetDir = self.getGenerator().getBinDir(target) ++ bundleTempDir = binDir + '/' + bundle ++ bundleTargetDir = targetDir + '/' + bundle ++ ++ if os.path.exists(bundleTempDir): ++ shutil.move(bundleTempDir, bundleTargetDir) + + if self.enableMakeCore: + # copy core binaries into the bundle, since the gui + # now looks for the binaries in the current app dir. + +- targetDir = self.getGenerator().getBinDir(target) +- bundleBinDir = dir + "/Synergy.app/Contents/MacOS/" ++ bundleBinDir = bundleTargetDir + "/Contents/MacOS/" + shutil.copy(targetDir + "/synergyc", bundleBinDir) + shutil.copy(targetDir + "/synergys", bundleBinDir) + shutil.copy(targetDir + "/syntool", bundleBinDir) + +- if self.enableMakeGui: ++ self.loadConfig() ++ if not self.macIdentity: ++ raise Exception("run config with --mac-identity") + +- self.loadConfig() +- if not self.macIdentity: +- raise Exception("run config with --mac-identity") +- +- # 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 -codesign='" + self.macIdentity + "'" +- self.try_chdir(dir) +- err = os.system(bin) +- self.restore_chdir() ++ if sys.version_info < (2, 4): ++ raise Exception("Python 2.4 or greater required.") + +- if err != 0: +- raise Exception(bin + " failed with error: " + str(err)) ++ self.try_chdir(targetDir) ++ ++ p = subprocess.Popen( ++ ["macdeployqt", "Synergy.app", "-verbose=2", ++ "-codesign='" + self.macIdentity + "'"], ++ stdout=subprocess.PIPE, stderr=subprocess.PIPE) ++ ++ stdout, stderr = p.communicate() ++ ++ self.restore_chdir() ++ ++ # print stderr to standard out, since macdeployqt sends ++ # everything to stderr making it meaningless. ++ print stdout ++ print stderr ++ ++ if "ERROR" in stderr: ++ raise Exception("macdeployqt failed") + + def signmac(self): + print "signmac is now obsolete" From ccaf4a8ef38a12487dd62c15015da37508526cc7 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Thu, 5 Mar 2015 17:30:08 +0000 Subject: [PATCH 2/9] Removed toolchain code to skip packages #4407 --- ext/toolchain/ftputil.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/ext/toolchain/ftputil.py b/ext/toolchain/ftputil.py index bbb9a271..cac71e7d 100644 --- a/ext/toolchain/ftputil.py +++ b/ext/toolchain/ftputil.py @@ -27,14 +27,6 @@ class FtpUploader: ftp = FTP(self.host, self.user, self.password) ftp.cwd(self.dir) - - # check to see if we should stop here - if not replace: - files = ftp.nlst() - if dest in files: - print 'Already exists, skipping.' - ftp.close() - return f = open(src, 'rb') ftp.storbinary('STOR ' + dest, f) From 88d85204db79ae0453686c9fe27affbbc415aa68 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 21 Mar 2015 18:57:09 +0000 Subject: [PATCH 3/9] Fixed distftp source file path #4464 --- ext/toolchain/commands1.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index ccbe04e6..45141701 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -1313,12 +1313,8 @@ class InternalCommands: dest = self.dist_name_rev(type) print 'Uploading %s to FTP server %s...' % (dest, ftp.host) - srcDir = 'bin/' - generator = self.getGeneratorFromConfig().cmakeName - #if not generator.startswith('Visual Studio'): - # srcDir += 'release/' - - ftp.run(srcDir + src, dest) + binDir = self.getGenerator().getBinDir('Release') + ftp.run(binDir + '/' + src, dest) print 'Done' def getDebianArch(self): From dcf8a9f5f0894fb6fe840f0ad1efea5caf3e535d Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 21 Mar 2015 19:05:43 +0000 Subject: [PATCH 4/9] Changed use of popen to getstatusoutput #4464 The getstatusoutput function seems easier to use --- ext/toolchain/commands1.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index 45141701..4355f982 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -775,13 +775,12 @@ class InternalCommands: if sys.version_info < (2, 4): raise Exception("Python 2.4 or greater required.") - output = os.popen( + output = commands.getstatusoutput( "macdeployqt %s/Synergy.app -verbose=2 -codesign='%s'" % ( - targetDir, self.macIdentity)).read() + targetDir, self.macIdentity)) - print output - - if "ERROR" in output: + print output[1] + if "ERROR" in output[1]: raise Exception("macdeployqt failed") def signmac(self): From 2e060cc2f3abebe26ca4aef05a78aa9a9ee00999 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 21 Mar 2015 19:35:59 +0000 Subject: [PATCH 5/9] ChangeLog for 1.6.3 --- ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index b6dc7236..ee6e9e6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +1.6.3 +===== +Bug #4349 - Mouse click does not always bring window to front +Bug #4463 - Unidentified developer error on Mac OS X +Bug #4464 - Code signing verify failure not reported on Mac build +Enhancement #4455 - Replace version with branch name in package filename + 1.6.2 ===== Bug #4227 - Helper tool crashes when service checks elevation state From 0edb3a74b3771300b4721186bceb62bb11694906 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 21 Mar 2015 19:59:07 +0000 Subject: [PATCH 6/9] Fixed #4465 - Added syntool sign call --- ext/toolchain/commands1.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index 4355f982..31074cb0 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -803,6 +803,7 @@ class InternalCommands: self.signFile(pfx, pwd, 'bin/Release', 'synergyc.exe') self.signFile(pfx, pwd, 'bin/Release', 'synergys.exe') self.signFile(pfx, pwd, 'bin/Release', 'synergyd.exe') + self.signFile(pfx, pwd, 'bin/Release', 'syntool.exe') self.signFile(pfx, pwd, 'bin/Release', 'synwinhk.dll') def signFile(self, pfx, pwd, dir, file): From a833611804bbd5359845ffac30756d1db0bfff02 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 21 Mar 2015 20:01:13 +0000 Subject: [PATCH 7/9] Updated ChangeLog for 1.6.3 --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index ee6e9e6a..0e00bdc6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ Bug #4349 - Mouse click does not always bring window to front Bug #4463 - Unidentified developer error on Mac OS X Bug #4464 - Code signing verify failure not reported on Mac build +Bug #4465 - Binary (syntool) is not code signed on Windows Enhancement #4455 - Replace version with branch name in package filename 1.6.2 From 162ed1fef55b7976a10e7cc45b9180c587b25171 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 21 Mar 2015 21:15:53 +0000 Subject: [PATCH 8/9] Disabled code signing for old Qt versions #4464 --- ext/toolchain/commands1.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index 31074cb0..3b234161 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -775,9 +775,16 @@ class InternalCommands: if sys.version_info < (2, 4): raise Exception("Python 2.4 or greater required.") - output = commands.getstatusoutput( - "macdeployqt %s/Synergy.app -verbose=2 -codesign='%s'" % ( - targetDir, self.macIdentity)) + (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]: From 9706252fb9df7b3a52624b99963e43e30a9515c7 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 21 Mar 2015 22:01:49 +0000 Subject: [PATCH 9/9] Only trust errors for macdeployqt 5+ #4464 --- ext/toolchain/commands1.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index 3b234161..9f4cb4a5 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -788,7 +788,10 @@ class InternalCommands: print output[1] if "ERROR" in output[1]: - raise Exception("macdeployqt failed") + (qMajor, qMinor, qRev) = self.getQmakeVersion() + if qMajor >= 5: + # only listen to errors in qt 5+ + raise Exception("macdeployqt failed") def signmac(self): print "signmac is now obsolete"