truncate_platform_version

in lib/omnibus/metadata.rb [170:228]


      def truncate_platform_version(platform_version, platform)
        case platform
        when "centos", "cumulus", "debian", "el", "fedora", "freebsd", "omnios", "pidora", "raspbian", "rhel", "sles", "suse", "smartos"
          
          platform_version.split(".").first
        when "aix", "alpine", "openbsd", "slackware", "solaris2", "opensuse", "opensuseleap", "ubuntu", "amazon"
          
          platform_version.split(".")[0..1].join(".")
        when "mac_os_x", "darwin", "macos"
          
          pv_bits = platform_version.split(".")
          pv_bits[0].to_i >= 11 ? pv_bits[0] : pv_bits[0..1].join(".")
        when "arch", "gentoo", "kali"
          
          "rolling"
        when "windows"
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          case platform_version
          when "5.0.2195", "2000"   then "2000"
          when "5.1.2600", "xp"     then "xp"
          when "5.2.3790", "2003r2" then "2003r2"
          when "6.0.6001", "2008"   then "2008"
          when "6.1.7600", "7"      then "7"
          when "6.1.7601", "2008r2" then "2008r2"
          when "6.2.9200", "2012"   then "2012"
          
          
          
          when "6.2.9200", "8"      then "8"
          when /6\.3\.\d+/, "2012r2" then "2012r2"
          
          
          
          when /6\.3\.\d+/, "8.1" then "8.1"
          when "10", /^10\.0/ then "10"
          else
            raise UnknownPlatformVersion.new(platform, platform_version)
          end
        else
          raise UnknownPlatform.new(platform)
        end
      end