author | Gregory Szorc <gps@mozilla.com> |
Wed, 27 Jun 2018 12:15:44 -0700 | |
changeset 423978 | e03976b0784c52e885de484d069e4204a5305ac9 |
parent 423977 | cfe05f5510b4a68db9282850492fe6345b8f35be |
child 423979 | 16cad8d7cb82fd2e8cd71e93a285a9e55120d386 |
push id | 34197 |
push user | csabou@mozilla.com |
push date | Thu, 28 Jun 2018 09:44:02 +0000 |
treeherder | mozilla-central@db455160668d [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | glandium |
bugs | 1469441 |
milestone | 63.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/python/mozboot/bin/bootstrap.py +++ b/python/mozboot/bin/bootstrap.py @@ -53,24 +53,24 @@ def setup_proxy(): # intended for all protocols. Python doesn't currently automatically # detect this like it does for http_proxy and https_proxy. if 'ALL_PROXY' in os.environ and 'https_proxy' not in os.environ: os.environ['https_proxy'] = os.environ['ALL_PROXY'] if 'ALL_PROXY' in os.environ and 'http_proxy' not in os.environ: os.environ['http_proxy'] = os.environ['ALL_PROXY'] -def fetch_files(repo_url, repo_type): +def fetch_files(repo_url, repo_rev, repo_type): setup_proxy() repo_url = repo_url.rstrip('/') files = {} if repo_type == 'hgweb': - url = repo_url + '/archive/default.zip/python/mozboot' + url = repo_url + '/archive/%s.zip/python/mozboot' % repo_rev req = urlopen(url=url, timeout=30) data = StringIO(req.read()) data.seek(0) zip = zipfile.ZipFile(data, 'r') for f in zip.infolist(): # The paths are prefixed with the repo and revision name before the # directory name. offset = f.filename.find(REPOSITORY_PATH_PREFIX) + len(REPOSITORY_PATH_PREFIX) @@ -82,17 +82,17 @@ def fetch_files(repo_url, repo_type): files[name] = zip.read(f) else: raise NotImplementedError('Not sure how to handle repo type.', repo_type) return files -def ensure_environment(repo_url=None, repo_type=None): +def ensure_environment(repo_url=None, repo_rev=None, repo_type=None): """Ensure we can load the Python modules necessary to perform bootstrap.""" try: from mozboot.bootstrap import Bootstrapper return Bootstrapper except ImportError: # The first fallback is to assume we are running from a tree checkout # and have the files in a sibling directory. @@ -103,17 +103,17 @@ def ensure_environment(repo_url=None, re try: from mozboot.bootstrap import Bootstrapper return Bootstrapper except ImportError: sys.path.pop() # The next fallback is to download the files from the source # repository. - files = fetch_files(repo_url, repo_type) + files = fetch_files(repo_url, repo_rev, repo_type) # Install them into a temporary location. They will be deleted # after this script has finished executing. global TEMPDIR TEMPDIR = tempfile.mkdtemp() for relpath in files.keys(): destpath = os.path.join(TEMPDIR, relpath) @@ -132,32 +132,36 @@ def ensure_environment(repo_url=None, re def main(args): parser = OptionParser() parser.add_option('-r', '--repo-url', dest='repo_url', default='https://hg.mozilla.org/mozilla-central/', help='Base URL of source control repository where bootstrap files can ' 'be downloaded.') + parser.add_option('--repo-rev', dest='repo_rev', + default='default', + help='Revision of files in repository to fetch') parser.add_option('--repo-type', dest='repo_type', default='hgweb', help='The type of the repository. This defines how we fetch file ' 'content. Like --repo, you should not need to set this.') parser.add_option('--application-choice', dest='application_choice', help='Pass in an application choice (see mozboot.bootstrap.APPLICATIONS) ' 'instead of using the default interactive prompt.') parser.add_option('--no-interactive', dest='no_interactive', action='store_true', help='Answer yes to any (Y/n) interactive prompts.') options, leftover = parser.parse_args(args) try: try: - cls = ensure_environment(options.repo_url, options.repo_type) + cls = ensure_environment(options.repo_url, options.repo_rev, + options.repo_type) except Exception as e: print('Could not load the bootstrap Python environment.\n') print('This should never happen. Consider filing a bug.\n') print('\n') print(e) return 1 dasboot = cls(choice=options.application_choice, no_interactive=options.no_interactive) dasboot.bootstrap()