Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode 11.4 beta 3 installs instead of 11.4 GM #381

Closed
OdNairy opened this issue Mar 25, 2020 · 10 comments · Fixed by #382
Closed

Xcode 11.4 beta 3 installs instead of 11.4 GM #381

OdNairy opened this issue Mar 25, 2020 · 10 comments · Fixed by #382

Comments

@OdNairy
Copy link

OdNairy commented Mar 25, 2020

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
Copy link

@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
Copy link
Contributor

I think the problem is here:

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

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
Copy link
Author

OdNairy commented Mar 25, 2020

/cc @joshdholtz

@OdNairy
Copy link
Author

OdNairy commented Mar 25, 2020

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

robertwijas added a commit to robertwijas/xcode-install that referenced this issue Mar 25, 2020
It was finding a beta version despite the release one being already available (11.4 beta instead of 11.4).
Now it tries to match the name first and when nothing matches it falls back to matching version.

Resolves xcpretty#381

Solution proposed here: xcpretty#381 (comment).
@robertwijas
Copy link
Contributor

Done 🎉

@edulpn
Copy link

edulpn commented Apr 1, 2020

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
Copy link

edulpn commented Apr 1, 2020

❯ 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
Copy link

edulpn commented Apr 1, 2020

image

@OdNairy
Copy link
Author

OdNairy commented Apr 2, 2020

Hi, @edulpn
@robertwijas implemented the fix which should be merged soon.
You can track Pull Request status on this page: #382

@edulpn
Copy link

edulpn commented Apr 2, 2020

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

@jpsim jpsim closed this as completed in #382 Apr 2, 2020
sfo-den pushed a commit to sfo-den/xcode-install that referenced this issue Oct 6, 2024
It was finding a beta version despite the release one being already available (11.4 beta instead of 11.4).
Now it tries to match the name first and when nothing matches it falls back to matching version.

Resolves xcpretty/xcode-install#381

Solution proposed here: xcpretty/xcode-install#381 (comment).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants