Skip to content

Commit

Permalink
Merge pull request #959 from heroku/schneems/remove-libpq-hack
Browse files Browse the repository at this point in the history
Remove libpq vendoring
  • Loading branch information
schneems authored Mar 11, 2020
2 parents 3f28116 + 2bf0cc3 commit f20f977
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 50 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Master (unreleased)

* Remove libpq external dependency (https://github.com/heroku/heroku-buildpack-ruby/pull/959)

## v210 (3/6/2020)

Expand Down
50 changes: 0 additions & 50 deletions lib/language_pack/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ def compile
setup_export
setup_profiled
allow_git do
vendor_libpq
install_bundler_in_app
build_bundler("development:test")
post_bundler
Expand All @@ -118,55 +117,6 @@ def compile
raise e
end

def vendor_libpq
# Check for existing libraries
return unless File.exist?("/usr/lib/x86_64-linux-gnu/libpq.so.5.11")
return unless ENV['STACK'] == 'heroku-18'

topic("Vendoring libpq 5.12.1")

@metadata.fetch("vendor_libpq12") do
warn(<<~EOF)
Replacing libpq with version libpq 5.12.1
This version includes a bug fix that can cause an exception
on boot for applications with incorrectly configured connection
values. For more information see:
https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior
If your application breaks you can rollback to your last build.
You can also temporarially opt out of this behavior by setting:
```
$ heroku config:set HEROKU_SKIP_LIBPQ12=1
```
In the future libpq 5.12 will be the default on the platform and
you will not be able to opt-out of the library. For more information see:
https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior
EOF

"true" # Set future cache value
end

Dir.chdir("vendor") do
@fetchers[:mri].fetch("libpq5_12.1-1.deb")
run!("dpkg -x libpq5_12.1-1.deb .")
run!("rm libpq5_12.1-1.deb")

load_libpq_12_unless_env_var = <<~EOF
if [ "$HEROKU_SKIP_LIBPQ12" == "" ]; then
export LD_LIBRARY_PATH="$HOME/vendor/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH"
fi
EOF
add_to_export load_libpq_12_unless_env_var
add_to_profiled load_libpq_12_unless_env_var
ENV["LD_LIBRARY_PATH"] = Dir.pwd + "/usr/lib/x86_64-linux-gnu:#{ENV["LD_LIBRARY_PATH"]}"
end
end

def cleanup
end

Expand Down

0 comments on commit f20f977

Please sign in to comment.