Monday, October 22, 2012

MongoDB 2.2.0 RPM Build Instructions


Building rpm files from mongo source. There isn't any documentation on this. But the source is very clean and easy to read.

The mongodb source downloads need some modification before they will build RPM packages. RPM packages are the binary distribution combined with control scripts, usually python or bash scripts, which configure the system.

This document can be paired with a Jenkins document for CI build automation.

Download the mongodb source package. Gunzip and untar and cd into the directory. Should look like this:

cd into the buildscripts directory. You should see a file packager.py. To run this, add the version of rpm you are building like this: >python packager.py 2.2.0. For now let's configure the system and modify packager.py  
to get rpms to build before adding additional enhancements. 



The program packager.py is used to build debian and rpm packages. You have to edit this program before you are able to build rpm or debian packages on your local development machine. Packager.py is probably 10gen's implementation on their own build environment. We have to make some minor modifications to modify these dependencies.


  1. Modify the python list variables ARCHES and DISTROS to match the machine you are doing a build on. You can't build a 64bit rpm on a 32 bit machine and you can't build a debian package on a redhat installation. I am using a CentOS system on a 64 bit Dell Laptop,  before: 
          After: 



    2. One of the problems with packager.py as configured is it downloads a new copy of the binaries to a new tmp directory every time it runs. This not only wastes disk space but a 53mb download on every run is not necessary. Modify prefix to your own location. In the examples below I use /home/dc/tmp as my prefix directory. You can choose any path you can read/write files into without doing a sudo.  You will have to either precreate this directory before running packager.py or you can add python code to do this. To make this process simple I am going to precreate the prefix directory which means I'll have to run a mkdir command outside the script. 


Before:




After: 



 In this case the prefix directory is set to /home/dc/tmp/. Precreate this file, make sure this directory exists and is accessible, mkdir /home/dc/tmp 

Run the script and you should see an error message. The script has proceeded to the point where the dl directory is created. We are going to modify the program to not download the mongodb files each time.



3. Modify the httpget funcction to not download.

Before: 




After:





  1. Since we commented out the downloading part, we have to install the mongodb binaries ourselves. Copy the mongo binary to your prefix directory. The mongo binaries are the same files you use to install mongodb with.  After packager.py runs the first time it should have created a subdirectcory called dl for downloads under the python prefix variable path. Copy the linux 32 or 64 bit binaries into this directory. When you copy you will have to rename the file by switching the 2.2.0 and x86_64 parts of the file name and changing the file extension from .tgz to .tar.gz. They do this so a download doesn't write over existing versions. For example my download was named mongodb-linux-x86_64-2.2.0.tgz, rename this to what is below:


5. comment out the git archive command. This command doesn't work in our localized build environment. 



6. Every time you run packager.py you will have to delete the subdirectories under BINARIES/usr. I leave a second xterm open, cd into this directory and do a rm -rf *. Be careful, make sure you are in the correct directory before running this. In the screenshot below we have to remove bin and mongo-liinux-x86_64-2.2.0



You will see errors like this, which indicate you have to delete the directories on the next run: 

File "packager.py", line 176, in main
repos.append(make_package(distro, arch, spec, srcdir))
File "packager.py", line 341, in make_package
unpack_binaries_into(arch, spec, sdir+("%s/usr/"%BINARYDIR))
File "packager.py", line 321, in unpack_binaries_into
raise exc
OSError: [Errno 39] Directory not empty






7. change the paths to include the installation directory of your source so pacakager.py can find the right files for build. This reflects the configuraion of their build server which is different than what we have. Add the directory where you have downloaded the mongod source into. There are 3 places where /home/dc/Downloads/mongodb-src-r2.2.0 are added. There should be a current directory variable in packager.py we should be able to use instead of hardcoding this in... 




8. precreate the directory /dst/x86_64/redhat/mongodb-10gen-2.2.0/rpm.


9. Run packager.py 



[dc@localhost buildscripts]$ python packager.py 2.2.0

Working in directory /home/dc/tmp
Fetching http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.2.0.tgz to dl/mongodb-linux-2.2.0-x86_64.tar.gz.
Copying packaging files from /home/dc/Downloads/mongodb-src-r2.2.0/buildscripts/..//debian to dst/x86_64/redhat/mongo-10gen-2.2.0/
Copying packaging files from /home/dc/Downloads/mongodb-src-r2.2.0/buildscripts/..//rpm to dst/x86_64/redhat/mongo-10gen-2.2.0/

In /home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/BINARIES/usr, running tar xvzf /home/dc/tmp/dl/mongodb-linux-2.2.0-x86_64.tar.gz mongodb-linux-x86_64-2.2.0/bin
mongodb-linux-x86_64-2.2.0/bin/mongodump
mongodb-linux-x86_64-2.2.0/bin/mongorestore
mongodb-linux-x86_64-2.2.0/bin/mongoexport
mongodb-linux-x86_64-2.2.0/bin/mongoimport
mongodb-linux-x86_64-2.2.0/bin/mongostat
mongodb-linux-x86_64-2.2.0/bin/mongotop
mongodb-linux-x86_64-2.2.0/bin/mongooplog
mongodb-linux-x86_64-2.2.0/bin/mongofiles
mongodb-linux-x86_64-2.2.0/bin/bsondump
mongodb-linux-x86_64-2.2.0/bin/mongoperf
mongodb-linux-x86_64-2.2.0/bin/mongosniff
mongodb-linux-x86_64-2.2.0/bin/mongod
mongodb-linux-x86_64-2.2.0/bin/mongos
mongodb-linux-x86_64-2.2.0/bin/mongo
In /home/dc/tmp, running rpm --showrc

In /home/dc/tmp, running cp -v dst/x86_64/redhat/mongo-10gen-2.2.0/rpm/mongo-10gen.spec /home/dc/tmp/rpmbuild/SPECS/

`dst/x86_64/redhat/mongo-10gen-2.2.0/rpm/mongo-10gen.spec' -> `/home/dc/tmp/rpmbuild/SPECS/mongo-10gen.spec'

In /home/dc/tmp/dst/x86_64/redhat, running tar -cpzf /home/dc/tmp/rpmbuild/SOURCES/mongo-10gen-2.2.0.tar.gz mongo-10gen-2.2.0

In /home/dc/tmp, running rpmbuild -ba --target x86_64 --macros /usr/lib/rpm/macros:/usr/lib/rpm/x86_64-linux/macros:/etc/rpm/macros.*:/etc/rpm/macros:/etc/rpm/x86_64-linux/macros:~/.rpmmacros:/home/dc/tmp/macros /home/dc/tmp/rpmbuild//SPECS/mongo-10gen.spec

Building target platforms: x86_64
Building for target x86_64
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.x82Gq2
+ umask 022
+ cd /home/dc/tmp/rpmbuild//BUILD
+ cd /home/dc/tmp/rpmbuild/BUILD
+ rm -rf mongo-10gen-2.2.0
+ /usr/bin/gzip -dc /home/dc/tmp/rpmbuild/SOURCES/mongo-10gen-2.2.0.tar.gz
+ /bin/tar -xvvf -
drwxrwxr-x dc/dc 0 2012-10-22 17:30 mongo-10gen-2.2.0/
drwxrwxr-x dc/dc 0 2012-10-22 17:30 mongo-10gen-2.2.0/rpm/
-rw-rw-r-- dc/dc 4289 2012-10-22 17:30 mongo-10gen-2.2.0/rpm/mongo-10gen.spec
drwxrwxr-x dc/dc 0 2012-10-22 17:21 mongo-10gen-2.2.0/BINARIES/
drwxrwxr-x dc/dc 0 2012-10-22 17:30 mongo-10gen-2.2.0/BINARIES/usr/
drwxrwxr-x dc/dc 0 2012-10-22 17:30 mongo-10gen-2.2.0/BINARIES/usr/bin/
-rwxr-xr-x dc/dc 10450080 2012-08-28 13:58 mongo-10gen-2.2.0/BINARIES/usr/bin/mongotop
-rwxr-xr-x dc/dc 10470624 2012-08-28 13:58 mongo-10gen-2.2.0/BINARIES/usr/bin/mongoimport
-rwxr-xr-x dc/dc 10458368 2012-08-28 13:58 mongo-10gen-2.2.0/BINARIES/usr/bin/mongoexport
-rwxr-xr-x dc/dc 10494080 2012-08-28 13:58 mongo-10gen-2.2.0/BINARIES/usr/bin/mongostat
-rwxr-xr-x dc/dc 10493288 2012-08-28 13:59 mongo-10gen-2.2.0/BINARIES/usr/bin/mongod
-rwxr-xr-x dc/dc 10446016 2012-08-28 13:59 mongo-10gen-2.2.0/BINARIES/usr/bin/bsondump
-rwxr-xr-x dc/dc 10450112 2012-08-28 13:59 mongo-10gen-2.2.0/BINARIES/usr/bin/mongoperf
-rwxr-xr-x dc/dc 6766992 2012-08-28 14:00 mongo-10gen-2.2.0/BINARIES/usr/bin/mongos
-rwxr-xr-x dc/dc 10495264 2012-08-28 13:57 mongo-10gen-2.2.0/BINARIES/usr/bin/mongodump
-rwxr-xr-x dc/dc 10491136 2012-08-28 13:58 mongo-10gen-2.2.0/BINARIES/usr/bin/mongorestore
-rwxr-xr-x dc/dc 4313768 2012-08-28 14:00 mongo-10gen-2.2.0/BINARIES/usr/bin/mongo
-rwxr-xr-x dc/dc 10445952 2012-08-28 13:59 mongo-10gen-2.2.0/BINARIES/usr/bin/mongooplog
-rwxr-xr-x dc/dc 10495336 2012-08-28 13:59 mongo-10gen-2.2.0/BINARIES/usr/bin/mongofiles
drwxrwxr-x dc/dc 0 2012-10-22 17:30 mongo-10gen-2.2.0/rpmp/
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd mongo-10gen-2.2.0
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.Zg6rek
+ umask 022
+ cd /home/dc/tmp/rpmbuild//BUILD
+ cd mongo-10gen-2.2.0
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.L3YO2B
+ umask 022
+ cd /home/dc/tmp/rpmbuild//BUILD
+ cd mongo-10gen-2.2.0
+ mkdir -p /home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr
+ cp -rv BINARIES/usr/bin /home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr
`BINARIES/usr/bin' -> `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/bin'
`BINARIES/usr/bin/mongotop' -> `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/bin/mongotop'
`BINARIES/usr/bin/mongoimport' -> `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/bin/mongoimport'
`BINARIES/usr/bin/mongoexport' -> `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/bin/mongoexport'
`BINARIES/usr/bin/mongostat' -> `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/bin/mongostat'
`BINARIES/usr/bin/mongod' -> `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/bin/mongod'
`BINARIES/usr/bin/bsondump' -> `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/bin/bsondump'
`BINARIES/usr/bin/mongoperf' -> `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/bin/mongoperf'
`BINARIES/usr/bin/mongos' -> `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/bin/mongos'
`BINARIES/usr/bin/mongodump' -> `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/bin/mongodump'
`BINARIES/usr/bin/mongorestore' -> `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/bin/mongorestore'
`BINARIES/usr/bin/mongo' -> `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/bin/mongo'
`BINARIES/usr/bin/mongooplog' -> `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/bin/mongooplog'
`BINARIES/usr/bin/mongofiles' -> `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/bin/mongofiles'
+ mkdir -p /home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/share/man/man1
+ cp /home/dc/Downloads/mongodb-src-r2.2.0/debian/bsondump.1 /home/dc/Downloads/mongodb-src-r2.2.0/debian/mongo.1 /home/dc/Downloads/mongodb-src-r2.2.0/debian/mongod.1 /home/dc/Downloads/mongodb-src-r2.2.0/debian/mongodump.1 /home/dc/Downloads/mongodb-src-r2.2.0/debian/mongoexport.1 /home/dc/Downloads/mongodb-src-r2.2.0/debian/mongofiles.1 /home/dc/Downloads/mongodb-src-r2.2.0/debian/mongoimport.1 /home/dc/Downloads/mongodb-src-r2.2.0/debian/mongorestore.1 /home/dc/Downloads/mongodb-src-r2.2.0/debian/mongos.1 /home/dc/Downloads/mongodb-src-r2.2.0/debian/mongosniff.1 /home/dc/Downloads/mongodb-src-r2.2.0/debian/mongostat.1 /home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/share/man/man1/
+ rm -v /home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/share/man/man1/mongosniff.1
removed `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/usr/share/man/man1/mongosniff.1'
+ mkdir -p /home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/etc/rc.d/init.d
+ cp -v /home/dc/Downloads/mongodb-src-r2.2.0/rpm/init.d-mongod /home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/etc/rc.d/init.d/mongod
`/home/dc/Downloads/mongodb-src-r2.2.0/rpm/init.d-mongod' -> `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/etc/rc.d/init.d/mongod'
+ chmod a+x /home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/etc/rc.d/init.d/mongod
+ mkdir -p /home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/etc
+ cp -v /home/dc/Downloads/mongodb-src-r2.2.0/rpm/mongod.conf /home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/etc/mongod.conf
`/home/dc/Downloads/mongodb-src-r2.2.0/rpm/mongod.conf' -> `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/etc/mongod.conf'
+ mkdir -p /home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/etc/sysconfig
+ cp -v /home/dc/Downloads/mongodb-src-r2.2.0/rpm/mongod.sysconfig /home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/etc/sysconfig/mongod
`/home/dc/Downloads/mongodb-src-r2.2.0/rpm/mongod.sysconfig' -> `/home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/etc/sysconfig/mongod'
+ mkdir -p /home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/var/lib/mongo
+ mkdir -p /home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/var/log/mongo
+ touch /home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64/var/log/mongo/mongod.log
+ exit 0
Processing files: mongo-10gen-2.2.0-mongodb_1.el6.x86_64
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: ld-linux-x86-64.so.2()(64bit) ld-linux-x86-64.so.2(GLIBC_2.3)(64bit) libc.so.6()(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libgcc_s.so.1()(64bit) libgcc_s.so.1(GCC_3.0)(64bit) libm.so.6()(64bit) libm.so.6(GLIBC_2.2.5)(64bit) libpthread.so.0()(64bit) libpthread.so.0(GLIBC_2.2.5)(64bit) libpthread.so.0(GLIBC_2.3.2)(64bit) librt.so.1()(64bit) libstdc++.so.6()(64bit) libstdc++.so.6(CXXABI_1.3)(64bit) libstdc++.so.6(CXXABI_1.3.1)(64bit) libstdc++.so.6(GLIBCXX_3.4)(64bit) rtld(GNU_HASH)
Conflicts: mongo mongo-10gen-unstable
Obsoletes: mongo-stable
Processing files: mongo-10gen-server-2.2.0-mongodb_1.el6.x86_64
Provides: config(mongo-10gen-server) = 2.2.0-mongodb_1.el6
Requires(interp): /bin/sh /bin/sh /bin/sh /bin/sh
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires(pre): /bin/sh
Requires(post): /bin/sh
Requires(preun): /bin/sh
Requires(postun): /bin/sh
Requires: /bin/bash ld-linux-x86-64.so.2()(64bit) ld-linux-x86-64.so.2(GLIBC_2.3)(64bit) libc.so.6()(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libgcc_s.so.1()(64bit) libgcc_s.so.1(GCC_3.0)(64bit) libgcc_s.so.1(GCC_4.0.0)(64bit) libm.so.6()(64bit) libm.so.6(GLIBC_2.2.5)(64bit) libpthread.so.0()(64bit) libpthread.so.0(GLIBC_2.2.5)(64bit) libpthread.so.0(GLIBC_2.3.2)(64bit) librt.so.1()(64bit) libstdc++.so.6()(64bit) libstdc++.so.6(CXXABI_1.3)(64bit) libstdc++.so.6(CXXABI_1.3.1)(64bit) libstdc++.so.6(GLIBCXX_3.4)(64bit) rtld(GNU_HASH)
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64
Wrote: /home/dc/tmp/rpmbuild/SRPMS/mongo-10gen-2.2.0-mongodb_1.el6.src.rpm
Wrote: /home/dc/tmp/rpmbuild/RPMS/x86_64/mongo-10gen-2.2.0-mongodb_1.el6.x86_64.rpm
Wrote: /home/dc/tmp/rpmbuild/RPMS/x86_64/mongo-10gen-server-2.2.0-mongodb_1.el6.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.6eXthg
+ umask 022
+ cd /home/dc/tmp/rpmbuild//BUILD
+ cd mongo-10gen-2.2.0
+ rm -rf /home/dc/tmp/rpmbuild/BUILDROOT/mongo-10gen-2.2.0-mongodb_1.el6.x86_64
+ exit 0
In /home/dc/tmp, running sh -c cp -v "/home/dc/tmp/rpmbuild//RPMS/x86_64/"*.rpm "repo/redhat/os/x86_64/RPMS/"
`/home/dc/tmp/rpmbuild//RPMS/x86_64/mongo-10gen-2.2.0-mongodb_1.el6.x86_64.rpm' -> `repo/redhat/os/x86_64/RPMS/mongo-10gen-2.2.0-mongodb_1.el6.x86_64.rpm'
`/home/dc/tmp/rpmbuild//RPMS/x86_64/mongo-10gen-server-2.2.0-mongodb_1.el6.x86_64.rpm' -> `repo/redhat/os/x86_64/RPMS/mongo-10gen-server-2.2.0-mongodb_1.el6.x86_64.rpm'
repo/redhat/os/x86_64/RPMS/
In /home/dc/tmp/repo/redhat/os/x86_64, running createrepo .
2/2 - RPMS/mongo-10gen-2.2.0-mongodb_1.el6.x86_64.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
In /home/dc/Downloads/mongodb-src-r2.2.0/buildscripts, running cp -rv /home/dc/tmp/repo/redhat /var/www/repo.2012-10-22.1
`/home/dc/tmp/repo/redhat' -> `/var/www/repo.2012-10-22.1/redhat'
`/home/dc/tmp/repo/redhat/os' -> `/var/www/repo.2012-10-22.1/redhat/os'
`/home/dc/tmp/repo/redhat/os/x86_64' -> `/var/www/repo.2012-10-22.1/redhat/os/x86_64'
`/home/dc/tmp/repo/redhat/os/x86_64/repodata' -> `/var/www/repo.2012-10-22.1/redhat/os/x86_64/repodata'
`/home/dc/tmp/repo/redhat/os/x86_64/repodata/filelists.xml.gz' -> `/var/www/repo.2012-10-22.1/redhat/os/x86_64/repodata/filelists.xml.gz'
`/home/dc/tmp/repo/redhat/os/x86_64/repodata/other.xml.gz' -> `/var/www/repo.2012-10-22.1/redhat/os/x86_64/repodata/other.xml.gz'
`/home/dc/tmp/repo/redhat/os/x86_64/repodata/primary.xml.gz' -> `/var/www/repo.2012-10-22.1/redhat/os/x86_64/repodata/primary.xml.gz'
`/home/dc/tmp/repo/redhat/os/x86_64/repodata/repomd.xml' -> `/var/www/repo.2012-10-22.1/redhat/os/x86_64/repodata/repomd.xml'
`/home/dc/tmp/repo/redhat/os/x86_64/RPMS' -> `/var/www/repo.2012-10-22.1/redhat/os/x86_64/RPMS'
`/home/dc/tmp/repo/redhat/os/x86_64/RPMS/mongo-10gen-server-2.2.0-mongodb_1.el6.x86_64.rpm' -> `/var/www/repo.2012-10-22.1/redhat/os/x86_64/RPMS/mongo-10gen-server-2.2.0-mongodb_1.el6.x86_64.rpm'
`/home/dc/tmp/repo/redhat/os/x86_64/RPMS/mongo-10gen-2.2.0-mongodb_1.el6.x86_64.rpm' -> `/var/www/repo.2012-10-22.1/redhat/os/x86_64/RPMS/mongo-10gen-2.2.0-mongodb_1.el6.x86_64.rpm'
In /home/dc/Downloads/mongodb-src-r2.2.0/buildscripts, running rm -rv /home/dc/tmp
removed `/home/dc/tmp/repo/redhat/os/x86_64/repodata/filelists.xml.gz'
removed `/home/dc/tmp/repo/redhat/os/x86_64/repodata/other.xml.gz'
removed `/home/dc/tmp/repo/redhat/os/x86_64/repodata/primary.xml.gz'
removed `/home/dc/tmp/repo/redhat/os/x86_64/repodata/repomd.xml'
removed directory: `/home/dc/tmp/repo/redhat/os/x86_64/repodata'
removed `/home/dc/tmp/repo/redhat/os/x86_64/RPMS/mongo-10gen-server-2.2.0-mongodb_1.el6.x86_64.rpm'
removed `/home/dc/tmp/repo/redhat/os/x86_64/RPMS/mongo-10gen-2.2.0-mongodb_1.el6.x86_64.rpm'
removed directory: `/home/dc/tmp/repo/redhat/os/x86_64/RPMS'
removed directory: `/home/dc/tmp/repo/redhat/os/x86_64'
removed directory: `/home/dc/tmp/repo/redhat/os'
removed directory: `/home/dc/tmp/repo/redhat'
removed directory: `/home/dc/tmp/repo'
removed directory: `/home/dc/tmp/rpmbuild/BUILDROOT'
removed `/home/dc/tmp/rpmbuild/SOURCES/mongo-10gen-2.2.0.tar.gz'
removed directory: `/home/dc/tmp/rpmbuild/SOURCES'
removed `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/rpm/mongo-10gen.spec'
removed directory: `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/rpm'
removed `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/BINARIES/usr/bin/mongotop'
removed `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/BINARIES/usr/bin/mongoimport'
removed `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/BINARIES/usr/bin/mongoexport'
removed `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/BINARIES/usr/bin/mongostat'
removed `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/BINARIES/usr/bin/mongod'
removed `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/BINARIES/usr/bin/bsondump'
removed `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/BINARIES/usr/bin/mongoperf'
removed `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/BINARIES/usr/bin/mongos'
removed `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/BINARIES/usr/bin/mongodump'
removed `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/BINARIES/usr/bin/mongorestore'
removed `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/BINARIES/usr/bin/mongo'
removed `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/BINARIES/usr/bin/mongooplog'
removed `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/BINARIES/usr/bin/mongofiles'
removed directory: `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/BINARIES/usr/bin'
removed directory: `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/BINARIES/usr'
removed directory: `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/BINARIES'
removed directory: `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0/rpmp'
removed directory: `/home/dc/tmp/rpmbuild/BUILD/mongo-10gen-2.2.0'
removed directory: `/home/dc/tmp/rpmbuild/BUILD'
removed `/home/dc/tmp/rpmbuild/SRPMS/mongo-10gen-2.2.0-mongodb_1.el6.src.rpm'
removed directory: `/home/dc/tmp/rpmbuild/SRPMS'
removed `/home/dc/tmp/rpmbuild/RPMS/x86_64/mongo-10gen-server-2.2.0-mongodb_1.el6.x86_64.rpm'
removed `/home/dc/tmp/rpmbuild/RPMS/x86_64/mongo-10gen-2.2.0-mongodb_1.el6.x86_64.rpm'
removed directory: `/home/dc/tmp/rpmbuild/RPMS/x86_64'
removed directory: `/home/dc/tmp/rpmbuild/RPMS'
removed `/home/dc/tmp/rpmbuild/SPECS/mongo-10gen.spec'
removed directory: `/home/dc/tmp/rpmbuild/SPECS'
removed directory: `/home/dc/tmp/rpmbuild'
removed `/home/dc/tmp/macros'
removed `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/rpm/mongo-10gen.spec'
removed directory: `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/rpm'
removed `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/BINARIES/usr/bin/mongotop'
removed `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/BINARIES/usr/bin/mongoimport'
removed `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/BINARIES/usr/bin/mongoexport'
removed `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/BINARIES/usr/bin/mongostat'
removed `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/BINARIES/usr/bin/mongod'
removed `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/BINARIES/usr/bin/bsondump'
removed `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/BINARIES/usr/bin/mongoperf'
removed `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/BINARIES/usr/bin/mongos'
removed `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/BINARIES/usr/bin/mongodump'
removed `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/BINARIES/usr/bin/mongorestore'
removed `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/BINARIES/usr/bin/mongo'
removed `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/BINARIES/usr/bin/mongooplog'
removed `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/BINARIES/usr/bin/mongofiles'
removed directory: `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/BINARIES/usr/bin'
removed directory: `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/BINARIES/usr'
removed directory: `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/BINARIES'
removed directory: `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0/rpmp'
removed directory: `/home/dc/tmp/dst/x86_64/redhat/mongo-10gen-2.2.0'
removed directory: `/home/dc/tmp/dst/x86_64/redhat'
removed directory: `/home/dc/tmp/dst/x86_64'
removed directory: `/home/dc/tmp/dst'
removed `/home/dc/tmp/dl/mongodb-linux-2.2.0-x86_64.tar.gz'
removed directory: `/home/dc/tmp/dl'
removed directory: `/home/dc/tmp'
[dc@localhost buildscripts]$


The output is placed under /var/www/repo where the most recent repo can be identified by the date suffix.



10. Cleanup.
The script deletes most of the temp directories but not all of them;

Delete:
mongodb-src-2.2.0 directory
/usr/tmp/rpm*; there  are rpm spec files stored here as tmp files;
/var/www/repo* ; once you have your rpms, move them and delete the output dirs
/tmp/ xxx; there may be some phantom directories here from running packager.py before we commented out httpget.









1 comment:

  1. Thanks for this post... it's helped me get most of the way thru creating a debian pkg... but I am stumped in this:
    Traceback (most recent call last):
    File "packager.py", line 1005, in
    main(sys.argv)
    File "packager.py", line 181, in main
    make_repo(repo)
    File "packager.py", line 350, in make_repo
    make_deb_repo(repodir)
    File "packager.py", line 448, in make_deb_repo
    sysassert(["gpg", "-r", arg, "--no-secmem-warning", "-abs", "--output", "Release.gpg", "Release"])
    File "packager.py", line 238, in sysassert
    print "In %s, running %s" % (os.getcwd(), " ".join(argv))
    TypeError: sequence item 2: expected string, NoneType found

    The offending line of code is the last here:
    def sysassert(argv):
    """Run argv and assert that it exited with status 0."""
    print "In %s, running %s" % (os.getcwd(), " ".join(argv))


    .... any ideas why argv would be not reasonable type? I am guessing it is null ... I passed 2.4.1 to the script

    ReplyDelete