xcpretty / xcode-install

🔽 Install and update your Xcodes
https://fastlane.tools
MIT License
2.59k stars 243 forks source link

Feature/adding new cli option to define number of try for downloading DMG file #404

Closed gunesmes closed 4 years ago

gunesmes commented 4 years ago

There are several issues related to downloading the DMG file since it is a several gig file, downloading this file requires more than 3 retries. For my experience, I set to retry option 100 and it completed the downloading around 45th try.

I added a CLI option to define how many times it tries to download the file.

issues:

Xcode

without --retry, default is 3

bash-3.2$ xcversion install 11.6

install 11.6
Available session is not valid any more. Continuing with normal login.
100   305  100   305    0     0    340      0 --:--:-- --:--:-- --:--:--   340%
100   305  100   305    0     0    340      0 --:--:-- --:--:-- --:--:--   340
100   305  100   305    0     0    340      0 --:--:-- --:--:-- --:--:--   340
  0 7770M    0 70.6M    0     0   488k      0  4:31:27  0:02:28  4:28:59     0%
curl: (18) transfer closed with 8074031871 bytes remaining to read
100   309  100   309    0     0    267      0  0:00:01  0:00:01 --:--:--   267%
100   305  100   305    0     0    154      0  0:00:01  0:00:01 --:--:--  297k
100   305  100   305    0     0    154      0  0:00:01  0:00:01 --:--:--  297k
100   305  100   305    0     0    154      0  0:00:01  0:00:01 --:--:--  297k
  1 7699M    1 77.4M    0     0   734k      0  2:58:51  0:01:47  2:57:04  533k%
curl: (18) transfer closed with 7992796651 bytes remaining to read
100   305  100   305    0     0    335      0 --:--:-- --:--:-- --:--:--  297k%
100   305  100   305    0     0    335      0 --:--:-- --:--:-- --:--:--  297k
100   305  100   305    0     0    335      0 --:--:-- --:--:-- --:--:--  297k
  0 7622M    0 73.9M    0     0   689k      0  3:08:39  0:01:49  3:06:50  862k%
curl: (18) transfer closed with 7915294483 bytes remaining to read
%[!] Failed to download Xcode 11.6.
bash-3.2$

with --retry=4 will try to dowload 4 times

bash-3.2$ xcversion install 11.6 --retry=4

install 11.6 --retry=4
Available session is not valid any more. Continuing with normal login.
100   309  100   309    0     0    278      0  0:00:01  0:00:01 --:--:--   278%
100   305  100   305    0     0    158      0  0:00:01  0:00:01 --:--:--  297k
100   305  100   305    0     0    158      0  0:00:01  0:00:01 --:--:--  297k
100   305  100   305    0     0    158      0  0:00:01  0:00:01 --:--:--  297k
  3 6372M    3  219M    0     0   651k      0  2:47:03  0:05:45  2:41:18 94185%
curl: (18) transfer closed with 6452085416 bytes remaining to read
100   305  100   305    0     0    304      0  0:00:01  0:00:01 --:--:--  297k%
  2 6153M    2  184M    0     0   479k      0  3:38:59  0:06:33  3:32:26  603k%
curl: (18) transfer closed with 6258910537 bytes remaining to read
100   309  100   309    0     0    409      0 --:--:-- --:--:-- --:--:--   409%
100   309  100   309    0     0    409      0 --:--:-- --:--:-- --:--:--   409
100   305  100   305    0     0    193      0  0:00:01  0:00:01 --:--:--  297k
100   305  100   305    0     0    193      0  0:00:01  0:00:01 --:--:--  297k
  4 5968M    4  276M    0     0   705k      0  2:24:22  0:06:40  2:17:42  628k%
curl: (18) transfer closed with 5969205301 bytes remaining to read
100   309  100   309    0     0    414      0 --:--:-- --:--:-- --:--:--   414%
100   305  100   305    0     0    266      0  0:00:01  0:00:01 --:--:--   266
100   305  100   305    0     0    266      0  0:00:01  0:00:01 --:--:--   266
  3 5692M    3  227M    0     0   733k      0  2:12:32  0:05:17  2:07:15  667k%
curl: (18) transfer closed with 5731145963 bytes remaining to read
%[!] Failed to download Xcode 11.6.
bash-3.2$

Simulator

without --retry, default is 3

bash-3.2$ xcversion simulators --install='iOS 11.0 Simulator'

simulators --install=iOS 11.0 Simulator
  9 1989M    9  189M    0     0  1677k      0  0:20:14  0:01:55  0:18:19 1805k%
curl: (18) transfer closed with 1886829804 bytes remaining to read
  5 1799M    5  105M    0     0  1697k      0  0:18:05  0:01:03  0:17:02 1811k%
curl: (18) transfer closed with 1776103408 bytes remaining to read
  9 1693M    9  163M    0     0  1590k      0  0:18:10  0:01:45  0:16:25 1541k%
curl: (18) transfer closed with 1604346613 bytes remaining to read
%[!] Failed to download iOS 11.0 Simulator.

with --retry=5 will try to dowload 5 times

bash-3.2$ xcversion simulators --install='iOS 10.3.1 Simulator' --retry=5

simulators --install=iOS 10.3.1 Simulator --retry=5
 13 1198M   13  164M    0     0   717k      0  0:28:30  0:03:54  0:24:36  861k%
curl: (18) transfer closed with 1084795514 bytes remaining to read
 34  865M   34  298M    0     0  1421k      0  0:10:23  0:03:34  0:06:49 1855k%
curl: (18) transfer closed with 595033804 bytes remaining to read
 31  528M   31  163M    0     0  1653k      0  0:05:27  0:01:41  0:03:46 1737k%
curl: (18) transfer closed with 381830355 bytes remaining to read
 45  364M   45  163M    0     0  1194k      0  0:05:12  0:02:20  0:02:52  354k%
curl: (18) transfer closed with 209942487 bytes remaining to read
 53  200M   53  107M    0     0  1510k      0  0:02:15  0:01:12  0:01:03 1760k%
curl: (18) transfer closed with 97659610 bytes remaining to read
%[!] Failed to download iOS 10.3.1 Simulator.
bash-3.2$