Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions Formula/p/patchpal.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
class Patchpal < Formula
desc "AI Assisted Patch Backporting Tool Frontend"
homepage "https://gitlab.com/patchpal-ai/patchpal-gui"
url "https://gitlab.com/patchpal-ai/patchpal-gui/-/archive/v0.4.0/patchpal-gui-v0.4.0.tar.bz2"
sha256 "69e949af1c458879ffbc7198fffc16f7fae288825dc012045224d108be9be339"
license "Apache-2.0"

depends_on "pkgconf" => :build
depends_on "rust" => :build

depends_on "cairo"
depends_on "gawk"
depends_on "gdk-pixbuf"
depends_on "gettext"
depends_on "glib"
depends_on "graphene"
depends_on "gtk4"
depends_on "harfbuzz"
depends_on "llvm"
depends_on "pango"

on_linux do
depends_on "xorg-server" => :test
end

def install
system "cargo", "install", *std_cargo_args
end

test do
if OS.linux?
xvfb_pid = spawn Formula["xorg-server"].bin/"Xvfb", ":1"
ENV["DISPLAY"] = ":1"
sleep 10
end

system "git", "init"
system "git", "checkout", "-b", "main"
(testpath/"test.txt").write "Hello world"
system "git", "add", "test.txt"
system "git", "commit", "-m", "initial commit"

system "git", "checkout", "-b", "test"
rm (testpath/"test.txt")
(testpath/"test.txt").write "Foo bar"
system "git", "add", "test.txt"
system "git", "commit", "-m", "to-cherrypick"
commit_hash = shell_output("git rev-parse HEAD").strip

system "git", "switch", "main"
system bin/"patchpal", "--commit-clean", "--no-ai", commit_hash
assert_match commit_hash, shell_output("git log -1 --pretty=%B")
assert_match "Foo bar", (testpath/"test.txt").read
ensure
Process.kill("TERM", xvfb_pid) if xvfb_pid
end
end
Loading