From ca88be85165f8ffb71d52c33fcebfb0ea346ded5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karsten=20K=C3=B6nig?= Date: Tue, 24 Mar 2015 15:29:58 +0100 Subject: [PATCH 1/4] install not on devices which do not match the minimal needed iOS version --- documents.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/documents.py b/documents.py index 5581011..a78462e 100644 --- a/documents.py +++ b/documents.py @@ -223,6 +223,11 @@ def can_run_on_device(self, device): if country == acc.storeCountry: return True return False + if 'minimumOSVersion' in self.jobInfo: + minimumOSVersion = int(self.jobInfo['minimumOSVersion']) + productVersion = int(''.join(device['deviceInfo']['ProductVersion'].split('.'))) + if productVersion < minimumOSVersion: + return False return True From 375ae412eb1b8c21b0ddcfde4aadacdeb17a70a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karsten=20K=C3=B6nig?= Date: Tue, 24 Mar 2015 16:08:45 +0100 Subject: [PATCH 2/4] added .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9765c3f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*pyc +*# +.#* From f2385f742291af2c8000cd3afb071bc55653bdd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karsten=20K=C3=B6nig?= Date: Tue, 24 Mar 2015 16:22:10 +0100 Subject: [PATCH 3/4] documents.py: add error message field to the job document class --- documents.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/documents.py b/documents.py index a78462e..1e22982 100644 --- a/documents.py +++ b/documents.py @@ -160,7 +160,8 @@ class Job(BackendDocument): #TODO accountId, bundleId, storeCountry, appType{AppStoreApp,CydiaApp}, executionStrategy{DefaultExecution,OpenCloseExecution,RandomExecution,SmartExecution} 'worker': Worker, 'device': Device, - 'date_added': float + 'date_added': float, + 'error_message': unicode } required_fields = ['type', 'state', 'jobInfo'] default_values = { From 90648ab7800febd1ad10bb1f5117a2ab59ded6d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karsten=20K=C3=B6nig?= Date: Thu, 26 Mar 2015 11:13:42 +0100 Subject: [PATCH 4/4] documents.py: remember already tried device classes in Job document --- documents.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/documents.py b/documents.py index 1e22982..f0486d3 100644 --- a/documents.py +++ b/documents.py @@ -161,12 +161,15 @@ class Job(BackendDocument): 'worker': Worker, 'device': Device, 'date_added': float, - 'error_message': unicode + 'error_message': unicode, + 'compatible_devices': int } required_fields = ['type', 'state', 'jobInfo'] default_values = { 'date_added': time.time, - 'state': STATE.UNDEFINED + 'state': STATE.UNDEFINED, + # 100 for ipad, 10 for iPhone and 1 for iPod + 'compatible_devices': 0b111 } indexes = [{ 'fields':['type', 'state'], @@ -229,7 +232,19 @@ def can_run_on_device(self, device): productVersion = int(''.join(device['deviceInfo']['ProductVersion'].split('.'))) if productVersion < minimumOSVersion: return False - return True + + deviceClass = device['deviceInfo']['DeviceClass'] + if deviceClass == 'iPad': + deviceClassValue = 0b100 + elif deviceClass == 'iPhone': + deviceClassValue = 0b10 + else: + deviceClassValue = 0b1 + + if not self.compatible_devices & deviceClassValue: + return False + else: + return True # A app is a concrete app (user account, version, bundleID) under test