From 49dcf82cb4a3a83219efac4043337bbc5554054f Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 16 Dec 2018 20:01:17 +0000 Subject: [PATCH] brew-postgresql-upgrade-database: don't use old kegs. (#35169) Instead always rely on the versioned formulae that are properly supported. Reference #34879. --- cmd/brew-postgresql-upgrade-database.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/brew-postgresql-upgrade-database.rb b/cmd/brew-postgresql-upgrade-database.rb index 6bd2e079780..f9b873e3f2e 100755 --- a/cmd/brew-postgresql-upgrade-database.rb +++ b/cmd/brew-postgresql-upgrade-database.rb @@ -25,13 +25,14 @@ if old_datadir.exist? EOS end -old_bin = Pathname.glob("#{HOMEBREW_PREFIX}/Cellar/#{name}{,@#{pg_version_data}}/#{pg_version_data}.*/bin").first +old_pg_name = "#{name}@#{pg_version_data}" +old_pg_glob = "#{HOMEBREW_PREFIX}/Cellar/#{old_pg_name}/#{pg_version_data}.*/bin" +old_bin = Pathname.glob(old_pg_glob).first old_bin ||= begin - old_pg_name = "#{name}@#{pg_version_data}" Formula[old_pg_name] ohai "brew install #{old_pg_name}" system "brew", "install", old_pg_name - Pathname.glob("#{HOMEBREW_PREFIX}/Cellar/#{old_pg_name}/#{pg_version_data}.*/bin").first + Pathname.glob(old_pg_glob).first rescue FormulaUnavailableError nil end