111 lines
3.5 KiB
Ruby
111 lines
3.5 KiB
Ruby
class Rpm < Formula
|
|
desc "Standard unix software packaging tool"
|
|
homepage "http://www.rpm.org/"
|
|
url "http://ftp.rpm.org/releases/rpm-4.14.x/rpm-4.14.1.tar.bz2"
|
|
sha256 "43f40e2ccc3ca65bd3238f8c9f8399d4957be0878c2e83cba2746d2d0d96793b"
|
|
revision 1
|
|
version_scheme 1
|
|
|
|
bottle do
|
|
sha256 "80802434ab18123370e3391032525acc7c4394a7cd88073a4673bebf2f921ae0" => :mojave
|
|
sha256 "aa36aca65587fc561e2b4ca98577f14d4dfeab2e9122c64c0a29552986eda636" => :high_sierra
|
|
sha256 "3b312cf702cbc80bb709bc93a8385154e188b42640cee17c875f9da755ad15da" => :sierra
|
|
sha256 "1ec620b4d0063e71f35d9812d0862fbd42d7711beb08859f60c33f99f31d631c" => :el_capitan
|
|
end
|
|
|
|
depends_on "berkeley-db"
|
|
depends_on "gettext"
|
|
depends_on "libarchive"
|
|
depends_on "libmagic"
|
|
depends_on "lua@5.1"
|
|
depends_on "openssl"
|
|
depends_on "pkg-config"
|
|
depends_on "popt"
|
|
depends_on "xz"
|
|
depends_on "zstd"
|
|
|
|
def install
|
|
ENV.prepend_path "PKG_CONFIG_PATH", Formula["lua@5.1"].opt_libexec/"lib/pkgconfig"
|
|
|
|
# only rpm should go into HOMEBREW_CELLAR, not rpms built
|
|
inreplace ["macros.in", "platform.in"], "@prefix@", HOMEBREW_PREFIX
|
|
|
|
# ensure that pkg-config binary is found for dep generators
|
|
inreplace "scripts/pkgconfigdeps.sh",
|
|
"/usr/bin/pkg-config", Formula["pkg-config"].opt_bin/"pkg-config"
|
|
|
|
system "./configure", "--disable-dependency-tracking",
|
|
"--disable-silent-rules",
|
|
"--prefix=#{prefix}",
|
|
"--localstatedir=#{var}",
|
|
"--sharedstatedir=#{var}/lib",
|
|
"--sysconfdir=#{etc}",
|
|
"--with-path-magic=#{HOMEBREW_PREFIX}/share/misc/magic",
|
|
"--enable-nls",
|
|
"--disable-plugins",
|
|
"--with-external-db",
|
|
"--with-crypto=openssl",
|
|
"--without-apidocs",
|
|
"--with-vendor=homebrew"
|
|
system "make", "install"
|
|
end
|
|
|
|
def post_install
|
|
(var/"lib/rpm").mkpath
|
|
|
|
# Attempt to fix expected location of GPG to a sane default.
|
|
inreplace lib/"rpm/macros", "/usr/bin/gpg2", HOMEBREW_PREFIX/"bin/gpg"
|
|
end
|
|
|
|
def test_spec
|
|
<<~EOS
|
|
Summary: Test package
|
|
Name: test
|
|
Version: 1.0
|
|
Release: 1
|
|
License: Public Domain
|
|
Group: Development/Tools
|
|
BuildArch: noarch
|
|
|
|
%description
|
|
Trivial test package
|
|
|
|
%prep
|
|
%build
|
|
%install
|
|
mkdir -p $RPM_BUILD_ROOT/tmp
|
|
touch $RPM_BUILD_ROOT/tmp/test
|
|
|
|
%files
|
|
/tmp/test
|
|
|
|
%changelog
|
|
|
|
EOS
|
|
end
|
|
|
|
def rpmdir(macro)
|
|
Pathname.new(`#{bin}/rpm --eval #{macro}`.chomp)
|
|
end
|
|
|
|
test do
|
|
(testpath/"rpmbuild").mkpath
|
|
(testpath/".rpmmacros").write <<~EOS
|
|
%_topdir #{testpath}/rpmbuild
|
|
%_tmppath %{_topdir}/tmp
|
|
EOS
|
|
|
|
system "#{bin}/rpm", "-vv", "-qa", "--dbpath=#{testpath}/var/lib/rpm"
|
|
assert_predicate testpath/"var/lib/rpm/Packages", :exist?,
|
|
"Failed to create 'Packages' file!"
|
|
rpmdir("%_builddir").mkpath
|
|
specfile = rpmdir("%_specdir")+"test.spec"
|
|
specfile.write(test_spec)
|
|
system "#{bin}/rpmbuild", "-ba", specfile
|
|
assert_predicate rpmdir("%_srcrpmdir")/"test-1.0-1.src.rpm", :exist?
|
|
assert_predicate rpmdir("%_rpmdir")/"noarch/test-1.0-1.noarch.rpm", :exist?
|
|
system "#{bin}/rpm", "-qpi", "--dbpath=#{testpath}/var/lib/rpm",
|
|
rpmdir("%_rpmdir")/"noarch/test-1.0-1.noarch.rpm"
|
|
end
|
|
end
|