public
Last active

MongoDB SSL packaging

  • Download Gist
mongodb-ssl-packaging.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
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 <richard@10gen.com>"])
+ # XXX sign with my gpg key instead of Richard's -- xdg, 2012-10-19
+ sysassert(["dpkg-buildpackage", "-a"+distro_arch, "-k David Alexandre Golden <xdg@xdg.me>"])
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 <richard@10gen.com> %s
+ -- David Golden <xdg@xdg.me> %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 <richard@10gen.com>
+Maintainer: David Golden <xdg@xdg.me>
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 <xdg@xdg.me>
+- Custom packaging
+
* Thu Jan 28 2010 Richard M Kreuter <richard@10gen.com>
- 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
+}
+

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.