pgtap 0.95.0

The `skip clean` no longer appears to be required. It was previously added in
https://github.com/Homebrew/homebrew/pull/15474 because this formula used
to potentially end up with an empty install, or only the presence of an empty
share directory.

Since we now install Perl modules required and have for some time now the
installation hasn't been "empty" in that way and the line is redundant.

Also fixes sandboxing, fixes perl module finding, etc.

Closes Homebrew/homebrew#49338.

Closes Homebrew/homebrew#49366.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
This commit is contained in:
Dominyk Tiller 2016-02-20 00:57:48 +00:00
parent dec7ff23a9
commit e6f1a8a290

View file

@ -1,29 +1,32 @@
class Pgtap < Formula
desc "Unit testing framework for PostgreSQL"
homepage "http://pgtap.org/"
url "http://api.pgxn.org/dist/pgtap/0.94.0/pgtap-0.94.0.zip"
sha256 "c590ce9edb19a95dbd7caef84f677ff433fd87eaa68effdc4a7ac0fdf29be4cc"
url "http://api.pgxn.org/dist/pgtap/0.95.0/pgtap-0.95.0.zip"
sha256 "a39093e451ce23ab4f67a3ce25543fe59471148f65d5e83ef514df2f90656dc5"
head "https://github.com/theory/pgtap.git"
# Not :postgresql, because we need to install into its share directory.
depends_on "postgresql"
skip_clean "share"
resource "Test::Harness" do
url "https://cpan.metacpan.org/authors/id/L/LE/LEONT/Test-Harness-3.30.tar.gz"
sha256 "ff1900f3b3e61321d3c4b3283298f3106d43d55446605e9cfcf1dcec036acec1"
url "https://cpan.metacpan.org/authors/id/L/LE/LEONT/Test-Harness-3.36.tar.gz"
sha256 "e7566f13b041d028b56f184b77ec2545ec6f0bb5a0f8f5368f7e4a08b496b63e"
end
resource "TAP::Parser::SourceHandler::pgTAP" do
url "https://cpan.metacpan.org/authors/id/D/DW/DWHEELER/TAP-Parser-SourceHandler-pgTAP-3.29.tar.gz"
sha256 "918aa9ada7a05334ace7304e7b9e002bbf0b569bfcf8fb06118777bdabd60e1b"
url "https://cpan.metacpan.org/authors/id/D/DW/DWHEELER/TAP-Parser-SourceHandler-pgTAP-3.31.tar.gz"
sha256 "d4ea61d77f486df52d0bc15026862d01ad50d21c8e008f3c2060bd7a9127bfe9"
end
resource "DBD::Pg" do
url "https://cpan.metacpan.org/authors/id/T/TU/TURNSTEP/DBD-Pg-3.5.3.tar.gz"
sha256 "7e98a9b975256a4733db1c0e974cad5ad5cb821489323e395ed97bd058e0a90e"
end
def install
# Make sure modules can find just-installed dependencies.
arch = `perl -MConfig -E 'print $Config{archname}'`
plib = "#{lib}/perl5"
arch = `perl -MConfig -E 'print $Config{archname}'`
plib = "#{lib}/perl5"
ENV["PERL5LIB"] = "#{plib}:#{plib}/#{arch}:#{lib}:#{lib}/#{arch}"
resource("Test::Harness").stage do
@ -40,8 +43,27 @@ class Pgtap < Formula
system "./Build", "install"
end
resource("DBD::Pg").stage do
system "perl", "Makefile.PL", "INSTALL_BASE=#{prefix}",
"INSTALLSITEMAN3DIR=#{man3}"
system "make"
system "make", "install"
end
pg_config = "#{Formula["postgresql"].opt_bin}/pg_config"
mkdir "stage"
system "make", "PG_CONFIG=#{pg_config}"
system "make", "PG_CONFIG=#{pg_config}", "install"
system "make", "install", "DESTDIR=#{buildpath}/stage"
(doc/"postgresql/extentsion").install Dir["stage/**/share/doc/postgresql/extension/*"]
(share/"postgresql/extension").install Dir["stage/**/share/postgresql/extension/*"]
bin.env_script_all_files(libexec/"bin", :PERL5LIB => ENV["PERL5LIB"])
end
test do
# This is a bit of a "fake" test but it allows us to check the Perl env
# has been configured correctly and the tools have basic functionality.
system "#{Formula["postgresql"].opt_bin}/initdb", testpath/"test"
system bin/"pg_prove", testpath/"test"
end
end