Compare commits

...

6 Commits

Author SHA1 Message Date
f52dd8dc6d chore(release): 0.6.6 2021-07-01 23:52:50 +01:00
4cdbaf1ec0 chore(cask): fix cask vs formula terminology
Homebrew casks are their own thing, separate from formulas. Hence remove
all mentions to "formula" to avoid confusion.
2021-07-01 23:50:50 +01:00
f3a289b11c chore(release): 0.6.5 2021-07-01 23:37:21 +01:00
9019e73d60 fix(native_comp): improve handling of *.eln files in .app bundle
Specifically support latest changes in master which places *.eln files
within the .app bundle in "Contents/Frameworks".
2021-07-01 23:33:50 +01:00
28930381a8 chore(release): 0.6.4 2021-06-30 10:41:34 +01:00
df25e54ef7 chore(sign): simplify *.eln locating logic
Instead of only checking very specific paths within the .app bundle,
just check the whole bundle for any and all *.eln files.
2021-06-30 10:20:22 +01:00
5 changed files with 50 additions and 61 deletions

View File

@@ -2,6 +2,17 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [0.6.6](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.5...v0.6.6) (2021-07-01)
### [0.6.5](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.4...v0.6.5) (2021-07-01)
### Bug Fixes
* **native_comp:** improve handling of *.eln files in .app bundle ([9019e73](https://github.com/jimeh/build-emacs-for-macos/commit/9019e73d606f0379f988f46d6008770f8f3f7a51))
### [0.6.4](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.3...v0.6.4) (2021-06-30)
### [0.6.3](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.2...v0.6.3) (2021-06-29)

View File

@@ -412,20 +412,17 @@ class Build
contents_dir = File.join(app, 'Contents')
FileUtils.cd(contents_dir) do
# Skip creation of symlinks if *.eln files are located under
# Resources/native-lisp. Emacs is capable of finding lisp sources and
# *.eln cache files without symlinks.
return if Dir['Resources/native-lisp/**/*.eln'].any?
info 'Creating symlinks within Emacs.app needed for native-comp'
FileUtils.ln_s('Resources/lisp', 'lisp') unless File.exist?('lisp')
source = Dir['MacOS/libexec/emacs/**/eln-cache',
'MacOS/lib/emacs/**/native-lisp'].first
if source.nil?
err 'Failed to find native-lisp cache directory for symlink creation.'
# Skip creation of symlinks if *.eln files are not located in a location
# known to be used by builds which need symlinks and other tweaks.
return if source.nil?
info 'Creating symlinks within Emacs.app needed for native-comp'
if !File.exist?('lisp') && File.exist?('Resources/lisp')
FileUtils.ln_s('Resources/lisp', 'lisp')
end
# Check for folder name containing two dots (.), as this causes Apple's
@@ -435,10 +432,9 @@ class Build
# The workaround for now is to rename the folder replacing the dots with
# hyphens (-), and create the native-lisp symlink pointing to the new
# location.
if source.match(%r{/.+\..+\..+/})
# Dig deeper into native-lisp directory
eln_dir = File.dirname(Dir[File.join(source, '**', '*.eln')].first)
eln_dir = File.dirname(Dir[File.join(source, '**', '*.eln')].first)
if eln_dir.match(%r{/.+\..+\..+/})
base = File.basename(eln_dir)
parent = File.dirname(eln_dir)

View File

@@ -42,11 +42,11 @@ type UpdateOptions struct {
// BuildsRepo is the GitHub repository containing binary releases.
BuildsRepo *repository.Repository
// TapRepo is the GitHub repository to update the cask formula in.
// TapRepo is the GitHub repository to update the casks in.
TapRepo *repository.Repository
// Ref is the git ref to apply cask formula updates on top of. Default
// branch will be used if empty.
// Ref is the git ref to apply cask updates on top of. Default branch will
// be used if empty.
Ref string
// OutputDir specifies a directory to write cask files to. When set, tap
@@ -56,10 +56,10 @@ type UpdateOptions struct {
// Force update will ignore the outdated live check flag, and process all
// casks regardless. But it will only update the cask in question if the
// resulting output cask formula is different.
// resulting output cask is different.
Force bool
// TemplatesDir is the directory where cask formula templates are located.
// TemplatesDir is the directory where cask templates are located.
TemplatesDir string
LiveChecks []*LiveCheck
@@ -150,7 +150,7 @@ func (s *Updater) putFile(
content []byte,
) (bool, error) {
parent := filepath.Dir(filename)
s.logger.Info("processing formula update",
s.logger.Info("processing cask update",
"output-directory", parent, "cask", chk.Cask, "file", filename,
)
@@ -164,18 +164,18 @@ func (s *Updater) putFile(
return false, err
}
infoMsg := "creating formula"
infoMsg := "creating cask"
if !os.IsNotExist(err) {
infoMsg = "updating formula"
infoMsg = "updating cask"
if bytes.Equal(existingContent, content) {
s.logger.Info(
"skip update: no change to cask formula content",
"skip update: no change to cask content",
"cask", chk.Cask, "file", filename,
)
s.logger.Debug(
"formula content",
"cask content",
"file", filename, "content", string(content),
)
@@ -198,7 +198,7 @@ func (s *Updater) putFile(
)
s.logger.Debug(
"formula content",
"cask content",
"file", filename, "content", string(content),
)
@@ -218,7 +218,7 @@ func (s *Updater) putRepoFile(
filename string,
content []byte,
) (bool, error) {
s.logger.Info("processing formula update",
s.logger.Info("processing cask update",
"tap-repo", repo.Source, "cask", chk.Cask, "file", filename,
)
repoContent, _, resp, err := s.gh.Repositories.GetContents(
@@ -264,12 +264,12 @@ func (s *Updater) createRepoFile(
diff := fmt.Sprint(gotextdiff.ToUnified(filename, filename, "", edits))
s.logger.Info(
"creating formula",
"creating cask",
"cask", chk.Cask, "version", chk.Version.Latest, "file", filename,
"diff", diff,
)
s.logger.Debug(
"formula content",
"cask content",
"file", filename, "content", string(content),
)
contResp, _, err := s.gh.Repositories.CreateFile(
@@ -307,7 +307,7 @@ func (s *Updater) updateRepoFile(
if existingContent == string(content) {
s.logger.Info(
"skip update: no change to formula content",
"skip update: no change to cask content",
"cask", chk.Cask, "file", filename,
)
@@ -329,12 +329,12 @@ func (s *Updater) updateRepoFile(
))
s.logger.Info(
"updating formula",
"updating cask",
"cask", chk.Cask, "version", chk.Version.Latest, "file", filename,
"diff", diff,
)
s.logger.Debug(
"formula content",
"cask content",
"file", filename, "content", string(content),
)

View File

@@ -23,7 +23,7 @@ func caskCmd() *cli2.Command {
return &cli2.Command{
Name: "cask",
Usage: "manage Homebrew Cask formula",
Usage: "manage Homebrew Casks",
Flags: []cli2.Flag{
&cli2.StringFlag{
Name: "builds-repository",
@@ -101,7 +101,7 @@ func caskUpdateCmd() *cli2.Command {
Name: "force",
Aliases: []string{"f"},
Usage: "force update file even if livecheck has it marked " +
"as not outdated (does not force update if formula " +
"as not outdated (does not force update if cask " +
"content is unchanged)",
Value: false,
},

View File

@@ -117,42 +117,24 @@ func signCLIHelper(ctx context.Context, appBundle string, opts *Options) error {
}
// elnFiles finds all native-compilation *.eln files within a Emacs.app bundle,
// based on expected paths they might be stored in.
// excluding any *.eln which should be automatically located by codesign when
// signing the Emacs.app bundle itself with the --deep flag. Essentially this
// only returns *.eln files which must be individually signed before signing the
// app bundle itself.
func elnFiles(emacsApp string) ([]string, error) {
dirs := []string{
// Current *.eln location.
filepath.Join(emacsApp, "Contents", "Resources", "native-lisp"),
// Legacy *.eln location.
filepath.Join(emacsApp, "Contents", "MacOS", "lib", "emacs"),
}
var files []string
walkDirFunc := func(path string, _d fs.DirEntry, _err error) error {
if strings.HasSuffix(path, ".eln") {
walkDirFunc := func(path string, d fs.DirEntry, _err error) error {
if d.Type().IsRegular() && strings.HasSuffix(path, ".eln") &&
!strings.Contains(path, ".app/Contents/Frameworks/") {
files = append(files, path)
}
return nil
}
for _, dir := range dirs {
fi, err := os.Stat(dir)
if err != nil {
if os.IsNotExist(err) {
continue
}
return nil, err
}
if !fi.IsDir() {
continue
}
err = filepath.WalkDir(dir, walkDirFunc)
if err != nil {
return nil, err
}
err := filepath.WalkDir(filepath.Join(emacsApp, "Contents"), walkDirFunc)
if err != nil {
return nil, err
}
return files, nil