135 lines
4.5 KiB
Ruby
135 lines
4.5 KiB
Ruby
class Dpkg < Formula
|
|
desc "Debian package management system"
|
|
homepage "https://wiki.debian.org/Teams/Dpkg"
|
|
# Please use a mirror as the primary URL as the
|
|
# dpkg site removes tarballs regularly which means we get issues
|
|
# unnecessarily and older versions of the formula are broken.
|
|
url "https://deb.debian.org/debian/pool/main/d/dpkg/dpkg_1.21.12.tar.xz"
|
|
sha256 "ec7a0e29898f457ea21cc89826601059bce2433d2b4e578a38b2a66d8768559a"
|
|
license "GPL-2.0-only"
|
|
|
|
livecheck do
|
|
url "https://deb.debian.org/debian/pool/main/d/dpkg/"
|
|
regex(/href=.*?dpkg[._-]v?(\d+(?:\.\d+)+)\.t/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 arm64_ventura: "1472fdf59519cc7efd2f8dd89f6d869f758fc6c5e476db693ae4398c286ab5d4"
|
|
sha256 arm64_monterey: "a998923448323bbc8df82565e6f60782f446d6d9655b427823ff68de39f165b0"
|
|
sha256 arm64_big_sur: "3d35a3f3aa5accbf759ab7af5d1fb462cba8e8d6735557a0075d5403b9feeb00"
|
|
sha256 ventura: "ca30ac03ae2f4e14da864dc9ac6b8cf5139e645868ab064fc36cf1fd954f3bde"
|
|
sha256 monterey: "dd4908e4b8c6c59996ea82a5b35bc435690b36ab273f32838d224f8a08dbb78a"
|
|
sha256 big_sur: "1a0ea6c1bcfdd4c89307862ad9a5284146448bb51c27f90e354aa7be689fd1e4"
|
|
sha256 x86_64_linux: "41ae89c1190df1ac76bd1bfff28b6da4e6509fec42f8edcc5ea5ba47face9b62"
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "po4a" => :build
|
|
depends_on "gettext"
|
|
depends_on "gnu-tar"
|
|
depends_on "gpatch"
|
|
depends_on "libmd" # for md5.h
|
|
depends_on "perl"
|
|
depends_on "xz" # For LZMA
|
|
|
|
uses_from_macos "bzip2"
|
|
uses_from_macos "zlib"
|
|
|
|
on_linux do
|
|
keg_only "not linked to prevent conflicts with system dpkg"
|
|
end
|
|
|
|
patch :DATA
|
|
|
|
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"] = if OS.mac?
|
|
Formula["gnu-tar"].opt_bin/"gtar"
|
|
else
|
|
Formula["gnu-tar"].opt_bin/"tar"
|
|
end
|
|
|
|
# Since 1.18.24 dpkg mandates the use of GNU patch to prevent occurrences
|
|
# of the CVE-2017-8283 vulnerability.
|
|
# https://www.openwall.com/lists/oss-security/2017/04/20/2
|
|
ENV["PATCH"] = Formula["gpatch"].opt_bin/"patch"
|
|
|
|
# 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
|
|
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
|
|
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_predicate testpath/"test.deb", :exist?
|
|
|
|
rm_rf "test"
|
|
system bin/"dpkg", "-x", "test.deb", testpath
|
|
assert_predicate testpath/"data/homebrew.txt", :exist?
|
|
end
|
|
end
|
|
|
|
__END__
|
|
diff --git a/lib/dpkg/i18n.c b/lib/dpkg/i18n.c
|
|
index 4952700..81533ff 100644
|
|
--- a/lib/dpkg/i18n.c
|
|
+++ b/lib/dpkg/i18n.c
|
|
@@ -23,6 +23,11 @@
|
|
|
|
#include <dpkg/i18n.h>
|
|
|
|
+#ifdef __APPLE__
|
|
+#include <string.h>
|
|
+#include <xlocale.h>
|
|
+#endif
|
|
+
|
|
#ifdef HAVE_USELOCALE
|
|
static locale_t dpkg_C_locale;
|
|
#endif
|