rpm 5.4.15

Change from using berkeley-db 5.3 to 6.1 (the default version).
Everything else now uses the internal versions (where available),
to avoid external dependencies: beecrypt, neon, pcre, lua, syck.

The internal file and popt are currently missing or broken, so
they cannot be used. The mandatory libtasn1 and uuid are not
available as internal yet, so they also be have to be external.

Also make sure to set the right macros, for prefix / rpmbuild.
The rpm installation should go into prefix (in HOMEBREW_CELLAR),
while any rpms built by rpmbuild should go into HOMEBREW_PREFIX.

Disable the use of scriptlet depends, needs bash --rpm-requires.
This means that scripts won't automatically pick up executables.

Test rpm by quering the rpmdb (var/lib/rpm/Packages), creating
the database - if one doesn't exist already. Include a trivial
test package for testing rpmbuild functionality, creating rpms.
(will build under "var/lib/rpmbuild", if nothing else is set)

To use another top directory, set it in ~/.rpmmacros:
%_topdir        %(echo $HOME)/rpmbuild

Closes: Homebrew/homebrew#35062.

Closes Homebrew/homebrew#39054.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Anders F Bjorklund 2015-04-19 20:33:06 +02:00 committed by Jack Nagel
parent aac1c96b71
commit 22bd08b4ee

View file

@ -15,30 +15,29 @@ end
class Rpm < Formula class Rpm < Formula
homepage 'http://www.rpm5.org/' homepage 'http://www.rpm5.org/'
url 'http://rpm5.org/files/rpm/rpm-5.4/rpm-5.4.14-0.20131024.src.rpm', url 'http://rpm5.org/files/rpm/rpm-5.4/rpm-5.4.15-0.20140824.src.rpm',
:using => RpmDownloadStrategy :using => RpmDownloadStrategy
version '5.4.14' version '5.4.15'
sha1 'ea1a5f073ba4923d32f98b4e95a3f2555824f22c' sha1 '5e94f4679759c36ce76a4847401b22b660a97227'
depends_on 'berkeley-db' depends_on 'berkeley-db'
depends_on 'libmagic' depends_on 'libmagic'
depends_on 'popt' depends_on 'popt'
depends_on 'beecrypt'
depends_on 'libtasn1' depends_on 'libtasn1'
depends_on 'neon'
depends_on 'gettext' depends_on 'gettext'
depends_on 'xz' depends_on 'xz'
depends_on 'ossp-uuid' depends_on 'ossp-uuid'
depends_on 'pcre'
depends_on 'rpm2cpio' => :build depends_on 'rpm2cpio' => :build
def install def install
# only rpm should go into HOMEBREW_CELLAR, not rpms built
inreplace "macros/macros.in", '@prefix@', HOMEBREW_PREFIX
args = %W[ args = %W[
--prefix=#{prefix} --prefix=#{prefix}
--localstatedir=#{var} --localstatedir=#{var}
--with-path-cfg=#{etc}/rpm --with-path-cfg=#{etc}/rpm
--with-path-magic=#{HOMEBREW_PREFIX}/share/misc/magic --with-path-magic=#{HOMEBREW_PREFIX}/share/misc/magic
--with-extra-path-macros=#{lib}/rpm/macros.* --with-path-sources=#{HOMEBREW_PREFIX}/var/lib/rpmbuild
--with-libiconv-prefix=/usr --with-libiconv-prefix=/usr
--disable-openmp --disable-openmp
--disable-nls --disable-nls
@ -47,23 +46,65 @@ class Rpm < Formula
--with-sqlite=external --with-sqlite=external
--with-file=external --with-file=external
--with-popt=external --with-popt=external
--with-beecrypt=external --with-beecrypt=internal
--with-libtasn1=external --with-libtasn1=external
--with-neon=external --with-neon=internal
--with-uuid=external --with-uuid=external
--with-pcre=external --with-pcre=internal
--with-lua=internal --with-lua=internal
--with-syck=internal --with-syck=internal
--without-apidocs --without-apidocs
varprefix=#{var} varprefix=#{var}
] ]
inreplace "configure", "db-6.0", "db-5.3"
inreplace "configure", "db_sql-6.0", "db_sql-5.3"
system "./configure", *args system "./configure", *args
inreplace "Makefile", "--tag=CC", "--tag=CXX" inreplace "Makefile", "--tag=CC", "--tag=CXX"
inreplace "Makefile", "--mode=link $(CCLD)", "--mode=link $(CXX)" inreplace "Makefile", "--mode=link $(CCLD)", "--mode=link $(CXX)"
system "make" system "make"
# enable rpmbuild macros, for building *.rpm packages
inreplace "macros/macros", "#%%{load:%{_usrlibrpm}/macros.rpmbuild}", "%{load:%{_usrlibrpm}/macros.rpmbuild}"
# using __scriptlet_requires needs bash --rpm-requires
inreplace "macros/macros.rpmbuild", "%_use_internal_dependency_generator\t2", "%_use_internal_dependency_generator\t1"
system "make install" system "make install"
end end
def spec
<<-EOS.undent
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
return Pathname.new(`#{bin}/rpm --eval #{macro}`.chomp)
end
test do
system "#{bin}/rpm", "-vv", "-qa"
rpmdir('%_builddir').mkpath
specfile = rpmdir('%_specdir')+'test.spec'
specfile.unlink if specfile.exist?
(specfile).write(spec)
system "#{bin}/rpmbuild", "-ba", specfile
end
end end