support m1 devices (#149)
as title fix #147 fix #119 Co-authored-by: Matti R <matti@mdranta.net> Reviewed-on: https://gitea.com/gitea/homebrew-gitea/pulls/149 Reviewed-by: Andrew Thornton <art27@cantab.net> Reviewed-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-committed-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
b62d43c15f
commit
41a9d93d9d
|
@ -1,3 +1,5 @@
|
||||||
|
require './utils/macos_codesign.rb'
|
||||||
|
|
||||||
class Changelog < Formula
|
class Changelog < Formula
|
||||||
desc "Generate changelog of gitea repository"
|
desc "Generate changelog of gitea repository"
|
||||||
homepage "https://gitea.com/gitea/changelog"
|
homepage "https://gitea.com/gitea/changelog"
|
||||||
|
@ -28,13 +30,13 @@ class Changelog < Formula
|
||||||
url @@url,
|
url @@url,
|
||||||
using: @@using
|
using: @@using
|
||||||
|
|
||||||
bottle :unneeded
|
|
||||||
def install
|
def install
|
||||||
if stable.using.blank?
|
if stable.using.blank?
|
||||||
filename = Changelog.class_variable_get("@@filename")
|
filename = Changelog.class_variable_get("@@filename")
|
||||||
else
|
else
|
||||||
filename = downloader.cached_location
|
filename = downloader.cached_location
|
||||||
end
|
end
|
||||||
|
apply_ad_hoc_signature(filename)
|
||||||
bin.install filename => "changelog"
|
bin.install filename => "changelog"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
require './utils/macos_codesign.rb'
|
||||||
|
|
||||||
class GiteaHead < Formula
|
class GiteaHead < Formula
|
||||||
desc "Git with a cup of tea, painless self-hosted git service"
|
desc "Git with a cup of tea, painless self-hosted git service"
|
||||||
homepage "https://gitea.io"
|
homepage "https://gitea.io"
|
||||||
|
@ -29,13 +31,13 @@ class GiteaHead < Formula
|
||||||
using: @@using
|
using: @@using
|
||||||
|
|
||||||
conflicts_with "gitea", because: "both install gitea binaries"
|
conflicts_with "gitea", because: "both install gitea binaries"
|
||||||
bottle :unneeded
|
|
||||||
def install
|
def install
|
||||||
if stable.using.blank?
|
if stable.using.blank?
|
||||||
filename = GiteaHead.class_variable_get("@@filename")
|
filename = GiteaHead.class_variable_get("@@filename")
|
||||||
else
|
else
|
||||||
filename = downloader.cached_location
|
filename = downloader.cached_location
|
||||||
end
|
end
|
||||||
|
apply_ad_hoc_signature(filename)
|
||||||
bin.install filename => "gitea"
|
bin.install filename => "gitea"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
3
gitea.rb
3
gitea.rb
|
@ -1,3 +1,5 @@
|
||||||
|
require './utils/macos_codesign.rb'
|
||||||
|
|
||||||
class Gitea < Formula
|
class Gitea < Formula
|
||||||
desc "Git with a cup of tea, painless self-hosted git service"
|
desc "Git with a cup of tea, painless self-hosted git service"
|
||||||
homepage "https://gitea.io"
|
homepage "https://gitea.io"
|
||||||
|
@ -43,6 +45,7 @@ class Gitea < Formula
|
||||||
else
|
else
|
||||||
filename = downloader.cached_location
|
filename = downloader.cached_location
|
||||||
end
|
end
|
||||||
|
apply_ad_hoc_signature(filename)
|
||||||
bin.install filename => "gitea"
|
bin.install filename => "gitea"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
require './utils/macos_codesign.rb'
|
||||||
|
|
||||||
class TeaHead < Formula
|
class TeaHead < Formula
|
||||||
desc "A command line tool to interact with Gitea servers"
|
desc "A command line tool to interact with Gitea servers"
|
||||||
homepage "https://gitea.com/gitea/tea"
|
homepage "https://gitea.com/gitea/tea"
|
||||||
|
@ -29,13 +31,13 @@ class TeaHead < Formula
|
||||||
using: @@using
|
using: @@using
|
||||||
|
|
||||||
conflicts_with "tea", because: "both install tea binaries"
|
conflicts_with "tea", because: "both install tea binaries"
|
||||||
bottle :unneeded
|
|
||||||
def install
|
def install
|
||||||
if stable.using.blank?
|
if stable.using.blank?
|
||||||
filename = TeaHead.class_variable_get("@@filename")
|
filename = TeaHead.class_variable_get("@@filename")
|
||||||
else
|
else
|
||||||
filename = downloader.cached_location
|
filename = downloader.cached_location
|
||||||
end
|
end
|
||||||
|
apply_ad_hoc_signature(filename)
|
||||||
bin.install filename => "tea"
|
bin.install filename => "tea"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
4
tea.rb
4
tea.rb
|
@ -1,3 +1,5 @@
|
||||||
|
require './utils/macos_codesign.rb'
|
||||||
|
|
||||||
class Tea < Formula
|
class Tea < Formula
|
||||||
desc "A command line tool to interact with Gitea servers"
|
desc "A command line tool to interact with Gitea servers"
|
||||||
homepage "https://gitea.com/gitea/tea"
|
homepage "https://gitea.com/gitea/tea"
|
||||||
|
@ -37,13 +39,13 @@ class Tea < Formula
|
||||||
using: @@using
|
using: @@using
|
||||||
|
|
||||||
conflicts_with "tea-head", because: "both install tea binaries"
|
conflicts_with "tea-head", because: "both install tea binaries"
|
||||||
bottle :unneeded
|
|
||||||
def install
|
def install
|
||||||
if stable.using.blank?
|
if stable.using.blank?
|
||||||
filename = Tea.class_variable_get("@@filename")
|
filename = Tea.class_variable_get("@@filename")
|
||||||
else
|
else
|
||||||
filename = downloader.cached_location
|
filename = downloader.cached_location
|
||||||
end
|
end
|
||||||
|
apply_ad_hoc_signature(filename)
|
||||||
bin.install filename => "tea"
|
bin.install filename => "tea"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
## this file is licensed under BSD-2-Clause License (https://github.com/Homebrew/brew/blob/4665bb8e663c6d0ef452f4c124742732c96f8fd6/LICENSE.txt)
|
||||||
|
## source: https://github.com/homebrew/brew/blob/4665bb8e663c6d0ef452f4c124742732c96f8fd6/Library/Homebrew/os/mac/keg.rb
|
||||||
|
|
||||||
|
def apply_ad_hoc_signature(file)
|
||||||
|
return if MacOS.version < :big_sur
|
||||||
|
return unless Hardware::CPU.arm?
|
||||||
|
|
||||||
|
odebug "Codesigning #{file}"
|
||||||
|
# Use quiet_system to squash notifications about resigning binaries
|
||||||
|
# which already have valid signatures.
|
||||||
|
return if quiet_system("codesign", "--sign", "-", "--force",
|
||||||
|
"--preserve-metadata=entitlements,requirements,flags,runtime",
|
||||||
|
file)
|
||||||
|
|
||||||
|
# If the codesigning fails, it may be a bug in Apple's codesign utility
|
||||||
|
# A known workaround is to copy the file to another inode, then move it back
|
||||||
|
# erasing the previous file. Then sign again.
|
||||||
|
#
|
||||||
|
# TODO: remove this once the bug in Apple's codesign utility is fixed
|
||||||
|
Dir::Tmpname.create("workaround") do |tmppath|
|
||||||
|
FileUtils.cp file, tmppath
|
||||||
|
FileUtils.mv tmppath, file, force: true
|
||||||
|
end
|
||||||
|
|
||||||
|
# Try signing again
|
||||||
|
odebug "Codesigning (2nd try) #{file}"
|
||||||
|
return if quiet_system("codesign", "--sign", "-", "--force",
|
||||||
|
"--preserve-metadata=entitlements,requirements,flags,runtime",
|
||||||
|
file)
|
||||||
|
|
||||||
|
# If it fails again, error out
|
||||||
|
onoe <<~EOS
|
||||||
|
Failed applying an ad-hoc signature to #{file}
|
||||||
|
EOS
|
||||||
|
end
|
Loading…
Reference in New Issue