mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 02:36:39 +00:00
feat(build): handle macOS Big Sur and later version number
This commit is contained in:
@@ -53,7 +53,7 @@ class OSVersion
|
||||
end
|
||||
|
||||
def to_s
|
||||
@to_s ||= "#{major}.#{minor}"
|
||||
@to_s ||= major >= 11 ? major.to_s : "#{major}.#{minor}"
|
||||
end
|
||||
|
||||
def major
|
||||
|
||||
@@ -2,6 +2,7 @@ package osinfo
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -29,8 +30,17 @@ func New() (*OSInfo, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *OSInfo) MajorMinor() string {
|
||||
// DistinctVersion returns macOS version down to a distinct "major"
|
||||
// version. For macOS 10.x, this will include the first two numeric parts of the
|
||||
// version (10.15), while for 11.x and later, the first numeric part is enough
|
||||
// (11).
|
||||
func (s *OSInfo) DistinctVersion() string {
|
||||
parts := strings.Split(s.Version, ".")
|
||||
|
||||
if n, _ := strconv.Atoi(parts[0]); n >= 11 {
|
||||
return parts[0]
|
||||
}
|
||||
|
||||
max := len(parts)
|
||||
if max > 2 {
|
||||
max = 2
|
||||
|
||||
@@ -77,7 +77,7 @@ func Create(ctx context.Context, opts *Options) (*Plan, error) {
|
||||
buildName := fmt.Sprintf(
|
||||
"Emacs.%s.%s.%s",
|
||||
version,
|
||||
sanitizeString(osInfo.Name+"-"+osInfo.MajorMinor()),
|
||||
sanitizeString(osInfo.Name+"-"+osInfo.DistinctVersion()),
|
||||
sanitizeString(osInfo.Arch),
|
||||
)
|
||||
diskImage := buildName + ".dmg"
|
||||
|
||||
Reference in New Issue
Block a user