From 6eaa69b98858065bc08628abc810b82ea7042389 Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Thu, 14 Sep 2023 05:37:30 +0000 Subject: [PATCH] feat: migrate gitea to homebrew-core (#178) Same to tea, we have incorporated gitea into homebrew-core as well. (PR, https://github.com/Homebrew/homebrew-core/pull/141302). I think we can just transition to core. Thanks! This is the formula page, https://formulae.brew.sh/formula/gitea Reviewed-on: https://gitea.com/gitea/homebrew-gitea/pulls/178 Reviewed-by: Lunny Xiao Co-authored-by: Rui Chen Co-committed-by: Rui Chen --- .gitea/workflows/test.yml | 4 --- bump_version.sh | 8 +----- gitea-head.rb | 48 --------------------------------- gitea.rb | 56 --------------------------------------- tap_migrations.json | 1 + 5 files changed, 2 insertions(+), 115 deletions(-) delete mode 100644 gitea-head.rb delete mode 100644 gitea.rb diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 860e80b..6559b9c 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -24,10 +24,6 @@ jobs: - name: test install run: | brew tap gitea/gitea "${PWD}" - brew install gitea/gitea/tea - tea --version - brew install gitea/gitea/gitea - gitea --version brew install gitea/gitea/act_runner act_runner --version # TODO: test for arm diff --git a/bump_version.sh b/bump_version.sh index a8d988e..a62aae9 100755 --- a/bump_version.sh +++ b/bump_version.sh @@ -1,18 +1,12 @@ #!/bin/sh -binaries="tea act_runner gitea" +binaries="act_runner" for bin in ${binaries};do file="${bin}.rb" case "$bin" in - tea) - git_url="https://gitea.com/gitea/tea" - supported_os="linux-386 linux-amd64 linux-arm64 darwin-amd64 darwin-arm64";; act_runner) git_url="https://gitea.com/gitea/act_runner" supported_os="linux-amd64 linux-arm64 darwin-amd64 darwin-arm64";; - gitea) - git_url="https://github.com/go-gitea/gitea" - supported_os="linux-386 linux-amd64 linux-arm64 darwin-10.12-amd64 darwin-10.12-arm64";; *) >&2 echo "Error: unrecognized binary ($bin)" exit 1;; diff --git a/gitea-head.rb b/gitea-head.rb deleted file mode 100644 index 1c97494..0000000 --- a/gitea-head.rb +++ /dev/null @@ -1,48 +0,0 @@ -require_relative './utils/macos_codesign.rb' - -class GiteaHead < Formula - desc "Git with a cup of tea, painless self-hosted git service" - homepage "https://gitea.io" - version "main" - license "MIT" - - os = OS.mac? ? "darwin-10.12" : "linux" - arch = case Hardware::CPU.arch - when :i386 then "386" - when :x86_64 then "amd64" - when :arm64 then "arm64" - else - raise "gitea: Unsupported system architecture #{Hardware::CPU.arch}" - end - - @@filename = "gitea-#{version}-#{os}-#{arch}" - @@url = "https://dl.gitea.com/gitea/#{version}/#{@@filename}" - @@using = :nounzip - - if os == "darwin-10.12" || arch == "amd64" - @@url += ".xz" - @@using = nil - depends_on "xz" - end - - @@sha256 = %x[ curl -sL #{@@url}.sha256 ].split.first - - sha256 @@sha256 - url @@url, - using: @@using - - conflicts_with "gitea", because: "both install gitea binaries" - def install - if stable.using.blank? - filename = GiteaHead.class_variable_get("@@filename") - else - filename = downloader.cached_location - end - apply_ad_hoc_signature(filename) - bin.install filename => "gitea" - end - - test do - system "#{bin}/gitea", "--version" - end -end diff --git a/gitea.rb b/gitea.rb deleted file mode 100644 index 992868e..0000000 --- a/gitea.rb +++ /dev/null @@ -1,56 +0,0 @@ -require_relative './utils/macos_codesign.rb' - -class Gitea < Formula - desc "Git with a cup of tea, painless self-hosted git service" - homepage "https://gitea.io" - version "1.20.4" - license "MIT" - - os = OS.mac? ? "darwin-10.12" : "linux" - arch = case Hardware::CPU.arch - when :i386 then "386" - when :x86_64 then "amd64" - when :arm64 then "arm64" - else - raise "gitea: Unsupported system architecture #{Hardware::CPU.arch}" - end - - @@filename = "gitea-#{version}-#{os}-#{arch}" - @@url = "https://dl.gitea.com/gitea/#{version}/#{@@filename}" - @@using = :nounzip - - if os == "darwin-10.12" || arch == "amd64" - @@url += ".xz" - @@using = nil - depends_on "xz" - end - - @@sha256 = case "#{os}-#{arch}" - when "linux-386" then "ad38dba630a3598488ad46d74283f826b68905168f1830b2142c398074ed79d0" # binary - when "linux-amd64" then "66e64dfe991fb02c1a6f141eb4245be5de3d790e85df03d3659935dfdb070e39" - when "linux-arm64" then "95f8e1b29f1402b4af5e12ed6d2da6fad35ae8c99f413e7afbf265aeb85eb6d7" # binary - when "darwin-10.12-amd64" then "b814918cfb7efe5c41a03712d047ef7fdd2113fdd4cce3b1a0c46994923bf84a" - when "darwin-10.12-arm64" then "941991b7edad8dd5026e843f611000d5a3032c0024272896c0bd6b13507b6fee" - else - raise "gitea: Unsupported system #{os}-#{arch}" - end - - sha256 @@sha256 - url @@url, - using: @@using - - conflicts_with "gitea-head", because: "both install gitea binaries" - def install - if stable.using.blank? - filename = Gitea.class_variable_get("@@filename") - else - filename = downloader.cached_location - end - apply_ad_hoc_signature(filename) - bin.install filename => "gitea" - end - - test do - system "#{bin}/gitea", "--version" - end -end diff --git a/tap_migrations.json b/tap_migrations.json index 7058d96..447b40b 100644 --- a/tap_migrations.json +++ b/tap_migrations.json @@ -1,3 +1,4 @@ { + "gitea": "homebrew/core", "tea": "homebrew/core" }