/// <summary>
        /// Derives the package architecture from a .NET runtime identiifer.
        /// </summary>
        /// <param name="runtimeIdentifier">
        /// The runtime identifier.
        /// </param>
        /// <returns>
        /// The equivalent package architecture.
        /// </returns>
        public static string GetPackageArchitecture(string runtimeIdentifier)
        {
            // Valid architectures can be obtained by running "dpkg-architecture --list-known"
            RuntimeIdentifiers.ParseRuntimeId(runtimeIdentifier, out _, out _, out Architecture? architecture, out _);

            if (architecture != null)
            {
                switch (architecture.Value)
                {
                case Architecture.Arm:
                    return("armhf");

                case Architecture.Arm64:
                    return("arm64");

                case Architecture.X64:
                    return("amd64");

                case Architecture.X86:
                    return("i386");
                }
            }

            return("all");
        }
Exemplo n.º 2
0
        /// <summary>
        /// Derives the package architecture from a .NET runtime identiifer.
        /// </summary>
        /// <param name="runtimeIdentifier">
        /// The runtime identifier.
        /// </param>
        /// <returns>
        /// The equivalent package architecture.
        /// </returns>
        public static string GetPackageArchitecture(string runtimeIdentifier)
        {
            // Some architectures are listed here:
            // - https://wiki.centos.org/Download
            // - https://docs.fedoraproject.org/ro/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch01s03.html
            RuntimeIdentifiers.ParseRuntimeId(runtimeIdentifier, out _, out _, out Architecture? architecture, out _);

            if (architecture != null)
            {
                switch (architecture.Value)
                {
                case Architecture.Arm:
                    return("armhfp");

                case Architecture.Arm64:
                    return("aarch64");

                case Architecture.X64:
                    return("x86_64");

                case Architecture.X86:
                    return("i386");
                }
            }

            return("any");
        }