80 lines
3 KiB
Ruby
80 lines
3 KiB
Ruby
class Dpkg < Formula
|
|
desc "Debian package management system"
|
|
homepage "https://wiki.debian.org/Teams/Dpkg"
|
|
url "https://mirrors.ocf.berkeley.edu/debian/pool/main/d/dpkg/dpkg_1.18.15.tar.xz"
|
|
mirror "https://mirrorservice.org/sites/ftp.debian.org/debian/pool/main/d/dpkg/dpkg_1.18.15.tar.xz"
|
|
sha256 "aee936653b9c39403160c0a331ee7934563fbfa4e1f5adbc14a289c803cda371"
|
|
|
|
bottle do
|
|
sha256 "d4948d2da0cfd747dc4926fb0b9ed8febe067b925bc65082dbad62fdc03128a8" => :sierra
|
|
sha256 "904a2b6d2461b41bd87b92c66758c084416f85cf71bce3b6413c5cd99c238bf2" => :el_capitan
|
|
sha256 "f65544444a68dfd1100485ac081584d9771b4baabe8f4099708be5fd92cb38ba" => :yosemite
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "gnu-tar"
|
|
depends_on "xz" # For LZMA
|
|
|
|
def install
|
|
# We need to specify a recent gnutar, otherwise various dpkg C programs will
|
|
# use the system "tar", which will fail because it lacks certain switches.
|
|
ENV["TAR"] = Formula["gnu-tar"].opt_bin/"gtar"
|
|
|
|
# Theoretically, we could reinsert a patch here submitted upstream previously
|
|
# but the check for PERL_LIB remains in place and incompatible with Homebrew.
|
|
# Using an env and scripting is a solution less likely to break over time.
|
|
# Both variables need to be set. One is compile-time, the other run-time.
|
|
ENV["PERL_LIBDIR"] = libexec/"lib/perl5"
|
|
ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5"
|
|
|
|
system "./configure", "--disable-dependency-tracking",
|
|
"--disable-silent-rules",
|
|
"--prefix=#{libexec}",
|
|
"--sysconfdir=#{etc}",
|
|
"--localstatedir=#{var}",
|
|
"--disable-dselect",
|
|
"--disable-start-stop-daemon"
|
|
system "make"
|
|
system "make", "install"
|
|
|
|
bin.install Dir[libexec/"bin/*"]
|
|
man.install Dir[libexec/"share/man/*"]
|
|
(lib/"pkgconfig").install_symlink Dir[libexec/"lib/pkgconfig/*.pc"]
|
|
bin.env_script_all_files(libexec/"bin", :PERL5LIB => ENV["PERL5LIB"])
|
|
|
|
(buildpath/"dummy").write "Vendor: dummy\n"
|
|
(etc/"dpkg/origins").install "dummy"
|
|
(etc/"dpkg/origins").install_symlink "dummy" => "default"
|
|
end
|
|
|
|
def post_install
|
|
(var/"lib/dpkg").mkpath
|
|
(var/"log").mkpath
|
|
end
|
|
|
|
def caveats; <<-EOS.undent
|
|
This installation of dpkg is not configured to install software, so
|
|
commands such as `dpkg -i`, `dpkg --configure` will fail.
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
# Do not remove the empty line from the end of the control file
|
|
# All deb control files MUST end with an empty line
|
|
(testpath/"test/data/homebrew.txt").write "brew"
|
|
(testpath/"test/DEBIAN/control").write <<-EOS.undent
|
|
Package: test
|
|
Version: 1.40.99
|
|
Architecture: amd64
|
|
Description: I am a test
|
|
Maintainer: Dpkg Developers <test@test.org>
|
|
|
|
EOS
|
|
system bin/"dpkg", "-b", testpath/"test", "test.deb"
|
|
assert File.exist?("test.deb")
|
|
|
|
rm_rf "test"
|
|
system bin/"dpkg", "-x", "test.deb", testpath
|
|
assert File.exist?("data/homebrew.txt")
|
|
end
|
|
end
|