From 1cea274ccd7102abc407c82eda85fc76e95fef6d Mon Sep 17 00:00:00 2001 From: Gonzalo Exequiel Pedone Date: Sun, 16 Aug 2020 16:33:16 -0300 Subject: [PATCH] Improved error messages in CmdParser. Clear all formats when deleting a device. Sign Mac package with default developer signature. --- Manager/src/cmdparser.cpp | 40 ++++++++++++++------------ cmio/PlatformUtils/src/preferences.cpp | 2 ++ ports/deploy/deploy_mac.py | 12 ++++++++ ports/deploy/installscript.mac.qs | 4 +-- 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/Manager/src/cmdparser.cpp b/Manager/src/cmdparser.cpp index bed4144..31b97e3 100644 --- a/Manager/src/cmdparser.cpp +++ b/Manager/src/cmdparser.cpp @@ -710,11 +710,12 @@ int AkVCam::CmdParserPrivate::removeDevice(const StringMap &flags, return -1; } + auto deviceId = args[1]; auto devices = this->m_ipcBridge.devices(); - auto it = std::find(devices.begin(), devices.end(), args[1]); + auto it = std::find(devices.begin(), devices.end(), deviceId); if (it == devices.end()) { - std::cerr << "Device doesn't exists." << std::endl; + std::cerr << "'" << deviceId << "' doesn't exists." << std::endl; return -1; } @@ -748,11 +749,12 @@ int AkVCam::CmdParserPrivate::showDeviceType(const StringMap &flags, return -1; } + auto deviceId = args[1]; auto devices = this->m_ipcBridge.devices(); - auto it = std::find(devices.begin(), devices.end(), args[1]); + auto it = std::find(devices.begin(), devices.end(), deviceId); if (it == devices.end()) { - std::cerr << "device doesn't exists." << std::endl; + std::cerr << "'" << deviceId << "' doesn't exists." << std::endl; return -1; } @@ -776,11 +778,12 @@ int AkVCam::CmdParserPrivate::showDeviceDescription(const StringMap &flags, return -1; } + auto deviceId = args[1]; auto devices = this->m_ipcBridge.devices(); - auto it = std::find(devices.begin(), devices.end(), args[1]); + auto it = std::find(devices.begin(), devices.end(), deviceId); if (it == devices.end()) { - std::cerr << "Device doesn't exists." << std::endl; + std::cerr << "'" << deviceId << "' doesn't exists." << std::endl; return -1; } @@ -803,10 +806,10 @@ int AkVCam::CmdParserPrivate::setDeviceDescription(const AkVCam::StringMap &flag auto deviceId = args[1]; auto devices = this->m_ipcBridge.devices(); - auto dit = std::find(devices.begin(), devices.end(), args[1]); + auto dit = std::find(devices.begin(), devices.end(), deviceId); if (dit == devices.end()) { - std::cerr << "device doesn't exists." << std::endl; + std::cerr << "'" << deviceId << "' doesn't exists." << std::endl; return -1; } @@ -854,11 +857,12 @@ int AkVCam::CmdParserPrivate::showFormats(const StringMap &flags, return -1; } + auto deviceId = args[1]; auto devices = this->m_ipcBridge.devices(); - auto it = std::find(devices.begin(), devices.end(), args[1]); + auto it = std::find(devices.begin(), devices.end(), deviceId); if (it == devices.end()) { - std::cerr << "device doesn't exists." << std::endl; + std::cerr << "'" << deviceId << "' doesn't exists." << std::endl; return -1; } @@ -910,10 +914,10 @@ int AkVCam::CmdParserPrivate::addFormat(const StringMap &flags, auto deviceId = args[1]; auto devices = this->m_ipcBridge.devices(); - auto dit = std::find(devices.begin(), devices.end(), args[1]); + auto dit = std::find(devices.begin(), devices.end(), deviceId); if (dit == devices.end()) { - std::cerr << "device doesn't exists." << std::endl; + std::cerr << "'" << deviceId << "' doesn't exists." << std::endl; return -1; } @@ -998,10 +1002,10 @@ int AkVCam::CmdParserPrivate::removeFormat(const StringMap &flags, auto deviceId = args[1]; auto devices = this->m_ipcBridge.devices(); - auto dit = std::find(devices.begin(), devices.end(), args[1]); + auto dit = std::find(devices.begin(), devices.end(), deviceId); if (dit == devices.end()) { - std::cerr << "device doesn't exists." << std::endl; + std::cerr << "'" << deviceId << "' doesn't exists." << std::endl; return -1; } @@ -1041,10 +1045,10 @@ int AkVCam::CmdParserPrivate::removeFormats(const AkVCam::StringMap &flags, auto deviceId = args[1]; auto devices = this->m_ipcBridge.devices(); - auto dit = std::find(devices.begin(), devices.end(), args[1]); + auto dit = std::find(devices.begin(), devices.end(), deviceId); if (dit == devices.end()) { - std::cerr << "device doesn't exists." << std::endl; + std::cerr << "'" << deviceId << "' doesn't exists." << std::endl; return -1; } @@ -1083,10 +1087,10 @@ int AkVCam::CmdParserPrivate::showConnections(const StringMap &flags, auto deviceId = args[1]; auto devices = this->m_ipcBridge.devices(); - auto dit = std::find(devices.begin(), devices.end(), args[1]); + auto dit = std::find(devices.begin(), devices.end(), deviceId); if (dit == devices.end()) { - std::cerr << "device doesn't exists." << std::endl; + std::cerr << "'" << deviceId << "' doesn't exists." << std::endl; return -1; } diff --git a/cmio/PlatformUtils/src/preferences.cpp b/cmio/PlatformUtils/src/preferences.cpp index b63a012..9a136de 100644 --- a/cmio/PlatformUtils/src/preferences.cpp +++ b/cmio/PlatformUtils/src/preferences.cpp @@ -370,6 +370,8 @@ void AkVCam::Preferences::removeCamera(const std::string &path) if (cameraIndex < 0) return; + cameraSetFormats(cameraIndex, {}); + auto nCameras = camerasCount(); deleteAllKeys("cameras." + std::to_string(cameraIndex)); diff --git a/ports/deploy/deploy_mac.py b/ports/deploy/deploy_mac.py index 0f18819..3e57f0a 100644 --- a/ports/deploy/deploy_mac.py +++ b/ports/deploy/deploy_mac.py @@ -73,6 +73,8 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt): self.binaryInstallDir) print('\nWritting build system information\n') self.writeBuildInfo() + print('\nSigning bundle\n') + self.signPackage(self.appBundleDir) def commitHash(self): try: @@ -188,6 +190,16 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt): size += os.path.getsize(fpath) return size + + def signPackage(self, package): + process = subprocess.Popen(['codesign', # nosec + '--force', + '--sign', + '-', + package], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + process.communicate() def createAppInstaller(self, mutex): packagePath = self.createInstaller() diff --git a/ports/deploy/installscript.mac.qs b/ports/deploy/installscript.mac.qs index 58b8b97..86f4a20 100644 --- a/ports/deploy/installscript.mac.qs +++ b/ports/deploy/installscript.mac.qs @@ -26,11 +26,11 @@ Component.prototype.createOperations = function() component.addElevatedOperation("Execute", "chmod", - "+x", + "a+x", "@TargetDir@/@Name@.plugin/Contents/Resources/AkVCamAssistant"); component.addElevatedOperation("Execute", "chmod", - "+x", + "a+x", "@TargetDir@/@Name@.plugin/Contents/Resources/AkVCamManager"); }