Search code examples
mongodbrpmbuildrpm-spec

Packaging MongoDB with packager.py


Trying to package my custom built MongoDB 2.6.6 (with SSL), I'm using the packager.py script from buildscript/ in the sources I got from www.mongodb.org.

I've changed it in a few places, based on this and on errors I've had because of file locations.

I've come along way, but now the error I'm getting is from within rpmbuild:

error: File not found: /tmp/tmp7vZvNP/rpmbuild/BUILDROOT/mongodb-org-2.6.6-1.%{_arch}/usr/bin/mongod

Put aside the fact I searched and couldn't find where the %{_arch} thing came from, the mongod binary file exists in /tmp/tmp7vZvNP/rpmbuild/BUILDROOT/mongodb-org-2.6.6-1.%\{_arch\}/usr/bin/mongodb-linux-x86_64-2.6.6/bin/

Where is {_bindir} defined for the spec file? Any other idea what's the next thing I should be pursuing?


Solution

  • So after reading @Etan Reisner's comment, I did the following: Changed write_rpm_macros_file to look like this:

    def write_rpm_macros_file(path, topdir, arch):
        f=open(path, 'w')
        try:
            f.write("%%_topdir  %s\n" % topdir)
            f.write("%%_arch    %s\n" % arch)
            f.write("%%_bindir  %s" % "/usr/bin/mongodb-linux-x86_64-2.6.6/bin/")
        finally:
            f.close()
    

    And now I have an RPM built correctly.

    Edit: I changed the binaries tar.gz file and now the %_bindir macro is not needed...