xcpretty / xcode-install

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

Xcode 11.4 beta 3 installs instead of 11.4 GM #381

Closed OdNairy closed 4 years ago

OdNairy commented 4 years ago

xcversion list presents a list with "11.4" and "11.4 beta 3". However, with xcversion install "11.4" it downloads and installs beta 3 (11N132i build number). The problem was reproduced twice on the same mac.

xcode-install v. 2.6.3 ruby v. 2.6.3 gem v. 3.0.4

eugene-krinitsyn commented 4 years ago

@OdNairy I was able to hotfix this locally.

Navigate to /Users/username/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/xcode-install-2.6.3/lib/xcode/install.rb (if you're using rbenv)

Below line 384 (@xcodes += prereleases.reject { |pre| names.include?(pre.name) })

put the following: @xcodes = @xcodes.reject { |xcode| xcode.name.include?("beta") }

Note that this will break the ability to install beta versions in future until you install a new version of xcode-install or remove the fix manually.

Also check a relevant issue's thread.

robertwijas commented 4 years ago

I think the problem is here:

https://github.com/xcpretty/xcode-install/blob/18c402c3c487c83352a1669ba781fe9ac5574782/lib/xcode/install.rb#L169-L172

It's matching the version too soon. The code shows that name match has the highest priority but the version is matched before it has a chance to find name match.

My fix would be:

      seedlist.each do |current_seed|
        return current_seed if current_seed.name == version
      end

      seedlist.each do |current_seed|
        return current_seed if parsed_version && current_seed.version == parsed_version
      end
OdNairy commented 4 years ago

/cc @joshdholtz

OdNairy commented 4 years ago

@robertwijas Awesome. Possibly you can make a Pull Request with your changes?

robertwijas commented 4 years ago

Done 🎉

edulpn commented 4 years ago

I'm trying to install 11.4 (the stable one) and it installs 11.4 beta 3 instead. I've already updated the gem after the PR above was merged, but still no go. Bad thing is that there is no way to see what is going to be installed before it downloads like 8GB and takes half an hour extracting...

edulpn commented 4 years ago
❯ xcversion install 11.4
-------------------------------------------------------------------------------------
Please provide your Apple Developer Program account credentials
The login information you enter will be stored in your macOS Keychain
You can also pass the password using the `FASTLANE_PASSWORD` environment variable
See more information about it on GitHub: https://github.com/fastlane/fastlane/tree/master/credentials_manager
-------------------------------------------------------------------------------------
Username: 
100   323  100   323    0     0    155      0  0:00:02  0:00:02 --:--:--   154%
100   305  100   305    0     0    119      0  0:00:02  0:00:02 --:--:--   119
100 7726M  100 7726M    0     0  3220k      0  0:40:56  0:40:56 --:--:-- 3924k%
%Please authenticate for Xcode installation.
Password:
/Applications/Xcode-11.4.app: valid on disk
/Applications/Xcode-11.4.app: satisfies its Designated Requirement

[17:24:53]: Verifying your Xcode installation at path '/Applications/Xcode-11.4.app'...
[17:24:53]: Verifying Xcode was signed by Apple Inc.
[17:24:53]: $ codesign --display --verbose=4 /Applications/Xcode-11.4.app
[17:24:57]: ▸ Executable=/Applications/Xcode-11.4.app/Contents/MacOS/Xcode
[17:24:57]: ▸ Identifier=com.apple.dt.Xcode
[17:24:57]: ▸ Format=app bundle with Mach-O thin (x86_64)
[17:24:57]: ▸ CodeDirectory v=20200 size=466 flags=0x2000(library-validation) hashes=7+5 location=embedded
[17:24:57]: ▸ VersionPlatform=1
[17:24:57]: ▸ VersionMin=658944
[17:24:57]: ▸ VersionSDK=659204
[17:24:57]: ▸ Hash type=sha256 size=32
[17:24:57]: ▸ CandidateCDHash sha256=626d94ddbd31a4e51a6d360780ae64a1e21289ff
[17:24:57]: ▸ CandidateCDHashFull sha256=626d94ddbd31a4e51a6d360780ae64a1e21289ffabcd9590be4be6374869a618
[17:24:57]: ▸ Hash choices=sha256
[17:24:57]: ▸ CMSDigest=626d94ddbd31a4e51a6d360780ae64a1e21289ffabcd9590be4be6374869a618
[17:24:57]: ▸ CMSDigestType=2
[17:24:57]: ▸ Page size=4096
[17:24:57]: ▸ CDHash=626d94ddbd31a4e51a6d360780ae64a1e21289ff
[17:24:57]: ▸ Signature size=4547
[17:24:57]: ▸ Authority=Software Signing
[17:24:57]: ▸ Authority=Apple Code Signing Certification Authority
[17:24:57]: ▸ Authority=Apple Root CA
[17:24:57]: ▸ Info.plist entries=40
[17:24:57]: ▸ TeamIdentifier=59GAB85EFG
[17:24:57]: ▸ Sealed Resources version=2 rules=13 files=308569
[17:24:57]: ▸ Internal requirements count=1 size=68
[17:24:58]: Successfully verified the code signature ✅
[17:24:58]: Verifying Xcode using GateKeeper...
[17:24:58]: This will take up to a few minutes, now is a great time to go for a coffee ☕...
[17:24:58]: $ /usr/sbin/spctl --assess --verbose /Applications/Xcode-11.4.app
[17:26:31]: ▸ /Applications/Xcode-11.4.app: accepted
[17:26:31]: ▸ source=Apple System
[17:26:31]: Successfully verified Xcode installation at path '/Applications/Xcode-11.4.app' 🎧
Xcode 11.4
Build version 11N132i
edulpn commented 4 years ago

image

OdNairy commented 4 years ago

Hi, @edulpn @robertwijas implemented the fix which should be merged soon. You can track Pull Request status on this page: https://github.com/xcpretty/xcode-install/pull/382

edulpn commented 4 years ago

ah, makes sense... sorry guys, thought it was already merged, my bad!