diff options
author | Brian Samek <brian.samek@mongodb.com> | 2017-01-23 10:44:48 -0500 |
---|---|---|
committer | Brian Samek <brian.samek@mongodb.com> | 2017-01-24 10:43:11 -0500 |
commit | 7284381b79b29f0a2e13e1c67397101f5397cc16 (patch) | |
tree | bfcaaf9860e12fdc94a036d4fb964873e0c8b893 | |
parent | 23c16f6f2ce1fe4a87610ae5e7b1fe9927a91286 (diff) | |
download | mongo-7284381b79b29f0a2e13e1c67397101f5397cc16.tar.gz |
SERVER-27784 Remove httpget() from packager.py
-rwxr-xr-x | buildscripts/packager-enterprise.py | 12 | ||||
-rwxr-xr-x | buildscripts/packager.py | 29 |
2 files changed, 7 insertions, 34 deletions
diff --git a/buildscripts/packager-enterprise.py b/buildscripts/packager-enterprise.py index 6146a79cacb..c7783c98dfe 100755 --- a/buildscripts/packager-enterprise.py +++ b/buildscripts/packager-enterprise.py @@ -157,10 +157,7 @@ def main(argv): os.chdir(prefix) try: - # Download the binaries. - urlfmt="http://downloads.mongodb.com/linux/mongodb-linux-%s-enterprise-%s-%s.tgz" made_pkg = False - # Build a package for each distro/spec/arch tuple, and # accumulate the repository-layout directories. for (distro, arch) in packager.crossproduct(distros, args.arches): @@ -168,12 +165,9 @@ def main(argv): for build_os in distro.build_os(arch): 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 4d1e846417a..933e0612323 100755 --- a/buildscripts/packager.py +++ b/buildscripts/packager.py @@ -31,7 +31,6 @@ import errno from glob import glob import os import re -import requests import shutil import subprocess import sys @@ -287,7 +286,7 @@ def get_args(distros, arch_choices): 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=arch_choices, default=[], 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", required=True, type=lambda x: is_valid_file(parser, x)) args = parser.parse_args() @@ -316,9 +315,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): @@ -326,12 +322,9 @@ def main(argv): for build_os in distro.build_os(arch): 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) @@ -383,20 +376,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) - - r = requests.get(url, stream=True) - if r.status_code == 200: - with open(filename, 'wb') as f: - for chunk in r.iter_content(chunk_size=16384): - f.write(chunk) - else: - raise Exception("HTTP error %d" % r.status_code) - - 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() |