mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 13:06:38 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
ac8348323d
|
|||
| 59f52b65ee | |||
|
81a96f4d60
|
|||
|
1df39fafe6
|
|||
|
14a8d1aaaf
|
|||
|
272a3000a1
|
|||
|
d684cf560f
|
|||
| ea189a6713 | |||
|
63289216d7
|
13
CHANGELOG.md
13
CHANGELOG.md
@@ -2,6 +2,19 @@
|
|||||||
|
|
||||||
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.
|
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.4.11](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.10...0.4.11) (2021-05-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **builds:** update build script for new plan.yml format ([1df39fa](https://github.com/jimeh/build-emacs-for-macos/commit/1df39fafe62ada385aa1d92e6b7f591c16c0a80c))
|
||||||
|
* **release:** initial attempt at providing automatic builds ([6328921](https://github.com/jimeh/build-emacs-for-macos/commit/63289216d70e496d664a7e3078dea5a82eb8f65d))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **release:** attempt to fix issue with talking to GitHub API ([272a300](https://github.com/jimeh/build-emacs-for-macos/commit/272a3000a1f96d8f131e684736127b923513a205))
|
||||||
|
|
||||||
### [0.4.10](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.9...0.4.10) (2021-04-25)
|
### [0.4.10](https://github.com/jimeh/build-emacs-for-macos/compare/0.4.9...0.4.10) (2021-04-25)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ require 'json'
|
|||||||
require 'net/http'
|
require 'net/http'
|
||||||
require 'optparse'
|
require 'optparse'
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
|
require 'time'
|
||||||
require 'uri'
|
require 'uri'
|
||||||
|
require 'yaml'
|
||||||
|
|
||||||
class Error < StandardError; end
|
class Error < StandardError; end
|
||||||
|
|
||||||
@@ -21,9 +23,9 @@ module Output
|
|||||||
|
|
||||||
def out(msg, newline: true)
|
def out(msg, newline: true)
|
||||||
if newline
|
if newline
|
||||||
puts "==> #{msg}"
|
warn "==> #{msg}"
|
||||||
else
|
else
|
||||||
print "==> #{msg}"
|
STDERR.print "==> #{msg}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -87,8 +89,10 @@ class Build
|
|||||||
end
|
end
|
||||||
|
|
||||||
def build
|
def build
|
||||||
|
load_plan(options[:plan]) if options[:plan]
|
||||||
|
|
||||||
unless meta[:sha] && meta[:date]
|
unless meta[:sha] && meta[:date]
|
||||||
err 'Failed to get commit info from GitHub API.'
|
err 'Failed to get commit info from GitHub.'
|
||||||
end
|
end
|
||||||
|
|
||||||
tarball = download_tarball(meta[:sha])
|
tarball = download_tarball(meta[:sha])
|
||||||
@@ -108,6 +112,17 @@ class Build
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def load_plan(filename)
|
||||||
|
plan = YAML.safe_load(File.read(filename), [:Time])
|
||||||
|
|
||||||
|
@meta = {
|
||||||
|
sha: plan.dig('commit', 'sha'),
|
||||||
|
ref: plan.dig('commit', 'ref'),
|
||||||
|
date: plan.dig('commit', 'date')
|
||||||
|
}
|
||||||
|
@archive_filename = plan['archive']
|
||||||
|
end
|
||||||
|
|
||||||
def tarballs_dir
|
def tarballs_dir
|
||||||
@tarballs_dir ||= File.join(root_dir, 'tarballs')
|
@tarballs_dir ||= File.join(root_dir, 'tarballs')
|
||||||
end
|
end
|
||||||
@@ -358,29 +373,39 @@ class Build
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def archive_app(app)
|
def archive_filename
|
||||||
FileUtils.mkdir_p(builds_dir)
|
return @archive_filename if @archive_filename
|
||||||
|
|
||||||
metadata = [
|
metadata = [
|
||||||
meta[:ref]&.gsub(/\W/, '-'),
|
meta[:ref]&.gsub(/\W/, '-'),
|
||||||
meta[:date],
|
meta[:date]&.strftime('%Y-%m-%d'),
|
||||||
meta[:sha][0..6],
|
meta[:sha][0..6],
|
||||||
"macOS-#{OS.version}",
|
"macOS-#{OS.version}",
|
||||||
OS.arch
|
OS.arch
|
||||||
].compact
|
].compact
|
||||||
|
|
||||||
filename = "Emacs.app-[#{metadata.join('][')}].tbz"
|
filename = "Emacs.app-[#{metadata.join('][')}].tbz"
|
||||||
target = "#{builds_dir}/#{filename}"
|
@archive_filename = File.join(builds_dir, filename)
|
||||||
|
end
|
||||||
|
|
||||||
|
def archive_app(app)
|
||||||
|
filename = File.basename(archive_filename)
|
||||||
|
target_dir = File.dirname(archive_filename)
|
||||||
|
relative_target_dir = target_dir.gsub(root_dir + '/', '')
|
||||||
|
|
||||||
|
FileUtils.mkdir_p(target_dir)
|
||||||
|
|
||||||
app_base = File.basename(app)
|
app_base = File.basename(app)
|
||||||
app_dir = File.dirname(app)
|
app_dir = File.dirname(app)
|
||||||
|
|
||||||
if !File.exist?(target)
|
if !File.exist?(archive_filename)
|
||||||
info "Creating #{filename} archive in \"#{builds_dir}\"..."
|
info "Creating #{filename} archive in \"#{relative_target_dir}\"..."
|
||||||
FileUtils.cd(app_dir) { system('tar', '-cjf', target, app_base) }
|
FileUtils.cd(app_dir) do
|
||||||
|
system('tar', '-cjf', archive_filename, app_base)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
info "#{filename} archive exists in " \
|
info "#{filename} archive exists in " \
|
||||||
"#{builds_dir.gsub(root_dir + '/', '')}, skipping archving."
|
"#{relative_target_dir}, skipping archving."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -411,7 +436,7 @@ class Build
|
|||||||
commit = JSON.parse(commit_json)
|
commit = JSON.parse(commit_json)
|
||||||
meta = {
|
meta = {
|
||||||
sha: commit['sha'],
|
sha: commit['sha'],
|
||||||
date: Date.parse(commit['commit']['committer']['date'])
|
date: Time.parse(commit['commit']['committer']['date'])
|
||||||
}
|
}
|
||||||
meta[:ref] = ref if ref && ref[0..6] != meta[:sha][0..6]
|
meta[:ref] = ref if ref && ref[0..6] != meta[:sha][0..6]
|
||||||
|
|
||||||
@@ -812,6 +837,7 @@ end
|
|||||||
|
|
||||||
if __FILE__ == $PROGRAM_NAME
|
if __FILE__ == $PROGRAM_NAME
|
||||||
cli_options = {
|
cli_options = {
|
||||||
|
work_dir: File.expand_path(__dir__),
|
||||||
native_full_aot: false,
|
native_full_aot: false,
|
||||||
parallel: Etc.nprocessors,
|
parallel: Etc.nprocessors,
|
||||||
rsvg: false,
|
rsvg: false,
|
||||||
@@ -872,6 +898,19 @@ if __FILE__ == $PROGRAM_NAME
|
|||||||
cli_options[:no_frame_refocus] = true
|
cli_options[:no_frame_refocus] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
opts.on('--work-dir DIR',
|
||||||
|
'Specify a working directory where tarballs, sources, and ' \
|
||||||
|
'builds will be stored and worked with') do |v|
|
||||||
|
cli_options[:work_dir] = v
|
||||||
|
end
|
||||||
|
|
||||||
|
opts.on(
|
||||||
|
'--plan FILE',
|
||||||
|
'Follow given plan file, instead of using given git ref/sha'
|
||||||
|
) do |v|
|
||||||
|
cli_options[:plan] = v
|
||||||
|
end
|
||||||
|
|
||||||
opts.on('--[no-]native-fast-boot',
|
opts.on('--[no-]native-fast-boot',
|
||||||
'DEPRECATED: use --[no-]native-full-aot instead') do |v|
|
'DEPRECATED: use --[no-]native-full-aot instead') do |v|
|
||||||
if v
|
if v
|
||||||
@@ -890,7 +929,8 @@ if __FILE__ == $PROGRAM_NAME
|
|||||||
end
|
end
|
||||||
end.parse!
|
end.parse!
|
||||||
|
|
||||||
Build.new(File.expand_path(__dir__), ARGV.shift, cli_options).build
|
work_dir = cli_options.delete(:work_dir)
|
||||||
|
Build.new(work_dir, ARGV.shift, cli_options).build
|
||||||
rescue Error => e
|
rescue Error => e
|
||||||
warn "ERROR: #{e.message}"
|
warn "ERROR: #{e.message}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user