Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Linux] Properly parse single-digit Ubuntu version (#5463)
Fixes: #4929 Some releases of Ubuntu use only a single digit for their version: OS type: Linux OS name: Linux Mint OS release: 20 OS bits: x86_64 CPU count: 2 This would cause `xaprepare` to error out on these platforms: $ make prepare … Error: Unable to parse string '20' as a valid Ubuntu release version Failed to initialize operating system support System.InvalidOperationException: Failed to initialize operating system support at Xamarin.Android.Prepare.OS.Init () [0x00024] in /home/zola/Desktop/xamarin-android/build-tools/xaprepare/xaprepare/OperatingSystems/OS.cs:243 at Xamarin.Android.Prepare.Context.Init (System.String scenarioName) [0x0022d] in /home/zola/Desktop/xamarin-android/build-tools/xaprepare/xaprepare/Application/Context.cs:766 at Xamarin.Android.Prepare.App.Run (System.String[] args) [0x00793] in /home/zola/Desktop/xamarin-android/build-tools/xaprepare/xaprepare/Main.cs:153 make: *** [Makefile:204: prepare] Error 1 If `Version.TryParse()` fails to parse `OS release`, add a fallback which uses `Int32.TryParse()`. This should allow `make prepare` to run on these Linux platforms. Additionally, don't hardcode `Ubuntu` into the error message, use the actual (derived) distro name instead.
- Loading branch information