Skip to content

Commit

Permalink
pg_tiktoken: revision bump for Postgres 17
Browse files Browse the repository at this point in the history
  • Loading branch information
bayandin committed Nov 24, 2024
1 parent 3279a45 commit 2473131
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions Formula/pg_tiktoken.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
class PgTiktoken < Formula
desc "Tiktoken tokenizer for PostgreSQL"
homepage "https://github.com/kelvich/pg_tiktoken"
url "https://github.com/kelvich/pg_tiktoken/archive/26806147b17b60763039c6a6878884c41a262318.tar.gz"
url "https://github.com/kelvich/pg_tiktoken/archive/9118dd4549b7d8c0bbc98e04322499f7bf2fa6f7.tar.gz"
version "0.0.1"
sha256 "e64e55aaa38c259512d3e27c572da22c4637418cf124caba904cd50944e5004e"
revision 1
sha256 "a5bc447e7920ee149d3c064b8b9f0086c0e83939499753178f7d35788416f628"
revision 2

bottle do
root_url "https://ghcr.io/v2/bayandin/tap"
Expand All @@ -19,16 +19,16 @@ class PgTiktoken < Formula
uses_from_macos "llvm" => :build

resource "pgrx" do
url "https://github.com/pgcentralfoundation/pgrx/archive/refs/tags/v0.10.2.tar.gz"
sha256 "040fd7195fc350ec7c823e7c2dcafad2cf621c8696fd2ce0db7626d7fbd3d877"
url "https://github.com/pgcentralfoundation/pgrx/archive/refs/tags/v0.12.6.tar.gz"
sha256 "ba04f50b3f9f160a1c70861ad2358b3eb6485dbc13608eef09b4094460487a57"
end

def neon_postgres
Formula["bayandin/tap/neon-postgres"]
end

def pg_versions
neon_postgres.pg_versions
neon_postgres.pg_versions(with: "v17")
end

def install
Expand All @@ -47,16 +47,13 @@ def install
system "cargo", "pgrx", "init", *args

pg_versions.each do |v|
# Ref https://github.com/postgres/postgres/commit/b55f62abb2c2e07dfae99e19a2b3d7ca9e58dc1a
dlsuffix = (OS.linux? || "v14 v15".include?(v)) ? "so" : "dylib"

system "cargo", "pgrx", "package", "--profile", "release",
"--pg-config", neon_postgres.pg_bin_for(v)/"pg_config",
"--out-dir", "stage-#{v}"

stage_dir = Pathname("stage-#{v}#{HOMEBREW_PREFIX}")
mkdir_p lib/neon_postgres.name/v
mv stage_dir/"lib/neon-postgres/#{v}/pg_tiktoken.#{dlsuffix}", lib/neon_postgres.name/v
mv stage_dir/"lib/neon-postgres/#{v}/pg_tiktoken.#{neon_postgres.dlsuffix(v)}", lib/neon_postgres.name/v

from_ext_dir = stage_dir/"share/neon-postgres/#{v}/extension"
to_ext_dir = share/neon_postgres.name/v/"extension"
Expand Down

0 comments on commit 2473131

Please sign in to comment.