Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Add recipe for rpm package manager #8090

Closed
wants to merge 3 commits into from
Closed

Conversation

haraldF
Copy link
Contributor

@haraldF haraldF commented Oct 12, 2011

This change adds a recipe for the rpm package manager. This tool is very helpful to introspect / query / verify / uncompress rpm packages, e.g. for MeeGo development on Mac OS X.

I'm currently trying to upstream the Mac OS X build fixes, until they're accepted in rpm, I'm going to maintain them in rpm.rb.

@jcrobak
Copy link

jcrobak commented Oct 13, 2011

FYI, I had to add:

 depends_on 'lua'

to the recipe, else I got an error when configuring rpm:

configure: error: lua not present (--without-lua to disable)
==> Exit Status: 1
http://github.com/mxcl/homebrew/blob/master/Library/Formula/rpm.rb#L19

@haraldF
Copy link
Contributor Author

haraldF commented Oct 13, 2011

Thanks for the info, I've updated my merge request.

@jcrobak
Copy link

jcrobak commented Oct 13, 2011

hey haraldF - I'm also seeing an odd issue... seems like it hasn't done variable substitution during configure:

 ~ $ rpm -q foo
error: cannot open Packages database in /${prefix}/var/lib/rpm
error: cannot open Packages database in /${prefix}/var/lib/rpm
package foo is not installed

I installed with brew install -v but nothing jumped out. Any ideas?

@Sharpie
Copy link
Contributor

Sharpie commented Oct 15, 2011

Double check the patches:

==> Installing rpm
==> Downloading http://rpm.org/releases/rpm-4.9.x/rpm-4.9.1.2.tar.bz2
######################################################################## 100.0%
==> Patching
patching file lib/poptALL.c
patching file lib/rpmgi.c
patching file misc/glob.c
patching file rpm2cpio.c
Hunk #1 FAILED at 20.
1 out of 1 hunk FAILED -- saving rejects to file rpm2cpio.c.rej
patching file rpmio/rpmio.c
Hunk #1 FAILED at 1455.
Hunk #2 succeeded at 1759 with fuzz 2.
1 out of 2 hunks FAILED -- saving rejects to file rpmio/rpmio.c.rej
patching file rpmqv.c
patching file system.h
Error: Failure while executing: /usr/bin/patch -f -p1 -i 001-homebrew.diff

@haraldF
Copy link
Contributor Author

haraldF commented Oct 16, 2011

@Sharpie - weird, I just retried and the patches apply fine:

/usr/bin/curl -f#LA Homebrew 0.8 (Ruby 1.8.7-249; Mac OS X 10.6.8) http://rpm.org/releases/rpm-4.9.x/rpm-4.9.1.2.tar.bz2 -o /Users/harald/Library/Caches/Homebrew/rpm-4.9.1.2.tar.bz2
######################################################################## 100.0%
/usr/bin/tar xf /Users/harald/Library/Caches/Homebrew/rpm-4.9.1.2.tar.bz2
==> Patching
/usr/bin/patch -f -p1 -i 001-homebrew.diff
patching file lib/poptALL.c
patching file lib/rpmgi.c
patching file misc/glob.c
patching file rpm2cpio.c
patching file rpmio/rpmio.c
patching file rpmqv.c
patching file system.h
==> ./configure --enable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/rpm/4.9.1.2 --with-external-db

@mathieulegrand
Copy link

I am seeing the same rejects:

~% brew install rpm
==> Downloading http://rpm.org/releases/rpm-4.9.x/rpm-4.9.1.2.tar.bz2
File already downloaded in /Users/mathieulegrand/Library/Caches/Homebrew
==> Patching
patching file lib/poptALL.c
patching file lib/rpmgi.c
patching file misc/glob.c
patching file rpm2cpio.c
Hunk #1 FAILED at 20.
1 out of 1 hunk FAILED -- saving rejects to file rpm2cpio.c.rej
patching file rpmio/rpmio.c
Hunk #1 FAILED at 1455.
Hunk #2 succeeded at 1759 with fuzz 2.
1 out of 2 hunks FAILED -- saving rejects to file rpmio/rpmio.c.rej
patching file rpmqv.c
patching file system.h
Error: Failure while executing: /usr/bin/patch -f -p1 -i 001-homebrew.diff

@2bits
Copy link
Contributor

2bits commented Dec 7, 2011

I was able to patch this on Lion without any hunk failures. I don't have my SL handy to test this on it, though.
I get a different error than other people mentioned, as it has a dep on berkeley-db I guess:

checking db.h usability... yes
checking db.h presence... yes
checking for db.h... yes
configure: error: Berkeley DB version >= 4.5 required
Error: #<BuildError: Failed executing: ./configure --enable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/rpm/4.9.1.2 --with-external-db>
/usr/local/Library/Homebrew/formula.rb:541:in `system'

So I guess this needs another commit for that depends_on. Sorry if the issues have caused ya'll some headaches.
I know how that feels lol, but this does sound handy. Here is a gist of my config.log

@mistydemeo
Copy link
Member

The patches also applied for me on 10.6.8/Xcode 3.2.6, so my build also halted on the missing depends_on 'berkeley-db'. It builds fine with berkeley-db in place.

@arusarka
Copy link

I copied the ruby code from rpm.rb file and put it in rpm.rb. then I did brew install rpm.rb

Hoever I'm getting an error uninitialized constant Rpm::DATA.

1st q -> Am I supposed to install it that way?
2nd q -> Maybe the error is there because the patches method has a constant called DATA.

I would really like not having to install macports just for rpm. Any help is highly appreciated.

Thanks.

--Aru

Had to install berkeley-db first. Thanks a lot.

@2bits
Copy link
Contributor

2bits commented Feb 14, 2012

gist your config.log including the exact error message, plus a brew doctor and brew --config
To answer your questions:

  1. It's ok to install that way. If brew update ever complains about the file you copied into the Library, you can safely delete the file and then brew update again.
  2. That's a long shot, as @mistydemeo mentioned it built ok. We'll know more once we see the logs.

Well I'm now getting the same error as the other fellow:

~ $ rpm -q xbill.rpm
error: cannot open Packages database in /${prefix}/var/lib/rpm
error: cannot open Packages database in /${prefix}/var/lib/rpm
package foo is not installed

but I can fix it if I specify a dbpath like rpm --dbpath /usr/local/var/rpm
I'm working on trying to get a better dbpath into the formula. There are a lot of places in his code
where he uses /var though...

This seems to set the dbpath the way we might want it so that it persists,
though I'm not sure the tabs pasted into github ok:

inreplace 'macros.in', "%_dbpath %{_var}/lib/rpm", "%_dbpath #{var}/rpm"

I went ahead and made a gist of a new rpm.rb that includes

  • new deps on xz, bdb, gnupg, and doxygen
  • enables python bindings, which get symlinked into Homebrew's site-packages
  • removes unused debug configure argument
  • creates working symlinks for rpmquery and rpmverify that are otherwise b0rked due to bad scripting.

So how well does it work? Well if I exit 1 before the end of the formula and brew link rpm to get
everything in its final resting place, and I run make check I get 52 fails out of 109. So at least something works.

@arusarka
Copy link

Thanks for your help 2bits.

I was able to install rpm by installing berkeley-db first.

I was getting an error where the configure (or make) step had failed due to dependency on berkeley-db. So I went ahead with brew install berkeley-db first. After that, brew install rpm.rb. The rpm.rb from haraldF rpm branch worked perfectly for me. I did not have to change anything.

@2bits
Copy link
Contributor

2bits commented Feb 16, 2012

Using some official rpm from a distro, like xbill.rpm, or any official rpm you have handy, would you run rpm -qil xbill.rpm and paste in your result? I'm curious if it's just my build that can't list the contents of an rpm nor its info.

@arusarka
Copy link

Damn! I thought I had it figured out.

Here's the console output:

➜ ~ rpm -qil /tmp/xbill-2.1-2.fc11.x86_64.rpm
error: cannot open Packages database in /${prefix}/var/lib/rpm
error: cannot open Packages database in /${prefix}/var/lib/rpm
package /tmp/xbill-2.1-2.fc11.x86_64.rpm is not installed

@2bits
Copy link
Contributor

2bits commented Feb 16, 2012

It's okay, plus we get to see your prompt :-)
I think it's important to address the testsuite failures upstream,
though I'm reticent because I haven't determined why there's so many.

@2bits
Copy link
Contributor

2bits commented Feb 16, 2012

Configure determines we have /usr/bin/fakechroot which we don't.
Then rpm proceeds to use that command throughout the testsuite.
I tried to build fakechroot from tarball, and I got pretty far with my formula,
but it has too many inconsistencies with ftw(3) for me fix.

@harking
Copy link
Contributor

harking commented Mar 1, 2012

I'm going to try and look into just creating a brew based off the MacPorts of RPM. Looks like they've already solved these problems.
https://trac.macports.org/browser/trunk/dports/sysutils/rpm/Portfile

@haraldF
Copy link
Contributor Author

haraldF commented Mar 1, 2012

last commit should fix the "cannot open Packages database" bug

@haraldF
Copy link
Contributor Author

haraldF commented Mar 1, 2012

@harking let me know how it goes. I saw MacPorts was using rpm5, however, I needed an rpm4.

@adamv
Copy link
Contributor

adamv commented Mar 1, 2012

Reminder that when this is ready for review for inclusion, we'll want a single squashed commit rebased on top of master.

@thughes
Copy link
Contributor

thughes commented Mar 24, 2012

I made one additional change and squashed the commit on top of master: #11188

@jacknagel jacknagel closed this Mar 26, 2012
@afb afb mentioned this pull request Nov 18, 2012
afb added a commit to afb/homebrew that referenced this pull request May 1, 2013
- 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 Homebrew#8090 Homebrew#11188 Homebrew#14937
@afb afb mentioned this pull request May 1, 2013
@Homebrew Homebrew locked and limited conversation to collaborators Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet