Skip to content
This repository was archived by the owner on Jul 8, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions device.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ def f(*popenargs, **kwargs):

import deviceconnection

from paramiko import SSHClient
from scp import SCPClient

logger = logging.getLogger('worker.'+__name__)

class iDevice(object):
Expand Down Expand Up @@ -255,8 +258,32 @@ def archive(self, bundleId, app_archive_folder, app_only=True):

if not os.path.exists(app_archive_folder):
os.makedirs(app_archive_folder)

if self.ios_version()[0] > 8:
logger.info("try archiving app %s with tweak" % (bundleId))

result = True

pilot = Pilot(self.base_url())
device_ipa = pilot.archive(bundleId)

try:
ssh = SSHClient()
ssh.load_system_host_keys()
ssh.connect(device_handler.device_connection_info(self.udid)[0], username='root')
scp = SCPCleint(ssh.get_transport())
scp.get(device_ipa, local_path='%s/%s.ipa' % (app_archive_folder, bundleId))
scp.close()
ssh.close()
except SCPException as e:
logger.error('archiving app %s failed with: %s', bundleId, e)
result=False

return result

logger.debug('try archiving app %s with cmd: %s' % (bundleId, ' '.join(options)))
result=True

try:
output = subprocess.check_output(options)
logger.debug('output: %s' % output)
Expand Down
4 changes: 3 additions & 1 deletion job.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ def execute(self):
bundleId = jobInfo['bundleId']

if self.device.ios_version()[0] > 8:
logger.debug("skipping app archiving since device is running iOS 9 or later")
logger.debug("try archiving app with tweak")
if not self.backend.has_app_archive(self.appId):
self._archive_app_binary(bundleId)
else:
logger.debug("check if backend already has an app ipa")
if not self.backend.has_app_archive(self.appId):
Expand Down
9 changes: 7 additions & 2 deletions pilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,13 @@ def run_auto_execution(self, bundleId, taskInfo={}):
logger.info('execution of %s finished', bundleId)
return True



def archive(self, bundleId):
logger.info("archiving %s", bundleId)
r = requests.get("%s/archive/%s" % (self.baseUrl, bundleId))
if (r.status_code != 200):
logger.error("Failed to archive! <%s> Response: %s" % (bundleId, r.text))
return None
return r.json()['file']

def inject(self, process, command, taskInfo={}):
data = {
Expand Down