Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

Commit efc98ff

Browse files
authored
Merge pull request #45 from levlozhkin/postgres-9.6
Upgrade to Postgres 9.6
2 parents 2489016 + 5276d32 commit efc98ff

File tree

4 files changed

+34
-25
lines changed

4 files changed

+34
-25
lines changed

files/brews/postgresql.rb

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
class Postgresql < Formula
22
desc "Object-relational database system"
33
homepage "https://www.postgresql.org/"
4-
url "https://ftp.postgresql.org/pub/source/v9.5.2/postgresql-9.5.2.tar.bz2"
5-
sha256 "f8d132e464506b551ef498719f18cfe9d777709c7a1589dc360afc0b20e47c41"
4+
url "https://ftp.postgresql.org/pub/source/v9.6.2/postgresql-9.6.2.tar.bz2"
5+
sha256 "0187b5184be1c09034e74e44761505e52357248451b0c854dddec6c231fe50c9"
6+
7+
head "https://github.com/postgres/postgres.git"
68

79
bottle do
8-
revision 1
9-
sha256 "12bc2c22b06aaa82f577c14a667805a6e8aed9065a3a376e324393afdf6b62f0" => :el_capitan
10-
sha256 "5e7ee10a23edb6ee985f49a969894133939a20eaeee2f2841cb8be82c2f79c74" => :yosemite
11-
sha256 "e6673530167899750d5f2eaaebe53e7ff8b10caada449aef39d66a1af39cfe49" => :mavericks
10+
sha256 "75795830b5d1ed481cd21e91e1c74e03a49d51e521a6cf7b167d1976cbf515dd" => :sierra
11+
sha256 "df15dfcfc4672767a739012565d52990198a121cdaaa4ca986c1cd7ecddd69d9" => :el_capitan
12+
sha256 "fb64a01714c6abf4509eddf6f3011d774987c6f322fde0bb35c0b476acf3eb19" => :yosemite
1213
end
1314

14-
option "32-bit"
1515
option "without-perl", "Build without Perl support"
1616
option "without-tcl", "Build without Tcl support"
1717
option "with-dtrace", "Build with DTrace support"
@@ -23,8 +23,13 @@ class Postgresql < Formula
2323
depends_on "openssl"
2424
depends_on "readline"
2525
depends_on "libxml2" if MacOS.version <= :leopard # Leopard libxml is too old
26+
27+
option "with-python", "Enable PL/Python2"
2628
depends_on :python => :optional
2729

30+
option "with-python3", "Enable PL/Python3 (incompatible with --with-python)"
31+
depends_on :python3 => :optional
32+
2833
conflicts_with "postgres-xc",
2934
:because => "postgresql and postgres-xc install the same binaries."
3035

@@ -34,7 +39,8 @@ class Postgresql < Formula
3439
end
3540

3641
def install
37-
ENV.libxml2 if MacOS.version >= :snow_leopard
42+
# avoid adding the SDK library directory to the linker search path
43+
ENV["XML2_CONFIG"] = "xml2-config --exec-prefix=/usr"
3844

3945
ENV.prepend "LDFLAGS", "-L#{Formula["openssl"].opt_lib} -L#{Formula["readline"].opt_lib}"
4046
ENV.prepend "CPPFLAGS", "-I#{Formula["openssl"].opt_include} -I#{Formula["readline"].opt_include}"
@@ -56,9 +62,17 @@ def install
5662
--with-libxslt
5763
]
5864

59-
args << "--with-python" if build.with? "python"
6065
args << "--with-perl" if build.with? "perl"
6166

67+
which_python = nil
68+
if build.with?("python") && build.with?("python3")
69+
odie "Cannot provide both --with-python and --with-python3"
70+
elsif build.with?("python") || build.with?("python3")
71+
args << "--with-python"
72+
which_python = which(build.with?("python") ? "python" : "python3")
73+
end
74+
ENV["PYTHON"] = which_python
75+
6276
# The CLT is required to build Tcl support on 10.7 and 10.8 because
6377
# tclConfig.sh is not part of the SDK
6478
if build.with?("tcl") && (MacOS.version >= :mavericks || MacOS::CLT.installed?)
@@ -72,10 +86,6 @@ def install
7286
args << "--enable-dtrace" if build.with? "dtrace"
7387
args << "--with-uuid=e2fs"
7488

75-
if build.build_32_bit?
76-
ENV.append %w[CFLAGS LDFLAGS], "-arch #{Hardware::CPU.arch_32_bit}"
77-
end
78-
7989
system "./configure", *args
8090
system "make"
8191
system "make", "install-world", "datadir=#{pkgshare}",
@@ -84,6 +94,7 @@ def install
8494
end
8595

8696
def post_install
97+
(var/"log").mkpath
8798
(var/"postgres").mkpath
8899
unless File.exist? "#{var}/postgres/PG_VERSION"
89100
system "#{bin}/initdb", "#{var}/postgres"
@@ -96,17 +107,17 @@ def caveats; <<-EOS.undent
96107
https://github.com/Homebrew/homebrew/issues/2510
97108
98109
To migrate existing data from a previous major version (pre-9.0) of PostgreSQL, see:
99-
https://www.postgresql.org/docs/9.5/static/upgrading.html
110+
https://www.postgresql.org/docs/9.6/static/upgrading.html
100111
101-
To migrate existing data from a previous minor version (9.0-9.4) of PosgresSQL, see:
102-
https://www.postgresql.org/docs/9.5/static/pgupgrade.html
112+
To migrate existing data from a previous minor version (9.0-9.6) of PostgreSQL, see:
113+
https://www.postgresql.org/docs/9.6/static/pgupgrade.html
103114
104115
You will need your previous PostgreSQL installation from brew to perform `pg_upgrade`.
105116
Do not run `brew cleanup postgresql` until you have performed the migration.
106117
EOS
107118
end
108119

109-
plist_options :manual => "postgres -D #{HOMEBREW_PREFIX}/var/postgres"
120+
plist_options :manual => "pg_ctl -D #{HOMEBREW_PREFIX}/var/postgres start"
110121

111122
def plist; <<-EOS.undent
112123
<?xml version="1.0" encoding="UTF-8"?>
@@ -122,15 +133,13 @@ def plist; <<-EOS.undent
122133
<string>#{opt_bin}/postgres</string>
123134
<string>-D</string>
124135
<string>#{var}/postgres</string>
125-
<string>-r</string>
126-
<string>#{var}/postgres/server.log</string>
127136
</array>
128137
<key>RunAtLoad</key>
129138
<true/>
130139
<key>WorkingDirectory</key>
131140
<string>#{HOMEBREW_PREFIX}</string>
132141
<key>StandardErrorPath</key>
133-
<string>#{var}/postgres/server.log</string>
142+
<string>#{var}/log/postgres.log</string>
134143
</dict>
135144
</plist>
136145
EOS

manifests/params.pp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
$bindir = "${boxen::config::homebrewdir}/bin"
99
$executable = "${bindir}/postgres"
10-
$datadir = "${boxen::config::datadir}/postgresql-9.5"
11-
$logdir = "${boxen::config::logdir}/postgresql-9.5"
10+
$datadir = "${boxen::config::datadir}/postgresql-9.6"
11+
$logdir = "${boxen::config::logdir}/postgresql-9.6"
1212
$port = 15432
1313

1414
$package = 'boxen/brews/postgresql'
15-
$version = '9.5.2'
15+
$version = '9.6.2'
1616

1717
$service = 'dev.postgresql'
1818

spec/classes/postgresql__config_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
it do
77
should contain_class('boxen::config')
88

9-
%w(data/postgresql-9.5 log/postgresql-9.5).each do |d|
9+
%w(data/postgresql-9.6 log/postgresql-9.6).each do |d|
1010
should contain_file("/test/boxen/#{d}").with_ensure(:directory)
1111
end
1212

spec/classes/postgresql__service_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
it do
77
should contain_service("com.boxen.postgresql").with_ensure(:stopped)
88

9-
should contain_exec("init-postgresql-db").with_creates("/test/boxen/data/postgresql-9.5/PG_VERSION")
9+
should contain_exec("init-postgresql-db").with_creates("/test/boxen/data/postgresql-9.6/PG_VERSION")
1010
should contain_service("dev.postgresql").with_ensure(:running)
1111
should contain_exec("wait-for-postgresql").with_unless("nc -z 127.0.0.1 15432")
1212
end

0 commit comments

Comments
 (0)