diff options
author | Ernie Hershey <ernie.hershey@10gen.com> | 2013-10-04 20:12:44 -0400 |
---|---|---|
committer | Ernie Hershey <ernie.hershey@10gen.com> | 2013-10-12 18:20:01 -0400 |
commit | b57a0b403ef86071c2d8d8e8c32f54abb8907a75 (patch) | |
tree | 1e51113be134aded201d382f5a0d664cf5dea2b1 | |
parent | b2f87f53245b8c15eff65700a929984ebeab75a8 (diff) | |
download | mongo-b57a0b403ef86071c2d8d8e8c32f54abb8907a75.tar.gz |
SERVER-963 Externalize enterprise packaging spec files
-rwxr-xr-x | buildscripts/packager-enterprise.py | 398 | ||||
-rw-r--r-- | debian/mongodb-enterprise-unstable-server.postinst | 55 | ||||
-rw-r--r-- | rpm/mongodb-enterprise-unstable.spec | 156 |
3 files changed, 227 insertions, 382 deletions
diff --git a/buildscripts/packager-enterprise.py b/buildscripts/packager-enterprise.py index 6441499f32f..7a1e4ba63c4 100755 --- a/buildscripts/packager-enterprise.py +++ b/buildscripts/packager-enterprise.py @@ -354,10 +354,21 @@ def make_deb(distro, arch, spec, srcdir): else: raise Exception("unknown debianoid flavor: not sysvinit or upstart?") # Rewrite the control and rules files - write_debian_control_file(sdir+"debian/control", spec) - write_debian_rules_file(sdir+"debian/rules", spec) write_debian_changelog(sdir+"debian/changelog", spec, srcdir) distro_arch=distro.archname(arch) + sysassert(["cp", "-v", srcdir+"debian/control", sdir+"debian/"]) + sysassert(["cp", "-v", srcdir+"debian/rules", sdir+"debian/"]) + + + # old non-server-package postinst will be hanging around for old versions + # + if os.path.exists(sdir+"debian/postinst"): + os.unlink(sdir+"debian/postinst") + + # copy our postinst files + # + sysassert(["sh", "-c", "cp -v \"%sdebian/\"*.postinst \"%sdebian/\""%(srcdir, sdir)]) + # Do the packaging. oldcwd=os.getcwd() try: @@ -369,7 +380,8 @@ def make_deb(distro, arch, spec, srcdir): ensure_dir(r) # FIXME: see if shutil.copyfile or something can do this without # much pain. - sysassert(["cp", "-v", sdir+"../%s%s_%s%s_%s.deb"%(distro.pkgbase(), suffix, spec.pversion(distro), "-"+spec.param("revision") if spec.param("revision") else"", distro_arch), r]) + #sysassert(["cp", "-v", sdir+"../%s%s_%s%s_%s.deb"%(distro.pkgbase(), suffix, spec.pversion(distro), "-"+spec.param("revision") if spec.param("revision") else"", distro_arch), r]) + sysassert(["sh", "-c", "cp -v \"%s/../\"*.deb \"%s\""%(sdir, r)]) return r def make_deb_repo(repo): @@ -529,178 +541,11 @@ def write_debian_changelog(path, spec, srcdir): finally: f.close() -def write_debian_control_file(path, spec): - s="""Source: @@PACKAGE_BASENAME@@ -Section: devel -Priority: optional -Maintainer: Richard Kreuter <richard@10gen.com> -Build-Depends: -Standards-Version: 3.8.0 -Homepage: http://www.mongodb.org - -Package: @@PACKAGE_BASENAME@@ -Conflicts: mongo-10gen, mongo-10gen-enterprise, mongo-10gen-enterprise-server, mongo-10gen-server, mongo-10gen-unstable, mongo-10gen-unstable-enterprise, mongo-10gen-unstable-enterprise-mongos, mongo-10gen-unstable-enterprise-server, mongo-10gen-unstable-enterprise-shell, mongo-10gen-unstable-enterprise-tools, mongo-10gen-unstable-mongos, mongo-10gen-unstable-server, mongo-10gen-unstable-shell, mongo-10gen-unstable-tools, mongo18-10gen, mongo18-10gen-server, mongo20-10gen, mongo20-10gen-server, mongodb, mongodb-10gen, mongodb-10gen-enterprise, mongodb-10gen-unstable, mongodb-10gen-unstable-enterprise, mongodb-10gen-unstable-enterprise-mongos, mongodb-10gen-unstable-enterprise-server, mongodb-10gen-unstable-enterprise-shell, mongodb-10gen-unstable-enterprise-tools, mongodb-10gen-unstable-mongos, mongodb-10gen-unstable-server, mongodb-10gen-unstable-shell, mongodb-10gen-unstable-tools, mongodb-enterprise, mongodb-enterprise-mongos, mongodb-enterprise-server, mongodb-enterprise-shell, mongodb-enterprise-tools, mongodb-nightly, mongodb-org, mongodb-org-mongos, mongodb-org-server, mongodb-org-shell, mongodb-org-tools, mongodb-stable, mongodb18-10gen, mongodb20-10gen, mongodb-org-unstable, mongodb-org-unstable-mongos, mongodb-org-unstable-server, mongodb-org-unstable-shell, mongodb-org-unstable-tools -Architecture: any -Depends: libc6 (>= 2.3.2), libgcc1 (>= 1:4.1.1), libstdc++6 (>= 4.1.1), libsnmp15, libsasl2-2, libssl1.0.0 -Description: An object/document-oriented database - MongoDB is a high-performance, open source, schema-free - document-oriented data store that's easy to deploy, manage - and use. It's network accessible, written in C++ and offers - the following features : - . - * Collection oriented storage - easy storage of object- - style data - * Full index support, including on inner objects - * Query profiling - * Replication and fail-over support - * Efficient storage of binary data including large - objects (e.g. videos) - * Auto-sharding for cloud-level scalability (Q209) - . - High performance, scalability, and reasonable depth of - functionality are the goals for the project. -""" - s=re.sub("@@PACKAGE_BASENAME@@", "mongodb%s" % spec.suffix(), s) - - f=open(path, 'w') - try: - f.write(s) - finally: - f.close() - -def write_debian_rules_file(path, spec): - # Note debian/rules is a makefile, so for visual disambiguation we - # make all tabs here \t. - s="""#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - - -configure: configure-stamp -configure-stamp: -\tdh_testdir - # Add here commands to configure the package. - -\ttouch configure-stamp - - -build: build-stamp - -build-stamp: configure-stamp -\tdh_testdir - - # Add here commands to compile the package. -# THE FOLLOWING LINE IS INTENTIONALLY COMMENTED. -\t# scons - #docbook-to-man debian/mongodb.sgml > mongodb.1 -\tls debian/*.1 > debian/@@PACKAGE_NAME@@.manpages - -\ttouch $@ - -clean: -\tdh_testdir -\tdh_testroot -\trm -f build-stamp configure-stamp - -\t# FIXME: scons freaks out at the presence of target files -\t# under debian/mongodb. -\t#scons -c -\trm -rf $(CURDIR)/debian/@@PACKAGE_NAME@@ -\trm -f config.log -\trm -f mongo -\trm -f mongod -\trm -f mongoimportjson -\trm -f mongoexport -\trm -f mongorestore -\trm -f mongodump -\trm -f mongofiles -\trm -f .sconsign.dblite -\trm -f libmongoclient.a -\trm -rf client/*.o -\trm -rf tools/*.o -\trm -rf shell/*.o -\trm -rf .sconf_temp -\trm -f buildscripts/*.pyc -\trm -f *.pyc -\trm -f buildinfo.cpp -\tdh_clean debian/files - -install: build -\tdh_testdir -\tdh_testroot -\tdh_prep -\tdh_installdirs - -# THE FOLLOWING LINE IS INTENTIONALLY COMMENTED. -\t# scons --prefix=$(CURDIR)/debian/mongodb/usr install -\tcp -v $(CURDIR)/@@BINARYDIR@@/usr/bin/* $(CURDIR)/debian/@@PACKAGE_NAME@@/usr/bin -\tmkdir -p $(CURDIR)/debian/@@PACKAGE_NAME@@/etc -\tcp $(CURDIR)/debian/mongod.conf $(CURDIR)/debian/@@PACKAGE_NAME@@/etc/mongod.conf - -\tmkdir -p $(CURDIR)/debian/@@PACKAGE_NAME@@/usr/share/lintian/overrides/ -\tinstall -m 644 $(CURDIR)/debian/lintian-overrides \ -\t\t$(CURDIR)/debian/@@PACKAGE_NAME@@/usr/share/lintian/overrides/@@PACKAGE_NAME@@ - -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: build install -\tdh_testdir -\tdh_testroot -\tdh_installchangelogs -\tdh_installdocs -\tdh_installexamples -#\tdh_install -#\tdh_installmenu -#\tdh_installdebconf\t -#\tdh_installlogrotate -#\tdh_installemacsen -#\tdh_installpam -#\tdh_installmime -\tdh_installinit --name=@@PACKAGE_BASENAME@@ -#\tdh_installinfo -\tdh_installman -\tdh_link -# Appears to be broken on Ubuntu 11.10...? -#\tdh_strip -\tdh_compress -\tdh_fixperms -\tdh_installdeb -\tdh_shlibdeps -\tdh_gencontrol -\tdh_md5sums -\tdh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure -""" - s=re.sub("@@PACKAGE_NAME@@", "mongodb%s" % spec.suffix(), s) - s=re.sub("@@PACKAGE_BASENAME@@", "mongodb", s) - s=re.sub("@@BINARYDIR@@", BINARYDIR, s) - f=open(path, 'w') - try: - f.write(s) - finally: - f.close() - # FIXME: some versions of debianoids seem to - # need the rules file to be 755? - os.chmod(path, stat.S_IXUSR|stat.S_IWUSR|stat.S_IRUSR|stat.S_IXGRP|stat.S_IRGRP|stat.S_IXOTH|stat.S_IWOTH) - def make_rpm(distro, arch, spec, srcdir): # Create the specfile. suffix=spec.suffix() sdir=setupdir(distro, arch, spec) - specfile=sdir+"rpm/mongodb%s.spec" % suffix - write_rpm_spec_file(specfile, spec) + specfile=srcdir+"rpm/mongodb%s.spec" % suffix topdir=ensure_dir(os.getcwd()+'/rpmbuild/') for subdir in ["BUILD", "RPMS", "SOURCES", "SPECS", "SRPMS"]: ensure_dir("%s/%s/" % (topdir, subdir)) @@ -777,216 +622,5 @@ def write_rpm_macros_file(path, topdir): finally: f.close() -def write_rpm_spec_file(path, spec): - s="""Name: @@PACKAGE_BASENAME@@ -Conflicts: mongo-10gen, mongo-10gen-enterprise, mongo-10gen-enterprise-server, mongo-10gen-server, mongo-10gen-unstable, mongo-10gen-unstable-enterprise, mongo-10gen-unstable-enterprise-mongos, mongo-10gen-unstable-enterprise-server, mongo-10gen-unstable-enterprise-shell, mongo-10gen-unstable-enterprise-tools, mongo-10gen-unstable-mongos, mongo-10gen-unstable-server, mongo-10gen-unstable-shell, mongo-10gen-unstable-tools, mongo18-10gen, mongo18-10gen-server, mongo20-10gen, mongo20-10gen-server, mongodb, mongodb-10gen, mongodb-10gen-enterprise, mongodb-10gen-unstable, mongodb-10gen-unstable-enterprise, mongodb-10gen-unstable-enterprise-mongos, mongodb-10gen-unstable-enterprise-server, mongodb-10gen-unstable-enterprise-shell, mongodb-10gen-unstable-enterprise-tools, mongodb-10gen-unstable-mongos, mongodb-10gen-unstable-server, mongodb-10gen-unstable-shell, mongodb-10gen-unstable-tools, mongodb-enterprise, mongodb-enterprise-mongos, mongodb-enterprise-server, mongodb-enterprise-shell, mongodb-enterprise-tools, mongodb-nightly, mongodb-org, mongodb-org-mongos, mongodb-org-server, mongodb-org-shell, mongodb-org-tools, mongodb-stable, mongodb18-10gen, mongodb20-10gen, mongodb-org-unstable, mongodb-org-unstable-mongos, mongodb-org-unstable-server, mongodb-org-unstable-shell, mongodb-org-unstable-tools -Obsoletes: @@PACKAGE_OBSOLETES@@ -Version: @@PACKAGE_VERSION@@ -Release: mongodb_@@PACKAGE_REVISION@@%{?dist} -Summary: mongo client shell and tools -License: AGPL 3.0 -URL: http://www.mongodb.org -Group: Applications/Databases -Requires: cyrus-sasl, net-snmp-libs - -Source0: %{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root - -%description -Mongo (from "huMONGOus") is a schema-free document-oriented database. -It features dynamic profileable queries, full indexing, replication -and fail-over support, efficient storage of large binary data objects, -and auto-sharding. - -This package provides the mongo shell, import/export tools, and other -client utilities. - -%package server -Summary: mongo server, sharding server, and support scripts -Group: Applications/Databases -Requires: @@PACKAGE_BASENAME@@ - -%description server -Mongo (from "huMONGOus") is a schema-free document-oriented database. - -This package provides the mongo server software, mongo sharding server -softwware, default configuration files, and init.d scripts. - -%package devel -Summary: Headers and libraries for mongo development. -Group: Applications/Databases - -%description devel -Mongo (from "huMONGOus") is a schema-free document-oriented database. - -This package provides the mongo static library and header files needed -to develop mongo client software. - -%prep -%setup - -%build -#scons --prefix=$RPM_BUILD_ROOT/usr all -# XXX really should have shared library here - -%install -#scons --prefix=$RPM_BUILD_ROOT/usr install -mkdir -p $RPM_BUILD_ROOT/usr -cp -rv @@BINARYDIR@@/usr/bin $RPM_BUILD_ROOT/usr -mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1 -cp debian/*.1 $RPM_BUILD_ROOT/usr/share/man/man1/ -# FIXME: remove this rm when mongosniff is back in the package -rm -v $RPM_BUILD_ROOT/usr/share/man/man1/mongosniff.1* -mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d -cp -v rpm/init.d-mongod $RPM_BUILD_ROOT/etc/rc.d/init.d/mongod -chmod a+x $RPM_BUILD_ROOT/etc/rc.d/init.d/mongod -mkdir -p $RPM_BUILD_ROOT/etc -cp -v rpm/mongod.conf $RPM_BUILD_ROOT/etc/mongod.conf -mkdir -p $RPM_BUILD_ROOT/etc/sysconfig -cp -v rpm/mongod.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/mongod -mkdir -p $RPM_BUILD_ROOT/var/lib/mongodb -mkdir -p $RPM_BUILD_ROOT/var/log/mongodb -touch $RPM_BUILD_ROOT/var/log/mongodb/mongod.log - -%clean -#scons -c -rm -rf $RPM_BUILD_ROOT - -%pre server -if ! /usr/bin/id -g mongodb &>/dev/null; then - /usr/sbin/groupadd -r mongod -fi -if ! /usr/bin/id mongodb &>/dev/null; then - /usr/sbin/useradd -M -r -g mongodb -d /var/lib/mongodb -s /bin/false \ - -c mongodb mongodb > /dev/null 2>&1 -fi - -%post server -if test $1 = 1 -then - /sbin/chkconfig --add mongod -fi - -%preun server -if test $1 = 0 -then - /sbin/chkconfig --del mongod -fi - -%postun server -if test $1 -ge 1 -then - /sbin/service mongod condrestart >/dev/null 2>&1 || : -fi - -%files -%defattr(-,root,root,-) -#%doc README GNU-AGPL-3.0.txt - -%{_bindir}/bsondump -%{_bindir}/mongo -%{_bindir}/mongodump -%{_bindir}/mongoexport -#@@VERSION!=2.1.0@@%{_bindir}/mongofiles -%{_bindir}/mongoimport -#@@VERSION>=2.1.0@@%{_bindir}/mongooplog -#@@VERSION>=2.1.0@@%{_bindir}/mongoperf -%{_bindir}/mongorestore -#@@VERSION>1.9@@%{_bindir}/mongotop -%{_bindir}/mongostat -# FIXME: uncomment when mongosniff is back in the package -#%{_bindir}/mongosniff - -# FIXME: uncomment this when there's a stable release whose source -# tree contains a bsondump man page. -#@@VERSION>1.9@@%{_mandir}/man1/bsondump.1* -%{_mandir}/man1/mongo.1* -%{_mandir}/man1/mongodump.1* -%{_mandir}/man1/mongoexport.1* -%{_mandir}/man1/mongofiles.1* -%{_mandir}/man1/mongoimport.1* -%{_mandir}/man1/mongorestore.1* -%{_mandir}/man1/mongostat.1* -# FIXME: uncomment when mongosniff is back in the package -#%{_mandir}/man1/mongosniff.1* -#@@VERSION>=2.4.0@@%{_mandir}/man1/mongotop.1* -#@@VERSION>=2.4.0@@%{_mandir}/man1/mongoperf.1* -#@@VERSION>=2.4.0@@%{_mandir}/man1/mongooplog.1* - -%files server -%defattr(-,root,root,-) -%config(noreplace) /etc/mongod.conf -%{_bindir}/mongod -%{_bindir}/mongos -%{_mandir}/man1/mongod.1* -%{_mandir}/man1/mongos.1* -/etc/rc.d/init.d/mongod -/etc/sysconfig/mongod -#/etc/rc.d/init.d/mongos -%attr(0755,mongodb,mongodb) %dir /var/lib/mongodb -%attr(0755,mongodb,mongodb) %dir /var/log/mongodb -%attr(0640,mongodb,mongodb) %config(noreplace) %verify(not md5 size mtime) /var/log/mongodb/mongod.log - -%changelog -* Thu Jan 28 2010 Richard M Kreuter <richard@10gen.com> -- Minor fixes. - -* Sat Oct 24 2009 Joe Miklojcik <jmiklojcik@shopwiki.com> - -- Wrote mongo.spec. -""" - suffix=spec.suffix() - s=re.sub("@@PACKAGE_BASENAME@@", "mongodb%s" % suffix, s) - s=re.sub("@@PACKAGE_VERSION@@", spec.pversion(Distro("redhat")), s) - # FIXME, maybe: the RPM guide says that Release numbers ought to - # be integers starting at 1, but we use "mongodb_1{%dist}", - # whatever the hell that means. - s=re.sub("@@PACKAGE_REVISION@@", str(int(spec.param("revision"))+1) if spec.param("revision") else "1", s) - s=re.sub("@@BINARYDIR@@", BINARYDIR, s) - if suffix.endswith("-org"): - s=re.sub("@@PACKAGE_PROVIDES@@", "mongodb-stable", s) - s=re.sub("@@PACKAGE_OBSOLETES@@", "mongodb-stable,mongo-stable", s) - elif suffix == "-org-unstable": - s=re.sub("@@PACKAGE_PROVIDES@@", "mongodb-unstable", s) - s=re.sub("@@PACKAGE_OBSOLETES@@", "mongodb-unstable,mongo-unstable", s) - elif suffix == "-enterprise": - s=re.sub("@@PACKAGE_PROVIDES@@", "mongodb-enterprise", s) - s=re.sub("@@PACKAGE_OBSOLETES@@", "mongodb-enterprise,mongo-enterprise", s) - elif suffix == "-enterprise-unstable": - s=re.sub("@@PACKAGE_PROVIDES@@", "mongodb-enterprise-unstable", s) - s=re.sub("@@PACKAGE_OBSOLETES@@", "mongodb-enterprise-unstable,mongo-enterprise-unstable", s) - else: - raise Exception("BUG: unknown suffix %s" % suffix) - - lines=[] - for line in s.split("\n"): - m = re.search("@@VERSION(>|>=|!=)(\d.*)@@(.*)", line) - if m: - op = m.group(1) - ver = m.group(2) - fn = m.group(3) - if op == '>': - if spec.version_better_than(ver): - lines.append(fn) - elif op == '>=': - if spec.version() == ver or spec.version_better_than(ver): - lines.append(fn) - elif op == '!=': - if spec.version() != ver: - lines.append(fn) - else: - # Since we're inventing our own template system for RPM - # specfiles here, we oughtn't use template syntax we don't - # support. - raise Exception("BUG: probable bug in packager script: %s, %s, %s" % (m.group(1), m.group(2), m.group(3))) - else: - lines.append(line) - s="\n".join(lines) - - f=open(path, 'w') - try: - f.write(s) - finally: - f.close() - if __name__ == "__main__": main(sys.argv) diff --git a/debian/mongodb-enterprise-unstable-server.postinst b/debian/mongodb-enterprise-unstable-server.postinst new file mode 100644 index 00000000000..b9700a1232f --- /dev/null +++ b/debian/mongodb-enterprise-unstable-server.postinst @@ -0,0 +1,55 @@ +#!/bin/sh +# postinst script for mongodb +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * <postinst> `configure' <most-recently-configured-version> +# * <old-postinst> `abort-upgrade' <new version> +# * <conflictor's-postinst> `abort-remove' `in-favour' <package> +# <new-version> +# * <postinst> `abort-remove' +# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' +# <failed-install-package> <version> `removing' +# <conflicting-package> <version> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + # create a mongodb group and user + if ! grep -q mongodb /etc/passwd; then + adduser --system --no-create-home mongodb + addgroup --system mongodb + adduser mongodb mongodb + fi + + # create db -- note: this should agree with dbpath in mongod.conf + mkdir -p /var/lib/mongodb + chown -R mongodb:mongodb /var/lib/mongodb + + # create logdir -- note: this should agree with logpath in mongod.conf + mkdir -p /var/log/mongodb + chown -R mongodb:mongodb /var/log/mongodb + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/rpm/mongodb-enterprise-unstable.spec b/rpm/mongodb-enterprise-unstable.spec new file mode 100644 index 00000000000..7fe4a52476d --- /dev/null +++ b/rpm/mongodb-enterprise-unstable.spec @@ -0,0 +1,156 @@ +Name: mongodb-enterprise-unstable +Conflicts: mongo-10gen, mongo-10gen-enterprise, mongo-10gen-enterprise-server, mongo-10gen-server, mongo-10gen-unstable, mongo-10gen-unstable-enterprise, mongo-10gen-unstable-enterprise-mongos, mongo-10gen-unstable-enterprise-server, mongo-10gen-unstable-enterprise-shell, mongo-10gen-unstable-enterprise-tools, mongo-10gen-unstable-mongos, mongo-10gen-unstable-server, mongo-10gen-unstable-shell, mongo-10gen-unstable-tools, mongo18-10gen, mongo18-10gen-server, mongo20-10gen, mongo20-10gen-server, mongodb, mongodb-10gen, mongodb-10gen-enterprise, mongodb-10gen-unstable, mongodb-10gen-unstable-enterprise, mongodb-10gen-unstable-enterprise-mongos, mongodb-10gen-unstable-enterprise-server, mongodb-10gen-unstable-enterprise-shell, mongodb-10gen-unstable-enterprise-tools, mongodb-10gen-unstable-mongos, mongodb-10gen-unstable-server, mongodb-10gen-unstable-shell, mongodb-10gen-unstable-tools, mongodb-enterprise, mongodb-enterprise-mongos, mongodb-enterprise-server, mongodb-enterprise-shell, mongodb-enterprise-tools, mongodb-nightly, mongodb-org, mongodb-org-mongos, mongodb-org-server, mongodb-org-shell, mongodb-org-tools, mongodb-stable, mongodb18-10gen, mongodb20-10gen, mongodb-org-unstable, mongodb-org-unstable-mongos, mongodb-org-unstable-server, mongodb-org-unstable-shell, mongodb-org-unstable-tools +Obsoletes: mongodb-enterprise-unstable,mongo-enterprise-unstable +Version: 2.5.2 +Release: mongodb_1%{?dist} +Summary: mongo client shell and tools +License: AGPL 3.0 +URL: http://www.mongodb.org +Group: Applications/Databases +Requires: cyrus-sasl, net-snmp-libs + +Source0: %{name}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root + +%description +Mongo (from "huMONGOus") is a schema-free document-oriented database. +It features dynamic profileable queries, full indexing, replication +and fail-over support, efficient storage of large binary data objects, +and auto-sharding. + +This package provides the mongo shell, import/export tools, and other +client utilities. + +%package server +Summary: mongo server, sharding server, and support scripts +Group: Applications/Databases +Requires: mongodb-enterprise-unstable + +%description server +Mongo (from "huMONGOus") is a schema-free document-oriented database. + +This package provides the mongo server software, mongo sharding server +softwware, default configuration files, and init.d scripts. + +%package devel +Summary: Headers and libraries for mongo development. +Group: Applications/Databases + +%description devel +Mongo (from "huMONGOus") is a schema-free document-oriented database. + +This package provides the mongo static library and header files needed +to develop mongo client software. + +%prep +%setup + +%build +#scons --prefix=$RPM_BUILD_ROOT/usr all +# XXX really should have shared library here + +%install +#scons --prefix=$RPM_BUILD_ROOT/usr install +mkdir -p $RPM_BUILD_ROOT/usr +cp -rv BINARIES/usr/bin $RPM_BUILD_ROOT/usr +mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1 +cp debian/*.1 $RPM_BUILD_ROOT/usr/share/man/man1/ +# FIXME: remove this rm when mongosniff is back in the package +rm -v $RPM_BUILD_ROOT/usr/share/man/man1/mongosniff.1* +mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d +cp -v rpm/init.d-mongod $RPM_BUILD_ROOT/etc/rc.d/init.d/mongod +chmod a+x $RPM_BUILD_ROOT/etc/rc.d/init.d/mongod +mkdir -p $RPM_BUILD_ROOT/etc +cp -v rpm/mongod.conf $RPM_BUILD_ROOT/etc/mongod.conf +mkdir -p $RPM_BUILD_ROOT/etc/sysconfig +cp -v rpm/mongod.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/mongod +mkdir -p $RPM_BUILD_ROOT/var/lib/mongodb +mkdir -p $RPM_BUILD_ROOT/var/log/mongodb +mkdir -p $RPM_BUILD_ROOT/var/run/mongodb +touch $RPM_BUILD_ROOT/var/log/mongodb/mongod.log + +%clean +#scons -c +rm -rf $RPM_BUILD_ROOT + +%pre server +if ! /usr/bin/id -g mongodb &>/dev/null; then + /usr/sbin/groupadd -r mongod +fi +if ! /usr/bin/id mongodb &>/dev/null; then + /usr/sbin/useradd -M -r -g mongodb -d /var/lib/mongodb -s /bin/false -c mongodb mongodb > /dev/null 2>&1 +fi + +%post server +if test $1 = 1 +then + /sbin/chkconfig --add mongod +fi + +%preun server +if test $1 = 0 +then + /sbin/chkconfig --del mongod +fi + +%postun server +if test $1 -ge 1 +then + /sbin/service mongod condrestart >/dev/null 2>&1 || : +fi + +%files +%defattr(-,root,root,-) +#%doc README GNU-AGPL-3.0.txt + +%{_bindir}/bsondump +%{_bindir}/mongo +%{_bindir}/mongodump +%{_bindir}/mongoexport +%{_bindir}/mongofiles +%{_bindir}/mongoimport +%{_bindir}/mongooplog +%{_bindir}/mongoperf +%{_bindir}/mongorestore +%{_bindir}/mongotop +%{_bindir}/mongostat +# FIXME: uncomment when mongosniff is back in the package +#%{_bindir}/mongosniff + +# FIXME: uncomment this when there's a stable release whose source +# tree contains a bsondump man page. +%{_mandir}/man1/bsondump.1* +%{_mandir}/man1/mongo.1* +%{_mandir}/man1/mongodump.1* +%{_mandir}/man1/mongoexport.1* +%{_mandir}/man1/mongofiles.1* +%{_mandir}/man1/mongoimport.1* +%{_mandir}/man1/mongorestore.1* +%{_mandir}/man1/mongostat.1* +# FIXME: uncomment when mongosniff is back in the package +#%{_mandir}/man1/mongosniff.1* +%{_mandir}/man1/mongotop.1* +%{_mandir}/man1/mongoperf.1* +%{_mandir}/man1/mongooplog.1* + +%files server +%defattr(-,root,root,-) +%config(noreplace) /etc/mongod.conf +%{_bindir}/mongod +%{_bindir}/mongos +%{_mandir}/man1/mongod.1* +%{_mandir}/man1/mongos.1* +/etc/rc.d/init.d/mongod +/etc/sysconfig/mongod +#/etc/rc.d/init.d/mongos +%attr(0755,mongodb,mongodb) %dir /var/lib/mongodb +%attr(0755,mongodb,mongodb) %dir /var/log/mongodb +%attr(0755,mongodb,mongodb) %dir /var/run/mongodb +%attr(0640,mongodb,mongodb) %config(noreplace) %verify(not md5 size mtime) /var/log/mongodb/mongod.log + +%changelog +* Thu Jan 28 2010 Richard M Kreuter <richard@10gen.com> +- Minor fixes. + +* Sat Oct 24 2009 Joe Miklojcik <jmiklojcik@shopwiki.com> - +- Wrote mongo.spec. |