summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Samek <brian.samek@mongodb.com>2017-02-13 11:28:32 -0500
committerBrian Samek <brian.samek@mongodb.com>2017-02-13 11:28:32 -0500
commit99ab9a6e264939397d134378a70f500b54e91a23 (patch)
tree33660ae7f3975e0b4150a61a31dfb699293876db
parentca3083852896e024a7da6a48eb4dc80de850ae2b (diff)
downloadmongo-99ab9a6e264939397d134378a70f500b54e91a23.tar.gz
SERVER-27784 Remove httpget() from packager.py
-rwxr-xr-xbuildscripts/packager-enterprise.py17
-rwxr-xr-xbuildscripts/packager.py39
2 files changed, 7 insertions, 49 deletions
diff --git a/buildscripts/packager-enterprise.py b/buildscripts/packager-enterprise.py
index ef14d39b69a..d2a8e110b2f 100755
--- a/buildscripts/packager-enterprise.py
+++ b/buildscripts/packager-enterprise.py
@@ -26,20 +26,15 @@
# apt-get install dpkg-dev rpm debhelper fakeroot ia32-libs createrepo git-core libsnmp15
# echo "Now put the dist gnupg signing keys in ~root/.gnupg"
-import argparse
import errno
-import getopt
from glob import glob
import packager
import os
import re
import shutil
-import stat
-import subprocess
import sys
import tempfile
import time
-import urlparse
# The MongoDB names for the architectures we support.
DEFAULT_ARCHES=["x86_64"]
@@ -282,9 +277,6 @@ def main(argv):
os.chdir(prefix)
try:
- # Download the binaries.
- urlfmt="http://downloads.mongodb.com/linux/mongodb-linux-%s-enterprise-%s-%s.tgz"
-
# Build a package for each distro/spec/arch tuple, and
# accumulate the repository-layout directories.
for (distro, arch) in packager.crossproduct(distros, args.arches):
@@ -292,12 +284,9 @@ def main(argv):
for build_os in distro.build_os():
if build_os in args.distros or not args.distros:
- if args.tarball:
- filename = tarfile(build_os, arch, spec)
- packager.ensure_dir(filename)
- shutil.copyfile(args.tarball,filename)
- else:
- packager.httpget(urlfmt % (arch, build_os, spec.version()), packager.ensure_dir(tarfile(build_os, arch, spec)))
+ filename = tarfile(build_os, arch, spec)
+ packager.ensure_dir(filename)
+ shutil.copyfile(args.tarball,filename)
repo = make_package(distro, build_os, arch, spec, srcdir)
make_repo(repo, distro, build_os, spec)
diff --git a/buildscripts/packager.py b/buildscripts/packager.py
index e54f6a1ccf8..c7e42cf6e3c 100755
--- a/buildscripts/packager.py
+++ b/buildscripts/packager.py
@@ -28,18 +28,14 @@
import argparse
import errno
-import getopt
-import httplib2
from glob import glob
import os
import re
import shutil
-import stat
import subprocess
import sys
import tempfile
import time
-import urlparse
# The MongoDB names for the architectures we support.
DEFAULT_ARCHES=["x86_64"]
@@ -263,7 +259,7 @@ def get_args(distros):
parser.add_argument("-d", "--distros", help="Distros to build for", choices=DISTRO_CHOICES, required=False, default=[], action='append')
parser.add_argument("-p", "--prefix", help="Directory to build into", required=False)
parser.add_argument("-a", "--arches", help="Architecture to build", choices=DEFAULT_ARCHES, default=DEFAULT_ARCHES, required=False, action='append')
- parser.add_argument("-t", "--tarball", help="Local tarball to package instead of downloading (only valid with one distro/arch combination)", required=False, type=lambda x: is_valid_file(parser, x))
+ parser.add_argument("-t", "--tarball", help="Local tarball to package instead of downloading", required=True, type=lambda x: is_valid_file(parser, x))
args = parser.parse_args()
@@ -292,9 +288,6 @@ def main(argv):
os.chdir(prefix)
try:
- # Download the binaries.
- urlfmt="http://downloads.mongodb.org/linux/mongodb-linux-%s-%s-%s.tgz"
-
# Build a package for each distro/spec/arch tuple, and
# accumulate the repository-layout directories.
for (distro, arch) in crossproduct(distros, args.arches):
@@ -302,12 +295,9 @@ def main(argv):
for build_os in distro.build_os():
if build_os in args.distros or not args.distros:
- if args.tarball:
- filename = tarfile(build_os, arch, spec)
- ensure_dir(filename)
- shutil.copyfile(args.tarball,filename)
- else:
- httpget(urlfmt % (arch, build_os, spec.version()), ensure_dir(tarfile(build_os, arch, spec)))
+ filename = tarfile(build_os, arch, spec)
+ ensure_dir(filename)
+ shutil.copyfile(args.tarball,filename)
repo = make_package(distro, build_os, arch, spec, srcdir)
make_repo(repo, distro, build_os, spec)
@@ -359,27 +349,6 @@ def setupdir(distro, build_os, arch, spec):
# or dst/x86_64/redhat/rhel55/mongodb-org-unstable/
return "dst/%s/%s/%s/%s%s-%s/" % (arch, distro.name(), build_os, distro.pkgbase(), spec.suffix(), spec.pversion(distro))
-def httpget(url, filename):
- """Download the contents of url to filename, return filename."""
- print "Fetching %s to %s." % (url, filename)
- conn = None
- u=urlparse.urlparse(url)
- assert(u.scheme=='http')
- try:
- h = httplib2.Http(cache = os.environ["HOME"] + "/.cache")
- resp, content = h.request(url, "GET")
- t=filename+'.TMP'
- if resp.status==200:
- with open(t, 'w') as f:
- f.write(content)
- else:
- raise Exception("HTTP error %d" % resp.status)
- os.rename(t, filename)
- finally:
- if conn:
- conn.close()
- return filename
-
def unpack_binaries_into(build_os, arch, spec, where):
"""Unpack the tarfile for (build_os, arch, spec) into directory where."""
rootdir=os.getcwd()