Created
October 21, 2012 17:49
-
-
Save dagolden/3927817 to your computer and use it in GitHub Desktop.
MongoDB SSL packaging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/buildscripts/packager.py b/buildscripts/packager.py | |
index d0dd492..a1084cb 100644 | |
--- a/buildscripts/packager.py | |
+++ b/buildscripts/packager.py | |
@@ -26,6 +26,13 @@ | |
# apt-get install dpkg-dev rpm debhelper fakeroot ia32-libs createrepo git-core | |
# echo "Now put the dist gnupg signing keys in ~root/.gnupg" | |
+# XXX by xdg, 2012-10-17 | |
+# Must have a gpg key to use and must modify the script below to match | |
+# Building SSl requires libssl and libssl-dev -- not sure how to specify | |
+# that dependency yet | |
+ | |
+# Hacked to avoid downloading binaries | |
+ | |
import errno | |
import getopt | |
import httplib | |
@@ -42,10 +49,12 @@ import urlparse | |
# repositories to the world, so the last thing the program does is | |
# move the repositories into place. Make this be the path where the | |
# web server will look for repositories. | |
-REPOPATH="/var/www/repo" | |
+# XXX put the results in my home directory -- xdg, 2012-10-19 | |
+REPOPATH="/home/david/repo" | |
# The 10gen names for the architectures we support. | |
-ARCHES=["i686", "x86_64"] | |
+# XXX I've only build for 64-bit -- xdg, 2012-10-19 | |
+ARCHES=["x86_64"] | |
# Made up names for the flavors of distribution we package for. | |
DISTROS=["debian-sysvinit", "ubuntu-upstart", "redhat"] | |
@@ -54,6 +63,9 @@ DISTROS=["debian-sysvinit", "ubuntu-upstart", "redhat"] | |
# and our binaries, use this relative subdirectory for placing the | |
# binaries. | |
BINARYDIR="BINARIES" | |
+ | |
+# XXX Where we keep the custom compiled tarballs -- xdg, 2012-10-19 | |
+TARBALLDIR="/home/david/tarballs" | |
class Spec(object): | |
def __init__(self, specstr): | |
@@ -164,11 +176,8 @@ def main(argv): | |
os.chdir(prefix) | |
try: | |
- # Download the binaries. | |
- urlfmt="http://fastdl.mongodb.org/linux/mongodb-linux-%s-%s.tgz" | |
- for (spec, arch) in crossproduct(specs, ARCHES): | |
- httpget(urlfmt % (arch, spec.version()), ensure_dir(tarfile(arch, spec))) | |
- | |
+ # XXX We don't download binaries anymore -- xdg, 2012-10-19 | |
+ | |
# Build a pacakge for each distro/spec/arch tuple, and | |
# accumulate the repository-layout directories. | |
for (distro, spec, arch) in crossproduct(distros, specs, ARCHES): | |
@@ -264,7 +273,8 @@ def ensure_dir(filename): | |
def tarfile(arch, spec): | |
"""Return the location where we store the downloaded tarball for | |
(arch, spec)""" | |
- return "dl/mongodb-linux-%s-%s.tar.gz" % (spec.version(), arch) | |
+ # XXX Find our locally-compiled binaries -- xdg, 2012-10-19 | |
+ return "%s/mongodb-linux-%s-%s.tar.gz" % (TARBALLDIR, spec.version(), arch) | |
def setupdir(distro, arch, spec): | |
# The setupdir will be a directory containing all inputs to the | |
@@ -311,9 +321,10 @@ def unpack_binaries_into(arch, spec, where): | |
# thing and chdir into where and run tar there. | |
os.chdir(where) | |
try: | |
- sysassert(["tar", "xvzf", rootdir+"/"+tarfile(arch, spec), "mongodb-linux-%s-%s/bin" % (arch, spec.version())]) | |
- os.rename("mongodb-linux-%s-%s/bin" % (arch, spec.version()), "bin") | |
- os.rmdir("mongodb-linux-%s-%s" % (arch, spec.version())) | |
+ # XXX our modified tarfile has absolute path and consistnt version/arch order -- xdg, 2012-10-19 | |
+ sysassert(["tar", "xvzf", tarfile(arch, spec), "mongodb-linux-%s-%s/bin" % (spec.version(), arch)]) | |
+ os.rename("mongodb-linux-%s-%s/bin" % (spec.version(), arch), "bin") | |
+ os.rmdir("mongodb-linux-%s-%s" % (spec.version(), arch)) | |
except Exception: | |
exc=sys.exc_value | |
os.chdir(rootdir) | |
@@ -333,7 +344,8 @@ def make_package(distro, arch, spec, srcdir): | |
for pkgdir in ["debian", "rpm"]: | |
print "Copying packaging files from %s to %s" % ("%s/%s" % (srcdir, pkgdir), sdir) | |
# FIXME: sh-dash-cee is bad. See if tarfile can do this. | |
- sysassert(["sh", "-c", "(cd \"%s\" && git archive r%s %s/ ) | (cd \"%s\" && tar xvf -)" % (srcdir, spec.version(), pkgdir, sdir)]) | |
+ # XXX we need locally modified build files, not the ones from the last tag -- xdg, 2012-10-19 | |
+ sysassert(["sh", "-c", "cp -a %s/%s %s" % (srcdir, pkgdir, sdir)]) | |
# Splat the binaries under sdir. The "build" stages of the | |
# packaging infrastructure will move the binaries to wherever they | |
# need to go. | |
@@ -341,7 +353,9 @@ def make_package(distro, arch, spec, srcdir): | |
# Remove the mongosniff binary due to libpcap dynamic | |
# linkage. FIXME: this removal should go away | |
# eventually. | |
- os.unlink(sdir+("%s/usr/bin/mongosniff"%BINARYDIR)) | |
+ # XXX This didn't build for me, so make deletion conditional -- xdg, 2012-10-19 | |
+ if os.path.exists(sdir+("%s/usr/bin/mongosniff"%BINARYDIR)): | |
+ os.unlink(sdir+("%s/usr/bin/mongosniff"%BINARYDIR)) | |
return distro.make_pkg(arch, spec, srcdir) | |
def make_repo(repodir): | |
@@ -376,7 +390,8 @@ def make_deb(distro, arch, spec, srcdir): | |
oldcwd=os.getcwd() | |
try: | |
os.chdir(sdir) | |
- sysassert(["dpkg-buildpackage", "-a"+distro_arch, "-k Richard Kreuter <[email protected]>"]) | |
+ # XXX sign with my gpg key instead of Richard's -- xdg, 2012-10-19 | |
+ sysassert(["dpkg-buildpackage", "-a"+distro_arch, "-k David Alexandre Golden <[email protected]>"]) | |
finally: | |
os.chdir(oldcwd) | |
r=distro.repodir(arch) | |
@@ -520,9 +535,9 @@ def write_debian_changelog(path, spec, srcdir): | |
if spec.param("revision"): | |
preamble="""mongodb%s (%s-%s) unstable; urgency=low | |
- * Bump revision number | |
+ * Custom packaging | |
- -- Richard Kreuter <[email protected]> %s | |
+ -- David Golden <[email protected]> %s | |
""" % (spec.suffix(), spec.pversion(Distro("debian")), spec.param("revision"), time.strftime("%a, %d %b %Y %H:%m:%S %z")) | |
try: | |
@@ -547,7 +562,7 @@ def write_debian_control_file(path, spec): | |
s="""Source: @@PACKAGE_BASENAME@@ | |
Section: devel | |
Priority: optional | |
-Maintainer: Richard Kreuter <[email protected]> | |
+Maintainer: David Golden <[email protected]> | |
Build-Depends: | |
Standards-Version: 3.8.0 | |
Homepage: http://www.mongodb.org | |
@@ -555,7 +570,7 @@ Homepage: http://www.mongodb.org | |
Package: @@PACKAGE_BASENAME@@ | |
Conflicts: @@PACKAGE_CONFLICTS@@ | |
Architecture: any | |
-Depends: libc6 (>= 2.3.2), libgcc1 (>= 1:4.1.1), libstdc++6 (>= 4.1.1) | |
+Depends: ${shlibs:Depends}, ${misc:Depends}, adduser | |
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 | |
@@ -678,7 +693,7 @@ binary-arch: build install | |
#\tdh_install | |
#\tdh_installmenu | |
#\tdh_installdebconf\t | |
-#\tdh_installlogrotate | |
+\tdh_installlogrotate --name=@@PACKAGE_BASENAME@@ | |
#\tdh_installemacsen | |
#\tdh_installpam | |
#\tdh_installmime | |
@@ -940,6 +955,9 @@ fi | |
%attr(0640,mongod,mongod) %config(noreplace) %verify(not md5 size mtime) /var/log/mongo/mongod.log | |
%changelog | |
+* Wed Oct 17 2012 David Golden <[email protected]> | |
+- Custom packaging | |
+ | |
* Thu Jan 28 2010 Richard M Kreuter <[email protected]> | |
- Minor fixes. | |
diff --git a/debian/mongodb.logrotate b/debian/mongodb.logrotate | |
new file mode 100644 | |
index 0000000..12634ba | |
--- /dev/null | |
+++ b/debian/mongodb.logrotate | |
@@ -0,0 +1,13 @@ | |
+/var/log/mongodb/mongodb.log { | |
+ daily | |
+ rotate 7 | |
+ compress | |
+ missingok | |
+ notifempty | |
+ sharedscripts | |
+ postrotate | |
+ /bin/kill -SIGUSR1 `cat /var/lib/mongodb/mongod.lock` && \ | |
+ rm -f /var/log/mongodb/mongodb.log.????-??-??T??-??-?? | |
+ endscript | |
+} | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment