Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add recipe for rpm package manager #11188

Closed
wants to merge 1 commit into from
@thughes

This is a squashed version of #8090, with one additional change:

ENV.append 'CFLAGS', "-O0"

Without that flag I was getting weird errors when running rpmbuild, such as "cpio: Bad magic".

Note that there are two forks of rpm: version 4 and version 5. They are not compatible and are maintained by separate people. version 4 (which this formula is for) seems to be more widely used (i.e., it's the one used by RedHat, CentOS, etc.).

@thughes

Any issues preventing this from being merged?

@MindTooth

I think that you can remove the -O0 flag. Since it's now set as default I believe.

Or -Os is the standard: 273a738

@thughes

When I checked, "-Os" was set as the default and it doesn't run with that (it builds fine with anything, but only seems to run correctly with "-O0")

@MindTooth

OK :) Just wanted to check.

@danigiri

Cool Cool Cool.

Tried it but spits out some issues with the patches?

1 out of 1 hunk FAILED -- saving rejects to file rpm2cpio.c.rej
2 out of 2 hunks FAILED -- saving rejects to file rpmio/rpmio.c.rej
1 out of 1 hunk FAILED -- saving rejects to file rpmqv.c.rej
1 out of 2 hunks FAILED -- saving rejects to file system.h.rej
@thughes

Seems to be working for me. Anyone else having problems?

@danigiri

False alarm, soz. Did a copy-n-paste of the commit and probably botched a char or two. Compiles fine now.

Damn useful brew, thanks.

@adamv
Owner

Is version 5 ever going to "be popular"? Is it more or less a fork or what? We can pull this in, but I don't want to be setting ourselves up for a version conflict in the future.

@harking

It looks like v5 will be used in the future, but for now it is safe to have this brew utilize v4 as RedHat still officially supports it, and it is what most users are expecting.

@adamv adamv was assigned
@mikemcquaid
Owner

What is RPM use{d,ful} for on OSX?

@adamv
Owner

The def patch method needs comments above it telling us where the patches are from and if they can be removed in the next version

@thughes

@mikemcquaid I use it for packaging architecture independent RPMs (i.e., Java) for Linux

@adamv unfortunately I don't know where the patches are from since @haraldF was the one that wrote those (#8090)

@mikemcquaid
Owner

Sounds like RPM on OSX is pretty niche to me. I don't mind if someone else pulls it though,

@danigiri

@thughes I planned to use it with the maven-rpm-plugin
Though it segfaults on me as the provided architecture macro values seem to conflict with it

@harking

Our use case aligns with @danigiri 's, maven-rpm-plugin.

@danigiri

@harking I get --target 'noarch-apple-mac os x' as the plugin uses 'architecture-vendor-OS' and as these values are on the rpm macros and using these rpm always segfaults for me.

If I do a --target 'noarch' it seems to work. Do you experience the same thing?

@danigiri

I have created a wrapper for rpmbuild that if added to your path will at least have maven-rpm-plugin worn on Mac OS X
git://gist.github.com/2815502.git

@afb

I updated this to 4.10.0 and rebased the patches (to rpm.org's 4ad7927d0d29e000a2d287b5a0fc5d8d2d86c113), in 7cd93bd.
Reenabled standard optimizations again, and also fixed some other bugs with the formula:

  • --disable-optimize and --without-javaglue was for the internal beecrypt
  • --without-apidocs (i.e. no doxygen) is now called --without-hackingdocs
  • there was some broken symlinks to ../../bin installed, intended for /usr/bin
@revrom

I had to update the rpm.rb to include the --without-lua in the install def, like this to get the rpm compiled and deployed on my system (Mountain Lion):

system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}", "--with-external-db", "--sysconfdir=#{HOMEBREW_PREFIX}/etc", "--disable-optimize", "--without-javaglue", "--without-apidocs", "--enable-python", "--localstatedir=#{HOMEBREW_PREFIX}/var", "--without-lua"

Otherwise even though Lua is installed in my brew, the configure has been still complaining configure: error: lua not present (--without-lua to disable)

@2bits

I'd like to see this get pulled when it's ready. @revrom Thanks for working on it for ML. Please gist your config.log when it doesn't find lua, I will look at it and see if I can offer some help.

7cd93bd worked for me. I didn't get any lua errors.

@2bits

@jacknagel What happened to 7cd93bd? It's not in master but was committed?

@jacknagel
Collaborator

It wasn't committed to core, no; however all repositories in a github fork network share an object store, so you can take any commit from any fork, stick it after https://github.com/mxcl/homebrew/commit and it will appear as if it is part of that repository. Which is misleading.

@2bits

Right on. I'll have to build this and try to get the info from a few RPMs.

@afb

@jacknagel Not only will it link to different forks, it will also try linking different repos...

http://rpm.org/gitweb?p=rpm.git;a=commit;h=4ad7927d0d29e000a2d287b5a0fc5d8d2d86c113
afb@7cd93bd

@ssbarnea

When we'll be able to run 'brew install rpm'?

@2bits

So this is the farthest I got for an rpm formula, and it works well. I just had to remove lua because it needs 5.1 and we run 5.2 now. Because of no repsonse from the OP, I'll open a new PR. Here's a query into a libtiff rpm:

$ rpm -qpi libtiff5-4.0.2-1.9.1.x86_64.rpm 
warning: libtiff5-4.0.2-1.9.1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 3dbdc284: NOKEY
Name        : libtiff5
Version     : 4.0.2
Release     : 1.9.1
Architecture: x86_64
Install Date: (not installed)
Group       : System/Libraries
Size        : 486631
License     : HPND
Signature   : RSA/SHA256, Wed Aug 15 04:20:55 2012, Key ID b88b2fd43dbdc284
Source RPM  : tiff-4.0.2-1.9.1.src.rpm
Build Date  : Wed Aug 15 04:20:14 2012
Build Host  : build11
Relocations : (not relocatable)
Packager    : http://bugs.opensuse.org
Vendor      : openSUSE
URL         : http://www.remotesensing.org/libtiff
Summary     : The Tiff Library (with JPEG and compression support)
Description :
This package includes the tiff libraries. To link a program with
libtiff, you will have to add -ljpeg and -lz to include the necessary
libjpeg and libz in the linking process.
@adamv
Owner

@2bits please open a new pull request. I'll also revert Lua to 5.1 probably.

@2bits 2bits referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@adamv
Owner

Closing in favor of #14937.

@adamv adamv closed this
@afb

Too bad, I was just going to push the lua 5.2 support. Oh well, it's in cce1818

@2bits 2bits referenced this pull request from a commit in 2bits/homebrew
@2bits 2bits New formula: rpm (version 4.x)
- Add rpm formula at version 4.10.1
- Enable lua bindings against lua-5.1. Works now.
- Enable python bindings. Works great.
- Uses bdb, nss, nspr, libmagic, xz, pkg-config.
- Has a patch, not mine, explained in the PR.
- Docs are disabled because they're online.

Closes #11188
0c052f4
@afb afb referenced this pull request from a commit in afb/homebrew
@afb afb New formula: rpm (version 4.x)
- Add rpm formula at version 4.10.1
- Enable lua bindings against lua-5.1. Works now.
- Enable python bindings. Works great.
- Uses bdb, nss, nspr, libmagic, xz, pkg-config.
- Has a patch, not mine, explained in the PR.
- Docs are disabled because they're online.

Closes #11188
(cherry picked from commit 0c052f4)

Conflicts:

	Library/Formula/rpm.rb
4bc0e8b
@afb afb referenced this pull request
Closed

add rpm 5.4 formula #12635

@afb afb referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@afb afb referenced this pull request from a commit in afb/homebrew
@afb afb New formula: rpm 4.11
- Add rpm formula at version 4.11.0.1
  (brown paper bag release of 4.11.x)
- Enable default lua and python bindings.
- Docs are disabled because they're online.
- Added portability patches (from 5f69d15).

Closes #8090 #11188 #14937
fa192d2
@afb afb referenced this pull request
Closed

New formula: rpm 4.11 #19557

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 24, 2012
  1. @thughes

    Add recipe for rpm package manager

    Harald Fernengel authored thughes committed
This page is out of date. Refresh to see the latest.
Showing with 156 additions and 0 deletions.
  1. +156 −0 Library/Formula/rpm.rb
View
156 Library/Formula/rpm.rb
@@ -0,0 +1,156 @@
+require 'formula'
+
+class Rpm < Formula
+ url 'http://rpm.org/releases/rpm-4.9.x/rpm-4.9.1.2.tar.bz2'
+ homepage 'http://www.rpm.org/'
+ md5 '85cc5b7adb5806b5abf5b538b088dbdc'
+
+ depends_on 'nss'
+ depends_on 'nspr'
+ depends_on 'libmagic'
+ depends_on 'popt'
+ depends_on 'lua'
+ depends_on 'berkeley-db'
+
+ def patches
+ DATA
+ end
+
+ def install
+ # Note - MacPorts also builds without optimizations. This seems to fix several
+ # random crashes
+ ENV.append 'CPPFLAGS', "-I#{HOMEBREW_PREFIX}/include/nss -I#{HOMEBREW_PREFIX}/include/nspr"
+ ENV.append 'CFLAGS', "-O0"
+ system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}", "--with-external-db", "--sysconfdir=#{HOMEBREW_PREFIX}/etc", "--disable-optimize", "--without-javaglue", "--without-apidocs", "--enable-python", "--localstatedir=#{HOMEBREW_PREFIX}/var"
+ system "make"
+ system "make install"
+ end
+end
+
+__END__
+diff --git a/lib/poptALL.c b/lib/poptALL.c
+index 474af33..535e564 100644
+--- a/lib/poptALL.c
++++ b/lib/poptALL.c
+@@ -246,7 +246,7 @@ rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
+ #if HAVE_MCHECK_H && HAVE_MTRACE
+ mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
+ #endif
+- setprogname(argv[0]); /* Retrofit glibc __progname */
++ xsetprogname(argv[0]); /* Retrofit glibc __progname */
+
+ /* XXX glibc churn sanity */
+ if (__progname == NULL) {
+diff --git a/lib/rpmgi.c b/lib/rpmgi.c
+index 19f8f9f..1f15313 100644
+--- a/lib/rpmgi.c
++++ b/lib/rpmgi.c
+@@ -45,7 +45,7 @@ static FD_t rpmgiOpen(const char * path, const char * fmode)
+ char * fn = rpmExpand(path, NULL);
+ FD_t fd = Fopen(fn, fmode);
+
+- if (fd == NULL || Ferror(fd)) {
++ if (fd == NULL) {
+ rpmlog(RPMLOG_ERR, _("open of %s failed: %s\n"), fn, Fstrerror(fd));
+ if (fd != NULL) (void) Fclose(fd);
+ fd = NULL;
+diff --git a/misc/glob.c b/misc/glob.c
+index 3bebe9e..921b8c0 100644
+--- a/misc/glob.c
++++ b/misc/glob.c
+@@ -944,6 +944,11 @@ __glob_pattern_p (const char *pattern, int quote)
+ }
+ # ifdef _LIBC
+ weak_alias (__glob_pattern_p, glob_pattern_p)
++# else
++int glob_pattern_p (__const char *__pattern, int __quote)
++{
++ return __glob_pattern_p(__pattern, __quote);
++}
+ # endif
+ #endif
+
+diff --git a/rpm2cpio.c b/rpm2cpio.c
+index ed3051e..75b4f5d 100644
+--- a/rpm2cpio.c
++++ b/rpm2cpio.c
+@@ -20,7 +20,7 @@ int main(int argc, char *argv[])
+ int rc;
+ FD_t gzdi;
+
+- setprogname(argv[0]); /* Retrofit glibc __progname */
++ xsetprogname(argv[0]); /* Retrofit glibc __progname */
+ rpmReadConfigFiles(NULL, NULL);
+ if (argc == 1)
+ fdi = fdDup(STDIN_FILENO);
+diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c
+index 2fbbf91..30f7685 100644
+--- a/rpmio/rpmio.c
++++ b/rpmio/rpmio.c
+@@ -1455,12 +1455,13 @@ int Fclose(FD_t fd)
+
+ if (fps->io == fpio) {
+ FILE *fp;
+- int fpno;
++ int fpno = -1;
+
+ fp = fdGetFILE(fd);
+- fpno = fileno(fp);
+- if (fp)
++ if (fp) {
++ fpno = fileno(fp);
+ rc = fclose(fp);
++ }
+ if (fpno == -1) {
+ fd = fdFree(fd);
+ fdPop(fd);
+@@ -1758,7 +1759,8 @@ int Ferror(FD_t fd)
+ int ec;
+
+ if (fps->io == fpio) {
+- ec = ferror(fdGetFILE(fd));
++ FILE *fs = fdGetFILE(fd);
++ ec = fs ? ferror(fs) : -1;
+ } else if (fps->io == gzdio) {
+ ec = (fd->syserrno || fd->errcookie != NULL) ? -1 : 0;
+ i--; /* XXX fdio under gzdio always has fdno == -1 */
+diff --git a/rpmqv.c b/rpmqv.c
+index 989e95a..f69adf3 100644
+--- a/rpmqv.c
++++ b/rpmqv.c
+@@ -92,8 +92,8 @@ int main(int argc, char *argv[])
+
+ /* Set the major mode based on argv[0] */
+ #ifdef IAM_RPMQV
+- if (rstreq(__progname, "rpmquery")) bigMode = MODE_QUERY;
+- if (rstreq(__progname, "rpmverify")) bigMode = MODE_VERIFY;
++ if (rstreq(__progname ? __progname : "", "rpmquery")) bigMode = MODE_QUERY;
++ if (rstreq(__progname ? __progname : "", "rpmverify")) bigMode = MODE_VERIFY;
+ #endif
+
+ #if defined(IAM_RPMQV)
+diff --git a/system.h b/system.h
+index 9b23e45..2f3378d 100644
+--- a/system.h
++++ b/system.h
+@@ -21,6 +21,7 @@
+ #ifdef __APPLE__
+ #include <crt_externs.h>
+ #define environ (*_NSGetEnviron())
++#define fdatasync fsync
+ #else
+ extern char ** environ;
+ #endif /* __APPLE__ */
+@@ -113,10 +114,10 @@ typedef char * security_context_t;
+ #if __GLIBC_MINOR__ >= 1
+ #define __progname __assert_program_name
+ #endif
+-#define setprogname(pn)
++#define xsetprogname(pn) setprogname((pn))
+ #else
+ #define __progname program_name
+-#define setprogname(pn) \
++#define xsetprogname(pn) \
+ { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
+ else __progname = pn; \
+ }
Something went wrong with that request. Please try again.